From cvs at intevation.de Sun Oct 2 13:06:33 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Sun Oct 2 13:06:35 2005 Subject: steffen: server/kolabd/kolabd kolab_bootstrap.in, 1.3, 1.4 kolab_smtpdpolicy.in, 1.2, 1.3 kolabpasswd.in, 1.1, 1.2 Message-ID: <20051002110633.617F0101EE7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv11591/kolabd Modified Files: kolab_bootstrap.in kolab_smtpdpolicy.in kolabpasswd.in Log Message: Fix for issue919 (non-escaped shell metachars in passwd) Index: kolab_bootstrap.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolab_bootstrap.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- kolab_bootstrap.in 20 Sep 2005 19:41:55 -0000 1.3 +++ kolab_bootstrap.in 2 Oct 2005 11:06:31 -0000 1.4 @@ -33,6 +33,19 @@ ##### Utility Functions +# Shell double-quote a string +# Borrored from Sysadm::Install +sub qquote { + my($str, $metas) = @_; + $str =~ s/([\\"])/\\$1/g; + if(defined $metas) { + $metas = '!$`' if $metas eq ":shell"; + $metas =~ s/\]/\\]/g; + $str =~ s/([$metas])/\\$1/g; + } + return "\"$str\""; +} + # Try to get fqdn sub myhostname { my $host = ''; @@ -42,7 +55,7 @@ chomp $host; close( HOSTNAME ); } - # FIXME: hardcoded - maybe fixed later + # FIXME: hardcoded - maybe fixed later if( open( HOSTNAME, '/etc/hostname' ) ) { $host = ; chomp $host; @@ -86,7 +99,7 @@ # Hash a password sub hashPassword { my $pw = shift; - my $hashcmd = "@sbindir@/slappasswd -s '".$pw."'"; + my $hashcmd = "@sbindir@/slappasswd -s ".qquote($pw,":shell"); (my $hashpw = `$hashcmd`) or die $@; chomp($hashpw); return $hashpw; Index: kolab_smtpdpolicy.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolab_smtpdpolicy.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- kolab_smtpdpolicy.in 16 Sep 2005 12:50:54 -0000 1.2 +++ kolab_smtpdpolicy.in 2 Oct 2005 11:06:31 -0000 1.3 @@ -197,7 +197,7 @@ CHECKSENDER: $mesg = $ldap->search( base=> $conf_basedn, - scope=> 'sub', + scope=> 'sub', filter=> "(&(objectClass=kolabinetorgperson)(|(mail=$sender)(alias=$sender)))"); if( !$mesg->code ) { mylog($syslog_priority, "LDAP search returned ".$mesg->count()." objects") if $verbose; @@ -237,7 +237,7 @@ # UPS, fake sender mylog($syslog_priority, "Attempt to fake address $sender") if $verbose; return "REJECT Invalid sender"; - + # Check for valid access to restricted distribution lists $tries = 0; CHECKDISTLIST: Index: kolabpasswd.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolabpasswd.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- kolabpasswd.in 13 Sep 2005 14:38:22 -0000 1.1 +++ kolabpasswd.in 2 Oct 2005 11:06:31 -0000 1.2 @@ -35,10 +35,23 @@ # won't be needed (i think) # my $kolab_prefix = (getpwnam('kolab'))[7] || die "Error: could not determine the kolab directory prefix (e.g. /kolab)"; +# Shell double-quote a string +# Borrored from Sysadm::Install +sub qquote { + my($str, $metas) = @_; + $str =~ s/([\\"])/\\$1/g; + if(defined $metas) { + $metas = '!$`' if $metas eq ":shell"; + $metas =~ s/\]/\\]/g; + $str =~ s/([$metas])/\\$1/g; + } + return "\"$str\""; +} + # Hash a password sub hashPassword { my $pw = shift; - my $hashcmd = "@sbindir@/slappasswd -s '".$pw."'"; + my $hashcmd = "@sbindir@/slappasswd -s ".qquote($pw,":shell"); (my $hashpw = `$hashcmd`) or die $@; chomp($hashpw); return $hashpw; From cvs at intevation.de Sun Oct 2 13:07:15 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Sun Oct 2 13:07:17 2005 Subject: steffen: server/kolabd/kolabd kolab_bootstrap, 1.15, 1.15.2.1 kolabpasswd, 1.7, 1.7.2.1 Message-ID: <20051002110715.D7771101FC1@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv11633/kolabd Modified Files: Tag: kolab_2_0_branch kolab_bootstrap kolabpasswd Log Message: Backport of: Fix for issue919 (non-escaped shell metachars in passwd) Index: kolab_bootstrap =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/Attic/kolab_bootstrap,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -d -r1.15 -r1.15.2.1 --- kolab_bootstrap 17 Jun 2005 18:02:59 -0000 1.15 +++ kolab_bootstrap 2 Oct 2005 11:07:13 -0000 1.15.2.1 @@ -33,6 +33,19 @@ ##### Utility Functions +# Shell double-quote a string +# Borrored from Sysadm::Install +sub qquote { + my($str, $metas) = @_; + $str =~ s/([\\"])/\\$1/g; + if(defined $metas) { + $metas = '!$`' if $metas eq ":shell"; + $metas =~ s/\]/\\]/g; + $str =~ s/([$metas])/\\$1/g; + } + return "\"$str\""; +} + # Try to get fqdn sub myhostname { my $host = ''; @@ -84,7 +97,7 @@ # Hash a password sub hashPassword { my $pw = shift; - my $hashcmd = $kolab_prefix."/sbin/slappasswd -s '".$pw."'"; + my $hashcmd = $kolab_prefix."/sbin/slappasswd -s ".qquote($pw,":shell"); (my $hashpw = `$hashcmd`) or die $@; chomp($hashpw); return $hashpw; Index: kolabpasswd =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/Attic/kolabpasswd,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -d -r1.7 -r1.7.2.1 --- kolabpasswd 18 Apr 2005 20:46:44 -0000 1.7 +++ kolabpasswd 2 Oct 2005 11:07:13 -0000 1.7.2.1 @@ -34,10 +34,23 @@ my $kolab_prefix = (getpwnam('kolab'))[7] || die "Error: could not determine the kolab directory prefix (e.g. /kolab)"; +# Shell double-quote a string +# Borrored from Sysadm::Install +sub qquote { + my($str, $metas) = @_; + $str =~ s/([\\"])/\\$1/g; + if(defined $metas) { + $metas = '!$`' if $metas eq ":shell"; + $metas =~ s/\]/\\]/g; + $str =~ s/([$metas])/\\$1/g; + } + return "\"$str\""; +} + # Hash a password sub hashPassword { my $pw = shift; - my $hashcmd = $kolab_prefix."/sbin/slappasswd -s '".$pw."'"; + my $hashcmd = $kolab_prefix."/sbin/slappasswd -s ".qquote($pw,":shell"); (my $hashpw = `$hashcmd`) or die $@; chomp($hashpw); return $hashpw; From cvs at intevation.de Mon Oct 3 03:07:00 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:07:02 2005 Subject: steffen: server/perl-kolab/Kolab-Conf Conf.pm,1.63,1.64 Message-ID: <20051003010700.5D6361005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/perl-kolab/Kolab-Conf In directory doto:/tmp/cvs-serv25849/Kolab-Conf Modified Files: Conf.pm Log Message: Changed the template expansion code to make it easier to add new expansion "modifiers" Index: Conf.pm =================================================================== RCS file: /kolabrepository/server/perl-kolab/Kolab-Conf/Conf.pm,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- Conf.pm 17 Sep 2005 14:21:23 -0000 1.63 +++ Conf.pm 3 Oct 2005 01:06:58 -0000 1.64 @@ -260,32 +260,50 @@ ($skip > 0) && $skip--; s/\@{3}endif\@{3}\n?//; } else { - while (/\@{3}(\S+?)(\|.+?)?\@{3}/) { - my $attr = $1; - my $opt = $2; - #print STDERR "attr=$attr, opt=$opt\n"; - if ($Kolab::config{$attr}) { - my $val = ""; - if (ref $Kolab::config{$attr} eq "ARRAY") { - if ($opt && $opt =~ /\|join(.*)/) { - $val = join $1, @{$Kolab::config{$attr}}; - } else { - $val = $Kolab::config{$attr}->[0]; - } - } else { - $val = $Kolab::config{$attr}; - } - s/\@{3}(\S+?)(\|.+?)?\@{3}/$val/; - last if ( $val eq "\@\@\@$attr\@\@\@" ); # prevent endless loop - } else { - Kolab::log('T', "No configuration variable corresponding to `$1' exists", KOLAB_WARN); - s/\@{3}(\S+?)\@{3}//; - } - } - } - ($skip == 0) && print $config $_; - } - + while (/\@{3}(\S+?)(\|(.+?)\((.*)\))?\@{3}/) { + my $attr = $1; + my $fct = $3; + my $args = $4; + #print STDERR "attr=\"$attr\", fct=\"$fct\", args=\"$args\"\n"; + if ($Kolab::config{$attr}) { + my $val = ""; + if( !$fct ) { + if (ref $Kolab::config{$attr} eq "ARRAY") { + $val = $Kolab::config{$attr}->[0]; + } else { + $val = $Kolab::config{$attr}; + } + } else { + # Modifier functions + SWITCH: { + # Join function + $fct eq 'join' && do { + $val = join $args, (ref $Kolab::config{$attr} eq "ARRAY") + ?@{$Kolab::config{$attr}} + :($Kolab::config{$attr}); + last SWITCH; + }; + # Quote function + $fct eq 'quote' && do { + # slapd.conf compatible quoting + $val = $Kolab::config{$attr}; + $val =~ s/"/\"/g; + $val = '"'.$val.'"'; + last SWITCH; + } + } + } + s/\@{3}(\S+?)(\|.+?)?\@{3}/$val/; + last if ( $val eq "\@\@\@$attr\@\@\@" ); # prevent endless loop + } else { + Kolab::log('T', "No configuration variable corresponding to `$1' exists", KOLAB_WARN); + s/\@{3}(\S+?)\@{3}//; + } + } + ($skip == 0) && print $config $_; + } + } + $template->close; $config->close; From cvs at intevation.de Mon Oct 3 03:07:57 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:07:59 2005 Subject: steffen: server/kolabd/kolabd configure.ac, 1.1, 1.2 kolab2.schema, 1.13, 1.14 kolabd.spec.in, 1.1, 1.2 Message-ID: <20051003010757.AAE6B1005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv25883/kolabd Modified Files: configure.ac kolab2.schema kolabd.spec.in Log Message: new modifier syntax + changed postfix relayhost LDAP attributes Index: configure.ac =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/configure.ac,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- configure.ac 13 Sep 2005 14:38:22 -0000 1.1 +++ configure.ac 3 Oct 2005 01:07:55 -0000 1.2 @@ -1,7 +1,7 @@ AC_PREREQ(2.59) # not the real version -m4_define(_VERSION,2.0.0) +m4_define(_VERSION,2.0.99) AC_INIT([kolabd],[_VERSION],[kolab-devel@kolab.org]) AC_CONFIG_AUX_DIR(.) Index: kolab2.schema =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolab2.schema,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- kolab2.schema 7 Jul 2005 21:18:47 -0000 1.13 +++ kolab2.schema 3 Oct 2005 01:07:55 -0000 1.14 @@ -348,6 +348,12 @@ SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) +attributetype ( 1.3.6.1.4.1.19414.2.1.510 + NAME 'postfix-relayport' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) + ########################## # cyrus imapd attributes # ########################## @@ -493,6 +499,7 @@ postfix-mydestination $ postfix-mynetworks $ postfix-relayhost $ + postfix-relayport $ postfix-transport $ postfix-virtual $ postfix-enable-virus-scan $ Index: kolabd.spec.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolabd.spec.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- kolabd.spec.in 13 Sep 2005 14:38:22 -0000 1.1 +++ kolabd.spec.in 3 Oct 2005 01:07:55 -0000 1.2 @@ -26,7 +26,7 @@ # package version %define V_ei_maj 2.0 -%define V_ei_min 0 +%define V_ei_min 99 %define V_cf 1.0.4 # package information From cvs at intevation.de Mon Oct 3 03:07:57 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:07:59 2005 Subject: steffen: server/kolabd/kolabd/templates imapd.conf.template.in, 1.1, 1.2 kolab_smtpdpolicy.conf.template.in, 1.1, 1.2 main.cf.template.in, 1.2, 1.3 Message-ID: <20051003010757.ADA6C1005D7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd/templates In directory doto:/tmp/cvs-serv25883/kolabd/templates Modified Files: imapd.conf.template.in kolab_smtpdpolicy.conf.template.in main.cf.template.in Log Message: new modifier syntax + changed postfix relayhost LDAP attributes Index: imapd.conf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/imapd.conf.template.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- imapd.conf.template.in 13 Sep 2005 14:38:22 -0000 1.1 +++ imapd.conf.template.in 3 Oct 2005 01:07:55 -0000 1.2 @@ -42,7 +42,7 @@ username_tolower: 1 ##virtdomains: userid -loginrealms: @@@postfix-mydomain@@@ @@@postfix-mydestination|join @@@ +loginrealms: @@@postfix-mydomain@@@ @@@postfix-mydestination|join( )@@@ # support for lookup of mailbox name from local LDAP server ldap_uri: @@@user_ldap_uri@@@ Index: kolab_smtpdpolicy.conf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/kolab_smtpdpolicy.conf.template.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- kolab_smtpdpolicy.conf.template.in 16 Sep 2005 12:50:54 -0000 1.1 +++ kolab_smtpdpolicy.conf.template.in 3 Oct 2005 01:07:55 -0000 1.2 @@ -21,4 +21,4 @@ @@@else@@@ allow_unauth: 0 @@@endif@@@ -permithosts: @@@kolabhost|join,@@@ +permithosts: @@@kolabhost|join(,)@@@ Index: main.cf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/main.cf.template.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- main.cf.template.in 29 Sep 2005 20:03:08 -0000 1.2 +++ main.cf.template.in 3 Oct 2005 01:07:55 -0000 1.3 @@ -33,7 +33,7 @@ myhostname = @@@fqdnhostname@@@ mydomain = @@@postfix-mydomain@@@ myorigin = $mydomain -relayhost = @@@postfix-relayhost@@@ +relayhost = [@@@postfix-relayhost@@@]:@@@postfix-relayport@@@ # masquerade_domains = $mydomain @@ -44,8 +44,8 @@ #inet_interfaces = 127.0.0.1 # relaying -mynetworks = @@@postfix-mynetworks|join @@@ -mydestination = @@@postfix-mydestination|join @@@ +mynetworks = @@@postfix-mynetworks|join( )@@@ +mydestination = @@@postfix-mydestination|join( )@@@ relay_domains = #smtpd_recipient_restrictions = permit_mynetworks, # check_client_access hash:@emailserver_confdir@/access, From cvs at intevation.de Mon Oct 3 03:08:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:08:38 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/templates service.tpl, 1.6, 1.7 Message-ID: <20051003010838.29D521005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates In directory doto:/tmp/cvs-serv25936/kolab-webadmin/php/admin/templates Modified Files: service.tpl Log Message: update webgui for new postfix relayhost Index: service.tpl =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates/service.tpl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- service.tpl 5 Jul 2005 10:31:51 -0000 1.6 +++ service.tpl 3 Oct 2005 01:08:36 -0000 1.7 @@ -14,7 +14,7 @@
{tr msg="Email address of account that should receive administrative mail:"} -
+
@@ -50,7 +50,7 @@

-{tr msg="Warn users when they have used"} {tr msg="% of their quota"}
+{tr msg="Warn users when they have used"} {tr msg="% of their quota"}
@@ -69,7 +69,7 @@

-{tr msg="When creating free/busy lists, include data from"} {tr msg="days in the past"}
+{tr msg="When creating free/busy lists, include data from"} {tr msg="days in the past"}
@@ -78,18 +78,17 @@
{tr msg="Networks allowed to relay and send mail through unauthenticated SMTP connections to the Kolab server (comma separated networks in x.x.x.x/y format):"} - +

{tr msg="SMTP \"smarthost/relayhost\""}

-
-{tr msg="Smarthost to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} -
- -{tr msg="Enable MX lookup for relayhost (if in doubt, leave it off)"} + +{tr msg="Smarthost (and optional port) to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} +: +
From cvs at intevation.de Mon Oct 3 03:08:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:08:38 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/service index.php, 1.24, 1.25 Message-ID: <20051003010838.2C6AB1005D7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service In directory doto:/tmp/cvs-serv25936/kolab-webadmin/www/admin/service Modified Files: index.php Log Message: update webgui for new postfix relayhost Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service/index.php,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- index.php 5 Jul 2005 22:51:40 -0000 1.24 +++ index.php 3 Oct 2005 01:08:36 -0000 1.25 @@ -46,7 +46,7 @@ global $postfixmynetworks; global $postfixallowunauth; global $postfixrelayhost; - global $postfixrelayhostmx; + global $postfixrelayport; global $kolabhost; global $kolabfilterverifyfrom; global $kolabfilterallowsender; @@ -74,14 +74,7 @@ $postfixmynetworks = join(', ',$attrs['postfix-mynetworks']); $postfixallowunauth = $attrs['postfix-allow-unauthenticated'][0]; $postfixrelayhost = $attrs['postfix-relayhost'][0]; - if( ereg( '\\[(.+)\\]', $postfixrelayhost, $regs ) ) { - $postfixrelayhost = $regs[1]; - $postfixrelayhostmx = 'false'; - } else if( $postfixrelayhost != '' ) { - $postfixrelayhostmx = 'true'; - } else { - $postfixrelayhostmx = 'false'; - } + $postfixrelayport = $attrs['postfix-relayport'][0]; $kolabhost = $attrs['kolabHost']; unset( $kolabhost['count'] ); $kolabfilterverifyfrom = $attrs['kolabfilter-verify-from-header'][0]; @@ -192,13 +185,13 @@ } if( $_REQUEST['submitpostfixrelayhost'] ) { - $value = trim( $_REQUEST['postfixrelayhost'] ); - if( $value != '' && !isset( $_REQUEST['postfixrelayhostmx'] ) ) { - $value = "[$value]"; - } - if( $value == '' ) $value = array(); + $host_val = trim( $_REQUEST['postfixrelayhost'] ); + $port_val = trim( $_REQUEST['postfixrelayport'] ); + if( $host_val == '' ) $host_val = array(); + if( $port_val == '' ) $port_val = array(); $attrs = array(); - $attrs['postfix-relayhost'] = $value; + $attrs['postfix-relayhost'] = $host_val; + $attrs['postfix-relayport'] = $port_val; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") .ldap_error($ldap->connection); @@ -306,7 +299,7 @@ $smarty->assign( 'postfixmynetworks', $postfixmynetworks ); $smarty->assign( 'postfixallowunauth', toboolstr($postfixallowunauth) ); $smarty->assign( 'postfixrelayhost', $postfixrelayhost ); -$smarty->assign( 'postfixrelayhostmx', $postfixrelayhostmx ); +$smarty->assign( 'postfixrelayport', $postfixrelayport ); $smarty->assign( 'kolabfilterverifyfrom', toboolstr($kolabfilterverifyfrom) ); $smarty->assign( 'kolabfilterallowsender', toboolstr($kolabfilterallowsender) ); $smarty->assign( 'kolabfilterrejectforgedfrom', toboolstr($kolabfilterrejectforgedfrom) ); From cvs at intevation.de Mon Oct 3 03:16:46 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:16:46 2005 Subject: steffen: server/kolabd/kolabd kolab2.schema,1.12,1.12.2.1 Message-ID: <20051003011646.018B71005D7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv26048/kolabd Modified Files: Tag: kolab_2_0_branch kolab2.schema Log Message: changed postfix relayhost LDAP attributes Index: kolab2.schema =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolab2.schema,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -d -r1.12 -r1.12.2.1 --- kolab2.schema 11 Jun 2005 16:40:23 -0000 1.12 +++ kolab2.schema 3 Oct 2005 01:16:43 -0000 1.12.2.1 @@ -326,6 +326,12 @@ SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) +attributetype ( 1.3.6.1.4.1.19414.2.1.510 + NAME 'postfix-relayport' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} ) + ########################## # cyrus imapd attributes # ########################## @@ -469,6 +475,7 @@ postfix-mydestination $ postfix-mynetworks $ postfix-relayhost $ + postfix-relayport $ postfix-transport $ postfix-virtual $ postfix-enable-virus-scan $ From cvs at intevation.de Mon Oct 3 03:16:45 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:16:47 2005 Subject: steffen: server/kolabd kolabd.spec,1.57.2.6,1.57.2.7 Message-ID: <20051003011645.EE38D1005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd In directory doto:/tmp/cvs-serv26048 Modified Files: Tag: kolab_2_0_branch kolabd.spec Log Message: changed postfix relayhost LDAP attributes Index: kolabd.spec =================================================================== RCS file: /kolabrepository/server/kolabd/Attic/kolabd.spec,v retrieving revision 1.57.2.6 retrieving revision 1.57.2.7 diff -u -d -r1.57.2.6 -r1.57.2.7 --- kolabd.spec 30 Sep 2005 12:42:34 -0000 1.57.2.6 +++ kolabd.spec 3 Oct 2005 01:16:43 -0000 1.57.2.7 @@ -40,7 +40,7 @@ Group: Mail License: GPL Version: 1.9.4 -Release: 20050930 +Release: 20051003 # list of sources Source0: kolabd-1.9.4.tar.gz From cvs at intevation.de Mon Oct 3 03:16:46 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:16:47 2005 Subject: steffen: server/kolabd/kolabd/templates main.cf.template, 1.15.2.2, 1.15.2.3 Message-ID: <20051003011646.0345A1005D8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd/templates In directory doto:/tmp/cvs-serv26048/kolabd/templates Modified Files: Tag: kolab_2_0_branch main.cf.template Log Message: changed postfix relayhost LDAP attributes Index: main.cf.template =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/Attic/main.cf.template,v retrieving revision 1.15.2.2 retrieving revision 1.15.2.3 diff -u -d -r1.15.2.2 -r1.15.2.3 --- main.cf.template 1 Aug 2005 14:04:13 -0000 1.15.2.2 +++ main.cf.template 3 Oct 2005 01:16:43 -0000 1.15.2.3 @@ -28,7 +28,7 @@ myhostname = @@@fqdnhostname@@@ mydomain = @@@postfix-mydomain@@@ myorigin = $mydomain -relayhost = @@@postfix-relayhost@@@ +relayhost = [@@@postfix-relayhost@@@]:@@@postfix-relayport@@@ # masquerade_domains = $mydomain From cvs at intevation.de Mon Oct 3 03:17:02 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:17:03 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/templates service.tpl, 1.5, 1.5.2.1 Message-ID: <20051003011702.1AA891005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates In directory doto:/tmp/cvs-serv26134/kolab-webadmin/php/admin/templates Modified Files: Tag: kolab_2_0_branch service.tpl Log Message: update webgui for new postfix relayhost Index: service.tpl =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates/service.tpl,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -d -r1.5 -r1.5.2.1 --- service.tpl 15 Jun 2005 11:11:43 -0000 1.5 +++ service.tpl 3 Oct 2005 01:17:00 -0000 1.5.2.1 @@ -85,11 +85,10 @@

{tr msg="SMTP \"smarthost/relayhost\""}

-
-{tr msg="Smarthost to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} -
- -{tr msg="Enable MX lookup for relayhost (if in doubt, leave it off)"} + +{tr msg="Smarthost (and optional port) to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} +: +
From cvs at intevation.de Mon Oct 3 03:17:02 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:17:03 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/service index.php, 1.22, 1.22.2.1 Message-ID: <20051003011702.1D2AD1005D7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service In directory doto:/tmp/cvs-serv26134/kolab-webadmin/www/admin/service Modified Files: Tag: kolab_2_0_branch index.php Log Message: update webgui for new postfix relayhost Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service/index.php,v retrieving revision 1.22 retrieving revision 1.22.2.1 diff -u -d -r1.22 -r1.22.2.1 --- index.php 10 Jun 2005 23:54:37 -0000 1.22 +++ index.php 3 Oct 2005 01:17:00 -0000 1.22.2.1 @@ -45,7 +45,7 @@ global $postfixmynetworks; global $postfixallowunauth; global $postfixrelayhost; - global $postfixrelayhostmx; + global $postfixrelayport; global $kolabhost; global $kolabfilterverifyfrom; global $kolabfilterallowsender; @@ -71,14 +71,7 @@ $postfixmynetworks = join(', ',$attrs['postfix-mynetworks']); $postfixallowunauth = $attrs['postfix-allow-unauthenticated'][0]; $postfixrelayhost = $attrs['postfix-relayhost'][0]; - if( ereg( '\\[(.+)\\]', $postfixrelayhost, $regs ) ) { - $postfixrelayhost = $regs[1]; - $postfixrelayhostmx = 'false'; - } else if( $postfixrelayhost != '' ) { - $postfixrelayhostmx = 'true'; - } else { - $postfixrelayhostmx = 'false'; - } + $postfixrelayport = $attrs['postfix-relayport'][0]; $kolabhost = $attrs['kolabHost']; unset( $kolabhost['count'] ); $kolabfilterverifyfrom = $attrs['kolabfilter-verify-from-header'][0]; @@ -189,13 +182,13 @@ } if( $_REQUEST['submitpostfixrelayhost'] ) { - $value = trim( $_REQUEST['postfixrelayhost'] ); - if( $value != '' && !isset( $_REQUEST['postfixrelayhostmx'] ) ) { - $value = "[$value]"; - } - if( $value == '' ) $value = array(); - $attrs = array(); - $attrs['postfix-relayhost'] = $value; + $host_val = trim( $_REQUEST['postfixrelayhost'] ); + $porr_val = trim( $_REQUEST['postfixrelayport'] ); + if( $host_val == '' ) $host_val = array(); + if( $port_val == '' ) $port_val = array(); + $attrs = array(); + $attrs['postfix-relayhost'] = $host_val; + $attrs['postfix-relayport'] = $port_val; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") .ldap_error($ldap->connection); @@ -263,7 +256,7 @@ $smarty->assign( 'postfixmynetworks', $postfixmynetworks ); $smarty->assign( 'postfixallowunauth', toboolstr($postfixallowunauth) ); $smarty->assign( 'postfixrelayhost', $postfixrelayhost ); -$smarty->assign( 'postfixrelayhostmx', $postfixrelayhostmx ); +$smarty->assign( 'postfixrelayport', $postfixrelayport ); $smarty->assign( 'kolabfilterverifyfrom', toboolstr($kolabfilterverifyfrom) ); $smarty->assign( 'kolabfilterallowsender', toboolstr($kolabfilterallowsender) ); $smarty->assign( 'kolabfilterrejectforgedfrom', toboolstr($kolabfilterrejectforgedfrom) ); From cvs at intevation.de Mon Oct 3 03:17:53 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:17:55 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/templates service.tpl, 1.5.2.1, 1.5.2.2 Message-ID: <20051003011753.8D4A61005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates In directory doto:/tmp/cvs-serv26164/kolab-webadmin/php/admin/templates Modified Files: Tag: kolab_2_0_branch service.tpl Log Message: typo Index: service.tpl =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates/service.tpl,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -u -d -r1.5.2.1 -r1.5.2.2 --- service.tpl 3 Oct 2005 01:17:00 -0000 1.5.2.1 +++ service.tpl 3 Oct 2005 01:17:51 -0000 1.5.2.2 @@ -88,7 +88,7 @@
{tr msg="Smarthost (and optional port) to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} : -
+
From cvs at intevation.de Mon Oct 3 03:18:00 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:18:01 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/templates service.tpl, 1.5.2.2, 1.5.2.3 Message-ID: <20051003011800.775AC1005D7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates In directory doto:/tmp/cvs-serv26177/kolab-webadmin/php/admin/templates Modified Files: Tag: kolab_2_0_branch service.tpl Log Message: typo Index: service.tpl =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates/service.tpl,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -u -d -r1.5.2.2 -r1.5.2.3 --- service.tpl 3 Oct 2005 01:17:51 -0000 1.5.2.2 +++ service.tpl 3 Oct 2005 01:17:58 -0000 1.5.2.3 @@ -88,7 +88,7 @@
{tr msg="Smarthost (and optional port) to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} : -
+
From cvs at intevation.de Mon Oct 3 03:46:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:46:38 2005 Subject: steffen: server obmtool.conf,1.198,1.199 Message-ID: <20051003014637.620E41005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv26557 Modified Files: obmtool.conf Log Message: versions, upped version number on kolab packages to 2.0.99 where possible Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.198 retrieving revision 1.199 diff -u -d -r1.198 -r1.199 --- obmtool.conf 27 Sep 2005 16:35:38 -0000 1.198 +++ obmtool.conf 3 Oct 2005 01:46:35 -0000 1.199 @@ -15,7 +15,7 @@ %kolab echo "---- boot/build ${NODE} %${CMD} ----" - kolab_version="pre-2.1-snapshot-20050926"; + kolab_version="pre-2.1-snapshot-20051003"; PREFIX=/${CMD}; loc='' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path plusloc='+' @@ -132,10 +132,10 @@ @install ${altloc}clamav-0.87-20050916 # @install ${loc}vim-6.3.78-2.4.0 # @install ${plusloc}dcron-2.9-2.4.0 - @install ${altloc}perl-kolab-5.8.7-20050918 - @install ${altloc}kolabd-2.0.0-20050918 --define kolab_version=$kolab_version - @install ${altloc}kolab-webadmin-0.4.9-20050918 --define kolab_version=$kolab_version - @install ${altloc}kolab-resource-handlers-0.4.1-20050918 --define kolab_version=$kolab_version + @install ${altloc}perl-kolab-5.8.7-20051003 + @install ${altloc}kolabd-2.0.99-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolab-webadmin-2.0.99-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolab-resource-handlers-2.0.99-20051003 --define kolab_version=$kolab_version @check if test ! -e "/usr/bin/kolab" ; then From cvs at intevation.de Mon Oct 3 03:46:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:46:38 2005 Subject: steffen: server/kolab-resource-handlers Makefile, 1.10, 1.11 kolab-resource-handlers.spec, 1.135, 1.136 Message-ID: <20051003014637.6D64A1005D7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers In directory doto:/tmp/cvs-serv26557/kolab-resource-handlers Modified Files: Makefile kolab-resource-handlers.spec Log Message: versions, upped version number on kolab packages to 2.0.99 where possible Index: Makefile =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/Makefile,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile 29 Aug 2005 04:53:49 -0000 1.10 +++ Makefile 3 Oct 2005 01:46:35 -0000 1.11 @@ -1,5 +1,5 @@ RPM = /kolab/bin/openpkg rpm -VERSION = 0.4.1 +VERSION = 2.0.99 PEARVERSION = 1.3 ifeq "x$(KOLABRPMSRC)" "x" KOLABRPMSRC = /kolab/RPM/SRC Index: kolab-resource-handlers.spec =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers.spec,v retrieving revision 1.135 retrieving revision 1.136 diff -u -d -r1.135 -r1.136 --- kolab-resource-handlers.spec 29 Sep 2005 08:50:07 -0000 1.135 +++ kolab-resource-handlers.spec 3 Oct 2005 01:46:35 -0000 1.136 @@ -1,6 +1,6 @@ # Versions %define V_php_horde_pear 1.3 -%define V_kolab_reshndl 0.4.1 +%define V_kolab_reshndl 2.0.99 # Package Information Name: kolab-resource-handlers @@ -8,7 +8,7 @@ URL: http://www.kolab.org/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) Version: %{V_kolab_reshndl} -Release: 20050929 +Release: 20051003 Class: JUNK License: GPL Group: MAIL From cvs at intevation.de Mon Oct 3 03:46:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:46:39 2005 Subject: steffen: server/perl-kolab perl-kolab.spec.in,1.21,1.22 Message-ID: <20051003014637.75ED71005DC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/perl-kolab In directory doto:/tmp/cvs-serv26557/perl-kolab Modified Files: perl-kolab.spec.in Log Message: versions, upped version number on kolab packages to 2.0.99 where possible Index: perl-kolab.spec.in =================================================================== RCS file: /kolabrepository/server/perl-kolab/perl-kolab.spec.in,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- perl-kolab.spec.in 30 Sep 2005 10:50:18 -0000 1.21 +++ perl-kolab.spec.in 3 Oct 2005 01:46:35 -0000 1.22 @@ -37,7 +37,7 @@ Group: Language License: GPL/Artistic Version: @VERSION@ -Release: 20050930 +Release: 20051003 # list of sources Source0: perl-kolab-@VERSION@.tar.gz From cvs at intevation.de Mon Oct 3 03:46:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 03:46:39 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin configure.ac, 1.18, 1.19 Message-ID: <20051003014637.722661005D8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin In directory doto:/tmp/cvs-serv26557/kolab-webadmin/kolab-webadmin Modified Files: configure.ac Log Message: versions, upped version number on kolab packages to 2.0.99 where possible Index: configure.ac =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/configure.ac,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- configure.ac 28 Jul 2005 02:14:38 -0000 1.18 +++ configure.ac 3 Oct 2005 01:46:35 -0000 1.19 @@ -1,6 +1,6 @@ AC_PREREQ(2.57) -m4_define(_VERSION,0.4.9) +m4_define(_VERSION,2.0.99) AC_INIT([kolab-webadmin],[_VERSION],[kolab-devel@kolab.org]) AC_CONFIG_SRCDIR(php/admin/include/ldap.class.php) AC_CONFIG_AUX_DIR(.) From cvs at intevation.de Mon Oct 3 04:11:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 04:11:04 2005 Subject: steffen: server obmtool.conf,1.174.2.16,1.174.2.17 Message-ID: <20051003021103.0A842100167@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv27148 Modified Files: Tag: kolab_2_0_branch obmtool.conf Log Message: versions Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.174.2.16 retrieving revision 1.174.2.17 diff -u -d -r1.174.2.16 -r1.174.2.17 --- obmtool.conf 18 Sep 2005 11:14:02 -0000 1.174.2.16 +++ obmtool.conf 3 Oct 2005 02:11:00 -0000 1.174.2.17 @@ -15,7 +15,7 @@ %kolab echo "---- boot/build ${NODE} %${CMD} ----" - kolab_version="pre-2.0.1-snapshot-20050918"; + kolab_version="pre-2.0.1-snapshot-20051003"; PREFIX=/${CMD}; loc='' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path plusloc='+' @@ -133,9 +133,9 @@ @install ${loc}vim-6.3.78-2.4.0 @install ${plusloc}dcron-2.9-2.4.0 @install ${altloc}perl-kolab-5.8.7-2.0_20050918 - @install ${altloc}kolabd-1.9.4-20050918 --define kolab_version=$kolab_version - @install ${altloc}kolab-webadmin-0.4.0-20050918 --define kolab_version=$kolab_version - @install ${altloc}kolab-resource-handlers-0.3.9-20050918 --define kolab_version=$kolab_version + @install ${altloc}kolabd-1.9.4-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolab-webadmin-0.4.0-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolab-resource-handlers-0.3.9-20051003 --define kolab_version=$kolab_version @check if test ! -e "/usr/bin/kolab" ; then From cvs at intevation.de Mon Oct 3 04:11:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 04:11:04 2005 Subject: steffen: server/kolab-resource-handlers kolab-resource-handlers.spec, 1.126.2.7, 1.126.2.8 Message-ID: <20051003021103.0DCE5100179@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers In directory doto:/tmp/cvs-serv27148/kolab-resource-handlers Modified Files: Tag: kolab_2_0_branch kolab-resource-handlers.spec Log Message: versions Index: kolab-resource-handlers.spec =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers.spec,v retrieving revision 1.126.2.7 retrieving revision 1.126.2.8 diff -u -d -r1.126.2.7 -r1.126.2.8 --- kolab-resource-handlers.spec 29 Sep 2005 08:50:45 -0000 1.126.2.7 +++ kolab-resource-handlers.spec 3 Oct 2005 02:11:01 -0000 1.126.2.8 @@ -8,7 +8,7 @@ URL: http://www.kolab.org/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) Version: %{V_kolab_reshndl} -Release: 20050929 +Release: 20051003 Class: JUNK License: GPL Group: MAIL From cvs at intevation.de Mon Oct 3 05:03:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 3 05:03:14 2005 Subject: steffen: server/php-smarty Makefile, 1.2, 1.3 php-smarty.spec, 1.3, 1.4 Message-ID: <20051003030313.260261005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/php-smarty In directory doto:/tmp/cvs-serv28587 Modified Files: Makefile php-smarty.spec Log Message: Updated Smarty version Index: Makefile =================================================================== RCS file: /kolabrepository/server/php-smarty/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 2 Jul 2004 12:27:33 -0000 1.2 +++ Makefile 3 Oct 2005 03:03:11 -0000 1.3 @@ -1,7 +1,7 @@ RPM = /kolab/bin/openpkg rpm NAME = Smarty RPMNAME = php-smarty -VERSION = 2.6.3 +VERSION = 2.6.10 ifeq "x$(KOLABRPMSRC)" "x" KOLABRPMSRC = /kolab/RPM/SRC @@ -9,8 +9,7 @@ all: test -d $(KOLABRPMSRC)/$(RPMNAME) || mkdir $(KOLABRPMSRC)/$(RPMNAME) - cd $(KOLABRPMSRC)/$(RPMNAME) && wget -c "http://smarty.php.net/distributions/$(NAME)-$(VERSION).tar.gz" \ - "http://smarty.php.net/distributions/manual/en/$(NAME)-$(VERSION)-docs.tar.gz" + cd $(KOLABRPMSRC)/$(RPMNAME) && wget -c "http://smarty.php.net/distributions/$(NAME)-$(VERSION).tar.gz" cp $(RPMNAME).spec $(KOLABRPMSRC)/$(RPMNAME) cd $(KOLABRPMSRC)/$(RPMNAME) && $(RPM) -ba $(RPMNAME).spec Index: php-smarty.spec =================================================================== RCS file: /kolabrepository/server/php-smarty/php-smarty.spec,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- php-smarty.spec 2 Jul 2004 12:27:33 -0000 1.3 +++ php-smarty.spec 3 Oct 2005 03:03:11 -0000 1.4 @@ -1,14 +1,14 @@ # Versions -%define V_php 4.0.6 -%define V_Smarty 2.6.3 +%define V_php 4.3.11 +%define V_Smarty 2.6.10 # Package Information Name: php-smarty Summary: Template engine for PHP URL: http://smarty.php.net/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) -Version: 2.6.3 -Release: 20040702 +Version: 2.6.10 +Release: 20051003 Class: JUNK License: LGPL Group: Languages @@ -16,7 +16,6 @@ # List of Sources Source0: http://smarty.php.net/distributions/Smarty-%{version}.tar.gz -Source1: http://smarty.php.net/distributions/manual/en/Smarty-%{version}-docs.tar.gz # Build Info Prefix: %{l_prefix} @@ -36,32 +35,33 @@ programmers and template designers. %prep - %setup -q -n Smarty-%{version} -a 1 + %setup -q -n Smarty-%{version} %build %install rm -rf $RPM_BUILD_ROOT - %{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty/core + %{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty/internals %{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty/plugins %{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/share/php-smarty/manual/stylesheet-images %{l_shtool} install -m 644 libs/{Config_File,Smarty{,_Compiler}}.class.php \ $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty %{l_shtool} install -m 644 libs/debug.tpl $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty - %{l_shtool} install -m 644 libs/core/*.php $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty/core + %{l_shtool} install -m 644 libs/internals/*.php $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty/internals %{l_shtool} install -m 644 libs/plugins/*.php $RPM_BUILD_ROOT%{l_prefix}/lib/php/Smarty/plugins %{l_shtool} install -m 644 BUGS ChangeLog FAQ INSTALL NEWS README RELEASE_NOTES TODO \ $RPM_BUILD_ROOT%{l_prefix}/share/php-smarty - %{l_shtool} install -m 644 manual/*\ - $RPM_BUILD_ROOT%{l_prefix}/share/php-smarty/manual %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \ %doc %{l_prefix}/share/php-smarty/BUGS %{l_prefix}/share/php-smarty/ChangeLog \ %{l_prefix}/share/php-smarty/FAQ %{l_prefix}/share/php-smarty/INSTALL \ %{l_prefix}/share/php-smarty/NEWS %{l_prefix}/share/php-smarty/README \ - %{l_prefix}/share/php-smarty/RELEASE_NOTES %{l_prefix}/share/php-smarty/TODO \ - %{l_prefix}/share/php-smarty/manual/* + %{l_prefix}/share/php-smarty/RELEASE_NOTES %{l_prefix}/share/php-smarty/TODO %clean rm -rf $RPM_BUILD_ROOT %files -f files + +%post + echo "Removing old compiled templates from %{l_prefix}/var/kolab/php/admin/templates_c" + rm -f %{l_prefix}/var/kolab/php/admin/templates_c/* From cvs at intevation.de Tue Oct 4 12:43:28 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue Oct 4 12:43:30 2005 Subject: david: doc/kde-client/svn-instructions checkout_proko2.sh, 1.9, 1.10 Message-ID: <20051004104328.9D8A61006D6@lists.intevation.de> Author: david Update of /kolabrepository/doc/kde-client/svn-instructions In directory doto:/tmp/cvs-serv29313 Modified Files: checkout_proko2.sh Log Message: doc/kleopatra branched for aegypten (SVN commit 467120) Index: checkout_proko2.sh =================================================================== RCS file: /kolabrepository/doc/kde-client/svn-instructions/checkout_proko2.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- checkout_proko2.sh 9 Jun 2005 16:08:03 -0000 1.9 +++ checkout_proko2.sh 4 Oct 2005 10:43:26 -0000 1.10 @@ -66,6 +66,7 @@ switch_dir doc/kmail switch_dir doc/korganizer switch_dir doc/kaddressbook +switch_dir doc/kleopatra switch_dir libkdepim switch_dir mimelib switch_dir libkcal From cvs at intevation.de Tue Oct 4 14:48:21 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue Oct 4 14:48:22 2005 Subject: steffen: server/kolabd/kolabd kolab_bootstrap.in,1.4,1.5 Message-ID: <20051004124821.AB2F61006D9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv31210/kolabd Modified Files: kolab_bootstrap.in Log Message: Issue832 implemented (user-defined toplevel DN for Kolab) Index: kolab_bootstrap.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolab_bootstrap.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- kolab_bootstrap.in 2 Oct 2005 11:06:31 -0000 1.4 +++ kolab_bootstrap.in 4 Oct 2005 12:48:19 -0000 1.5 @@ -310,6 +310,7 @@ $base_dn .= "dc=$dc,"; } chop $base_dn; + $base_dn = getUserInput("Top level DN for Kolab", $base_dn); print " base_dn : $base_dn\n"; } if ($bind_dn =~ /\@\@\@/) { @@ -479,9 +480,10 @@ my $mesg = $ldap->search(base=> "$base_dn", scope=> 'exact', filter=> "(objectclass=*)"); if ($mesg && $mesg->count != 1) { print "no $base_dn object found, creating one\n"; - my $dccomp = (split(/\./,$domain))[0]; - chomp $dccomp; - $mesg = $ldap->add( $base_dn, attr=> [dc=> $dccomp, 'objectclass'=> ['top', 'domain'] ]); + $base_dn =~ m/([^=]+)=([^,]+)/; + my @attrs = ( $1 => $2, 'objectclass'=> ['top', 'domain'] ); + @attrs = ( @attrs, 'dc' => (split(/,/,$domain))[0] ) if( $1 ne 'dc' ); + $mesg = $ldap->add( $base_dn, attr=> \@attrs); } $mesg && $mesg->code && warn "failed to write basedn entry : ", $mesg->error; my $ldapobject = newOrExistingLDAPEntry( $ldap, "k=kolab,$base_dn" ); From cvs at intevation.de Fri Oct 7 13:27:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 13:27:04 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin Makefile.am, 1.21, 1.22 Message-ID: <20051007112703.C6E631006CF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin In directory doto:/tmp/cvs-serv20889/kolab-webadmin Modified Files: Makefile.am Log Message: language detection fix + integration of italian translations Index: Makefile.am =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.am 5 Jul 2005 10:31:51 -0000 1.21 +++ Makefile.am 7 Oct 2005 11:27:01 -0000 1.22 @@ -169,16 +169,20 @@ PHP_LOCALE_FR_MO = php/admin/locale/fr/LC_MESSAGES/messages.mo PHP_LOCALE_NL_PO = php/admin/locale/nl/LC_MESSAGES/messages.po PHP_LOCALE_NL_MO = php/admin/locale/nl/LC_MESSAGES/messages.mo +PHP_LOCALE_IT_PO = php/admin/locale/it/LC_MESSAGES/messages.po +PHP_LOCALE_IT_MO = php/admin/locale/it/LC_MESSAGES/messages.mo localedir = $(phpadmindir)/locale phplocalededir = $(localedir)/de/LC_MESSAGES phplocalefrdir = $(localedir)/fr/LC_MESSAGES phplocalenldir = $(localedir)/nl/LC_MESSAGES +phplocaleitdir = $(localedir)/it/LC_MESSAGES phplocalede_DATA = $(PHP_LOCALE_DE_MO) phplocalefr_DATA = $(PHP_LOCALE_FR_MO) phplocalenl_DATA = $(PHP_LOCALE_NL_MO) +phplocaleit_DATA = $(PHP_LOCALE_IT_MO) EXTRA_DIST += $(WSTOPLEVEL_FILES) \ @@ -197,7 +201,8 @@ $(PHP_TEMPLATES) \ $(PHP_LOCALE_DE_PO) \ $(PHP_LOCALE_FR_PO) \ - $(PHP_LOCALE_NL_PO) + $(PHP_LOCALE_NL_PO) \ + $(PHP_LOCALE_IT_PO) install-data-hook: $(mkinstalldirs) $(DESTDIR)$(phpadmindir)/templates_c From cvs at intevation.de Fri Oct 7 13:27:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 13:27:04 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include locale.php, 1.7, 1.8 Message-ID: <20051007112703.C8895101EF4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include In directory doto:/tmp/cvs-serv20889/kolab-webadmin/php/admin/include Modified Files: locale.php Log Message: language detection fix + integration of italian translations Index: locale.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/locale.php,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- locale.php 10 Aug 2005 07:40:08 -0000 1.7 +++ locale.php 7 Oct 2005 11:27:01 -0000 1.8 @@ -69,12 +69,18 @@ // In case of multiple accept languages, keep the first one $acceptList = explode(",", $acceptList); foreach($acceptList as $l) { + $pos = strpos($l, ';' ); + if( $pos !== false ) { + $l = explode(';',$l); + $l = $l[0]; + } if( $tmp = supported_lang($l) ) { - $lang = $tmp; - break; + $lang = $tmp; + break; } } - } + } + if( !$lang ) $lang = "en"; setLanguage($lang); } return supported_lang($_SESSION["lang"]); From cvs at intevation.de Fri Oct 7 13:39:29 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 13:39:31 2005 Subject: steffen: server obmtool.conf,1.199,1.200 Message-ID: <20051007113929.E1F12101EF4@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv21105 Modified Files: obmtool.conf Log Message: versions Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.199 retrieving revision 1.200 diff -u -d -r1.199 -r1.200 --- obmtool.conf 3 Oct 2005 01:46:35 -0000 1.199 +++ obmtool.conf 7 Oct 2005 11:39:27 -0000 1.200 @@ -15,7 +15,7 @@ %kolab echo "---- boot/build ${NODE} %${CMD} ----" - kolab_version="pre-2.1-snapshot-20051003"; + kolab_version="pre-2.1-snapshot-20051007"; PREFIX=/${CMD}; loc='' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path plusloc='+' @@ -134,7 +134,7 @@ # @install ${plusloc}dcron-2.9-2.4.0 @install ${altloc}perl-kolab-5.8.7-20051003 @install ${altloc}kolabd-2.0.99-20051003 --define kolab_version=$kolab_version - @install ${altloc}kolab-webadmin-2.0.99-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolab-webadmin-2.0.99-20051007 --define kolab_version=$kolab_version @install ${altloc}kolab-resource-handlers-2.0.99-20051003 --define kolab_version=$kolab_version @check From cvs at intevation.de Fri Oct 7 14:16:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 14:16:12 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES messages.po, 1.10, 1.11 Message-ID: <20051007121611.5B50C1006CF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES In directory doto:/tmp/cvs-serv21774/locale/de/LC_MESSAGES Modified Files: messages.po Log Message: Updated translation files. Someone with knowledge of each language should go through them... Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES/messages.po,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- messages.po 5 Jul 2005 10:31:51 -0000 1.10 +++ messages.po 7 Oct 2005 12:16:09 -0000 1.11 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: kolab-messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-07-03 16:26+0200\n" +"POT-Creation-Date: 2005-10-07 13:50+0200\n" "PO-Revision-Date: 2005-03-11 14:50+0100\n" "Last-Translator: Matthias Kalle Dalheimer \n" @@ -170,31 +170,33 @@ msgstr "(nur externe Adresse ohne Kolab-Benutzerkonto)" [...1344 lines suppressed...] msgstr "Bitte melden Sie sich als ein gültiger Benutzer an" -#: ../include/ldap.class.php:53 +#: ../include/ldap.class.php:54 msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" msgstr "" -#: ../include/ldap.class.php:308 +#: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " msgstr "LDAP-Fehler: Kann die Verwalter-Gruppe nicht lesen" + +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "" +#~ "MX-Suche für Relayhost einschalten (wenn Sie sich nicht sicher sind, " +#~ "verwenden Sie diese Option nicht)" #~ msgid "React to spam" #~ msgstr "Auf Spam reagieren" From cvs at intevation.de Fri Oct 7 14:16:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 14:16:13 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES messages.po, 1.2, 1.3 Message-ID: <20051007121611.65601101EEE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES In directory doto:/tmp/cvs-serv21774/locale/fr/LC_MESSAGES Modified Files: messages.po Log Message: Updated translation files. Someone with knowledge of each language should go through them... Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES/messages.po,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- messages.po 5 Jul 2005 10:31:51 -0000 1.2 +++ messages.po 7 Oct 2005 12:16:09 -0000 1.3 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-07-03 16:26+0200\n" +"POT-Creation-Date: 2005-10-07 13:50+0200\n" "PO-Revision-Date: 2005-06-13 18:10+0200\n" "Last-Translator: Benoit Mortier \n" "Language-Team: \n" @@ -170,31 +170,33 @@ msgstr "(seulement les adresses externes sans un compte de messagerie Kolab)" [...1347 lines suppressed...] msgid "Please log in as a valid user" msgstr "Veuillez vous connecter comme un utilisateur valide" -#: ../include/ldap.class.php:53 +#: ../include/ldap.class.php:54 msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" msgstr "" "Erreur lors de la négociation du protocole LDAP v3. Veuillez contacter votre " "administrateur système" -#: ../include/ldap.class.php:308 +#: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " msgstr "Erreur LDAP: Impossible de lire le groupe des mainteneurs: " + +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "" +#~ "Active la vérification du MX pour le serveur relais (si vous hésitez, " +#~ "laisser le désactivé)" From cvs at intevation.de Fri Oct 7 14:16:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 14:16:13 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES messages.po, 1.1, 1.2 Message-ID: <20051007121611.6A6EA101EF4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES In directory doto:/tmp/cvs-serv21774/locale/it/LC_MESSAGES Modified Files: messages.po Log Message: Updated translation files. Someone with knowledge of each language should go through them... Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES/messages.po,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- messages.po 31 Jul 2005 00:01:50 -0000 1.1 +++ messages.po 7 Oct 2005 12:16:09 -0000 1.2 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-07-03 16:26+0200\n" +"POT-Creation-Date: 2005-10-07 13:50+0200\n" "PO-Revision-Date: 2005-07-22 23:43+0100\n" "Last-Translator: Alessandro Fiorino \n" "Language-Team: \n" @@ -27,9 +27,7 @@ msgid "The maintainer with DN" msgstr "Il Maintainer con DN" [...1996 lines suppressed...] -#: ../include/ldap.class.php:53 -msgid "Error setting LDAP protocol to v3. Please contact your system administrator" -msgstr "Errore impostanto il protocollo LDAP alla versione 3. Prego contattare l'amministratore di sistema" +#: ../include/ldap.class.php:54 +msgid "" +"Error setting LDAP protocol to v3. Please contact your system administrator" +msgstr "" +"Errore impostanto il protocollo LDAP alla versione 3. Prego contattare " +"l'amministratore di sistema" -#: ../include/ldap.class.php:308 +#: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "" +#~ "Abilita verifica MX per il server di relay (se in dubbio, lasciare " +#~ "disabilitato)" From cvs at intevation.de Fri Oct 7 14:16:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 7 14:16:13 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES messages.po, 1.2, 1.3 Message-ID: <20051007121611.6D5CA101EF7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES In directory doto:/tmp/cvs-serv21774/locale/nl/LC_MESSAGES Modified Files: messages.po Log Message: Updated translation files. Someone with knowledge of each language should go through them... Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES/messages.po,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- messages.po 5 Jul 2005 10:31:51 -0000 1.2 +++ messages.po 7 Oct 2005 12:16:09 -0000 1.3 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-07-03 16:26+0200\n" +"POT-Creation-Date: 2005-10-07 13:50+0200\n" "PO-Revision-Date: 2005-06-16 19:35+0200\n" "Last-Translator: Vincent Seynhaeve \n" "Language-Team: Nerlandais \n" @@ -163,31 +163,33 @@ msgstr " (alleen maar externe adressen zonder Kolab gebruikersaccount) " [...1327 lines suppressed...] @@ -1795,13 +1881,16 @@ msgid "Please log in as a valid user" msgstr "Gelieve aan te melden als een geldige gebruiker" -#: ../include/ldap.class.php:53 +#: ../include/ldap.class.php:54 msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" msgstr "" "Fout met instelling LDAP protocol to v3. Gelieve contact op te nemen met uw " "systeembeheerder " -#: ../include/ldap.class.php:308 +#: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " msgstr "LDAP fout: Can't read maintainers group" + +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "Activeer de MX controle voor de relayhost (bij twijfel, leeg laten)" From cvs at intevation.de Mon Oct 10 17:24:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 10 17:24:20 2005 Subject: thomas: server release-notes.txt,1.15.2.8,1.15.2.9 Message-ID: <20051010152418.736B91005C6@lists.intevation.de> Author: thomas Update of /kolabrepository/server In directory doto:/tmp/cvs-serv20929 Modified Files: Tag: kolab_2_0_branch release-notes.txt Log Message: Typo Index: release-notes.txt =================================================================== RCS file: /kolabrepository/server/release-notes.txt,v retrieving revision 1.15.2.8 retrieving revision 1.15.2.9 diff -u -d -r1.15.2.8 -r1.15.2.9 --- release-notes.txt 16 Sep 2005 17:26:33 -0000 1.15.2.8 +++ release-notes.txt 10 Oct 2005 15:24:16 -0000 1.15.2.9 @@ -5,7 +5,7 @@ For upgrading and installation instructions, please refer to the 1st.README file in the source directory. -Since 2.0.1 RC1: +Changes since 2.0.1rc1: - security fixes from OpenPKG: pcre-6.0-2.4.1 OpenPKG-SA-2005.018 From cvs at intevation.de Mon Oct 10 17:25:45 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Mon Oct 10 17:25:45 2005 Subject: thomas: server obmtool.conf,1.174.2.17,1.174.2.18 Message-ID: <20051010152545.0C4701005C6@lists.intevation.de> Author: thomas Update of /kolabrepository/server In directory doto:/tmp/cvs-serv20987 Modified Files: Tag: kolab_2_0_branch obmtool.conf Log Message: Updated clamav version for security update. Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.174.2.17 retrieving revision 1.174.2.18 diff -u -d -r1.174.2.17 -r1.174.2.18 --- obmtool.conf 3 Oct 2005 02:11:00 -0000 1.174.2.17 +++ obmtool.conf 10 Oct 2005 15:25:43 -0000 1.174.2.18 @@ -129,7 +129,7 @@ @install ${loc}spamassassin-3.0.3-2.4.1 @install ${plusloc}amavisd-2.3.1-2.4.0 @install ${loc}curl-7.14.0-2.4.0 - @install ${altloc}clamav-0.86.2-20050726 + @install ${altloc}clamav-0.87-20050916 @install ${loc}vim-6.3.78-2.4.0 @install ${plusloc}dcron-2.9-2.4.0 @install ${altloc}perl-kolab-5.8.7-2.0_20050918 From cvs at intevation.de Tue Oct 11 14:34:34 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue Oct 11 14:34:35 2005 Subject: steffen: server/kolabd/kolabd/templates main.cf.template.in, 1.3, 1.4 Message-ID: <20051011123434.A362B1005DD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd/templates In directory doto:/tmp/cvs-serv11253 Modified Files: main.cf.template.in Log Message: relay host fix from Fabio Index: main.cf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/main.cf.template.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- main.cf.template.in 3 Oct 2005 01:07:55 -0000 1.3 +++ main.cf.template.in 11 Oct 2005 12:34:32 -0000 1.4 @@ -33,7 +33,17 @@ myhostname = @@@fqdnhostname@@@ mydomain = @@@postfix-mydomain@@@ myorigin = $mydomain +@@@if postfix-relayhost@@@ + +# Postfix Relay Host +# +# Check if there is also a relayport otherwise put the default +@@@if postfix-relayport@@@ relayhost = [@@@postfix-relayhost@@@]:@@@postfix-relayport@@@ +@@@else@@@ +relayhost = [@@@postfix-relayhost@@@] +@@@endif@@@ +@@@endif@@@ # masquerade_domains = $mydomain From cvs at intevation.de Tue Oct 11 14:35:21 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue Oct 11 14:35:22 2005 Subject: steffen: server/kolabd/kolabd/templates master.cf.template.in, 1.2, 1.3 Message-ID: <20051011123521.4FDF61005C9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd/templates In directory doto:/tmp/cvs-serv11299 Modified Files: master.cf.template.in Log Message: another postfix fix from Fabio Index: master.cf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/master.cf.template.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- master.cf.template.in 16 Sep 2005 12:50:54 -0000 1.2 +++ master.cf.template.in 11 Oct 2005 12:35:19 -0000 1.3 @@ -33,6 +33,7 @@ lmtp unix - - n - - lmtp anvil unix - - n - 1 anvil scache unix - - n - 1 scache +proxymap unix - - n - - proxymap tlsmgr unix - - n 1000? 1 tlsmgr #cyrus unix - n n - - pipe flags=R user=cyrus argv=@bindir@/deliver -e -m ${extension} ${user} #uucp unix - n n - - pipe flags=Fqhu user=uucp argv=@bindir@/uux -r -n -z -a$sender - $nexthop!rmail ($recipient) From cvs at intevation.de Tue Oct 11 14:42:28 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Tue Oct 11 14:42:29 2005 Subject: steffen: server obmtool.conf,1.200,1.201 Message-ID: <20051011124228.2C1611006CB@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv11436 Modified Files: obmtool.conf Log Message: version Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.200 retrieving revision 1.201 diff -u -d -r1.200 -r1.201 --- obmtool.conf 7 Oct 2005 11:39:27 -0000 1.200 +++ obmtool.conf 11 Oct 2005 12:42:26 -0000 1.201 @@ -15,7 +15,7 @@ %kolab echo "---- boot/build ${NODE} %${CMD} ----" - kolab_version="pre-2.1-snapshot-20051007"; + kolab_version="pre-2.1-snapshot-20051011"; PREFIX=/${CMD}; loc='' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path plusloc='+' @@ -133,7 +133,7 @@ # @install ${loc}vim-6.3.78-2.4.0 # @install ${plusloc}dcron-2.9-2.4.0 @install ${altloc}perl-kolab-5.8.7-20051003 - @install ${altloc}kolabd-2.0.99-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolabd-2.0.99-20051011 --define kolab_version=$kolab_version @install ${altloc}kolab-webadmin-2.0.99-20051007 --define kolab_version=$kolab_version @install ${altloc}kolab-resource-handlers-2.0.99-20051003 --define kolab_version=$kolab_version @check From cvs at intevation.de Wed Oct 12 05:21:51 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 05:21:54 2005 Subject: steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr kolabfilter.php, 1.27, 1.28 resmgr.conf, 1.7, 1.8 Message-ID: <20051012032151.DABA0100160@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr In directory doto:/tmp/cvs-serv29787/kolab-resource-handlers/resmgr Modified Files: kolabfilter.php resmgr.conf Log Message: Fix for issue958 (From header rewriting) Index: kolabfilter.php =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/kolabfilter.php,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- kolabfilter.php 1 Jul 2005 11:59:45 -0000 1.27 +++ kolabfilter.php 12 Oct 2005 03:21:49 -0000 1.28 @@ -104,6 +104,15 @@ function verify_sender( $sender, $from, $client_addr ) { global $params; + // Allow anything from fellow Kolab-hosts + /* + $kolabhosts = split(',', $params['kolabhosts'] ); + $kolabhosts = array_map( "gethostbyname", $kolabhosts ); + foreach( $kolabhosts as $ip ) { + if( $client_addr == $ip ) return true; + } + */ + $adrs = imap_rfc822_parse_adrlist($from, $params['email_domain']); foreach ($adrs as $adr) { $from = $adr->mailbox.'@'.$adr->host; @@ -119,18 +128,19 @@ if( $params['verify_subdomains'] ) { //myLog( "Checking if ".substr($senderdom, -strlen($domain)-1)." == .$domain", RM_LOG_DEBUG ); //myLog( "Checking if ".substr($fromdom, -strlen($domain)-1)." == .$domain", RM_LOG_DEBUG ); - if( $client_addr != '127.0.0.1' && - ($senderdom == $domain || - $fromdom == $domain || - substr($senderdom, -strlen($domain)-1) == ".$domain" || - substr($fromdom, -strlen($domain)-1) == ".$domain" ) && - $sender != $from ) { + if( $client_addr != '127.0.0.1' && + ($senderdom == $domain || + $fromdom == $domain || + substr($senderdom, -strlen($domain)-1) == ".$domain" || + substr($fromdom, -strlen($domain)-1) == ".$domain" ) && + $sender != $from ) { return false; } } else { - if( ($senderdom == $domain || - $fromdom == $domain ) && - $sender != $from ) { + if( $client_addr != '127.0.0.1' && + ($senderdom == $domain || + $fromdom == $domain ) && + $sender != $from ) { return false; } } @@ -185,12 +195,14 @@ $senderok = false; } else { // Only rewrite if from is ours and envelope not - if( is_my_domain( $from ) && !is_my_domain( $sender )) { - myLog("Rewriting From header", RM_LOG_DEBUG); - $rewrittenfrom = "From: $from (UNTRUSTED, sender is \"$sender\")\r\n"; + if( is_my_domain( $from ) && !is_my_domain( $sender ) ) { + if( !ereg( "\(UNTRUSTED, sender is $sender\)", $from ) ) { + myLog("Rewriting From header", RM_LOG_DEBUG); + $rewrittenfrom = "From: $from (UNTRUSTED, sender is $sender)\r\n"; + } /* else already rewritten */ } else { // Not our domain in From, reject - $senderok = false; + $senderok = false; } } } Index: resmgr.conf =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/resmgr.conf,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- resmgr.conf 10 Jun 2005 23:54:37 -0000 1.7 +++ resmgr.conf 12 Oct 2005 03:21:49 -0000 1.8 @@ -11,6 +11,9 @@ // '@domain' specified after their username as part of their email address. $params['email_domain'] = 'example.com'; +// List of kolab hosts that are priviledged +$params['kolabhosts'] = 'one.example.com,two.example.com,three.example.com'; + // Are we using virtual domains with Cyrus? $params['virtual_domains'] = true; From cvs at intevation.de Wed Oct 12 05:21:51 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 05:21:54 2005 Subject: steffen: server/kolab-resource-handlers kolab-resource-handlers.spec, 1.136, 1.137 Message-ID: <20051012032151.D989C10015D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers In directory doto:/tmp/cvs-serv29787 Modified Files: kolab-resource-handlers.spec Log Message: Fix for issue958 (From header rewriting) Index: kolab-resource-handlers.spec =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers.spec,v retrieving revision 1.136 retrieving revision 1.137 diff -u -d -r1.136 -r1.137 --- kolab-resource-handlers.spec 3 Oct 2005 01:46:35 -0000 1.136 +++ kolab-resource-handlers.spec 12 Oct 2005 03:21:49 -0000 1.137 @@ -8,7 +8,7 @@ URL: http://www.kolab.org/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) Version: %{V_kolab_reshndl} -Release: 20051003 +Release: 20051011 Class: JUNK License: GPL Group: MAIL From cvs at intevation.de Wed Oct 12 05:24:25 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 05:24:26 2005 Subject: steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr kolabfilter.php, 1.26, 1.26.2.1 Message-ID: <20051012032425.22B7610015D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr In directory doto:/tmp/cvs-serv29901 Modified Files: Tag: kolab_2_0_branch kolabfilter.php Log Message: Backport of: Fix for issue958 (From header rewriting) Index: kolabfilter.php =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/kolabfilter.php,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -u -d -r1.26 -r1.26.2.1 --- kolabfilter.php 15 Jun 2005 11:05:45 -0000 1.26 +++ kolabfilter.php 12 Oct 2005 03:24:23 -0000 1.26.2.1 @@ -186,8 +186,10 @@ } else { // Only rewrite if from is ours and envelope not if( is_my_domain( $from ) && !is_my_domain( $sender )) { - myLog("Rewriting From header", RM_LOG_DEBUG); - $rewrittenfrom = "From: $from (UNTRUSTED, sender is \"$sender\")\r\n"; + if( !ereg( "\(UNTRUSTED, sender is $sender\)", $from ) ) { + myLog("Rewriting From header", RM_LOG_DEBUG); + $rewrittenfrom = "From: $from (UNTRUSTED, sender is $sender)\r\n"; + } /* else already rewritten */ } else { // Not our domain in From, reject $senderok = false; From cvs at intevation.de Wed Oct 12 05:24:49 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 05:24:51 2005 Subject: steffen: server/kolab-resource-handlers kolab-resource-handlers.spec, 1.126.2.8, 1.126.2.9 Message-ID: <20051012032449.DBFD6100160@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers In directory doto:/tmp/cvs-serv29936 Modified Files: Tag: kolab_2_0_branch kolab-resource-handlers.spec Log Message: version Index: kolab-resource-handlers.spec =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers.spec,v retrieving revision 1.126.2.8 retrieving revision 1.126.2.9 diff -u -d -r1.126.2.8 -r1.126.2.9 --- kolab-resource-handlers.spec 3 Oct 2005 02:11:01 -0000 1.126.2.8 +++ kolab-resource-handlers.spec 12 Oct 2005 03:24:47 -0000 1.126.2.9 @@ -8,7 +8,7 @@ URL: http://www.kolab.org/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) Version: %{V_kolab_reshndl} -Release: 20051003 +Release: 20051011 Class: JUNK License: GPL Group: MAIL From cvs at intevation.de Wed Oct 12 13:04:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 13:04:20 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/templates service.tpl, 1.5.2.3, 1.5.2.4 Message-ID: <20051012110418.D7FEF1005B0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates In directory doto:/tmp/cvs-serv6226/kolab-webadmin/kolab-webadmin/php/admin/templates Modified Files: Tag: kolab_2_0_branch service.tpl Log Message: Fix for issue942 -- had to partially revert the prev. fix and do a workaround instead to keep compatibility Index: service.tpl =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/templates/service.tpl,v retrieving revision 1.5.2.3 retrieving revision 1.5.2.4 diff -u -d -r1.5.2.3 -r1.5.2.4 --- service.tpl 3 Oct 2005 01:17:58 -0000 1.5.2.3 +++ service.tpl 12 Oct 2005 11:04:16 -0000 1.5.2.4 @@ -87,8 +87,7 @@
{tr msg="Smarthost (and optional port) to use to send outgoing mail (host.domain.tld). Leave empty for no relayhost."} -: -
+
From cvs at intevation.de Wed Oct 12 13:04:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 13:04:21 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/service index.php, 1.22.2.1, 1.22.2.2 Message-ID: <20051012110418.DA4171005D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service In directory doto:/tmp/cvs-serv6226/kolab-webadmin/kolab-webadmin/www/admin/service Modified Files: Tag: kolab_2_0_branch index.php Log Message: Fix for issue942 -- had to partially revert the prev. fix and do a workaround instead to keep compatibility Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service/index.php,v retrieving revision 1.22.2.1 retrieving revision 1.22.2.2 diff -u -d -r1.22.2.1 -r1.22.2.2 --- index.php 3 Oct 2005 01:17:00 -0000 1.22.2.1 +++ index.php 12 Oct 2005 11:04:16 -0000 1.22.2.2 @@ -45,7 +45,6 @@ global $postfixmynetworks; global $postfixallowunauth; global $postfixrelayhost; - global $postfixrelayport; global $kolabhost; global $kolabfilterverifyfrom; global $kolabfilterallowsender; @@ -71,7 +70,9 @@ $postfixmynetworks = join(', ',$attrs['postfix-mynetworks']); $postfixallowunauth = $attrs['postfix-allow-unauthenticated'][0]; $postfixrelayhost = $attrs['postfix-relayhost'][0]; - $postfixrelayport = $attrs['postfix-relayport'][0]; + if( ereg('\[(.*)\]', $postfixrelayhost, $regs ) ) { + $postfixrelayhost = $regs[1]; + } $kolabhost = $attrs['kolabHost']; unset( $kolabhost['count'] ); $kolabfilterverifyfrom = $attrs['kolabfilter-verify-from-header'][0]; @@ -183,7 +184,11 @@ if( $_REQUEST['submitpostfixrelayhost'] ) { $host_val = trim( $_REQUEST['postfixrelayhost'] ); - $porr_val = trim( $_REQUEST['postfixrelayport'] ); + if( ereg( '(.*):(.*)', $host_val, $regs ) ) { + $host_val = '['.$regs[1].']:'.$regs[2]; + } else if( $host_val ) { + $host_val = "[$host_val]"; + } if( $host_val == '' ) $host_val = array(); if( $port_val == '' ) $port_val = array(); $attrs = array(); From cvs at intevation.de Wed Oct 12 13:04:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 13:04:21 2005 Subject: steffen: server/kolabd kolabd.spec,1.57.2.7,1.57.2.8 Message-ID: <20051012110418.E46FF1005D9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd In directory doto:/tmp/cvs-serv6226/kolabd Modified Files: Tag: kolab_2_0_branch kolabd.spec Log Message: Fix for issue942 -- had to partially revert the prev. fix and do a workaround instead to keep compatibility Index: kolabd.spec =================================================================== RCS file: /kolabrepository/server/kolabd/Attic/kolabd.spec,v retrieving revision 1.57.2.7 retrieving revision 1.57.2.8 diff -u -d -r1.57.2.7 -r1.57.2.8 --- kolabd.spec 3 Oct 2005 01:16:43 -0000 1.57.2.7 +++ kolabd.spec 12 Oct 2005 11:04:16 -0000 1.57.2.8 @@ -40,7 +40,7 @@ Group: Mail License: GPL Version: 1.9.4 -Release: 20051003 +Release: 20051012 # list of sources Source0: kolabd-1.9.4.tar.gz From cvs at intevation.de Wed Oct 12 13:04:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 13:04:23 2005 Subject: steffen: server/kolabd/kolabd kolab2.schema,1.12.2.1,1.12.2.2 Message-ID: <20051012110418.E7F531005DF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv6226/kolabd/kolabd Modified Files: Tag: kolab_2_0_branch kolab2.schema Log Message: Fix for issue942 -- had to partially revert the prev. fix and do a workaround instead to keep compatibility Index: kolab2.schema =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/kolab2.schema,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -u -d -r1.12.2.1 -r1.12.2.2 --- kolab2.schema 3 Oct 2005 01:16:43 -0000 1.12.2.1 +++ kolab2.schema 12 Oct 2005 11:04:16 -0000 1.12.2.2 @@ -475,7 +475,6 @@ postfix-mydestination $ postfix-mynetworks $ postfix-relayhost $ - postfix-relayport $ postfix-transport $ postfix-virtual $ postfix-enable-virus-scan $ From cvs at intevation.de Wed Oct 12 13:04:18 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Wed Oct 12 13:04:23 2005 Subject: steffen: server/kolabd/kolabd/templates main.cf.template, 1.15.2.3, 1.15.2.4 Message-ID: <20051012110418.EEC6D1006A0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd/templates In directory doto:/tmp/cvs-serv6226/kolabd/kolabd/templates Modified Files: Tag: kolab_2_0_branch main.cf.template Log Message: Fix for issue942 -- had to partially revert the prev. fix and do a workaround instead to keep compatibility Index: main.cf.template =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/Attic/main.cf.template,v retrieving revision 1.15.2.3 retrieving revision 1.15.2.4 diff -u -d -r1.15.2.3 -r1.15.2.4 --- main.cf.template 3 Oct 2005 01:16:43 -0000 1.15.2.3 +++ main.cf.template 12 Oct 2005 11:04:16 -0000 1.15.2.4 @@ -28,7 +28,7 @@ myhostname = @@@fqdnhostname@@@ mydomain = @@@postfix-mydomain@@@ myorigin = $mydomain -relayhost = [@@@postfix-relayhost@@@]:@@@postfix-relayport@@@ +relayhost = @@@postfix-relayhost@@@ # masquerade_domains = $mydomain From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:05 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include ldap.class.php, 1.27, 1.28 Message-ID: <20051013015003.3EF571005C9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include In directory doto:/tmp/cvs-serv29305/kolab-webadmin/php/admin/include Modified Files: ldap.class.php Log Message: Fix for issue886 (i18n problem) Index: ldap.class.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/ldap.class.php,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- ldap.class.php 14 Jul 2005 23:07:30 -0000 1.27 +++ ldap.class.php 13 Oct 2005 01:50:00 -0000 1.28 @@ -181,10 +181,10 @@ if( $entries['count'] == 1 ) { return $entries[0]['uid'][0]; } else { - $errors[] = _("No such object $dn"); + $errors[] = sprintf( _("No such object %s"), $dn ); } } else { - $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection); + $errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection)); } return false; } @@ -197,7 +197,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - echo _("Error searching for DN for UID=$uid"); + echo sprintf( _("Error searching for DN for UID=%s"), $uid ); } return false; } @@ -211,10 +211,10 @@ if( $entries['count'] == 1 ) { return $entries[0]['mail'][0]; } else { - $errors[] = _("No such object $dn"); + $errors[] = sprintf( _("No such object %s"), $dn); } } else { - $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection); + $errors[] = sprintf(_("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection)); } return false; } @@ -227,7 +227,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - echo _("Error searching for DN for Mail=$mail"); + echo sprintf( _("Error searching for DN for Mail=%s"), $mail); } return false; } @@ -241,10 +241,10 @@ if( $entries['count'] == 1 ) { return $entries[0]['alias'][0]; } else { - $errors[] = _("No such object $dn"); + $errors[] = sprintf( _("No such object %s"), $dn); } } else { - $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection); + $errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection) ); } return false; } @@ -257,7 +257,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - $errors[] = _("Error searching for DN for alias=$mail: ").ldap_error($this->connection); + $errors[] = sprintf( _("Error searching for DN for alias=%s: %s"), $mail, ldap_error($this->connection)); } return false; } @@ -270,7 +270,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - $errors[] = _("Error searching for DN for mail_or_alias=$mail: ").ldap_error($this->connection); + $errors[] = sprintf( _("Error searching for DN for mail or alias %s: %s"), $mail, ldap_error($this->connection)); } return false; } From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:06 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES messages.po, 1.11, 1.12 Message-ID: <20051013015003.4372F1005D9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES In directory doto:/tmp/cvs-serv29305/kolab-webadmin/php/admin/locale/de/LC_MESSAGES Modified Files: messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES/messages.po,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- messages.po 7 Oct 2005 12:16:09 -0000 1.11 +++ messages.po 13 Oct 2005 01:50:01 -0000 1.12 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: kolab-messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-07 13:50+0200\n" +"POT-Creation-Date: 2005-10-13 03:40+0200\n" "PO-Revision-Date: 2005-03-11 14:50+0100\n" "Last-Translator: Matthias Kalle Dalheimer \n" @@ -192,12 +192,12 @@ #: tpl_messages.php:31 tpl_messages.php:38 tpl_messages.php:47 #: tpl_messages.php:57 tpl_messages.php:87 tpl_messages.php:110 #: tpl_messages.php:126 tpl_messages.php:162 tpl_messages.php:174 -#: tpl_messages.php:228 ../../../www/admin/user/user.php:752 -#: ../../../www/admin/user/user.php:799 +#: tpl_messages.php:228 ../../../www/admin/user/user.php:759 +#: ../../../www/admin/user/user.php:808 #: ../../../www/admin/sharedfolder/sf.php:282 -#: ../../../www/admin/administrator/admin.php:326 -#: ../../../www/admin/distributionlist/list.php:284 -#: ../../../www/admin/addressbook/addr.php:272 +#: ../../../www/admin/administrator/admin.php:330 +#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/addressbook/addr.php:275 msgid "Delete" msgstr "Löschen" @@ -1057,6 +1057,16 @@ msgid "Script was:" msgstr "Skript war:" +#: ../../../www/admin/user/deliver.php:74 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully activated" +msgstr "Abwesenheitsnachricht erfolgreich aktiviert" + +#: ../../../www/admin/user/deliver.php:75 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully deactivated" +msgstr "Abwesenheitsnachricht erfolgreich deaktiviert" + #: ../../../www/admin/user/forward.php:38 #: ../../../www/admin/user/vacation.php:17 msgid "" @@ -1069,6 +1079,16 @@ msgid "Please enter an email address" msgstr "Bitte geben Sie eine E-Mail-Adresse ein" +#: ../../../www/admin/user/forward.php:78 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully activated" +msgstr "Abwesenheitsnachricht erfolgreich aktiviert" + +#: ../../../www/admin/user/forward.php:79 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully deactivated" +msgstr "Abwesenheitsnachricht erfolgreich deaktiviert" + #: ../../../www/admin/user/index.php:33 #: ../../../www/admin/sharedfolder/index.php:22 #: ../../../www/admin/sharedfolder/sf.php:25 @@ -1083,6 +1103,11 @@ msgid "Error: You don't have Permissions to access this Menu" msgstr "Fehler: Sie haben keine Zugriffsrechte auf dieses Menü" +#: ../../../www/admin/user/index.php:106 +#, fuzzy, php-format +msgid "Manage Email User (%d Users)" +msgstr "E-Mail-Benutzer verwalten" + #: ../../../www/admin/user/index.php:169 #: ../../../www/admin/addressbook/index.php:122 msgid "Email" @@ -1108,6 +1133,11 @@ msgid "ends with" msgstr "endete mit" +#: ../../../www/admin/user/user.php:76 +#, php-format +msgid "Email address %1$s not in domains %2$s" +msgstr "" + #: ../../../www/admin/user/user.php:79 #: ../../../www/admin/addressbook/addr.php:71 #, fuzzy @@ -1130,6 +1160,16 @@ msgid "UID " msgstr "Benutzer-ID " +#: ../../../www/admin/user/user.php:127 +#, php-format +msgid "Delegate %s does not exist" +msgstr "" + +#: ../../../www/admin/user/user.php:140 +#, php-format +msgid "Illegal user or group %s" +msgstr "" + #: ../../../www/admin/user/user.php:151 #: ../../../www/admin/maintainer/maintainer.php:60 #: ../../../www/admin/administrator/admin.php:60 @@ -1261,53 +1301,144 @@ msgid "Leave blank for default (60 days)" msgstr "Freilassen für die Voreinstellung (60 Tage)" -#: ../../../www/admin/user/user.php:491 +#: ../../../www/admin/user/user.php:449 +#: ../../../www/admin/maintainer/maintainer.php:179 +#: ../../../www/admin/administrator/admin.php:186 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:159 +#, fuzzy, php-format +msgid "LDAP Error: No such dn: %s: %s" +msgstr "LDAP-Fehler: konnte nicht lesen" + +#: ../../../www/admin/user/user.php:485 +#, php-format +msgid "" +"Could not read resource encryption public key file://%s/etc/kolab/res_pub." +"pem: " +msgstr "" + +#: ../../../www/admin/user/user.php:492 msgid "Could not encrypt password: " msgstr "Konnte Passwort nicht verschlüsseln: " -#: ../../../www/admin/user/user.php:586 +#: ../../../www/admin/user/user.php:587 +#, php-format msgid "" "Account DN could not be modified, distribution list '%s' depends on it. To " +"modify this account, first remove it from the distribution list." msgstr "" -#: ../../../www/admin/user/user.php:663 ../../../www/admin/user/user.php:738 +#: ../../../www/admin/user/user.php:617 ../../../www/admin/user/user.php:621 +#: ../../../www/admin/distributionlist/list.php:195 +#, fuzzy, php-format +msgid "LDAP Error: Could not rename %1$s to %2$s: %3$s" +msgstr "LDAP-Fehler: umbenennen nicht möglich" + +#: ../../../www/admin/user/user.php:626 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove old entry %s,%s: %s" +msgstr "LDAP-Fehler: umbenennen nicht möglich" + +#: ../../../www/admin/user/user.php:632 +#: ../../../www/admin/distributionlist/list.php:201 +#, fuzzy, php-format +msgid "LDAP Error: Could not read %s: %s" +msgstr "LDAP-Fehler: konnte nicht lesen" + +#: ../../../www/admin/user/user.php:644 ../../../www/admin/user/user.php:657 +#: ../../../www/admin/user/user.php:694 ../../../www/admin/user/user.php:709 +#: ../../../www/admin/distributionlist/list.php:205 +#: ../../../www/admin/distributionlist/list.php:234 +#, fuzzy, php-format +msgid "LDAP Error: Could not modify object %s: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht modifizieren" + +#: ../../../www/admin/user/user.php:660 ../../../www/admin/user/user.php:712 +#, php-format +msgid "Mid-air collision detected, alias %1$s renamed to %2$s" +msgstr "" + +#: ../../../www/admin/user/user.php:665 ../../../www/admin/user/user.php:745 msgid "Modify User" msgstr "Benutzer verändern" -#: ../../../www/admin/user/user.php:711 +#: ../../../www/admin/user/user.php:666 +#, fuzzy, php-format +msgid "User '%s' successfully modified" +msgstr " erfolgreich verändert" + +#: ../../../www/admin/user/user.php:684 +#: ../../../www/admin/sharedfolder/sf.php:237 +#: ../../../www/admin/maintainer/maintainer.php:271 +#: ../../../www/admin/administrator/admin.php:279 +#: ../../../www/admin/addressbook/addr.php:220 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:260 +#, fuzzy, php-format +msgid "LDAP Error: could not add object %s: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht hinzufügen" + +#: ../../../www/admin/user/user.php:697 +#: ../../../www/admin/distributionlist/list.php:237 +#, php-format +msgid "Mid-air collision detected, email address %1$s renamed to %2$s" +msgstr "" + +#: ../../../www/admin/user/user.php:718 msgid "User " msgstr "Benutzer " -#: ../../../www/admin/user/user.php:711 -#: ../../../www/admin/maintainer/maintainer.php:278 -#: ../../../www/admin/administrator/admin.php:285 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:270 +#: ../../../www/admin/user/user.php:718 +#: ../../../www/admin/maintainer/maintainer.php:279 +#: ../../../www/admin/administrator/admin.php:289 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 msgid " successfully created" msgstr " erfolgreich erzeugt" -#: ../../../www/admin/user/user.php:712 ../../../www/admin/user/user.php:718 -#: ../../../www/admin/user/user.php:729 ../include/menu.php:30 +#: ../../../www/admin/user/user.php:719 ../../../www/admin/user/user.php:725 +#: ../../../www/admin/user/user.php:736 ../include/menu.php:30 msgid "Create New User" msgstr "Neuen Benutzer anlegen" -#: ../../../www/admin/user/user.php:744 ../../../www/admin/user/user.php:791 +#: ../../../www/admin/user/user.php:751 ../../../www/admin/user/user.php:800 msgid "Delete User" msgstr "Benutzer löschen" -#: ../../../www/admin/user/user.php:756 -#: ../../../www/admin/maintainer/maintainer.php:323 -#: ../../../www/admin/administrator/admin.php:330 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:312 -msgid "Error: need dn for delete operation" +#: ../../../www/admin/user/user.php:763 +#: ../../../www/admin/maintainer/maintainer.php:324 +#: ../../../www/admin/administrator/admin.php:334 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:313 +#, fuzzy +msgid "Error: need DN for delete operation" msgstr "Fehler: dn wird für Löschoperation benötigt" -#: ../../../www/admin/user/user.php:758 -#: ../../../www/admin/maintainer/maintainer.php:325 +#: ../../../www/admin/user/user.php:765 +#: ../../../www/admin/maintainer/maintainer.php:326 msgid "Error: you need administrative permissions to delete users" msgstr "Fehler: Sie benötigen Administratorrechte, um Benutzer zu löschen" -#: ../../../www/admin/user/user.php:785 +#: ../../../www/admin/user/user.php:777 +#, php-format +msgid "Account could not be deleted, distribution list '%s' depends on it." +msgstr "" + +#: ../../../www/admin/user/user.php:780 +#, php-format +msgid "Account removed from distribution list '%s'." +msgstr "" + +#: ../../../www/admin/user/user.php:782 +#, php-format +msgid "" +"Failure to remove account from distribution list '', account will not be " +"deleted." +msgstr "" + +#: ../../../www/admin/user/user.php:791 +#, fuzzy, php-format +msgid "LDAP Error: could not mark '%s' for deletion: %s" +msgstr "LDAP-Fehler: konnte nicht löschen " + +#: ../../../www/admin/user/user.php:794 msgid "User Deleted" msgstr "Benutzer gelöscht" @@ -1373,11 +1504,21 @@ msgid "" msgstr "" +#: ../../../www/admin/sharedfolder/index.php:52 +#, fuzzy, php-format +msgid "Manage Shared Folders (%d Folders)" +msgstr "Gemeinsam genutzte Ordner verwalten" + #: ../../../www/admin/sharedfolder/sf.php:51 #: ../../../www/admin/sharedfolder/sf.php:58 msgid "Permission for UID/email/GID" msgstr "Zugriffsrechte für UID/E-Mail/GID" +#: ../../../www/admin/sharedfolder/sf.php:101 +#, php-format +msgid "No UID or GID %s" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:117 msgid "Folder Name" msgstr "Ordnername" @@ -1398,20 +1539,65 @@ msgid "Permission for UID/GID" msgstr "Zugriffsrechte für UID/GID" +#: ../../../www/admin/sharedfolder/sf.php:143 +#: ../../../www/admin/distributionlist/list.php:135 +#: ../../../www/admin/addressbook/addr.php:142 +#, fuzzy, php-format +msgid "Error: DN required for %s operation" +msgstr "Fehler: dn wird für Löschoperation benötigt" + #: ../../../www/admin/sharedfolder/sf.php:153 ../include/menu.php:55 msgid "Add Shared Folder" msgstr "Gemeinsam genutzten Ordner hinzufügen" +#: ../../../www/admin/sharedfolder/sf.php:217 +#: ../../../www/admin/maintainer/maintainer.php:226 +#: ../../../www/admin/administrator/admin.php:233 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:206 +#, fuzzy, php-format +msgid "LDAP Error: could not rename %1$s to %2$s: %3$s" +msgstr "LDAP-Fehler: umbenennen nicht möglich" + #: ../../../www/admin/sharedfolder/sf.php:220 #: ../../../www/admin/sharedfolder/sf.php:229 msgid "Shared folder updated" msgstr "Gemeinsam genutzter Ordner aktualisiert" +#: ../../../www/admin/sharedfolder/sf.php:223 +#: ../../../www/admin/maintainer/maintainer.php:250 +#: ../../../www/admin/administrator/admin.php:257 +#: ../../../www/admin/addressbook/addr.php:203 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:235 +#, fuzzy, php-format +msgid "LDAP Error: could not read %s: %s" +msgstr "LDAP-Fehler: konnte nicht lesen" + +#: ../../../www/admin/sharedfolder/sf.php:227 +#: ../../../www/admin/maintainer/maintainer.php:254 +#: ../../../www/admin/administrator/admin.php:261 +#: ../../../www/admin/addressbook/addr.php:208 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:239 +#, fuzzy, php-format +msgid "LDAP Error: could not modify object %s: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht modifizieren" + +#: ../../../www/admin/sharedfolder/sf.php:239 +#, fuzzy, php-format +msgid "Shared folder '%s' added" +msgstr "Gemeinsam genutzter Ordner aktualisiert" + #: ../../../www/admin/sharedfolder/sf.php:251 #: ../../../www/admin/sharedfolder/sf.php:268 msgid "Modify Shared Folder" msgstr "Gemeinsam genutzten Ordner verändern" +#: ../../../www/admin/sharedfolder/sf.php:271 +#: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:289 +#, php-format +msgid "Error: No results returned for DN '%s'" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:283 msgid "Delete Shared Folder" msgstr "Gemeinsam genutzten Ordner löschen" @@ -1425,11 +1611,31 @@ msgstr " zum Löschen vorgemerkt" #: ../../../www/admin/sharedfolder/sf.php:293 -#: ../../../www/admin/distributionlist/list.php:296 -#: ../../../www/admin/addressbook/addr.php:285 +#: ../../../www/admin/distributionlist/list.php:297 +#: ../../../www/admin/addressbook/addr.php:289 msgid "Entry Deleted" msgstr "Eintrag gelöscht" +#: ../../../www/admin/sharedfolder/sf.php:296 +#, fuzzy, php-format +msgid "LDAP Error: Could not mark %s for deletion: %s" +msgstr "LDAP-Fehler: konnte nicht löschen " + +#: ../../../www/admin/service/index.php:97 +#, php-format +msgid "No account found for email address %s" +msgstr "" + +#: ../../../www/admin/service/index.php:105 +#, fuzzy, php-format +msgid "LDAP Error: Failed to add distribution list %s: %s" +msgstr "LDAP-Fehler: Konnte das Kolab-Konfigurationsobjekt nicht verändern: " + +#: ../../../www/admin/service/index.php:107 +#, fuzzy, php-format +msgid "Successfully created distribution list %s" +msgstr "Verteilerlisten anlegen" + #: ../../../www/admin/service/index.php:125 #: ../../../www/admin/service/index.php:134 #: ../../../www/admin/service/index.php:143 @@ -1438,48 +1644,50 @@ #: ../../../www/admin/service/index.php:171 #: ../../../www/admin/service/index.php:182 #: ../../../www/admin/service/index.php:196 +#: ../../../www/admin/service/index.php:214 #: ../../../www/admin/service/index.php:232 -#: ../../../www/admin/service/index.php:248 -#: ../../../www/admin/service/index.php:261 -msgid "LDAP Error: failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:249 +#: ../../../www/admin/service/index.php:262 +#, fuzzy, php-format +msgid "LDAP Error: failed to modify kolab configuration object: %s" msgstr "LDAP-Fehler: Konnte das Kolab-Konfigurationsobjekt nicht verändern: " -#: ../../../www/admin/service/index.php:214 -#, fuzzy -msgid "LDAP Error: Failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Failed to delete domain object %s: %s" msgstr "LDAP-Fehler: Konnte das Kolab-Konfigurationsobjekt nicht verändern: " -#: ../../../www/admin/service/index.php:268 +#: ../../../www/admin/service/index.php:270 msgid "POP3 Service" msgstr "POP3-Dienst" -#: ../../../www/admin/service/index.php:269 +#: ../../../www/admin/service/index.php:271 msgid "POP3/SSL service (TCP port 995)" msgstr "POP3/SSL-Dienst (TCP-Port 995)" -#: ../../../www/admin/service/index.php:270 +#: ../../../www/admin/service/index.php:272 msgid "IMAP Service" msgstr "IMAP-Dienst" -#: ../../../www/admin/service/index.php:271 +#: ../../../www/admin/service/index.php:273 msgid "IMAP/SSL Service (TCP port 993)" msgstr "IMAP/SSL-Dienst (TCP-Port 993)" -#: ../../../www/admin/service/index.php:272 +#: ../../../www/admin/service/index.php:274 msgid "Sieve service (TCP port 2000)" msgstr "Sieve-Dienst (TCP-Port 2000)" -#: ../../../www/admin/service/index.php:274 +#: ../../../www/admin/service/index.php:276 msgid "FTP FreeBusy Service (Legacy, not interoperable with Kolab2 FreeBusy)" msgstr "" "FTP-Frei/Belegt-Dienst (für Altsysteme, arbeitet nicht mit Kolab2-Frei/" "Belegt zusammen)" -#: ../../../www/admin/service/index.php:276 +#: ../../../www/admin/service/index.php:278 msgid "HTTP FreeBusy Service (Legacy)" msgstr "HTTP-Frei/Belegt-Dienst (für Altsysteme)" -#: ../../../www/admin/service/index.php:277 +#: ../../../www/admin/service/index.php:279 msgid "Amavis Email Scanning (Virus/Spam)" msgstr "Amavis-Scannen von E-Mail-Nachrichten (Viren/Spam)" @@ -1511,34 +1719,75 @@ msgid "Unique User ID" msgstr "Eindeutige Benutzer-ID" +#: ../../../www/admin/maintainer/maintainer.php:230 +#: ../../../www/admin/administrator/admin.php:237 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:210 +#, fuzzy, php-format +msgid "LDAP Error: could not remove old entry %s: %s" +msgstr "LDAP-Fehler: konnte nicht löschen " + +#: ../../../www/admin/maintainer/maintainer.php:240 +#: ../../../www/admin/administrator/admin.php:247 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Could not add new group entry %s: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht hinzufügen" + +#: ../../../www/admin/maintainer/maintainer.php:245 +#: ../../../www/admin/administrator/admin.php:252 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:225 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove old group entry %s: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht modifizieren" + #: ../../../www/admin/maintainer/maintainer.php:259 -#: ../../../www/admin/maintainer/maintainer.php:305 +#: ../../../www/admin/maintainer/maintainer.php:306 msgid "Modify Maintainer" msgstr "Maintainer verändern" #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/maintainer/maintainer.php:278 +#: ../../../www/admin/maintainer/maintainer.php:279 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid "Maintainer " msgstr "Maintainer " #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/administrator/admin.php:265 +#: ../../../www/admin/administrator/admin.php:267 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid " successfully modified" msgstr " erfolgreich verändert" -#: ../../../www/admin/maintainer/maintainer.php:279 -#: ../../../www/admin/maintainer/maintainer.php:285 -#: ../../../www/admin/maintainer/maintainer.php:296 ../include/menu.php:85 +#: ../../../www/admin/maintainer/maintainer.php:275 +#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:264 +#, fuzzy, php-format +msgid "LDAP Error: could not add object %s to maintainer group: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht hinzufügen" + +#: ../../../www/admin/maintainer/maintainer.php:280 +#: ../../../www/admin/maintainer/maintainer.php:286 +#: ../../../www/admin/maintainer/maintainer.php:297 ../include/menu.php:85 msgid "Create New Maintainer" msgstr "Neuen Maintainer anlegen" -#: ../../../www/admin/maintainer/maintainer.php:311 +#: ../../../www/admin/maintainer/maintainer.php:312 msgid "Delete Maintainer" msgstr "Maintainer löschen" -#: ../../../www/admin/maintainer/maintainer.php:341 +#: ../../../www/admin/maintainer/maintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:319 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from maintainer group: %s" +msgstr "LDAP-Fehler: Kann die Verwalter-Gruppe nicht lesen" + +#: ../../../www/admin/maintainer/maintainer.php:336 +#: ../../../www/admin/administrator/admin.php:345 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:325 +#, fuzzy, php-format +msgid "LDAP Error: could not mark %s for deletion: %s" +msgstr "LDAP-Fehler: konnte nicht löschen " + +#: ../../../www/admin/maintainer/maintainer.php:342 msgid "Maintainer Deleted" msgstr "Maintainer gelöscht" @@ -1547,33 +1796,38 @@ msgstr "" "Das Passwort des Managers kann nicht in der Web-Schnittstelle geändert werden" -#: ../../../www/admin/administrator/admin.php:264 -#: ../../../www/admin/administrator/admin.php:312 +#: ../../../www/admin/administrator/admin.php:266 +#: ../../../www/admin/administrator/admin.php:316 msgid "Modify Administrator" msgstr "Administrator verändern" -#: ../../../www/admin/administrator/admin.php:265 -#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/administrator/admin.php:267 +#: ../../../www/admin/administrator/admin.php:289 msgid "Administrator " msgstr "Administrator " -#: ../../../www/admin/administrator/admin.php:286 -#: ../../../www/admin/administrator/admin.php:292 -#: ../../../www/admin/administrator/admin.php:303 ../include/menu.php:71 +#: ../../../www/admin/administrator/admin.php:290 +#: ../../../www/admin/administrator/admin.php:296 +#: ../../../www/admin/administrator/admin.php:307 ../include/menu.php:71 msgid "Create New Administrator" msgstr "Neuen Administrator anlegen" -#: ../../../www/admin/administrator/admin.php:318 +#: ../../../www/admin/administrator/admin.php:322 msgid "Delete Administrator" msgstr "Administrator löschen" -#: ../../../www/admin/administrator/admin.php:332 +#: ../../../www/admin/administrator/admin.php:336 msgid "Error: you need administrative permissions to delete administrators" msgstr "" "Fehler: Sie benötigen Administratorrechte, um Administratoren löschen zu " "dürfen" -#: ../../../www/admin/administrator/admin.php:346 +#: ../../../www/admin/administrator/admin.php:340 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from admin group: %s" +msgstr "LDAP-Fehler: Kann die Verwalter-Gruppe nicht lesen" + +#: ../../../www/admin/administrator/admin.php:351 msgid "Administrator Deleted" msgstr "Administrator gelöscht" @@ -1589,6 +1843,11 @@ msgid "Please add at least one member" msgstr "Bitte fügen Sie wenigstens einen Eintrag hinzu" +#: ../../../www/admin/distributionlist/list.php:50 +#, php-format +msgid "No user with email address, UID or alias %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:62 msgid "User or distribution list with this email address already exists" msgstr "" @@ -1623,28 +1882,58 @@ msgid "Add Distribution List" msgstr "Verteilerliste hinzufügen" +#: ../../../www/admin/distributionlist/list.php:179 +#, php-format +msgid "No user with address %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:198 #: ../../../www/admin/distributionlist/list.php:207 msgid "Distribution List updated" msgstr "Verteilerliste aktualisiert" -#: ../../../www/admin/distributionlist/list.php:256 -#: ../../../www/admin/distributionlist/list.php:270 +#: ../../../www/admin/distributionlist/list.php:216 +#, fuzzy, php-format +msgid "LDAP Error: Could not add object %s: %s" +msgstr "LDAP-Fehler: konnte Objekt nicht hinzufügen" + +#: ../../../www/admin/distributionlist/list.php:245 +#, fuzzy, php-format +msgid "Distribution List '%s' added" +msgstr "Verteilerliste aktualisiert" + +#: ../../../www/admin/distributionlist/list.php:257 +#: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Verteilerliste verändern" -#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/distributionlist/list.php:274 +#, php-format +msgid "Error: No results returned for DN ''" +msgstr "" + +#: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" msgstr "Verteilerliste löschen" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid "Distribution List " msgstr "Verteilerliste " -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid " deleted" msgstr " gelöscht" +#: ../../../www/admin/distributionlist/list.php:300 +#, fuzzy, php-format +msgid "LDAP Error: Nould not delete %s: %s" +msgstr "LDAP-Fehler: konnte nicht löschen " + +#: ../../../www/admin/distributionlist/index.php:53 +#, fuzzy, php-format +msgid "Manage Distribution Lists (%d Lists)" +msgstr "Verteilerlisten verwalten" + #: ../../../www/admin/distributionlist/index.php:64 msgid "not yet implemented" msgstr "noch nicht implementiert" @@ -1666,70 +1955,82 @@ msgstr "Externe Adresse hinzufügen" #: ../../../www/admin/addressbook/addr.php:196 -msgid "LDAP Error: could not rename " +#, fuzzy, php-format +msgid "LDAP Error: could not rename %s to %s: %s" msgstr "LDAP-Fehler: umbenennen nicht möglich" -#: ../../../www/admin/addressbook/addr.php:203 -msgid "LDAP Error: could not read " -msgstr "LDAP-Fehler: konnte nicht lesen" - -#: ../../../www/admin/addressbook/addr.php:207 -msgid "LDAP Error: could not modify object " -msgstr "LDAP-Fehler: konnte Objekt nicht modifizieren" +#: ../../../www/admin/addressbook/addr.php:199 +#: ../../../www/admin/addressbook/addr.php:211 +#, fuzzy, php-format +msgid "%s successfully updated" +msgstr " erfolgreich erzeugt" -#: ../../../www/admin/addressbook/addr.php:218 -msgid "LDAP Error: could not add object " -msgstr "LDAP-Fehler: konnte Objekt nicht hinzufügen" +#: ../../../www/admin/addressbook/addr.php:223 +#, fuzzy, php-format +msgid "%s successfully added" +msgstr " erfolgreich erzeugt" -#: ../../../www/admin/addressbook/addr.php:230 -#: ../../../www/admin/addressbook/addr.php:250 +#: ../../../www/admin/addressbook/addr.php:233 +#: ../../../www/admin/addressbook/addr.php:253 msgid "Modify External Address" msgstr "Externe Adresse verändern" -#: ../../../www/admin/addressbook/addr.php:273 +#: ../../../www/admin/addressbook/addr.php:256 +#: ../../../www/admin/addressbook/addr.php:279 +#, php-format +msgid "Error: Multiple results returned for DN %s" +msgstr "" + +#: ../../../www/admin/addressbook/addr.php:276 msgid "Delete External Address" msgstr "Externe Adresse löschen" -#: ../../../www/admin/addressbook/addr.php:283 -msgid "LDAP Error: could not delete " +#: ../../../www/admin/addressbook/addr.php:286 +#, fuzzy, php-format +msgid "LDAP Error: could not delete %s: %s" msgstr "LDAP-Fehler: konnte nicht löschen " +#: ../../../www/admin/addressbook/addr.php:290 +#, php-format +msgid "Address book entry with DN %s was deleted" +msgstr "" + #: ../../../www/admin/domainmaintainer/domainmaintainer.php:149 msgid "Check domains this domain maintainer should be able to maintain" msgstr "" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:250 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:294 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:295 #, fuzzy msgid "Modify Domain Maintainer" msgstr "Maintainer verändern" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:270 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 #, fuzzy msgid "Domain maintainer " msgstr "Maintainer " -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:275 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:272 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:276 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:286 #: ../include/menu.php:77 #, fuzzy msgid "Create New Domain Maintainer" msgstr "Neuen Maintainer anlegen" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:300 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:301 #, fuzzy msgid "Delete Domain Maintainer" msgstr "Maintainer löschen" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:314 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:315 #, fuzzy msgid "Error: you need administrative permissions to delete domain maintainers" msgstr "" "Fehler: Sie benötigen Administratorrechte, um Administratoren löschen zu " "dürfen" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:331 #, fuzzy msgid "Domain Maintainer Deleted" msgstr "Maintainer gelöscht" @@ -1911,6 +2212,38 @@ #: ../include/ldap.class.php:54 msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" +msgstr "" + +#: ../include/ldap.class.php:184 ../include/ldap.class.php:214 +#: ../include/ldap.class.php:244 +#, php-format +msgid "No such object %s" +msgstr "" + +#: ../include/ldap.class.php:187 ../include/ldap.class.php:217 +#: ../include/ldap.class.php:247 +#, php-format +msgid "LDAP Error searching for DN %s: %s" +msgstr "" + +#: ../include/ldap.class.php:200 +#, php-format +msgid "Error searching for DN for UID=%s" +msgstr "" + +#: ../include/ldap.class.php:230 +#, php-format +msgid "Error searching for DN for Mail=%s" +msgstr "" + +#: ../include/ldap.class.php:260 +#, php-format +msgid "Error searching for DN for alias=%s: %s" +msgstr "" + +#: ../include/ldap.class.php:273 +#, php-format +msgid "Error searching for DN for mail or alias %s: %s" msgstr "" #: ../include/ldap.class.php:336 From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:10 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES messages.po, 1.2, 1.3 Message-ID: <20051013015003.5EC821005DE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES In directory doto:/tmp/cvs-serv29305/kolab-webadmin/php/admin/locale/it/LC_MESSAGES Modified Files: messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES/messages.po,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- messages.po 7 Oct 2005 12:16:09 -0000 1.2 +++ messages.po 13 Oct 2005 01:50:01 -0000 1.3 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-07 13:50+0200\n" +"POT-Creation-Date: 2005-10-13 03:40+0200\n" "PO-Revision-Date: 2005-07-22 23:43+0100\n" "Last-Translator: Alessandro Fiorino \n" "Language-Team: \n" @@ -191,12 +191,12 @@ #: tpl_messages.php:31 tpl_messages.php:38 tpl_messages.php:47 #: tpl_messages.php:57 tpl_messages.php:87 tpl_messages.php:110 #: tpl_messages.php:126 tpl_messages.php:162 tpl_messages.php:174 -#: tpl_messages.php:228 ../../../www/admin/user/user.php:752 -#: ../../../www/admin/user/user.php:799 +#: tpl_messages.php:228 ../../../www/admin/user/user.php:759 +#: ../../../www/admin/user/user.php:808 #: ../../../www/admin/sharedfolder/sf.php:282 -#: ../../../www/admin/administrator/admin.php:326 -#: ../../../www/admin/distributionlist/list.php:284 -#: ../../../www/admin/addressbook/addr.php:272 +#: ../../../www/admin/administrator/admin.php:330 +#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/addressbook/addr.php:275 msgid "Delete" msgstr "Cancella" @@ -1056,6 +1056,16 @@ msgid "Script was:" msgstr "Lo script era:" +#: ../../../www/admin/user/deliver.php:74 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully activated" +msgstr "Messagio di assenza attivato con successo" + +#: ../../../www/admin/user/deliver.php:75 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully deactivated" +msgstr "Messagio di assenza disattivato con successo" + #: ../../../www/admin/user/forward.php:38 #: ../../../www/admin/user/vacation.php:17 msgid "" @@ -1068,6 +1078,16 @@ msgid "Please enter an email address" msgstr "Prego inserire un indirizzo email" +#: ../../../www/admin/user/forward.php:78 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully activated" +msgstr "Messagio di assenza attivato con successo" + +#: ../../../www/admin/user/forward.php:79 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully deactivated" +msgstr "Messagio di assenza disattivato con successo" + #: ../../../www/admin/user/index.php:33 #: ../../../www/admin/sharedfolder/index.php:22 #: ../../../www/admin/sharedfolder/sf.php:25 @@ -1082,6 +1102,11 @@ msgid "Error: You don't have Permissions to access this Menu" msgstr "Errore: non avete i permessi per accedere a questo Menù" +#: ../../../www/admin/user/index.php:106 +#, fuzzy, php-format +msgid "Manage Email User (%d Users)" +msgstr "Gestione Utenti Email" + #: ../../../www/admin/user/index.php:169 #: ../../../www/admin/addressbook/index.php:122 msgid "Email" @@ -1107,6 +1132,11 @@ msgid "ends with" msgstr "finisce con" +#: ../../../www/admin/user/user.php:76 +#, php-format +msgid "Email address %1$s not in domains %2$s" +msgstr "" + #: ../../../www/admin/user/user.php:79 #: ../../../www/admin/addressbook/addr.php:71 msgid "User, vCard or distribution list with this email address already exists" @@ -1127,6 +1157,16 @@ msgid "UID " msgstr "UID " +#: ../../../www/admin/user/user.php:127 +#, php-format +msgid "Delegate %s does not exist" +msgstr "" + +#: ../../../www/admin/user/user.php:140 +#, php-format +msgid "Illegal user or group %s" +msgstr "" + #: ../../../www/admin/user/user.php:151 #: ../../../www/admin/maintainer/maintainer.php:60 #: ../../../www/admin/administrator/admin.php:60 @@ -1257,56 +1297,149 @@ msgid "Leave blank for default (60 days)" msgstr "Lasciare vuoto per il default (60 giorni)" -#: ../../../www/admin/user/user.php:491 +#: ../../../www/admin/user/user.php:449 +#: ../../../www/admin/maintainer/maintainer.php:179 +#: ../../../www/admin/administrator/admin.php:186 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:159 +#, fuzzy, php-format +msgid "LDAP Error: No such dn: %s: %s" +msgstr "Errore LDAP: impossibile leggere" + +#: ../../../www/admin/user/user.php:485 +#, php-format +msgid "" +"Could not read resource encryption public key file://%s/etc/kolab/res_pub." +"pem: " +msgstr "" + +#: ../../../www/admin/user/user.php:492 msgid "Could not encrypt password: " msgstr "Impossibile cifrare la password" -#: ../../../www/admin/user/user.php:586 +#: ../../../www/admin/user/user.php:587 +#, fuzzy, php-format msgid "" "Account DN could not be modified, distribution list '%s' depends on it. To " +"modify this account, first remove it from the distribution list." msgstr "" "Il DN dell'account non può essere modificato, la lista di distribuzione " msgstr "" +#: ../../../www/admin/sharedfolder/index.php:52 +#, fuzzy, php-format +msgid "Manage Shared Folders (%d Folders)" +msgstr "Gestione Cartelle Condivise" + #: ../../../www/admin/sharedfolder/sf.php:51 #: ../../../www/admin/sharedfolder/sf.php:58 msgid "Permission for UID/email/GID" msgstr "Permessi per UID/messaggio/GID" +#: ../../../www/admin/sharedfolder/sf.php:101 +#, php-format +msgid "No UID or GID %s" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:117 msgid "Folder Name" msgstr "Nome Cartella" @@ -1396,20 +1539,65 @@ msgid "Permission for UID/GID" msgstr "Permessi per UID/GID" +#: ../../../www/admin/sharedfolder/sf.php:143 +#: ../../../www/admin/distributionlist/list.php:135 +#: ../../../www/admin/addressbook/addr.php:142 +#, fuzzy, php-format +msgid "Error: DN required for %s operation" +msgstr "Errore: richiesto dn per operazione di cancellazione" + #: ../../../www/admin/sharedfolder/sf.php:153 ../include/menu.php:55 msgid "Add Shared Folder" msgstr "Aggiungi Cartella condivisa" +#: ../../../www/admin/sharedfolder/sf.php:217 +#: ../../../www/admin/maintainer/maintainer.php:226 +#: ../../../www/admin/administrator/admin.php:233 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:206 +#, fuzzy, php-format +msgid "LDAP Error: could not rename %1$s to %2$s: %3$s" +msgstr "Errore LDAP: impossibile rinominare" + #: ../../../www/admin/sharedfolder/sf.php:220 #: ../../../www/admin/sharedfolder/sf.php:229 msgid "Shared folder updated" msgstr "Cartella Condivisa aggiornata" +#: ../../../www/admin/sharedfolder/sf.php:223 +#: ../../../www/admin/maintainer/maintainer.php:250 +#: ../../../www/admin/administrator/admin.php:257 +#: ../../../www/admin/addressbook/addr.php:203 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:235 +#, fuzzy, php-format +msgid "LDAP Error: could not read %s: %s" +msgstr "Errore LDAP: impossibile leggere" + +#: ../../../www/admin/sharedfolder/sf.php:227 +#: ../../../www/admin/maintainer/maintainer.php:254 +#: ../../../www/admin/administrator/admin.php:261 +#: ../../../www/admin/addressbook/addr.php:208 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:239 +#, fuzzy, php-format +msgid "LDAP Error: could not modify object %s: %s" +msgstr "Errore LDAP: impossibile modificare l'oggetto" + +#: ../../../www/admin/sharedfolder/sf.php:239 +#, fuzzy, php-format +msgid "Shared folder '%s' added" +msgstr "Cartella Condivisa aggiornata" + #: ../../../www/admin/sharedfolder/sf.php:251 #: ../../../www/admin/sharedfolder/sf.php:268 msgid "Modify Shared Folder" msgstr "Modifica Cartella Condivisa" +#: ../../../www/admin/sharedfolder/sf.php:271 +#: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:289 +#, php-format +msgid "Error: No results returned for DN '%s'" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:283 msgid "Delete Shared Folder" msgstr "Cancella Cartella Condivisa" @@ -1423,11 +1611,32 @@ msgstr " segnata per la cancellazione" #: ../../../www/admin/sharedfolder/sf.php:293 -#: ../../../www/admin/distributionlist/list.php:296 -#: ../../../www/admin/addressbook/addr.php:285 +#: ../../../www/admin/distributionlist/list.php:297 +#: ../../../www/admin/addressbook/addr.php:289 msgid "Entry Deleted" msgstr "Voce Cancellata" +#: ../../../www/admin/sharedfolder/sf.php:296 +#, fuzzy, php-format +msgid "LDAP Error: Could not mark %s for deletion: %s" +msgstr "Errore LDAP: impossibile cancellare" + +#: ../../../www/admin/service/index.php:97 +#, php-format +msgid "No account found for email address %s" +msgstr "" + +#: ../../../www/admin/service/index.php:105 +#, fuzzy, php-format +msgid "LDAP Error: Failed to add distribution list %s: %s" +msgstr "" +"Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " + +#: ../../../www/admin/service/index.php:107 +#, fuzzy, php-format +msgid "Successfully created distribution list %s" +msgstr "Crea liste di distribuzione" + #: ../../../www/admin/service/index.php:125 #: ../../../www/admin/service/index.php:134 #: ../../../www/admin/service/index.php:143 @@ -1436,50 +1645,52 @@ #: ../../../www/admin/service/index.php:171 #: ../../../www/admin/service/index.php:182 #: ../../../www/admin/service/index.php:196 +#: ../../../www/admin/service/index.php:214 #: ../../../www/admin/service/index.php:232 -#: ../../../www/admin/service/index.php:248 -#: ../../../www/admin/service/index.php:261 -msgid "LDAP Error: failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:249 +#: ../../../www/admin/service/index.php:262 +#, fuzzy, php-format +msgid "LDAP Error: failed to modify kolab configuration object: %s" msgstr "" "Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " -#: ../../../www/admin/service/index.php:214 -#, fuzzy -msgid "LDAP Error: Failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Failed to delete domain object %s: %s" msgstr "" "Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " -#: ../../../www/admin/service/index.php:268 +#: ../../../www/admin/service/index.php:270 msgid "POP3 Service" msgstr "Servizio POP3" -#: ../../../www/admin/service/index.php:269 +#: ../../../www/admin/service/index.php:271 msgid "POP3/SSL service (TCP port 995)" msgstr "Servizio POP3/SSL (Porta TCP 995)" -#: ../../../www/admin/service/index.php:270 +#: ../../../www/admin/service/index.php:272 msgid "IMAP Service" msgstr "Servizio IMAP" -#: ../../../www/admin/service/index.php:271 +#: ../../../www/admin/service/index.php:273 msgid "IMAP/SSL Service (TCP port 993)" msgstr "Servizio IMAP/SSL (Porta TCP 993)" -#: ../../../www/admin/service/index.php:272 +#: ../../../www/admin/service/index.php:274 msgid "Sieve service (TCP port 2000)" msgstr "Servizio Sieve (Porta TCP 2000)" -#: ../../../www/admin/service/index.php:274 +#: ../../../www/admin/service/index.php:276 msgid "FTP FreeBusy Service (Legacy, not interoperable with Kolab2 FreeBusy)" msgstr "" "Servizio FTP di pubblicazione liste disponibilità (Obsoleto, incompatibile " "con Kolab2)" -#: ../../../www/admin/service/index.php:276 +#: ../../../www/admin/service/index.php:278 msgid "HTTP FreeBusy Service (Legacy)" msgstr "Servizio di pubblicazione liste di disponibilità HTTP (Obsoleto)" -#: ../../../www/admin/service/index.php:277 +#: ../../../www/admin/service/index.php:279 msgid "Amavis Email Scanning (Virus/Spam)" msgstr "Servizio di verifica Email Amavis (Virus/Spam)" @@ -1511,34 +1722,75 @@ msgid "Unique User ID" msgstr "ID univoco dell'utilizzatore" +#: ../../../www/admin/maintainer/maintainer.php:230 +#: ../../../www/admin/administrator/admin.php:237 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:210 +#, fuzzy, php-format +msgid "LDAP Error: could not remove old entry %s: %s" +msgstr "Errore LDAP: impossibile cancellare" + +#: ../../../www/admin/maintainer/maintainer.php:240 +#: ../../../www/admin/administrator/admin.php:247 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Could not add new group entry %s: %s" +msgstr "Errore LDAP: non posso aggiungere l'oggetto" + +#: ../../../www/admin/maintainer/maintainer.php:245 +#: ../../../www/admin/administrator/admin.php:252 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:225 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove old group entry %s: %s" +msgstr "Errore LDAP: impossibile modificare l'oggetto" + #: ../../../www/admin/maintainer/maintainer.php:259 -#: ../../../www/admin/maintainer/maintainer.php:305 +#: ../../../www/admin/maintainer/maintainer.php:306 msgid "Modify Maintainer" msgstr "Modifica Maintainer" #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/maintainer/maintainer.php:278 +#: ../../../www/admin/maintainer/maintainer.php:279 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid "Maintainer " msgstr "Maintainer " #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/administrator/admin.php:265 +#: ../../../www/admin/administrator/admin.php:267 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid " successfully modified" msgstr " modificato con successo" -#: ../../../www/admin/maintainer/maintainer.php:279 -#: ../../../www/admin/maintainer/maintainer.php:285 -#: ../../../www/admin/maintainer/maintainer.php:296 ../include/menu.php:85 +#: ../../../www/admin/maintainer/maintainer.php:275 +#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:264 +#, fuzzy, php-format +msgid "LDAP Error: could not add object %s to maintainer group: %s" +msgstr "Errore LDAP: non posso aggiungere l'oggetto" + +#: ../../../www/admin/maintainer/maintainer.php:280 +#: ../../../www/admin/maintainer/maintainer.php:286 +#: ../../../www/admin/maintainer/maintainer.php:297 ../include/menu.php:85 msgid "Create New Maintainer" msgstr "Crea un nuovo Maintainer" -#: ../../../www/admin/maintainer/maintainer.php:311 +#: ../../../www/admin/maintainer/maintainer.php:312 msgid "Delete Maintainer" msgstr "Cancella un Maintainer" -#: ../../../www/admin/maintainer/maintainer.php:341 +#: ../../../www/admin/maintainer/maintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:319 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from maintainer group: %s" +msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" + +#: ../../../www/admin/maintainer/maintainer.php:336 +#: ../../../www/admin/administrator/admin.php:345 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:325 +#, fuzzy, php-format +msgid "LDAP Error: could not mark %s for deletion: %s" +msgstr "Errore LDAP: impossibile cancellare" + +#: ../../../www/admin/maintainer/maintainer.php:342 msgid "Maintainer Deleted" msgstr "Maintainer Cancellato" @@ -1546,33 +1798,38 @@ msgid "Manager's password can't be changed from the webgui" msgstr "La password del Manager non può essere modificata dall'interfaccia web" -#: ../../../www/admin/administrator/admin.php:264 -#: ../../../www/admin/administrator/admin.php:312 +#: ../../../www/admin/administrator/admin.php:266 +#: ../../../www/admin/administrator/admin.php:316 msgid "Modify Administrator" msgstr "Modifica l'Amministratore" -#: ../../../www/admin/administrator/admin.php:265 -#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/administrator/admin.php:267 +#: ../../../www/admin/administrator/admin.php:289 msgid "Administrator " msgstr "Amministratore" -#: ../../../www/admin/administrator/admin.php:286 -#: ../../../www/admin/administrator/admin.php:292 -#: ../../../www/admin/administrator/admin.php:303 ../include/menu.php:71 +#: ../../../www/admin/administrator/admin.php:290 +#: ../../../www/admin/administrator/admin.php:296 +#: ../../../www/admin/administrator/admin.php:307 ../include/menu.php:71 msgid "Create New Administrator" msgstr "Crea nuovo amministratore" -#: ../../../www/admin/administrator/admin.php:318 +#: ../../../www/admin/administrator/admin.php:322 msgid "Delete Administrator" msgstr "Cancella amministratore" -#: ../../../www/admin/administrator/admin.php:332 +#: ../../../www/admin/administrator/admin.php:336 msgid "Error: you need administrative permissions to delete administrators" msgstr "" "Errore: devi avere i permessi di amministrazione per cancellare degli " "amministratori" -#: ../../../www/admin/administrator/admin.php:346 +#: ../../../www/admin/administrator/admin.php:340 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from admin group: %s" +msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" + +#: ../../../www/admin/administrator/admin.php:351 msgid "Administrator Deleted" msgstr "Amministratore cancellato" @@ -1588,6 +1845,11 @@ msgid "Please add at least one member" msgstr "Prego aggiungere almeno un membro" +#: ../../../www/admin/distributionlist/list.php:50 +#, php-format +msgid "No user with email address, UID or alias %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:62 msgid "User or distribution list with this email address already exists" msgstr "" @@ -1621,28 +1883,58 @@ msgid "Add Distribution List" msgstr "Aggiungi una Lista di Distribuzione" +#: ../../../www/admin/distributionlist/list.php:179 +#, php-format +msgid "No user with address %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:198 #: ../../../www/admin/distributionlist/list.php:207 msgid "Distribution List updated" msgstr "Lista di Distribuzione aggiornata" -#: ../../../www/admin/distributionlist/list.php:256 -#: ../../../www/admin/distributionlist/list.php:270 +#: ../../../www/admin/distributionlist/list.php:216 +#, fuzzy, php-format +msgid "LDAP Error: Could not add object %s: %s" +msgstr "Errore LDAP: non posso aggiungere l'oggetto" + +#: ../../../www/admin/distributionlist/list.php:245 +#, fuzzy, php-format +msgid "Distribution List '%s' added" +msgstr "Lista di Distribuzione aggiornata" + +#: ../../../www/admin/distributionlist/list.php:257 +#: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Modifica Lista di Distribuzione" -#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/distributionlist/list.php:274 +#, php-format +msgid "Error: No results returned for DN ''" +msgstr "" + +#: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" msgstr "Cancella Lista di Distribuzione" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid "Distribution List " msgstr "Lista di Distribuzione" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid " deleted" msgstr " cancellata" +#: ../../../www/admin/distributionlist/list.php:300 +#, fuzzy, php-format +msgid "LDAP Error: Nould not delete %s: %s" +msgstr "Errore LDAP: impossibile cancellare" + +#: ../../../www/admin/distributionlist/index.php:53 +#, fuzzy, php-format +msgid "Manage Distribution Lists (%d Lists)" +msgstr "Gestione Liste di Distribuzione" + #: ../../../www/admin/distributionlist/index.php:64 msgid "not yet implemented" msgstr "non ancora implementato" @@ -1664,70 +1956,82 @@ msgstr "Aggiungi indirizzi esterni" #: ../../../www/admin/addressbook/addr.php:196 -msgid "LDAP Error: could not rename " +#, fuzzy, php-format +msgid "LDAP Error: could not rename %s to %s: %s" msgstr "Errore LDAP: impossibile rinominare" -#: ../../../www/admin/addressbook/addr.php:203 -msgid "LDAP Error: could not read " -msgstr "Errore LDAP: impossibile leggere" - -#: ../../../www/admin/addressbook/addr.php:207 -msgid "LDAP Error: could not modify object " -msgstr "Errore LDAP: impossibile modificare l'oggetto" +#: ../../../www/admin/addressbook/addr.php:199 +#: ../../../www/admin/addressbook/addr.php:211 +#, fuzzy, php-format +msgid "%s successfully updated" +msgstr " creato con successo" -#: ../../../www/admin/addressbook/addr.php:218 -msgid "LDAP Error: could not add object " -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +#: ../../../www/admin/addressbook/addr.php:223 +#, fuzzy, php-format +msgid "%s successfully added" +msgstr " creato con successo" -#: ../../../www/admin/addressbook/addr.php:230 -#: ../../../www/admin/addressbook/addr.php:250 +#: ../../../www/admin/addressbook/addr.php:233 +#: ../../../www/admin/addressbook/addr.php:253 msgid "Modify External Address" msgstr "Modifica Indirizzo Esterno" -#: ../../../www/admin/addressbook/addr.php:273 +#: ../../../www/admin/addressbook/addr.php:256 +#: ../../../www/admin/addressbook/addr.php:279 +#, php-format +msgid "Error: Multiple results returned for DN %s" +msgstr "" + +#: ../../../www/admin/addressbook/addr.php:276 msgid "Delete External Address" msgstr "Cancella Indirizzo Esterno" -#: ../../../www/admin/addressbook/addr.php:283 -msgid "LDAP Error: could not delete " +#: ../../../www/admin/addressbook/addr.php:286 +#, fuzzy, php-format +msgid "LDAP Error: could not delete %s: %s" msgstr "Errore LDAP: impossibile cancellare" +#: ../../../www/admin/addressbook/addr.php:290 +#, php-format +msgid "Address book entry with DN %s was deleted" +msgstr "" + #: ../../../www/admin/domainmaintainer/domainmaintainer.php:149 msgid "Check domains this domain maintainer should be able to maintain" msgstr "" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:250 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:294 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:295 #, fuzzy msgid "Modify Domain Maintainer" msgstr "Modifica Maintainer" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:270 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 #, fuzzy msgid "Domain maintainer " msgstr "Maintainer " -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:275 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:272 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:276 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:286 #: ../include/menu.php:77 #, fuzzy msgid "Create New Domain Maintainer" msgstr "Crea un nuovo Maintainer" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:300 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:301 #, fuzzy msgid "Delete Domain Maintainer" msgstr "Cancella un Maintainer" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:314 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:315 #, fuzzy msgid "Error: you need administrative permissions to delete domain maintainers" msgstr "" "Errore: devi avere i permessi di amministrazione per cancellare degli " "amministratori" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:331 #, fuzzy msgid "Domain Maintainer Deleted" msgstr "Maintainer Cancellato" @@ -1912,6 +2216,38 @@ msgstr "" "Errore impostanto il protocollo LDAP alla versione 3. Prego contattare " "l'amministratore di sistema" + +#: ../include/ldap.class.php:184 ../include/ldap.class.php:214 +#: ../include/ldap.class.php:244 +#, php-format +msgid "No such object %s" +msgstr "" + +#: ../include/ldap.class.php:187 ../include/ldap.class.php:217 +#: ../include/ldap.class.php:247 +#, php-format +msgid "LDAP Error searching for DN %s: %s" +msgstr "" + +#: ../include/ldap.class.php:200 +#, php-format +msgid "Error searching for DN for UID=%s" +msgstr "" + +#: ../include/ldap.class.php:230 +#, php-format +msgid "Error searching for DN for Mail=%s" +msgstr "" + +#: ../include/ldap.class.php:260 +#, php-format +msgid "Error searching for DN for alias=%s: %s" +msgstr "" + +#: ../include/ldap.class.php:273 +#, php-format +msgid "Error searching for DN for mail or alias %s: %s" +msgstr "" #: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:11 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES messages.po, 1.3, 1.4 Message-ID: <20051013015003.51B101005DC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES In directory doto:/tmp/cvs-serv29305/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES Modified Files: messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES/messages.po,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- messages.po 7 Oct 2005 12:16:09 -0000 1.3 +++ messages.po 13 Oct 2005 01:50:01 -0000 1.4 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-07 13:50+0200\n" +"POT-Creation-Date: 2005-10-13 03:40+0200\n" "PO-Revision-Date: 2005-06-13 18:10+0200\n" "Last-Translator: Benoit Mortier \n" "Language-Team: \n" @@ -192,12 +192,12 @@ #: tpl_messages.php:31 tpl_messages.php:38 tpl_messages.php:47 #: tpl_messages.php:57 tpl_messages.php:87 tpl_messages.php:110 #: tpl_messages.php:126 tpl_messages.php:162 tpl_messages.php:174 -#: tpl_messages.php:228 ../../../www/admin/user/user.php:752 -#: ../../../www/admin/user/user.php:799 +#: tpl_messages.php:228 ../../../www/admin/user/user.php:759 +#: ../../../www/admin/user/user.php:808 #: ../../../www/admin/sharedfolder/sf.php:282 -#: ../../../www/admin/administrator/admin.php:326 -#: ../../../www/admin/distributionlist/list.php:284 -#: ../../../www/admin/addressbook/addr.php:272 +#: ../../../www/admin/administrator/admin.php:330 +#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/addressbook/addr.php:275 msgid "Delete" msgstr "Effacer" @@ -1061,6 +1061,16 @@ msgid "Script was:" msgstr "Le script était:" +#: ../../../www/admin/user/deliver.php:74 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully activated" +msgstr "Le message d'absence a été correctement activé" + +#: ../../../www/admin/user/deliver.php:75 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully deactivated" +msgstr "Le message d'absence a été correctement désactivé" + #: ../../../www/admin/user/forward.php:38 #: ../../../www/admin/user/vacation.php:17 msgid "" @@ -1073,6 +1083,16 @@ msgid "Please enter an email address" msgstr "Veuillez entrer une adresse de messagerie" +#: ../../../www/admin/user/forward.php:78 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully activated" +msgstr "Le message d'absence a été correctement activé" + +#: ../../../www/admin/user/forward.php:79 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully deactivated" +msgstr "Le message d'absence a été correctement désactivé" + #: ../../../www/admin/user/index.php:33 #: ../../../www/admin/sharedfolder/index.php:22 #: ../../../www/admin/sharedfolder/sf.php:25 @@ -1087,6 +1107,11 @@ msgid "Error: You don't have Permissions to access this Menu" msgstr "Erreur: Vous n'avez pas la permission d'accéder a ce menu" +#: ../../../www/admin/user/index.php:106 +#, fuzzy, php-format +msgid "Manage Email User (%d Users)" +msgstr "Gérer des utilisateurs de messagerie" + #: ../../../www/admin/user/index.php:169 #: ../../../www/admin/addressbook/index.php:122 msgid "Email" @@ -1112,6 +1137,11 @@ msgid "ends with" msgstr "fini avec" +#: ../../../www/admin/user/user.php:76 +#, php-format +msgid "Email address %1$s not in domains %2$s" +msgstr "" + #: ../../../www/admin/user/user.php:79 #: ../../../www/admin/addressbook/addr.php:71 msgid "User, vCard or distribution list with this email address already exists" @@ -1131,6 +1161,16 @@ msgid "UID " msgstr "UID " +#: ../../../www/admin/user/user.php:127 +#, php-format +msgid "Delegate %s does not exist" +msgstr "" + +#: ../../../www/admin/user/user.php:140 +#, php-format +msgid "Illegal user or group %s" +msgstr "" + #: ../../../www/admin/user/user.php:151 #: ../../../www/admin/maintainer/maintainer.php:60 #: ../../../www/admin/administrator/admin.php:60 @@ -1263,57 +1303,150 @@ msgid "Leave blank for default (60 days)" msgstr "Laisser vide pour les défauts (60 jours)" -#: ../../../www/admin/user/user.php:491 +#: ../../../www/admin/user/user.php:449 +#: ../../../www/admin/maintainer/maintainer.php:179 +#: ../../../www/admin/administrator/admin.php:186 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:159 +#, fuzzy, php-format +msgid "LDAP Error: No such dn: %s: %s" +msgstr "Erreur LDAP: Impossible de lire" + +#: ../../../www/admin/user/user.php:485 +#, php-format +msgid "" +"Could not read resource encryption public key file://%s/etc/kolab/res_pub." +"pem: " +msgstr "" + +#: ../../../www/admin/user/user.php:492 msgid "Could not encrypt password: " msgstr "Impossible de crypter le mot de passe: " -#: ../../../www/admin/user/user.php:586 +#: ../../../www/admin/user/user.php:587 +#, fuzzy, php-format msgid "" "Account DN could not be modified, distribution list '%s' depends on it. To " +"modify this account, first remove it from the distribution list." msgstr "" "Le DN du compte n'a pas pu être modifié pour la liste de distribution " msgstr "" +#: ../../../www/admin/sharedfolder/index.php:52 +#, fuzzy, php-format +msgid "Manage Shared Folders (%d Folders)" +msgstr "Gérer les dossiers partagés" + #: ../../../www/admin/sharedfolder/sf.php:51 #: ../../../www/admin/sharedfolder/sf.php:58 msgid "Permission for UID/email/GID" msgstr "Permissions pour UID/message/GID" +#: ../../../www/admin/sharedfolder/sf.php:101 +#, php-format +msgid "No UID or GID %s" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:117 msgid "Folder Name" msgstr "Nom du dossier" @@ -1401,20 +1544,65 @@ msgid "Permission for UID/GID" msgstr "Permission pour UID/GID" +#: ../../../www/admin/sharedfolder/sf.php:143 +#: ../../../www/admin/distributionlist/list.php:135 +#: ../../../www/admin/addressbook/addr.php:142 +#, fuzzy, php-format +msgid "Error: DN required for %s operation" +msgstr "Erreur: dn nécessaire pour une opération d'effacement" + #: ../../../www/admin/sharedfolder/sf.php:153 ../include/menu.php:55 msgid "Add Shared Folder" msgstr "Ajouter un dossier partagé" +#: ../../../www/admin/sharedfolder/sf.php:217 +#: ../../../www/admin/maintainer/maintainer.php:226 +#: ../../../www/admin/administrator/admin.php:233 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:206 +#, fuzzy, php-format +msgid "LDAP Error: could not rename %1$s to %2$s: %3$s" +msgstr "Erreur LDAP: impossible de renommer" + #: ../../../www/admin/sharedfolder/sf.php:220 #: ../../../www/admin/sharedfolder/sf.php:229 msgid "Shared folder updated" msgstr "Dossier partagé mis à jour" +#: ../../../www/admin/sharedfolder/sf.php:223 +#: ../../../www/admin/maintainer/maintainer.php:250 +#: ../../../www/admin/administrator/admin.php:257 +#: ../../../www/admin/addressbook/addr.php:203 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:235 +#, fuzzy, php-format +msgid "LDAP Error: could not read %s: %s" +msgstr "Erreur LDAP: Impossible de lire" + +#: ../../../www/admin/sharedfolder/sf.php:227 +#: ../../../www/admin/maintainer/maintainer.php:254 +#: ../../../www/admin/administrator/admin.php:261 +#: ../../../www/admin/addressbook/addr.php:208 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:239 +#, fuzzy, php-format +msgid "LDAP Error: could not modify object %s: %s" +msgstr "Erreur LDAP: impossible de modifier l'objet" + +#: ../../../www/admin/sharedfolder/sf.php:239 +#, fuzzy, php-format +msgid "Shared folder '%s' added" +msgstr "Dossier partagé mis à jour" + #: ../../../www/admin/sharedfolder/sf.php:251 #: ../../../www/admin/sharedfolder/sf.php:268 msgid "Modify Shared Folder" msgstr "Modifier un dossier partagé" +#: ../../../www/admin/sharedfolder/sf.php:271 +#: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:289 +#, php-format +msgid "Error: No results returned for DN '%s'" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:283 msgid "Delete Shared Folder" msgstr "Effacer un dossier partagé" @@ -1428,11 +1616,32 @@ msgstr " marqué pour effacement" #: ../../../www/admin/sharedfolder/sf.php:293 -#: ../../../www/admin/distributionlist/list.php:296 -#: ../../../www/admin/addressbook/addr.php:285 +#: ../../../www/admin/distributionlist/list.php:297 +#: ../../../www/admin/addressbook/addr.php:289 msgid "Entry Deleted" msgstr "Entrée effacée" +#: ../../../www/admin/sharedfolder/sf.php:296 +#, fuzzy, php-format +msgid "LDAP Error: Could not mark %s for deletion: %s" +msgstr "Erreur LDAP: impossible d'effacer" + +#: ../../../www/admin/service/index.php:97 +#, php-format +msgid "No account found for email address %s" +msgstr "" + +#: ../../../www/admin/service/index.php:105 +#, fuzzy, php-format +msgid "LDAP Error: Failed to add distribution list %s: %s" +msgstr "" +"Erreur LDAP: échec dans la modification de l'objet de configuration kolab: " + +#: ../../../www/admin/service/index.php:107 +#, fuzzy, php-format +msgid "Successfully created distribution list %s" +msgstr "Créer des listes de distribution" + #: ../../../www/admin/service/index.php:125 #: ../../../www/admin/service/index.php:134 #: ../../../www/admin/service/index.php:143 @@ -1441,50 +1650,52 @@ #: ../../../www/admin/service/index.php:171 #: ../../../www/admin/service/index.php:182 #: ../../../www/admin/service/index.php:196 +#: ../../../www/admin/service/index.php:214 #: ../../../www/admin/service/index.php:232 -#: ../../../www/admin/service/index.php:248 -#: ../../../www/admin/service/index.php:261 -msgid "LDAP Error: failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:249 +#: ../../../www/admin/service/index.php:262 +#, fuzzy, php-format +msgid "LDAP Error: failed to modify kolab configuration object: %s" msgstr "" "Erreur LDAP: échec dans la modification de l'objet de configuration kolab: " -#: ../../../www/admin/service/index.php:214 -#, fuzzy -msgid "LDAP Error: Failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Failed to delete domain object %s: %s" msgstr "" "Erreur LDAP: échec dans la modification de l'objet de configuration kolab: " -#: ../../../www/admin/service/index.php:268 +#: ../../../www/admin/service/index.php:270 msgid "POP3 Service" msgstr "Service POP3" -#: ../../../www/admin/service/index.php:269 +#: ../../../www/admin/service/index.php:271 msgid "POP3/SSL service (TCP port 995)" msgstr "Service POP3/SSL (TCP port 995)" -#: ../../../www/admin/service/index.php:270 +#: ../../../www/admin/service/index.php:272 msgid "IMAP Service" msgstr "Service IMAP" -#: ../../../www/admin/service/index.php:271 +#: ../../../www/admin/service/index.php:273 msgid "IMAP/SSL Service (TCP port 993)" msgstr "Service IMAP/SSL (TCP port 993)" -#: ../../../www/admin/service/index.php:272 +#: ../../../www/admin/service/index.php:274 msgid "Sieve service (TCP port 2000)" msgstr "Service Sieve (TCP port 2000)" -#: ../../../www/admin/service/index.php:274 +#: ../../../www/admin/service/index.php:276 msgid "FTP FreeBusy Service (Legacy, not interoperable with Kolab2 FreeBusy)" msgstr "" "Service FTP des options de disponibilités (Ancien, pas compatible avec " "Kolab2)" -#: ../../../www/admin/service/index.php:276 +#: ../../../www/admin/service/index.php:278 msgid "HTTP FreeBusy Service (Legacy)" msgstr "Service HTTP de disponibilité (Ancien)" -#: ../../../www/admin/service/index.php:277 +#: ../../../www/admin/service/index.php:279 msgid "Amavis Email Scanning (Virus/Spam)" msgstr "Service de vérification de la messagerie Amavis (Virus/Spam)" @@ -1516,34 +1727,75 @@ msgid "Unique User ID" msgstr "ID utilisateur unique" +#: ../../../www/admin/maintainer/maintainer.php:230 +#: ../../../www/admin/administrator/admin.php:237 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:210 +#, fuzzy, php-format +msgid "LDAP Error: could not remove old entry %s: %s" +msgstr "Erreur LDAP: impossible d'effacer" + +#: ../../../www/admin/maintainer/maintainer.php:240 +#: ../../../www/admin/administrator/admin.php:247 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Could not add new group entry %s: %s" +msgstr "Erreur LDAP: Impossible d'ajouter un objet" + +#: ../../../www/admin/maintainer/maintainer.php:245 +#: ../../../www/admin/administrator/admin.php:252 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:225 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove old group entry %s: %s" +msgstr "Erreur LDAP: impossible de modifier l'objet" + #: ../../../www/admin/maintainer/maintainer.php:259 -#: ../../../www/admin/maintainer/maintainer.php:305 +#: ../../../www/admin/maintainer/maintainer.php:306 msgid "Modify Maintainer" msgstr "Modifier les mainteneurs" #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/maintainer/maintainer.php:278 +#: ../../../www/admin/maintainer/maintainer.php:279 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid "Maintainer " msgstr "Mainteneurs" #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/administrator/admin.php:265 +#: ../../../www/admin/administrator/admin.php:267 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid " successfully modified" msgstr "modifié avec succès" -#: ../../../www/admin/maintainer/maintainer.php:279 -#: ../../../www/admin/maintainer/maintainer.php:285 -#: ../../../www/admin/maintainer/maintainer.php:296 ../include/menu.php:85 +#: ../../../www/admin/maintainer/maintainer.php:275 +#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:264 +#, fuzzy, php-format +msgid "LDAP Error: could not add object %s to maintainer group: %s" +msgstr "Erreur LDAP: Impossible d'ajouter un objet" + +#: ../../../www/admin/maintainer/maintainer.php:280 +#: ../../../www/admin/maintainer/maintainer.php:286 +#: ../../../www/admin/maintainer/maintainer.php:297 ../include/menu.php:85 msgid "Create New Maintainer" msgstr "Créer un nouveau mainteneur" -#: ../../../www/admin/maintainer/maintainer.php:311 +#: ../../../www/admin/maintainer/maintainer.php:312 msgid "Delete Maintainer" msgstr "Effacer un mainteneur" -#: ../../../www/admin/maintainer/maintainer.php:341 +#: ../../../www/admin/maintainer/maintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:319 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from maintainer group: %s" +msgstr "Erreur LDAP: Impossible de lire le groupe des mainteneurs: " + +#: ../../../www/admin/maintainer/maintainer.php:336 +#: ../../../www/admin/administrator/admin.php:345 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:325 +#, fuzzy, php-format +msgid "LDAP Error: could not mark %s for deletion: %s" +msgstr "Erreur LDAP: impossible d'effacer" + +#: ../../../www/admin/maintainer/maintainer.php:342 msgid "Maintainer Deleted" msgstr "Mainteneur effacé" @@ -1553,33 +1805,38 @@ "Les mots de passe des managers ne peuvent pas être changés depuis " "l'interface web" -#: ../../../www/admin/administrator/admin.php:264 -#: ../../../www/admin/administrator/admin.php:312 +#: ../../../www/admin/administrator/admin.php:266 +#: ../../../www/admin/administrator/admin.php:316 msgid "Modify Administrator" msgstr "Modifier l'administrateur" -#: ../../../www/admin/administrator/admin.php:265 -#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/administrator/admin.php:267 +#: ../../../www/admin/administrator/admin.php:289 msgid "Administrator " msgstr "Administrateur" -#: ../../../www/admin/administrator/admin.php:286 -#: ../../../www/admin/administrator/admin.php:292 -#: ../../../www/admin/administrator/admin.php:303 ../include/menu.php:71 +#: ../../../www/admin/administrator/admin.php:290 +#: ../../../www/admin/administrator/admin.php:296 +#: ../../../www/admin/administrator/admin.php:307 ../include/menu.php:71 msgid "Create New Administrator" msgstr "Créer un nouvel administrateur" -#: ../../../www/admin/administrator/admin.php:318 +#: ../../../www/admin/administrator/admin.php:322 msgid "Delete Administrator" msgstr "Effacer l'administrateur" -#: ../../../www/admin/administrator/admin.php:332 +#: ../../../www/admin/administrator/admin.php:336 msgid "Error: you need administrative permissions to delete administrators" msgstr "" "Erreur: vous avez besoin des permissions administratives pour effacer des " "administrateurs" -#: ../../../www/admin/administrator/admin.php:346 +#: ../../../www/admin/administrator/admin.php:340 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from admin group: %s" +msgstr "Erreur LDAP: Impossible de lire le groupe des mainteneurs: " + +#: ../../../www/admin/administrator/admin.php:351 msgid "Administrator Deleted" msgstr "Administrateur efface" @@ -1595,6 +1852,11 @@ msgid "Please add at least one member" msgstr "Veuillez ajouter au moins un membre" +#: ../../../www/admin/distributionlist/list.php:50 +#, php-format +msgid "No user with email address, UID or alias %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:62 msgid "User or distribution list with this email address already exists" msgstr "" @@ -1629,28 +1891,58 @@ msgid "Add Distribution List" msgstr "Ajouter une liste de distribution" +#: ../../../www/admin/distributionlist/list.php:179 +#, php-format +msgid "No user with address %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:198 #: ../../../www/admin/distributionlist/list.php:207 msgid "Distribution List updated" msgstr "Mise à jour de la liste de distribution effectuée" -#: ../../../www/admin/distributionlist/list.php:256 -#: ../../../www/admin/distributionlist/list.php:270 +#: ../../../www/admin/distributionlist/list.php:216 +#, fuzzy, php-format +msgid "LDAP Error: Could not add object %s: %s" +msgstr "Erreur LDAP: Impossible d'ajouter un objet" + +#: ../../../www/admin/distributionlist/list.php:245 +#, fuzzy, php-format +msgid "Distribution List '%s' added" +msgstr "Mise à jour de la liste de distribution effectuée" + +#: ../../../www/admin/distributionlist/list.php:257 +#: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Modifier la liste de distribution" -#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/distributionlist/list.php:274 +#, php-format +msgid "Error: No results returned for DN ''" +msgstr "" + +#: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" msgstr "Effacer la liste de distribution" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid "Distribution List " msgstr "Liste de distribution" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid " deleted" msgstr " effacé" +#: ../../../www/admin/distributionlist/list.php:300 +#, fuzzy, php-format +msgid "LDAP Error: Nould not delete %s: %s" +msgstr "Erreur LDAP: impossible d'effacer" + +#: ../../../www/admin/distributionlist/index.php:53 +#, fuzzy, php-format +msgid "Manage Distribution Lists (%d Lists)" +msgstr "Gérer les listes de distributions" + #: ../../../www/admin/distributionlist/index.php:64 msgid "not yet implemented" msgstr "pas encore implémenté" @@ -1672,70 +1964,82 @@ msgstr "Ajouter une adresse externe" #: ../../../www/admin/addressbook/addr.php:196 -msgid "LDAP Error: could not rename " +#, fuzzy, php-format +msgid "LDAP Error: could not rename %s to %s: %s" msgstr "Erreur LDAP: impossible de renommer" -#: ../../../www/admin/addressbook/addr.php:203 -msgid "LDAP Error: could not read " -msgstr "Erreur LDAP: Impossible de lire" - -#: ../../../www/admin/addressbook/addr.php:207 -msgid "LDAP Error: could not modify object " -msgstr "Erreur LDAP: impossible de modifier l'objet" +#: ../../../www/admin/addressbook/addr.php:199 +#: ../../../www/admin/addressbook/addr.php:211 +#, fuzzy, php-format +msgid "%s successfully updated" +msgstr "crée avec succès" -#: ../../../www/admin/addressbook/addr.php:218 -msgid "LDAP Error: could not add object " -msgstr "Erreur LDAP: Impossible d'ajouter un objet" +#: ../../../www/admin/addressbook/addr.php:223 +#, fuzzy, php-format +msgid "%s successfully added" +msgstr "crée avec succès" -#: ../../../www/admin/addressbook/addr.php:230 -#: ../../../www/admin/addressbook/addr.php:250 +#: ../../../www/admin/addressbook/addr.php:233 +#: ../../../www/admin/addressbook/addr.php:253 msgid "Modify External Address" msgstr "Modifier l'adresse externe" -#: ../../../www/admin/addressbook/addr.php:273 +#: ../../../www/admin/addressbook/addr.php:256 +#: ../../../www/admin/addressbook/addr.php:279 +#, php-format +msgid "Error: Multiple results returned for DN %s" +msgstr "" + +#: ../../../www/admin/addressbook/addr.php:276 msgid "Delete External Address" msgstr "Effacer l'adresse externe" -#: ../../../www/admin/addressbook/addr.php:283 -msgid "LDAP Error: could not delete " +#: ../../../www/admin/addressbook/addr.php:286 +#, fuzzy, php-format +msgid "LDAP Error: could not delete %s: %s" msgstr "Erreur LDAP: impossible d'effacer" +#: ../../../www/admin/addressbook/addr.php:290 +#, php-format +msgid "Address book entry with DN %s was deleted" +msgstr "" + #: ../../../www/admin/domainmaintainer/domainmaintainer.php:149 msgid "Check domains this domain maintainer should be able to maintain" msgstr "" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:250 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:294 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:295 #, fuzzy msgid "Modify Domain Maintainer" msgstr "Modifier les mainteneurs" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:270 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 #, fuzzy msgid "Domain maintainer " msgstr "Mainteneurs" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:275 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:272 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:276 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:286 #: ../include/menu.php:77 #, fuzzy msgid "Create New Domain Maintainer" msgstr "Créer un nouveau mainteneur" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:300 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:301 #, fuzzy msgid "Delete Domain Maintainer" msgstr "Effacer un mainteneur" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:314 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:315 #, fuzzy msgid "Error: you need administrative permissions to delete domain maintainers" msgstr "" "Erreur: vous avez besoin des permissions administratives pour effacer des " "administrateurs" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:331 #, fuzzy msgid "Domain Maintainer Deleted" msgstr "Mainteneur effacé" @@ -1920,6 +2224,38 @@ msgstr "" "Erreur lors de la négociation du protocole LDAP v3. Veuillez contacter votre " "administrateur système" + +#: ../include/ldap.class.php:184 ../include/ldap.class.php:214 +#: ../include/ldap.class.php:244 +#, php-format +msgid "No such object %s" +msgstr "" + +#: ../include/ldap.class.php:187 ../include/ldap.class.php:217 +#: ../include/ldap.class.php:247 +#, php-format +msgid "LDAP Error searching for DN %s: %s" +msgstr "" + +#: ../include/ldap.class.php:200 +#, php-format +msgid "Error searching for DN for UID=%s" +msgstr "" + +#: ../include/ldap.class.php:230 +#, php-format +msgid "Error searching for DN for Mail=%s" +msgstr "" + +#: ../include/ldap.class.php:260 +#, php-format +msgid "Error searching for DN for alias=%s: %s" +msgstr "" + +#: ../include/ldap.class.php:273 +#, php-format +msgid "Error searching for DN for mail or alias %s: %s" +msgstr "" #: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:12 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES messages.po, 1.3, 1.4 Message-ID: <20051013015003.7251E1005DF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES In directory doto:/tmp/cvs-serv29305/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES Modified Files: messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES/messages.po,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- messages.po 7 Oct 2005 12:16:09 -0000 1.3 +++ messages.po 13 Oct 2005 01:50:01 -0000 1.4 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-07 13:50+0200\n" +"POT-Creation-Date: 2005-10-13 03:40+0200\n" "PO-Revision-Date: 2005-06-16 19:35+0200\n" "Last-Translator: Vincent Seynhaeve \n" "Language-Team: Nerlandais \n" @@ -185,12 +185,12 @@ #: tpl_messages.php:31 tpl_messages.php:38 tpl_messages.php:47 #: tpl_messages.php:57 tpl_messages.php:87 tpl_messages.php:110 #: tpl_messages.php:126 tpl_messages.php:162 tpl_messages.php:174 -#: tpl_messages.php:228 ../../../www/admin/user/user.php:752 -#: ../../../www/admin/user/user.php:799 +#: tpl_messages.php:228 ../../../www/admin/user/user.php:759 +#: ../../../www/admin/user/user.php:808 #: ../../../www/admin/sharedfolder/sf.php:282 -#: ../../../www/admin/administrator/admin.php:326 -#: ../../../www/admin/distributionlist/list.php:284 -#: ../../../www/admin/addressbook/addr.php:272 +#: ../../../www/admin/administrator/admin.php:330 +#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/addressbook/addr.php:275 msgid "Delete" msgstr "Verwijderen" @@ -1036,6 +1036,16 @@ msgid "Script was:" msgstr "Script was:" +#: ../../../www/admin/user/deliver.php:74 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully activated" +msgstr "Vakantiemededeling succesvol geactiveerd" + +#: ../../../www/admin/user/deliver.php:75 +#, fuzzy, php-format +msgid "Delivery to '%s' successfully deactivated" +msgstr "Vakantiemededeling succesvol uitgeschakeld" + #: ../../../www/admin/user/forward.php:38 #: ../../../www/admin/user/vacation.php:17 msgid "" @@ -1047,6 +1057,16 @@ msgid "Please enter an email address" msgstr "Gelieve een e-mailadresin te geven" +#: ../../../www/admin/user/forward.php:78 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully activated" +msgstr "Vakantiemededeling succesvol geactiveerd" + +#: ../../../www/admin/user/forward.php:79 +#, fuzzy, php-format +msgid "Forwarding to '%s' successfully deactivated" +msgstr "Vakantiemededeling succesvol uitgeschakeld" + #: ../../../www/admin/user/index.php:33 #: ../../../www/admin/sharedfolder/index.php:22 #: ../../../www/admin/sharedfolder/sf.php:25 @@ -1061,6 +1081,11 @@ msgid "Error: You don't have Permissions to access this Menu" msgstr "Fout: je hebt geen toegangsrechten voor dit Menu " +#: ../../../www/admin/user/index.php:106 +#, fuzzy, php-format +msgid "Manage Email User (%d Users)" +msgstr "Behher gebruikers e-mails" + #: ../../../www/admin/user/index.php:169 #: ../../../www/admin/addressbook/index.php:122 msgid "Email" @@ -1086,6 +1111,11 @@ msgid "ends with" msgstr "Eindigt met" +#: ../../../www/admin/user/user.php:76 +#, php-format +msgid "Email address %1$s not in domains %2$s" +msgstr "" + #: ../../../www/admin/user/user.php:79 #: ../../../www/admin/addressbook/addr.php:71 msgid "User, vCard or distribution list with this email address already exists" @@ -1105,6 +1135,16 @@ msgid "UID " msgstr "UID" +#: ../../../www/admin/user/user.php:127 +#, php-format +msgid "Delegate %s does not exist" +msgstr "" + +#: ../../../www/admin/user/user.php:140 +#, php-format +msgid "Illegal user or group %s" +msgstr "" + #: ../../../www/admin/user/user.php:151 #: ../../../www/admin/maintainer/maintainer.php:60 #: ../../../www/admin/administrator/admin.php:60 @@ -1236,56 +1276,149 @@ msgid "Leave blank for default (60 days)" msgstr "Laat leeg voor standaard (60 dagen)" -#: ../../../www/admin/user/user.php:491 +#: ../../../www/admin/user/user.php:449 +#: ../../../www/admin/maintainer/maintainer.php:179 +#: ../../../www/admin/administrator/admin.php:186 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:159 +#, fuzzy, php-format +msgid "LDAP Error: No such dn: %s: %s" +msgstr "LDAP fout: leesfout" + +#: ../../../www/admin/user/user.php:485 +#, php-format +msgid "" +"Could not read resource encryption public key file://%s/etc/kolab/res_pub." +"pem: " +msgstr "" + +#: ../../../www/admin/user/user.php:492 msgid "Could not encrypt password: " msgstr "Kon wachtwoord niet versleutelen:" -#: ../../../www/admin/user/user.php:586 +#: ../../../www/admin/user/user.php:587 +#, fuzzy, php-format msgid "" "Account DN could not be modified, distribution list '%s' depends on it. To " +"modify this account, first remove it from the distribution list." msgstr "" "DN account kon niet gewijzigd worden, distributielijst " msgstr "" +#: ../../../www/admin/sharedfolder/index.php:52 +#, fuzzy, php-format +msgid "Manage Shared Folders (%d Folders)" +msgstr "Beheer gedeelde mappen" + #: ../../../www/admin/sharedfolder/sf.php:51 #: ../../../www/admin/sharedfolder/sf.php:58 msgid "Permission for UID/email/GID" msgstr "Toestemming voor UID/e-mail/GID" +#: ../../../www/admin/sharedfolder/sf.php:101 +#, php-format +msgid "No UID or GID %s" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:117 msgid "Folder Name" msgstr "Map naam" @@ -1375,20 +1518,65 @@ msgid "Permission for UID/GID" msgstr "Toestemming voor UID/GID" +#: ../../../www/admin/sharedfolder/sf.php:143 +#: ../../../www/admin/distributionlist/list.php:135 +#: ../../../www/admin/addressbook/addr.php:142 +#, fuzzy, php-format +msgid "Error: DN required for %s operation" +msgstr "Fout: dn nodig om handeling te verwijderen" + #: ../../../www/admin/sharedfolder/sf.php:153 ../include/menu.php:55 msgid "Add Shared Folder" msgstr "Voeg gedeelde map toe" +#: ../../../www/admin/sharedfolder/sf.php:217 +#: ../../../www/admin/maintainer/maintainer.php:226 +#: ../../../www/admin/administrator/admin.php:233 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:206 +#, fuzzy, php-format +msgid "LDAP Error: could not rename %1$s to %2$s: %3$s" +msgstr "LDAP fout: kon naam niet wijzigen" + #: ../../../www/admin/sharedfolder/sf.php:220 #: ../../../www/admin/sharedfolder/sf.php:229 msgid "Shared folder updated" msgstr "Gedeelde map bijgewerkt" +#: ../../../www/admin/sharedfolder/sf.php:223 +#: ../../../www/admin/maintainer/maintainer.php:250 +#: ../../../www/admin/administrator/admin.php:257 +#: ../../../www/admin/addressbook/addr.php:203 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:235 +#, fuzzy, php-format +msgid "LDAP Error: could not read %s: %s" +msgstr "LDAP fout: leesfout" + +#: ../../../www/admin/sharedfolder/sf.php:227 +#: ../../../www/admin/maintainer/maintainer.php:254 +#: ../../../www/admin/administrator/admin.php:261 +#: ../../../www/admin/addressbook/addr.php:208 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:239 +#, fuzzy, php-format +msgid "LDAP Error: could not modify object %s: %s" +msgstr "LDAP fout: kon het object niet aanpassen" + +#: ../../../www/admin/sharedfolder/sf.php:239 +#, fuzzy, php-format +msgid "Shared folder '%s' added" +msgstr "Gedeelde map bijgewerkt" + #: ../../../www/admin/sharedfolder/sf.php:251 #: ../../../www/admin/sharedfolder/sf.php:268 msgid "Modify Shared Folder" msgstr "Gedeelde map wijzigen" +#: ../../../www/admin/sharedfolder/sf.php:271 +#: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:289 +#, php-format +msgid "Error: No results returned for DN '%s'" +msgstr "" + #: ../../../www/admin/sharedfolder/sf.php:283 msgid "Delete Shared Folder" msgstr "Gedeelde map verwijderen" @@ -1402,11 +1590,31 @@ msgstr "Aangestipt voor verwijdering" #: ../../../www/admin/sharedfolder/sf.php:293 -#: ../../../www/admin/distributionlist/list.php:296 -#: ../../../www/admin/addressbook/addr.php:285 +#: ../../../www/admin/distributionlist/list.php:297 +#: ../../../www/admin/addressbook/addr.php:289 msgid "Entry Deleted" msgstr "Entry verwijderd" +#: ../../../www/admin/sharedfolder/sf.php:296 +#, fuzzy, php-format +msgid "LDAP Error: Could not mark %s for deletion: %s" +msgstr "LDAP fout: kon niet verwijderen" + +#: ../../../www/admin/service/index.php:97 +#, php-format +msgid "No account found for email address %s" +msgstr "" + +#: ../../../www/admin/service/index.php:105 +#, fuzzy, php-format +msgid "LDAP Error: Failed to add distribution list %s: %s" +msgstr "LDAP fout: bijwerken van het Kolab configuratie object is mislukt:" + +#: ../../../www/admin/service/index.php:107 +#, fuzzy, php-format +msgid "Successfully created distribution list %s" +msgstr "Maak distributielijsten" + #: ../../../www/admin/service/index.php:125 #: ../../../www/admin/service/index.php:134 #: ../../../www/admin/service/index.php:143 @@ -1415,47 +1623,49 @@ #: ../../../www/admin/service/index.php:171 #: ../../../www/admin/service/index.php:182 #: ../../../www/admin/service/index.php:196 +#: ../../../www/admin/service/index.php:214 #: ../../../www/admin/service/index.php:232 -#: ../../../www/admin/service/index.php:248 -#: ../../../www/admin/service/index.php:261 -msgid "LDAP Error: failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:249 +#: ../../../www/admin/service/index.php:262 +#, fuzzy, php-format +msgid "LDAP Error: failed to modify kolab configuration object: %s" msgstr "LDAP fout: bijwerken van het Kolab configuratie object is mislukt:" -#: ../../../www/admin/service/index.php:214 -#, fuzzy -msgid "LDAP Error: Failed to modify kolab configuration object: " +#: ../../../www/admin/service/index.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Failed to delete domain object %s: %s" msgstr "LDAP fout: bijwerken van het Kolab configuratie object is mislukt:" -#: ../../../www/admin/service/index.php:268 +#: ../../../www/admin/service/index.php:270 msgid "POP3 Service" msgstr "POP3 Service" -#: ../../../www/admin/service/index.php:269 +#: ../../../www/admin/service/index.php:271 msgid "POP3/SSL service (TCP port 995)" msgstr "POP3/SSL service (TCP poort 995)" -#: ../../../www/admin/service/index.php:270 +#: ../../../www/admin/service/index.php:272 msgid "IMAP Service" msgstr "IMAP Service" -#: ../../../www/admin/service/index.php:271 +#: ../../../www/admin/service/index.php:273 msgid "IMAP/SSL Service (TCP port 993)" msgstr "IMAP/SSL Service (TCP poort 993)" -#: ../../../www/admin/service/index.php:272 +#: ../../../www/admin/service/index.php:274 msgid "Sieve service (TCP port 2000)" msgstr "Sieve service (TCP poort 2000)" -#: ../../../www/admin/service/index.php:274 +#: ../../../www/admin/service/index.php:276 msgid "FTP FreeBusy Service (Legacy, not interoperable with Kolab2 FreeBusy)" msgstr "" "FTP Free/Busy service (vervallen, niet compatibel met Kolab2 Free/Busy)" -#: ../../../www/admin/service/index.php:276 +#: ../../../www/admin/service/index.php:278 msgid "HTTP FreeBusy Service (Legacy)" msgstr "HTTP Free/Busy service (vervallen)" -#: ../../../www/admin/service/index.php:277 +#: ../../../www/admin/service/index.php:279 msgid "Amavis Email Scanning (Virus/Spam)" msgstr "Amavis email scannen (virus/anti-spam)" @@ -1487,34 +1697,75 @@ msgid "Unique User ID" msgstr "Unieke gebruikers ID" +#: ../../../www/admin/maintainer/maintainer.php:230 +#: ../../../www/admin/administrator/admin.php:237 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:210 +#, fuzzy, php-format +msgid "LDAP Error: could not remove old entry %s: %s" +msgstr "LDAP fout: kon niet verwijderen" + +#: ../../../www/admin/maintainer/maintainer.php:240 +#: ../../../www/admin/administrator/admin.php:247 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:220 +#, fuzzy, php-format +msgid "LDAP Error: Could not add new group entry %s: %s" +msgstr "LDAP fout: kon geen object toevoegen" + +#: ../../../www/admin/maintainer/maintainer.php:245 +#: ../../../www/admin/administrator/admin.php:252 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:225 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove old group entry %s: %s" +msgstr "LDAP fout: kon het object niet aanpassen" + #: ../../../www/admin/maintainer/maintainer.php:259 -#: ../../../www/admin/maintainer/maintainer.php:305 +#: ../../../www/admin/maintainer/maintainer.php:306 msgid "Modify Maintainer" msgstr "Maintainers wijzigen" #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/maintainer/maintainer.php:278 +#: ../../../www/admin/maintainer/maintainer.php:279 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid "Maintainer " msgstr "Maintainers" #: ../../../www/admin/maintainer/maintainer.php:260 -#: ../../../www/admin/administrator/admin.php:265 +#: ../../../www/admin/administrator/admin.php:267 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:251 msgid " successfully modified" msgstr "Wijziging succesvol" -#: ../../../www/admin/maintainer/maintainer.php:279 -#: ../../../www/admin/maintainer/maintainer.php:285 -#: ../../../www/admin/maintainer/maintainer.php:296 ../include/menu.php:85 +#: ../../../www/admin/maintainer/maintainer.php:275 +#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:264 +#, fuzzy, php-format +msgid "LDAP Error: could not add object %s to maintainer group: %s" +msgstr "LDAP fout: kon geen object toevoegen" + +#: ../../../www/admin/maintainer/maintainer.php:280 +#: ../../../www/admin/maintainer/maintainer.php:286 +#: ../../../www/admin/maintainer/maintainer.php:297 ../include/menu.php:85 msgid "Create New Maintainer" msgstr "Maintainers aanmaken" -#: ../../../www/admin/maintainer/maintainer.php:311 +#: ../../../www/admin/maintainer/maintainer.php:312 msgid "Delete Maintainer" msgstr "Maintainers verwijderen" -#: ../../../www/admin/maintainer/maintainer.php:341 +#: ../../../www/admin/maintainer/maintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:319 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from maintainer group: %s" +msgstr "LDAP fout: Can't read maintainers group" + +#: ../../../www/admin/maintainer/maintainer.php:336 +#: ../../../www/admin/administrator/admin.php:345 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:325 +#, fuzzy, php-format +msgid "LDAP Error: could not mark %s for deletion: %s" +msgstr "LDAP fout: kon niet verwijderen" + +#: ../../../www/admin/maintainer/maintainer.php:342 msgid "Maintainer Deleted" msgstr "Maintainer verwijderd" @@ -1522,33 +1773,38 @@ msgid "Manager's password can't be changed from the webgui" msgstr "Managers wachtwoord kan niet gewijzigd worden via de webgui" -#: ../../../www/admin/administrator/admin.php:264 -#: ../../../www/admin/administrator/admin.php:312 +#: ../../../www/admin/administrator/admin.php:266 +#: ../../../www/admin/administrator/admin.php:316 msgid "Modify Administrator" msgstr "Wijzig Administrator" -#: ../../../www/admin/administrator/admin.php:265 -#: ../../../www/admin/administrator/admin.php:285 +#: ../../../www/admin/administrator/admin.php:267 +#: ../../../www/admin/administrator/admin.php:289 msgid "Administrator " msgstr "Administrator " -#: ../../../www/admin/administrator/admin.php:286 -#: ../../../www/admin/administrator/admin.php:292 -#: ../../../www/admin/administrator/admin.php:303 ../include/menu.php:71 +#: ../../../www/admin/administrator/admin.php:290 +#: ../../../www/admin/administrator/admin.php:296 +#: ../../../www/admin/administrator/admin.php:307 ../include/menu.php:71 msgid "Create New Administrator" msgstr "Creëer nieuwe Administrator" -#: ../../../www/admin/administrator/admin.php:318 +#: ../../../www/admin/administrator/admin.php:322 msgid "Delete Administrator" msgstr "Verwijder Administrator" -#: ../../../www/admin/administrator/admin.php:332 +#: ../../../www/admin/administrator/admin.php:336 msgid "Error: you need administrative permissions to delete administrators" msgstr "" "Fout : je hebt administratieve toegangsrechten nodig om administrators te " "verwijderen" -#: ../../../www/admin/administrator/admin.php:346 +#: ../../../www/admin/administrator/admin.php:340 +#, fuzzy, php-format +msgid "LDAP Error: Could not remove %s from admin group: %s" +msgstr "LDAP fout: Can't read maintainers group" + +#: ../../../www/admin/administrator/admin.php:351 msgid "Administrator Deleted" msgstr "Administrator verwijderd" @@ -1564,6 +1820,11 @@ msgid "Please add at least one member" msgstr "Gelieve tenminste een lid toe te voegen" +#: ../../../www/admin/distributionlist/list.php:50 +#, php-format +msgid "No user with email address, UID or alias %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:62 msgid "User or distribution list with this email address already exists" msgstr "Gebruiker of distributielijst met dit e-mailadres bestaat al" @@ -1596,28 +1857,58 @@ msgid "Add Distribution List" msgstr "Voeg distributielijst toe" +#: ../../../www/admin/distributionlist/list.php:179 +#, php-format +msgid "No user with address %s" +msgstr "" + #: ../../../www/admin/distributionlist/list.php:198 #: ../../../www/admin/distributionlist/list.php:207 msgid "Distribution List updated" msgstr "Distributielijst geüpdatet" -#: ../../../www/admin/distributionlist/list.php:256 -#: ../../../www/admin/distributionlist/list.php:270 +#: ../../../www/admin/distributionlist/list.php:216 +#, fuzzy, php-format +msgid "LDAP Error: Could not add object %s: %s" +msgstr "LDAP fout: kon geen object toevoegen" + +#: ../../../www/admin/distributionlist/list.php:245 +#, fuzzy, php-format +msgid "Distribution List '%s' added" +msgstr "Distributielijst geüpdatet" + +#: ../../../www/admin/distributionlist/list.php:257 +#: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Distributielijst wijzigen" -#: ../../../www/admin/distributionlist/list.php:285 +#: ../../../www/admin/distributionlist/list.php:274 +#, php-format +msgid "Error: No results returned for DN ''" +msgstr "" + +#: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" msgstr "Distributielijst verwijderen" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid "Distribution List " msgstr "Distributielijst" -#: ../../../www/admin/distributionlist/list.php:295 +#: ../../../www/admin/distributionlist/list.php:296 msgid " deleted" msgstr "verwijderd" +#: ../../../www/admin/distributionlist/list.php:300 +#, fuzzy, php-format +msgid "LDAP Error: Nould not delete %s: %s" +msgstr "LDAP fout: kon niet verwijderen" + +#: ../../../www/admin/distributionlist/index.php:53 +#, fuzzy, php-format +msgid "Manage Distribution Lists (%d Lists)" +msgstr "Beheer distributielijsten" + #: ../../../www/admin/distributionlist/index.php:64 msgid "not yet implemented" msgstr "nog niet geïmplementeerd" @@ -1639,70 +1930,82 @@ msgstr "Extern adres toevoegen" #: ../../../www/admin/addressbook/addr.php:196 -msgid "LDAP Error: could not rename " +#, fuzzy, php-format +msgid "LDAP Error: could not rename %s to %s: %s" msgstr "LDAP fout: kon naam niet wijzigen" -#: ../../../www/admin/addressbook/addr.php:203 -msgid "LDAP Error: could not read " -msgstr "LDAP fout: leesfout" - -#: ../../../www/admin/addressbook/addr.php:207 -msgid "LDAP Error: could not modify object " -msgstr "LDAP fout: kon het object niet aanpassen" +#: ../../../www/admin/addressbook/addr.php:199 +#: ../../../www/admin/addressbook/addr.php:211 +#, fuzzy, php-format +msgid "%s successfully updated" +msgstr "Creatie succesvol" -#: ../../../www/admin/addressbook/addr.php:218 -msgid "LDAP Error: could not add object " -msgstr "LDAP fout: kon geen object toevoegen" +#: ../../../www/admin/addressbook/addr.php:223 +#, fuzzy, php-format +msgid "%s successfully added" +msgstr "Creatie succesvol" -#: ../../../www/admin/addressbook/addr.php:230 -#: ../../../www/admin/addressbook/addr.php:250 +#: ../../../www/admin/addressbook/addr.php:233 +#: ../../../www/admin/addressbook/addr.php:253 msgid "Modify External Address" msgstr "Pas extern adres aan" -#: ../../../www/admin/addressbook/addr.php:273 +#: ../../../www/admin/addressbook/addr.php:256 +#: ../../../www/admin/addressbook/addr.php:279 +#, php-format +msgid "Error: Multiple results returned for DN %s" +msgstr "" + +#: ../../../www/admin/addressbook/addr.php:276 msgid "Delete External Address" msgstr "Verwijder extern adres " -#: ../../../www/admin/addressbook/addr.php:283 -msgid "LDAP Error: could not delete " +#: ../../../www/admin/addressbook/addr.php:286 +#, fuzzy, php-format +msgid "LDAP Error: could not delete %s: %s" msgstr "LDAP fout: kon niet verwijderen" +#: ../../../www/admin/addressbook/addr.php:290 +#, php-format +msgid "Address book entry with DN %s was deleted" +msgstr "" + #: ../../../www/admin/domainmaintainer/domainmaintainer.php:149 msgid "Check domains this domain maintainer should be able to maintain" msgstr "" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:250 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:294 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:295 #, fuzzy msgid "Modify Domain Maintainer" msgstr "Maintainers wijzigen" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:270 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 #, fuzzy msgid "Domain maintainer " msgstr "Maintainers" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:275 -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:285 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:272 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:276 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:286 #: ../include/menu.php:77 #, fuzzy msgid "Create New Domain Maintainer" msgstr "Maintainers aanmaken" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:300 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:301 #, fuzzy msgid "Delete Domain Maintainer" msgstr "Maintainers verwijderen" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:314 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:315 #, fuzzy msgid "Error: you need administrative permissions to delete domain maintainers" msgstr "" "Fout : je hebt administratieve toegangsrechten nodig om administrators te " "verwijderen" -#: ../../../www/admin/domainmaintainer/domainmaintainer.php:330 +#: ../../../www/admin/domainmaintainer/domainmaintainer.php:331 #, fuzzy msgid "Domain Maintainer Deleted" msgstr "Maintainer verwijderd" @@ -1887,6 +2190,38 @@ msgstr "" "Fout met instelling LDAP protocol to v3. Gelieve contact op te nemen met uw " "systeembeheerder " + +#: ../include/ldap.class.php:184 ../include/ldap.class.php:214 +#: ../include/ldap.class.php:244 +#, php-format +msgid "No such object %s" +msgstr "" + +#: ../include/ldap.class.php:187 ../include/ldap.class.php:217 +#: ../include/ldap.class.php:247 +#, php-format +msgid "LDAP Error searching for DN %s: %s" +msgstr "" + +#: ../include/ldap.class.php:200 +#, php-format +msgid "Error searching for DN for UID=%s" +msgstr "" + +#: ../include/ldap.class.php:230 +#, php-format +msgid "Error searching for DN for Mail=%s" +msgstr "" + +#: ../include/ldap.class.php:260 +#, php-format +msgid "Error searching for DN for alias=%s: %s" +msgstr "" + +#: ../include/ldap.class.php:273 +#, php-format +msgid "Error searching for DN for mail or alias %s: %s" +msgstr "" #: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:13 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/addressbook addr.php, 1.13, 1.14 Message-ID: <20051013015003.7F2BB1006A0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/addressbook In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/addressbook Modified Files: addr.php Log Message: Fix for issue886 (i18n problem) Index: addr.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/addressbook/addr.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- addr.php 29 Aug 2005 21:28:28 -0000 1.13 +++ addr.php 13 Oct 2005 01:50:01 -0000 1.14 @@ -139,7 +139,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, _("Error: DN required for $action operation") ); + array_push($errors, sprintf(_("Error: DN required for %s operation"), $action )); } } @@ -193,20 +193,22 @@ ($oldattrs=ldap_get_attributes($ldap->connection,$entry))) { foreach( $ldap_object as $k => $v ) if( $v == array() ) unset( $ldap_object[$k] ); if (!ldap_add($ldap->connection,$newdn, $ldap_object) || !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not rename ").$dn. - " to ".$newdn." ".ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not rename %s to %s: %s"), $dn, + $newdn, ldap_error($ldap->connection))); } else { - $messages[] = _("$newdn successfully updated"); + $messages[] = sprintf( _("%s successfully updated"), $newdn); } $dn = $newdn; } else { - array_push($errors,_("LDAP Error: could not read ").$dn." ".ldap_error($ldap->connection)); + array_push($errors,sprintf(_("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not modify object ").$dn.": ".ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not modify object %s: %s"),$dn, + ldap_error($ldap->connection))); } else { - $messages[] = _("$dn successfully updated"); + $messages[] = sprintf(_("%s successfully updated"), $dn); } } } @@ -215,9 +217,10 @@ $dn = "cn=".$ldap_object['cn'].",".$addressbook_root; foreach( $ldap_object as $k => $v ) if( $v == array() ) unset( $ldap_object[$k] ); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not add object ").$dn.": ".ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); } else { - $messages[] = _("$dn successfully added"); + $messages[] = sprintf(_("%s successfully added"), $dn); } } if ($errors) { @@ -250,7 +253,7 @@ $heading = _('Modify External Address'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: Multiple results returned for DN $dn") ); + array_push($errors, sprintf(_("Error: Multiple results returned for DN %s"), $dn) ); } } break; @@ -273,17 +276,18 @@ $heading = _('Delete External Address'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: Multiple results returned for DN $dn") ); + array_push($errors, sprintf(_("Error: Multiple results returned for DN %s"), $dn) ); } } break; case 'kill': if (!$errors) { if (!($ldap->deleteObject($dn))) { - array_push($errors, _("LDAP Error: could not delete ").$dn.": ".ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not delete %s: %s"),$dn, + ldap_error($ldap->connection))); } else { $heading = _('Entry Deleted'); - $messages[] = _("Address book entry with DN $dn was deleted"); + $messages[] = sprintf( _("Address book entry with DN %s was deleted"), $dn); $contenttemplate = 'addrdeleted.tpl'; } } From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:14 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist index.php, 1.13, 1.14 list.php, 1.20, 1.21 Message-ID: <20051013015003.98CE71006A8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/distributionlist Modified Files: index.php list.php Log Message: Fix for issue886 (i18n problem) Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist/index.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- index.php 28 Jul 2005 02:14:38 -0000 1.13 +++ index.php 13 Oct 2005 01:50:01 -0000 1.14 @@ -50,7 +50,7 @@ $result = ldap_search($ldap->connection, $base_dn, $filter); if( $result ) { $count = ldap_count_entries($ldap->connection, $result); - $title = _("Manage Distribution Lists ($count Lists)"); + $title = sprintf( _("Manage Distribution Lists (%d Lists)"), $count); $template = 'distlistall.tpl'; ldap_sort($ldap->connection,$result,'cn'); $entry = ldap_first_entry($ldap->connection, $result); Index: list.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist/list.php,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- list.php 28 Jul 2005 02:14:38 -0000 1.20 +++ list.php 13 Oct 2005 01:50:01 -0000 1.21 @@ -47,7 +47,7 @@ foreach( $lst as $a ) { debug("Trying $a"); ($dn = $ldap->dnForMail($a)) || ($dn = $ldap->dnForUid($a)) || ($dn = $ldap->dnForAlias($a)); - if( !$dn ) return _("No user with email address, UID or alias $a"); + if( !$dn ) return sprintf( _("No user with email address, UID or alias %s"), $a); } } return ''; @@ -132,7 +132,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, _("Error: DN required for $action operation") ); + array_push($errors, sprintf(_("Error: DN required for %s operation"), $action ) ); } } @@ -176,7 +176,7 @@ if( $memberdn ) { $ldap_object['member'][] = $memberdn; } else { - $errors[] = _("No user with address $a"); + $errors[] = sprintf(_("No user with address %s"), $a); break; } } @@ -192,18 +192,18 @@ ($oldattrs=ldap_get_attributes($ldap->connection,$entry))) { if (!ldap_add($ldap->connection,$newdn, $ldap_object) || !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: Could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); } else { $messages[] = _('Distribution List updated'); } $dn = $newdn; - } else array_push($errors, _("LDAP Error: Could not read $dn: ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf( _("LDAP Error: Could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: Could not modify object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection))); else $messages[] = _('Distribution List updated'); } } @@ -213,8 +213,8 @@ if( !$ldap_object['member'] ) unset($ldap_object['member']); $dn = "cn=".$ldap_object['cn'].",".$dl_root; if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: Could not add object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); debug("dn is $dn"); debug_var_dump( $ldap_object ); } @@ -231,17 +231,18 @@ $ldap_object['cn'] = $newcn; $ldap_object['dn'] = 'cn='.$ldap->escape($newcn).','.$dl_root; if (!ldap_rename($ldap->connection, $dn, 'cn='.$ldap->escape($newcn), $dl_root,true)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)); } - $error[] = _("Mid-air collision detected, email address $mail renamed to $newmail"); + $error[] = sprintf( _("Mid-air collision detected, email address %1\$s renamed to %2\$s"), + $mail, $newmail); break; } } } } if( !$errors ) { - $messages[] = _("Distribution List '$cn' added"); + $messages[] = sprintf(_("Distribution List '%s' added"), $cn ); } } if ($errors) { @@ -270,7 +271,7 @@ $heading = _('Modify Distribution List'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN '$dn'") ); + array_push($errors, sprintf( _("Error: No results returned for DN ''"), $dn)); } break; case 'delete': @@ -285,18 +286,18 @@ $heading = _('Delete Distribution List'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN '$dn'")); + array_push($errors, sprintf( _("Error: No results returned for DN '%s'"), $dn)); } break; case 'kill': if (!$errors) { /* Just delete the object and let kolabd clean up */ - if ($ldap->deleteGroupOfNames($dn)) { + if ($ldap->deleteGroupOfNames($dn)) { $messages[] = _('Distribution List ').$_REQUEST['cn']._(' deleted'); $heading = _('Entry Deleted'); $contenttemplate = 'sfdeleted.tpl'; } else { - array_push($errors, _("LDAP Error: Nould not delete $dn: ").$ldap->error()); + array_push($errors, sprintf(_("LDAP Error: Nould not delete %s: %s"), $dn, $ldap->error())); } } break; From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:14 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/administrator admin.php, 1.11, 1.12 Message-ID: <20051013015003.92B711006A3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/administrator In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/administrator Modified Files: admin.php Log Message: Fix for issue886 (i18n problem) Index: admin.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/administrator/admin.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- admin.php 11 Mar 2005 09:11:15 -0000 1.11 +++ admin.php 13 Oct 2005 01:50:01 -0000 1.12 @@ -95,7 +95,7 @@ if( $uid == 'manager' ) { unset($form->entries['password_1']); $form->entries['password_0']['type'] = 'comment'; - $form->entries['password_0']['value'] = _('Manager\'s password can\'t be changed from the webgui'); + $form->entries['password_0']['value'] = _("Manager's password can't be changed from the webgui"); } /* @@ -183,7 +183,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection))); } } @@ -230,10 +230,12 @@ if( empty($ldap_object['userPassword']) ) $ldap_object['userPassword'] = $oldattrs['userPassword'][0]; if (!ldap_add($ldap->connection,$newdn, $ldap_object) ) - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not rename %1\$s to %2\$s: %3\$s"), $dn, + $newdn, ldap_error($ldap->connection))); if( !$errors ) { if( !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not remove old entry $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not remove old entry %s: %s"), $dn, + ldap_error($ldap->connection))); } } if( !$errors ) { @@ -242,22 +244,22 @@ if( !ldap_mod_add( $ldap->connection, $groupdn, array( 'member' => $newdn ) ) ) { - $errors[] = _("LDAP Error: Could not add new group entry $newdn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not add new group entry %s: %s"), $newdn, + ldap_error($ldap->connection)); } if( !$errors && !ldap_mod_del($ldap->connection,$groupdn, array( 'member' => $dn ) ) ) { - $errors[] = _("LDAP Error: Could not remove old group entry $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove old group entry %s: %s"), $dn, + ldap_error($ldap->connection)); } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn ") - .ldap_error($ldap->connection)); + } else array_push($errors,sprintf(_("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not modify object $dn ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not modify object %s: %s"), $dn. + ldap_error($ldap->connection))); } } } @@ -274,12 +276,14 @@ debug("Calling ldap_add with dn=$dn"); // Add object to db if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); // Add object to admin group if( $dn && !ldap_mod_add($ldap->connection, 'cn=admin,cn=internal,'.$domain_dn, array( 'member' => $dn ) ) ) { - array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not add object %s to maintainer group: %s"), $dn, + ldap_error($ldap->connection))); } if( !$errors ) { $messages[] = _('Administrator ').$ldap_object['dn']._(' successfully created'); @@ -327,18 +331,19 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete administrators")); if (!$errors) { if(!ldap_mod_del($ldap->connection, 'cn=admin,cn=internal,'.domain_dn(), array('member' => $dn ) )) { - $errors[] = _("LDAP Error: Could not remove $dn from admin group: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not remove %s from admin group: %s"), $dn, + ldap_error($ldap->connection)); } if( !$errors ) { if( !$ldap->deleteObject($dn) ) { - array_push($errors, _("LDAP Error: could not mark $dn for deletion ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not mark %s for deletion: %s"), $dn, + ldap_error($ldap->connection))); } } } From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:15 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/domainmaintainer domainmaintainer.php, 1.1, 1.2 Message-ID: <20051013015003.A4FC11006A9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/domainmaintainer In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/domainmaintainer Modified Files: domainmaintainer.php Log Message: Fix for issue886 (i18n problem) Index: domainmaintainer.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/domainmaintainer/domainmaintainer.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- domainmaintainer.php 5 Jul 2005 10:31:51 -0000 1.1 +++ domainmaintainer.php 13 Oct 2005 01:50:01 -0000 1.2 @@ -156,7 +156,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection))); } } @@ -203,27 +203,27 @@ if( empty($ldap_object['userPassword']) ) $ldap_object['userPassword'] = $oldattrs['userPassword'][0]; if (!ldap_add($ldap->connection,$newdn, $ldap_object) ) - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); if( !$errors ) { if( !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not remove old entry $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not remove old entry %s: %s"), $dn, + ldap_error($ldap->connection))); } } if( !$errors ) { // Update maintainer group $groupdn = 'cn=domain-maintainer,cn=internal,'.$domain_dn; if( !ldap_mod_add( $ldap->connection, - $groupdn, - array( 'member' => $newdn ) ) ) { - $errors[] = _("LDAP Error: Could not add new group entry $newdn: ") - .ldap_error($ldap->connection); + $groupdn, + array( 'member' => $newdn ) ) ) { + $errors[] = sprintf( _("LDAP Error: Could not add new group entry %s: %s"), $newdn, + ldap_error($ldap->connection)); } if( !$errors && !ldap_mod_del($ldap->connection,$groupdn, array( 'member' => $dn ) ) ) { - $errors[] = _("LDAP Error: Could not remove old group entry $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove old group entry %s: %s"), $dn, + ldap_error($ldap->connection)); } if( !$errors ) { $domains = $ldap->domainsForMaintainerDn($dn); @@ -232,12 +232,12 @@ } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf( _("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not modify object $dn ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not modify object %s: %s"), $dn, + ldap_error($ldap->connection))); } if( !$errors ) { $domains = $ldap->domainsForMaintainerDn($dn); @@ -257,11 +257,12 @@ $dn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn; debug("Calling ldap_add with dn=$dn"); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); if( $dn && !ldap_mod_add($ldap->connection, 'cn=domain-maintainer,cn=internal,'.$domain_dn, array( 'member' => $dn ) ) ) { - array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s to maintainer group: %s"), $dn, + ldap_error($ldap->connection))); } if( $dn && !$errors ) { $ldap->addToDomainGroups( $dn, $_POST['domains'] ); @@ -309,20 +310,20 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "maintainer" && $auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete domain maintainers")); if (!$errors) { if(!ldap_mod_del($ldap->connection, 'cn=domain-maintainer,cn=internal,'.domain_dn(), array('member' => $dn ) )) { - $errors[] = _("LDAP Error: Could not remove $dn from maintainer group: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove %s from maintainer group: %s"), $dn, + ldap_error($ldap->connection)); } if( !$errors ) { $delete_template['kolabdeleteflag'] = 'TRUE'; if( !$ldap->deleteObject($dn)) { - array_push($errors, _("LDAP Error: could not mark $dn for deletion ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not mark %s for deletion: %s"), $dn, + ldap_error($ldap->connection))); } } } From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:16 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/maintainer maintainer.php, 1.13, 1.14 Message-ID: <20051013015003.AB2BD1006B0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/maintainer In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/maintainer Modified Files: maintainer.php Log Message: Fix for issue886 (i18n problem) Index: maintainer.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/maintainer/maintainer.php,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- maintainer.php 11 Mar 2005 09:11:15 -0000 1.13 +++ maintainer.php 13 Oct 2005 01:50:01 -0000 1.14 @@ -176,7 +176,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection))); } } @@ -223,12 +223,12 @@ if( empty($ldap_object['userPassword']) ) $ldap_object['userPassword'] = $oldattrs['userPassword'][0]; if (!ldap_add($ldap->connection,$newdn, $ldap_object) ) - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); if( !$errors ) { if( !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not remove old entry $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not remove old entry %s: %s"), $dn, + ldap_error($ldap->connection))); } } if( !$errors ) { @@ -237,22 +237,22 @@ if( !ldap_mod_add( $ldap->connection, $groupdn, array( 'member' => $newdn ) ) ) { - $errors[] = _("LDAP Error: Could not add new group entry $newdn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not add new group entry %s: %s"), $newdn, + ldap_error($ldap->connection)); } if( !$errors && !ldap_mod_del($ldap->connection,$groupdn, array( 'member' => $dn ) ) ) { - $errors[] = _("LDAP Error: Could not remove old group entry $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not remove old group entry %s: %s"), $dn, + ldap_error($ldap->connection)); } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf(_("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not modify object $dn ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not modify object %s: %s"), $dn, + ldap_error($ldap->connection))); } } } @@ -268,11 +268,12 @@ $dn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn; debug("Calling ldap_add with dn=$dn"); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); if( $dn && !ldap_mod_add($ldap->connection, 'cn=maintainer,cn=internal,'.$domain_dn, array( 'member' => $dn ) ) ) { - array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s to maintainer group: %s"), $dn, + ldap_error($ldap->connection))); } if( !$errors ) { $messages[] = _('Maintainer ').$ldap_object['dn']._(' successfully created'); @@ -320,20 +321,20 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "maintainer" && $auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete users")); if (!$errors) { if(!ldap_mod_del($ldap->connection, 'cn=maintainer,cn=internal,'.domain_dn(), array('member' => $dn ) )) { - $errors[] = _("LDAP Error: Could not remove $dn from maintainer group: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not remove %s from maintainer group: %s"), $dn, + ldap_error($ldap->connection)); } if( !$errors ) { $delete_template['kolabdeleteflag'] = 'TRUE'; if( !$ldap->deleteObject($dn)) { - array_push($errors, _("LDAP Error: could not mark $dn for deletion ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not mark %s for deletion: %s"), $dn. + ldap_error($ldap->connection))); } } } From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:17 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder index.php, 1.8, 1.9 sf.php, 1.22, 1.23 Message-ID: <20051013015003.C76D91006BF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/sharedfolder Modified Files: index.php sf.php Log Message: Fix for issue886 (i18n problem) Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/index.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- index.php 8 Jul 2005 02:05:35 -0000 1.8 +++ index.php 13 Oct 2005 01:50:01 -0000 1.9 @@ -49,7 +49,7 @@ $result = ldap_search($ldap->connection, $base_dn, $filter); if( $result ) { $count = ldap_count_entries($ldap->connection, $result); - $title = _("Manage Shared Folders ($count Folders)"); + $title = sprintf(_("Manage Shared Folders (%d Folders)"), $count); $template = 'sflistall.tpl'; ldap_sort($ldap->connection,$result,'cn'); $entry = ldap_first_entry($ldap->connection, $result); Index: sf.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/sf.php,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- sf.php 28 Jul 2005 02:14:38 -0000 1.22 +++ sf.php 13 Oct 2005 01:50:01 -0000 1.23 @@ -98,7 +98,7 @@ } } } - $errors[] = _("No UID or GID $uid"); + $errors[] = sprintf(_("No UID or GID %s"), $uid); return false; } @@ -140,7 +140,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, _("Error: DN required for $action operation")); + array_push($errors, sprintf(_("Error: DN required for %s operation"), $action); } } @@ -214,18 +214,18 @@ ($oldattrs=ldap_get_attributes($ldap->connection,$entry))) { if (!ldap_add($ldap->connection,$newdn, $ldap_object) || !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); } else { $messages[] = _('Shared folder updated'); } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn: ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf(_("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not modify object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not modify object %s: %s"), $dn, + ldap_error($ldap->connection))); else $messages[] = _('Shared folder updated'); } } @@ -234,9 +234,9 @@ $dn = "cn=".$ldap_object['cn'].",".$sf_root; $ldap_object['kolabHomeServer'] = trim($_POST['kolabhomeserver']); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ") - .ldap_error($ldap->connection)); - else $messages[] = _("Shared folder '$cn' added"); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); + else $messages[] = sprintf(_("Shared folder '%s' added"), $cn);; } if ($errors) { //print("
Create New Address Book Entry
\n"); @@ -268,7 +268,7 @@ $heading = _('Modify Shared Folder'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN $dn")); + array_push($errors, sprintf(_("Error: No results returned for DN '%s'"), $dn)); } break; case 'delete': @@ -283,7 +283,7 @@ $heading = _('Delete Shared Folder'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN $dn")); + array_push($errors, sprintf(_("Error: No results returned for DN '%s'"), $dn)); } break; case 'kill': @@ -293,7 +293,8 @@ $heading = _('Entry Deleted'); $contenttemplate = 'sfdeleted.tpl'; } else { - array_push($errors, _("LDAP Error: Could not mark $dn for deletion: ").ldap_error($link)); + array_push($errors, sprintf(_("LDAP Error: Could not mark %s for deletion: %s"), $dn, + ldap_error($ldap->connection))); } } break; From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:17 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/service index.php, 1.25, 1.26 Message-ID: <20051013015003.BD0F81006B4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/service Modified Files: index.php Log Message: Fix for issue886 (i18n problem) Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service/index.php,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- index.php 3 Oct 2005 01:08:36 -0000 1.25 +++ index.php 13 Oct 2005 01:50:01 -0000 1.26 @@ -94,7 +94,7 @@ $mail = trim($_REQUEST['systemaliasmail']); $dn = $ldap->dnForMailOrAlias( $mail ); if( !$dn ) { - $errors[] = _("No account found for email address $mail"); + $errors[] = sprintf(_("No account found for email address %s"), $mail); } else { foreach( array( 'postmaster', 'hostmaster', 'abuse', 'virusalert', 'MAILER-DAEMON' ) as $group ) { $attrs = array( 'objectClass' => array( 'top', 'kolabGroupOfNames' ), @@ -102,9 +102,9 @@ 'mail' => $group.'@'.$postfixmydomain, 'member' => $dn ); if( !ldap_add( $ldap->connection, "cn=$group,".$_SESSION['base_dn'], $attrs ) ) { - $errors[] = _("LDAP Error: Failed to add distribution list $group: ").$ldap->error(); + $errors[] = sprintf(_("LDAP Error: Failed to add distribution list %s: %s"), $group, $ldap->error()); } else { - $messages[] = "Successfully created distribution list $group"; + $messages[] = sprintf( _("Successfully created distribution list %s"), $group); } } } @@ -122,8 +122,8 @@ if( postvalue( 'amavis' ) != $amavis ) $attrs['postfix-enable-virus-scan'] = postvalue( 'amavis' ); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -131,8 +131,8 @@ $attrs = array(); $attrs['cyrus-quotawarn'] = trim( $_REQUEST['quotawarn'] ); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -140,8 +140,8 @@ $attrs = array(); $attrs['apache-allow-unauthenticated-fb'] = postvalue( 'httpallowunauthfb' ); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -149,8 +149,8 @@ $attrs = array(); $attrs['kolabFreeBusyPast'] = trim( $_REQUEST['freebusypast'] ); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -159,8 +159,8 @@ $attrs['postfix-mynetworks'] = preg_split( "/[\s,]+/", trim( $_REQUEST['postfixmynetworks'] ) ); //if( $attrs['postfix-mynetworks'] == '' ) $attrs['postfix-mynetworks'] = array(); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -168,8 +168,8 @@ $attrs = array(); $attrs['postfix-allow-unauthenticated'] = postvalue( 'postfixallowunauth' ); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -179,8 +179,8 @@ 'kolabfilter-allow-sender-header' => postvalue( 'kolabfilterallowsender' ), 'kolabfilter-reject-forged-from-header' => $_REQUEST['kolabfilterrejectforgedfrom']=='TRUE'?'TRUE':'FALSE' ); if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -193,8 +193,8 @@ $attrs['postfix-relayhost'] = $host_val; $attrs['postfix-relayport'] = $port_val; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -211,14 +211,14 @@ $attrs = array(); $attrs['postfix-mydestination'] = $postfixmydestination; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: Failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } $domain_obj_dn = 'cn='.$ldap->escape(trim($_REQUEST['adestination'])).',cn=domains,cn=internal,'.$_SESSION['base_dn']; debug("Trying to delete $domain_obj_dn"); if( !$errors && $ldap->read($domain_obj_dn) && !ldap_delete($ldap->connection, $domain_obj_dn ) ) { - $errors[] = _("LDAP Error: Failed to delete domain object $domain_obj_dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Failed to delete domain object %s: %s"), $domain_obj_dn, + ldap_error($ldap->connection)); } } // Add domain @@ -229,7 +229,8 @@ $attrs = array(); $attrs['postfix-mydestination'] = $postfixmydestination; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ").ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } } @@ -245,8 +246,8 @@ $attrs = array(); $attrs['kolabhost'] = $kolabhost; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ") - .ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } @@ -258,7 +259,8 @@ $attrs = array(); $attrs['kolabhost'] = $kolabhost; if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) { - $errors[] = _("LDAP Error: failed to modify kolab configuration object: ").ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: failed to modify kolab configuration object: %s"), + ldap_error($ldap->connection)); } } } From cvs at intevation.de Thu Oct 13 03:50:03 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:18 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/user deliver.php, 1.2, 1.3 forward.php, 1.12, 1.13 index.php, 1.14, 1.15 user.php, 1.68, 1.69 Message-ID: <20051013015003.DB27A1006C5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user In directory doto:/tmp/cvs-serv29305/kolab-webadmin/www/admin/user Modified Files: deliver.php forward.php index.php user.php Log Message: Fix for issue886 (i18n problem) Index: deliver.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/deliver.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- deliver.php 29 Aug 2005 21:28:28 -0000 1.2 +++ deliver.php 13 Oct 2005 01:50:01 -0000 1.3 @@ -71,8 +71,8 @@ } if( !$errors ) { - if( $active ) $messages[] = _("Delivery to '$inbox' successfully activated"); - else $messages[] = _("Delivery to '$inbox' successfully deactivated"); + if( $active ) $messages[] = sprintf(_("Delivery to '%s' successfully activated"), $inbox); + else $messages[] = sprintf(_("Delivery to '%s' successfully deactivated"), $inbox); } } Index: forward.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/forward.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- forward.php 29 Aug 2005 21:28:28 -0000 1.12 +++ forward.php 13 Oct 2005 01:50:01 -0000 1.13 @@ -75,8 +75,8 @@ } if( !$errors ) { - if( $active ) $messages[] = _("Forwarding to '$address' successfully activated"); - else $messages[] = _("Forwarding to '$address' successfully deactivated"); + if( $active ) $messages[] = sprintf(_("Forwarding to '%s' successfully activated"), $address); + else $messages[] = sprintf(_("Forwarding to '%s' successfully deactivated"), $address); } } } Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/index.php,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- index.php 12 Sep 2005 20:10:00 -0000 1.14 +++ index.php 13 Oct 2005 01:50:01 -0000 1.15 @@ -103,7 +103,7 @@ if( $result ) { $count = ldap_count_entries($ldap->connection, $result); - $title = _("Manage Email User ($count Users)"); + $title = sprintf(_("Manage Email User (%d Users)"), $count); // if there are more than 2000 entries, split in 26 categories for every letter, // or if more than 50, put in groups, or else just show all. if (false && $count > 2000) { Index: user.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- user.php 17 Sep 2005 22:31:17 -0000 1.68 +++ user.php 13 Oct 2005 01:50:01 -0000 1.69 @@ -73,7 +73,7 @@ $ok = true; } } - if(!$ok) return _("Email address $value not in domains ".join(", ", $domain)); + if(!$ok) return sprintf(_("Email address %1\$s not in domains %2\$s"), $value, join(", ", $domain)); if( $ldap->countMail( $_SESSION['base_dn'], $value ) > 0 ) { return _('User, vCard or distribution list with this email address already exists'); @@ -124,7 +124,7 @@ $str = ''; foreach( $lst as $delegate ) { if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(mail='.$ldap->escape($delegate).')' ) ) == 0 ) { - return _("Delegate $delegate does not exist"); + return sprintf(_("Delegate %s does not exist"), $delegate); } } return ''; @@ -137,7 +137,7 @@ foreach( $value as $v ) { $v = trim($v); if( !empty($v) && !ereg('^([0-9a-zA-Z._@ ]|-)*$', $v ) ) { - return _("Illegal user or group $v"); + return sprintf(_("Illegal user or group %s"), $v); } } return ''; @@ -405,7 +405,7 @@ 'policies' => array('anyone' => 4), 'validation' => 'checkpolicy', 'comment' => _('For automatic invitation handling') . '
' . - _('NOTE: For regular accounts to use this feature, give the \'calendar\' user access to the Calendar folder') ), + _("NOTE: For regular accounts to use this feature, give the 'calendar' user access to the Calendar folder") ), 'title_0' => array( 'name' => _('Title') ) ); $entries['alias'] = array( 'name' => _('Email Aliases'), 'type' => 'textarea', @@ -446,7 +446,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection))); } } @@ -482,7 +482,8 @@ $pubkeydata=file_get_contents("$kolab_prefix/etc/kolab/res_pub.pem" ); $pkey = openssl_pkey_get_public( $pubkeydata ); if( $pkey === false ) { - $sslerr = _("Could not read resource encryption public key file://$kolab_prefix/etc/kolab/res_pub.pem: "); + $sslerr = sprintf(_("Could not read resource encryption public key file://%s/etc/kolab/res_pub.pem: "), + $kolab_prefix); while( $msg = openssl_error_string() ) $sslerr .= $msg.' '; $errors[] = $sslerr; @@ -583,9 +584,7 @@ unset( $distlists['count'] ); foreach( $distlists as $distlist ) { $dlcn = $distlist['mail'][0]; - $errors[] = _("Account DN could not be modified, distribution list
'$dlcn' depends on it. To modify this account, first remove it from the distribution list."); + $errors[] = sprintf(_("Account DN could not be modified, distribution list '%s' depends on it. To modify this account, first remove it from the distribution list."), urlencode($distlist['dn']), $dlcn ); } if (($result=ldap_read($ldap->connection,$dn,"(objectclass=*)")) && @@ -615,22 +614,23 @@ unset($explodeddn[0]); $tmpbasedn = join(",",$explodeddn); if ( !$errors && !ldap_rename($ldap->connection,$dn,$tmprdn,$tmpbasedn,false) ) { - array_push($errors, _("LDAP Error: Could not rename $dn to $tmprdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $tmprdn, + ldap_error($ldap->connection))); } if ( !$errors && !ldap_add($ldap->connection,$newdn, $ldap_object) ) { - array_push($errors, _("LDAP Error: Could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); } if( !$errors ) { if( !ldap_delete($ldap->connection,$tmprdn.','.$tmpbasedn)) { - array_push($errors, _("LDAP Error: Could not remove old entry $tmprdn,$tmpbasedn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: Could not remove old entry %s,%s: %s"), + $tmprdn, $tmpbasedn, + ldap_error($ldap->connection))); } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: Could not read $dn: ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf(_("LDAP Error: Could not read %s: %s"), $dn, + ldap_error($ldap->connection)); } else { //$ldap_object = fill_up($ldap_object); if ($auth->group() == "user") { @@ -641,8 +641,8 @@ unset($ldap_object['kolabHomeServer']); } if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: Could not modify object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)); debug_var_dump( $ldap_object ); } } @@ -654,14 +654,16 @@ $newalias = md5sum( $dn.$alias ).'@'.substr( $alias, 0, strpos( $alias, '@' ) ); $ldap_object['alias'][$i] = $newalias; if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)); } - $error[] = _("Mid-air collision detected, alias $alias renamed to $newalias"); + $error[] = sprintf(_("Mid-air collision detected, alias %1\$s renamed to %2\$s"), + $alias, $newalias); } } } $heading = _('Modify User'); - if( !$errors ) $messages[] = _("User '$dn' successfully modified"); + if( !$errors ) $messages[] = sprintf(_("User '%s' successfully modified"), $dn); $form->setValues(); $form->entries['mail']['attrs'] = 'readonly'; $form->entries['kolabhomeserver']['attrs'] = 'readonly'; @@ -679,7 +681,8 @@ } debug("Calling ldap_add with dn=$dn"); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); // Check for mid-air collisions on mail if( $ldap->countMail( $_SESSION['base_dn'], $ldap_object['mail'], $dn ) > 0 ) { @@ -688,9 +691,11 @@ $newmail = md5sum( $dn.$mail ).'@'.substr( $mail, 0, strpos( $mail, '@' ) ); $ldap_object['uid'] = $ldap_object['mail'] = $newmail; if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)); } - $error[] = _("Mid-air collision detected, email address $mail renamed to $newmail"); + $error[] = sprintf(_("Mid-air collision detected, email address %1\$s renamed to %2\$s"), + $mail, $newmail); } // Check for collisions on alias @@ -701,9 +706,11 @@ $newalias = md5sum( $dn.$alias ).'@'.substr( $alias, 0, strpos( $alias, '@' ) ); $ldap_object['alias'][$i] = $newalias; if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)); } - $error[] = _("Mid-air collision detected, alias $alias renamed to $newalias"); + $error[] = sprintf(_("Mid-air collision detected, alias %1\$s renamed to %2\$s"), + $alias, $newalias); } } @@ -753,7 +760,7 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "maintainer" && $auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete users")); @@ -767,12 +774,13 @@ $dlmail = $distlist['mail'][0]; if( !$dlmail ) $dlmail = $distlist['cn'][0]; # Compatibility with old stuff if( $distlist['member']['count'] == 1 ) { - $errors[] = _("Account could not be deleted, distribution list '$dlmail' depends on it."); + $errors[] = sprintf(_("Account could not be deleted, distribution list '%s' depends on it."), $dlmail); } else { if( ldap_mod_del( $ldap->connection, $distlist['dn'], array('member' => $dn ) ) ) { - $messages[] = _("Account removed from distribution list '$dlmail'."); + $messages[] = sprintf(_("Account removed from distribution list '%s'."), $dlmail); } else { - $errors[] = _("Failure to remove account from distribution list '$dlmail', account will not be deleted."); + $errors[] = sprintf(_("Failure to remove account from distribution list '', account will not be deleted."), + $dlmail); break; } } @@ -780,7 +788,8 @@ if( !$errors ) { if (!$ldap->deleteObject($dn)) { - array_push($errors, _("LDAP Error: could not mark '$dn' for deletion: ").$ldap->error()); + array_push($errors, sprintf(_("LDAP Error: could not mark '%s' for deletion: %s"), $dn, + $ldap->error())); } else { $heading = _("User Deleted"); $contenttemplate = 'userdeleted.tpl'; From cvs at intevation.de Thu Oct 13 03:50:26 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:28 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include auth.class.php, 1.10, 1.10.2.1 form.class.php, 1.18.2.2, 1.18.2.3 ldap.class.php, 1.24.2.1, 1.24.2.2 Message-ID: <20051013015026.BB1A01005D9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include In directory doto:/tmp/cvs-serv29446/kolab-webadmin/php/admin/include Modified Files: Tag: kolab_2_0_branch auth.class.php form.class.php ldap.class.php Log Message: Fix for issue886 (i18n problem) Index: auth.class.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/auth.class.php,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -d -r1.10 -r1.10.2.1 --- auth.class.php 9 Apr 2005 08:55:02 -0000 1.10 +++ auth.class.php 13 Oct 2005 01:50:24 -0000 1.10.2.1 @@ -67,7 +67,7 @@ $auth_group = $ldap->groupForUid( $auth_user ); $tmp_group = ($auth_user=='manager')?'manager':$auth_group; if( !in_array( $tmp_group, $this->params['allow_user_classes'] ) ) { - $this->error_string = _("User class '$tmp_group' is denied access"); + $this->error_string = sprintf(_("User class '%s' is denied access"), $tmp_group); $this->gotoLoginPage(); } $bind_result = $ldap->bind( $dn, $_POST['password'] ); Index: form.class.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/form.class.php,v retrieving revision 1.18.2.2 retrieving revision 1.18.2.3 diff -u -d -r1.18.2.2 -r1.18.2.3 --- form.class.php 29 Aug 2005 21:28:50 -0000 1.18.2.2 +++ form.class.php 13 Oct 2005 01:50:24 -0000 1.18.2.3 @@ -253,7 +253,7 @@ if( $value['type'] == 'aclselect' ) { // ignore } else if( strlen( trim($_REQUEST[$key]) ) == 0 ) { - $this->errors[] = _('Required field ').$value['name']._(' is empty'); + $this->errors[] = sprintf( _('Required field %s is empty'), $value['name']); } } else { if( $value['type'] == 'aclselect' ) { Index: ldap.class.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/ldap.class.php,v retrieving revision 1.24.2.1 retrieving revision 1.24.2.2 diff -u -d -r1.24.2.1 -r1.24.2.2 --- ldap.class.php 28 Jul 2005 01:45:41 -0000 1.24.2.1 +++ ldap.class.php 13 Oct 2005 01:50:24 -0000 1.24.2.2 @@ -185,10 +185,10 @@ if( $entries['count'] == 1 ) { return $entries[0]['uid'][0]; } else { - $errors[] = _("No such object $dn"); + $errors[] = sprintf(_("No such object %s"), $dn); } } else { - $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection); + $errors[] = sprintf(_("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection) ); } return false; } @@ -201,7 +201,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - echo _("Error searching for DN for UID=$uid"); + echo sprintf( _("Error searching for DN for UID=%s"), $uid); } return false; } @@ -215,10 +215,10 @@ if( $entries['count'] == 1 ) { return $entries[0]['mail'][0]; } else { - $errors[] = _("No such object $dn"); + $errors[] = sprintf(_("No such object %s"), $dn); } } else { - $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection); + $errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection) ); } return false; } @@ -231,7 +231,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - echo _("Error searching for DN for Mail=$mail"); + echo sprintf( _("Error searching for DN for Mail=%s"), $mail); } return false; } @@ -248,7 +248,7 @@ $errors[] = _("No such object $dn"); } } else { - $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection); + $errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection) ); } return false; } @@ -261,7 +261,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - $errors[] = _("Error searching for DN for alias=$mail: ").ldap_error($this->connection); + $errors[] = sprintf( _("Error searching for DN for alias=%s: %s"), $mail, ldap_error($this->connection)); } return false; } @@ -274,7 +274,7 @@ return ldap_get_dn( $this->connection, $entry ); } } else { - $errors[] = _("Error searching for DN for mail_or_alias=$mail: ").ldap_error($this->connection); + $errors[] = sprintf(_("Error searching for DN for mail_or_alias=%s: %s"), $mail, ldap_error($this->connection)); } return false; } @@ -306,7 +306,7 @@ $res = ldap_search( $this->connection, $mybase, $filter, array('member') ); if( !$res ) { array_push($errors, _("LDAP Error: Can't read maintainers group: ") - .ldap_error($conn) ); + .ldap_error($conn) ); return array(); } $entries = ldap_get_entries( $this->connection, $res ); From cvs at intevation.de Thu Oct 13 03:50:26 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:30 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale extract_messages, 1.4, 1.4.2.1 Message-ID: <20051013015026.CB9561005DF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale In directory doto:/tmp/cvs-serv29446/kolab-webadmin/php/admin/locale Modified Files: Tag: kolab_2_0_branch extract_messages Log Message: Fix for issue886 (i18n problem) Index: extract_messages =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/extract_messages,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -d -r1.4 -r1.4.2.1 --- extract_messages 15 Jun 2005 20:48:21 -0000 1.4 +++ extract_messages 13 Oct 2005 01:50:24 -0000 1.4.2.1 @@ -86,7 +86,7 @@ # Call xgettext on all the php files (including the one generated from templates) # $allFiles = "$tplMessagesFile " . join(" ", @phpFiles) . " " . join(" ",@includeFiles); -#print "$allFiles\n"; +print "$allFiles\n"; print `xgettext --language=PHP -o messages.pot $allFiles`; # From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:34 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES messages.po, 1.1, 1.1.2.1 Message-ID: <20051013015027.0D00F1006A0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES In directory doto:/tmp/cvs-serv29446/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES Modified Files: Tag: kolab_2_0_branch messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES/messages.po,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -d -r1.1 -r1.1.2.1 --- messages.po 15 Jun 2005 20:48:21 -0000 1.1 +++ messages.po 13 Oct 2005 01:50:24 -0000 1.1.2.1 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-15 17:24+0200\n" +"POT-Creation-Date: 2005-10-13 01:19+0200\n" "PO-Revision-Date: 2005-06-13 18:10+0200\n" "Last-Translator: Benoit Mortier \n" "Language-Team: \n" @@ -24,82 +24,91 @@ "X-Generator: KBabel 1.9.1\n" [...2778 lines suppressed...] -msgstr "Veuillez vous connecter comme un utilisateur valide" +#~ msgid "Shared folder " +#~ msgstr "Dossier partagé" -#: ../include/ldap.class.php:53 -msgid "" -"Error setting LDAP protocol to v3. Please contact your system administrator" -msgstr "" -"Erreur lors de la négociation du protocole LDAP v3. Veuillez contacter votre " -"administrateur système" +#~ msgid " is empty" +#~ msgstr "est vide" -#: ../include/ldap.class.php:308 -msgid "LDAP Error: Can't read maintainers group: " -msgstr "Erreur LDAP: Impossible de lire le groupe des mainteneurs: " +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "" +#~ "Active la vérification du MX pour le serveur relais (si vous hésitez, " +#~ "laisser le désactivé)" From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:35 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/addressbook addr.php, 1.10.2.2, 1.10.2.3 Message-ID: <20051013015027.192321006A3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/addressbook In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/addressbook Modified Files: Tag: kolab_2_0_branch addr.php Log Message: Fix for issue886 (i18n problem) Index: addr.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/addressbook/addr.php,v retrieving revision 1.10.2.2 retrieving revision 1.10.2.3 diff -u -d -r1.10.2.2 -r1.10.2.3 --- addr.php 29 Aug 2005 21:28:50 -0000 1.10.2.2 +++ addr.php 13 Oct 2005 01:50:25 -0000 1.10.2.3 @@ -139,7 +139,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, _("Error: DN required for $action operation") ); + array_push($errors, sprintf(_("Error: DN required for %s operation"), $action ) ); } } @@ -196,17 +196,17 @@ array_push($errors, _("LDAP Error: could not rename ").$dn. " to ".$newdn." ".ldap_error($ldap->connection)); } else { - $messages[] = _("$newdn successfully updated"); + $messages[] = sprintf(_("%s successfully updated"), $newdn); } $dn = $newdn; } else { - array_push($errors,_("LDAP Error: could not read ").$dn." ".ldap_error($ldap->connection)); + array_push($errors,_("LDAP Error: could not read ").$dn.": ".ldap_error($ldap->connection)); } } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { array_push($errors, _("LDAP Error: could not modify object ").$dn.": ".ldap_error($ldap->connection)); } else { - $messages[] = _("$dn successfully updated"); + $messages[] = sprintf(_("%s successfully updated"), $dn); } } } @@ -217,7 +217,7 @@ if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) { array_push($errors, _("LDAP Error: could not add object ").$dn.": ".ldap_error($ldap->connection)); } else { - $messages[] = _("$dn successfully added"); + $messages[] = sprintf(_("%s successfully added"), $dn); } } if ($errors) { @@ -250,7 +250,7 @@ $heading = _('Modify External Address'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: Multiple results returned for DN $dn") ); + array_push($errors, sprintf(_("Error: Multiple results returned for DN %s"), $dn) ); } } break; @@ -273,7 +273,7 @@ $heading = _('Delete External Address'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: Multiple results returned for DN $dn") ); + array_push($errors, sprintf(_("Error: Multiple results returned for DN %s"),$dn) ); } } break; @@ -283,7 +283,7 @@ array_push($errors, _("LDAP Error: could not delete ").$dn.": ".ldap_error($ldap->connection)); } else { $heading = _('Entry Deleted'); - $messages[] = _("Address book entry with DN $dn was deleted"); + $messages[] = sprintf(_("Address book entry with DN %s was deleted"), $dn); $contenttemplate = 'addrdeleted.tpl'; } } From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:36 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES messages.po, 1.1, 1.1.2.1 Message-ID: <20051013015027.22F511006B0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES In directory doto:/tmp/cvs-serv29446/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES Modified Files: Tag: kolab_2_0_branch messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES/messages.po,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -d -r1.1 -r1.1.2.1 --- messages.po 17 Jun 2005 15:19:16 -0000 1.1 +++ messages.po 13 Oct 2005 01:50:24 -0000 1.1.2.1 @@ -6,11 +6,11 @@ msgid "" msgstr "" "Project-Id-Version: messages\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-08 12:24+0200\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2005-10-13 01:19+0200\n" "PO-Revision-Date: 2005-06-16 19:35+0200\n" "Last-Translator: Vincent Seynhaeve \n" -"Language-Team: Nerlandais \n" +"Language-Team: Nerlandais \n" [...2132 lines suppressed...] #: ../include/ldap.class.php:308 msgid "LDAP Error: Can't read maintainers group: " @@ -1640,3 +2145,17 @@ msgid "Versions" msgstr "Versies" +#~ msgid "Distribution List " +#~ msgstr "Distributielijst" + +#~ msgid " deleted" +#~ msgstr "verwijderd" + +#~ msgid "Shared folder " +#~ msgstr "Gedeelde map" + +#~ msgid " is empty" +#~ msgstr " is leeg" + +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "Activeer de MX controle voor de relayhost (bij twijfel, leeg laten)" From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:37 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/administrator admin.php, 1.11, 1.11.2.1 Message-ID: <20051013015027.1DB681006A9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/administrator In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/administrator Modified Files: Tag: kolab_2_0_branch admin.php Log Message: Fix for issue886 (i18n problem) Index: admin.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/administrator/admin.php,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -d -r1.11 -r1.11.2.1 --- admin.php 11 Mar 2005 09:11:15 -0000 1.11 +++ admin.php 13 Oct 2005 01:50:25 -0000 1.11.2.1 @@ -183,7 +183,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, _("LDAP Error: No such dn: ").$dn.": ".ldap_error($ldap->connection)); } } @@ -230,10 +230,10 @@ if( empty($ldap_object['userPassword']) ) $ldap_object['userPassword'] = $oldattrs['userPassword'][0]; if (!ldap_add($ldap->connection,$newdn, $ldap_object) ) - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not rename %s to %s: "), $dn, $newdn).ldap_error($ldap->connection)); if( !$errors ) { if( !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not remove old entry $dn: ").ldap_error($ldap->connection)); + array_push($errors, _("LDAP Error: could not remove old entry ").$dn.": ".ldap_error($ldap->connection)); } } if( !$errors ) { @@ -242,22 +242,22 @@ if( !ldap_mod_add( $ldap->connection, $groupdn, array( 'member' => $newdn ) ) ) { - $errors[] = _("LDAP Error: Could not add new group entry $newdn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not add new group entry %s: %s"),$newdn, + ldap_error($ldap->connection) ); } if( !$errors && !ldap_mod_del($ldap->connection,$groupdn, array( 'member' => $dn ) ) ) { - $errors[] = _("LDAP Error: Could not remove old group entry $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove old group entry %s: %s"), $dn, + ldap_error($ldap->connection) ); } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf( _("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection)) ); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not modify object $dn ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)) ); } } } @@ -274,12 +274,13 @@ debug("Calling ldap_add with dn=$dn"); // Add object to db if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, ldap_error($ldap->connection)) ); // Add object to admin group if( $dn && !ldap_mod_add($ldap->connection, 'cn=admin,cn=internal,'.$domain_dn, array( 'member' => $dn ) ) ) { - array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: could not add object %s to maintainer group: %s"), $dn, + ldap_error($ldap->connection)) ); } if( !$errors ) { $messages[] = _('Administrator ').$ldap_object['dn']._(' successfully created'); @@ -327,18 +328,18 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete administrators")); if (!$errors) { if(!ldap_mod_del($ldap->connection, 'cn=admin,cn=internal,'.domain_dn(), array('member' => $dn ) )) { - $errors[] = _("LDAP Error: Could not remove $dn from admin group: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove %s from admin group: %s"), $dn, + ldap_error($ldap->connection) ); } if( !$errors ) { if( !$ldap->deleteObject($dn) ) { - array_push($errors, _("LDAP Error: could not mark $dn for deletion ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not mark %s for deletion: %s"), $dn, ldap_error($ldap->connection)) ); } } } From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:38 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES messages.po, 1.8, 1.8.2.1 Message-ID: <20051013015027.2AF3D1006B4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES In directory doto:/tmp/cvs-serv29446/kolab-webadmin/php/admin/locale/de/LC_MESSAGES Modified Files: Tag: kolab_2_0_branch messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES/messages.po,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -d -r1.8 -r1.8.2.1 --- messages.po 15 Jun 2005 20:48:21 -0000 1.8 +++ messages.po 13 Oct 2005 01:50:24 -0000 1.8.2.1 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: kolab-messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-15 17:23+0200\n" +"POT-Creation-Date: 2005-10-13 01:19+0200\n" "PO-Revision-Date: 2005-03-11 14:50+0100\n" "Last-Translator: Matthias Kalle Dalheimer \n" @@ -20,86 +20,91 @@ "X-Generator: KBabel 1.9.1\n" [...2783 lines suppressed...] +#~ msgid "Shared folder " +#~ msgstr "Gemeinsam genutzter Ordner " -#: ../include/ldap.class.php:53 -msgid "" -"Error setting LDAP protocol to v3. Please contact your system administrator" -msgstr "" +#~ msgid " is empty" +#~ msgstr " ist leer" -#: ../include/ldap.class.php:308 -msgid "LDAP Error: Can't read maintainers group: " -msgstr "LDAP-Fehler: Kann die Verwalter-Gruppe nicht lesen" +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "" +#~ "MX-Suche für Relayhost einschalten (wenn Sie sich nicht sicher sind, " +#~ "verwenden Sie diese Option nicht)" #~ msgid "React to spam" #~ msgstr "Auf Spam reagieren" From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:39 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist index.php, 1.9.2.1, 1.9.2.2 list.php, 1.16.2.2, 1.16.2.3 Message-ID: <20051013015027.2F4011006BF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/distributionlist Modified Files: Tag: kolab_2_0_branch index.php list.php Log Message: Fix for issue886 (i18n problem) Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist/index.php,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -d -r1.9.2.1 -r1.9.2.2 --- index.php 28 Jul 2005 01:45:41 -0000 1.9.2.1 +++ index.php 13 Oct 2005 01:50:25 -0000 1.9.2.2 @@ -49,7 +49,7 @@ $result = ldap_search($ldap->connection, $base_dn, $filter); if( $result ) { $count = ldap_count_entries($ldap->connection, $result); - $title = _("Manage Distribution Lists ($count Lists)"); + $title = sprintf( _("Manage Distribution Lists (%d Lists)"), $count ); $template = 'distlistall.tpl'; ldap_sort($ldap->connection,$result,'cn'); $entry = ldap_first_entry($ldap->connection, $result); Index: list.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist/list.php,v retrieving revision 1.16.2.2 retrieving revision 1.16.2.3 diff -u -d -r1.16.2.2 -r1.16.2.3 --- list.php 15 Sep 2005 11:59:23 -0000 1.16.2.2 +++ list.php 13 Oct 2005 01:50:25 -0000 1.16.2.3 @@ -46,7 +46,7 @@ foreach( $lst as $a ) { debug("Trying $a"); ($dn = $ldap->dnForMail($a)) || ($dn = $ldap->dnForUid($a)) || ($dn = $ldap->dnForAlias($a)); - if( !$dn ) return _("No user with email address, UID or alias $a"); + if( !$dn ) return sprintf(_("No user with email address, UID or alias %s"), $a); } } return ''; @@ -141,7 +141,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, _("Error: DN required for $action operation") ); + array_push($errors, sprintf( _("Error: DN required for %s operation"), $action ) ); } } @@ -185,7 +185,7 @@ if( $memberdn ) { $ldap_object['member'][] = $memberdn; } else { - $errors[] = _("No user with address $a"); + $errors[] = sprintf( _("No user with address %s"), $a); break; } } @@ -201,18 +201,18 @@ ($oldattrs=ldap_get_attributes($ldap->connection,$entry))) { if (!ldap_add($ldap->connection,$newdn, $ldap_object) || !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: Could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not rename %s to %s: %s"), $dn, $newdn, + ldap_error($ldap->connection)) ); } else { $messages[] = _('Distribution List updated'); } $dn = $newdn; - } else array_push($errors, _("LDAP Error: Could not read $dn: ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf( _("LDAP Error: Could not read %s: %s"), $dn, + ldap_error($ldap->connection)) ); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: Could not modify object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)) ); else $messages[] = _('Distribution List updated'); } } @@ -222,8 +222,8 @@ if( !$ldap_object['member'] ) unset($ldap_object['member']); $dn = "cn=".$ldap_object['cn'].",".$dl_root; if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: Could not add object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not add object %s: %s"), $dn, + ldap_error($ldap->connection)) ); debug("dn is $dn"); debug_var_dump( $ldap_object ); } @@ -240,17 +240,17 @@ $ldap_object['cn'] = $newcn; $ldap_object['dn'] = 'cn='.$ldap->escape($newcn).','.$dl_root; if (!ldap_rename($ldap->connection, $dn, 'cn='.$ldap->escape($newcn), $dl_root,true)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection) ); } - $error[] = _("Mid-air collision detected, email address $mail renamed to $newmail"); + $error[] = sprintf( _("Mid-air collision detected, email address %1\$s was renamed to %2\$s"), $mail, $newmail ); break; } } } } if( !$errors ) { - $messages[] = _("Distribution List '$cn' added"); + $messages[] = sprintf( _("Distribution List '%s' added"), $cn ); } } if ($errors) { @@ -279,7 +279,7 @@ $heading = _('Modify Distribution List'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN '$dn'")); + array_push($errors, sprintf( _("Error: No results returned for DN '%s'"), $dn )); } break; case 'delete': @@ -294,18 +294,18 @@ $heading = _('Delete Distribution List'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN '$dn'")); + array_push($errors, sprintf( _("Error: No results returned for DN '%s'"), $dn) ); } break; case 'kill': if (!$errors) { /* Just delete the object and let kolabd clean up */ if( $ldap->deleteGroupOfNames($dn) ) { - $messages[] = _('Distribution List ').$_REQUEST['cn']._(' deleted'); + $messages[] = sprintf( _("Distribution List %s deleted"), $_REQUEST['cn'] );; $heading = _('Entry Deleted'); $contenttemplate = 'sfdeleted.tpl'; } else { - array_push($errors, _("LDAP Error: could delete $dn: ").ldap_error($link)); + array_push($errors, sprintf( _("LDAP Error: could not delete %s: %s"), $dn, ldap_error($link))); } } break; From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:40 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES messages.po, 1.1.2.1, 1.1.2.2 Message-ID: <20051013015027.346671006CC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES In directory doto:/tmp/cvs-serv29446/kolab-webadmin/php/admin/locale/it/LC_MESSAGES Modified Files: Tag: kolab_2_0_branch messages.po Log Message: Fix for issue886 (i18n problem) Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES/messages.po,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- messages.po 11 Aug 2005 15:25:12 -0000 1.1.2.1 +++ messages.po 13 Oct 2005 01:50:24 -0000 1.1.2.2 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-07-03 16:26+0200\n" +"POT-Creation-Date: 2005-10-13 01:19+0200\n" "PO-Revision-Date: 2005-07-22 23:43+0100\n" "Last-Translator: Alessandro Fiorino \n" "Language-Team: \n" @@ -24,1047 +24,1881 @@ "X-Generator: KBabel 1.9.1\n" [...3046 lines suppressed...] -msgstr "Effettuare la login con un utente valido" +#~ msgid " is empty" +#~ msgstr " è vuoto" -#: ../include/ldap.class.php:53 -msgid "Error setting LDAP protocol to v3. Please contact your system administrator" -msgstr "Errore impostanto il protocollo LDAP alla versione 3. Prego contattare l'amministratore di sistema" +#~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" +#~ msgstr "" +#~ "Abilita verifica MX per il server di relay (se in dubbio, lasciare " +#~ "disabilitato)" -#: ../include/ldap.class.php:308 -msgid "LDAP Error: Can't read maintainers group: " -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +#~ msgid "Domains" +#~ msgstr "Domini" +#~ msgid "Domain" +#~ msgstr "Dominio" From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:41 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/maintainer maintainer.php, 1.13, 1.13.2.1 Message-ID: <20051013015027.38FD01006D0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/maintainer In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/maintainer Modified Files: Tag: kolab_2_0_branch maintainer.php Log Message: Fix for issue886 (i18n problem) Index: maintainer.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/maintainer/maintainer.php,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -d -r1.13 -r1.13.2.1 --- maintainer.php 11 Mar 2005 09:11:15 -0000 1.13 +++ maintainer.php 13 Oct 2005 01:50:25 -0000 1.13.2.1 @@ -176,7 +176,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection)) ); } } @@ -223,12 +223,12 @@ if( empty($ldap_object['userPassword']) ) $ldap_object['userPassword'] = $oldattrs['userPassword'][0]; if (!ldap_add($ldap->connection,$newdn, $ldap_object) ) - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not rename %s to %s: %s"), $dn, $newdn, + ldap_error($ldap->connection))); if( !$errors ) { if( !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not remove old entry $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not remove old entry %s: %s"), $dn, + ldap_error($ldap->connection))); } } if( !$errors ) { @@ -237,22 +237,22 @@ if( !ldap_mod_add( $ldap->connection, $groupdn, array( 'member' => $newdn ) ) ) { - $errors[] = _("LDAP Error: Could not add new group entry $newdn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not add new group entry %s: %s"), $newdn, + ldap_error($ldap->connection) ); } if( !$errors && !ldap_mod_del($ldap->connection,$groupdn, array( 'member' => $dn ) ) ) { - $errors[] = _("LDAP Error: Could not remove old group entry $dn: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove old group entry %s: %s"), $dn, + ldap_error($ldap->connection) ); } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn ") - .ldap_error($ldap->connection)); + } else array_push($errors,sprintf( _("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection)) ); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: could not modify object $dn ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not modify object %s: %s"), $dn, + ldap_error($ldap->connection)) ); } } } @@ -268,11 +268,11 @@ $dn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn; debug("Calling ldap_add with dn=$dn"); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not add object %s: %s"), $dn, ldap_error($ldap->connection)) ); if( $dn && !ldap_mod_add($ldap->connection, 'cn=maintainer,cn=internal,'.$domain_dn, array( 'member' => $dn ) ) ) { - array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not add object %s to maintainer group: %s"), $dn, + ldap_error($ldap->connection))); } if( !$errors ) { $messages[] = _('Maintainer ').$ldap_object['dn']._(' successfully created'); @@ -320,20 +320,20 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "maintainer" && $auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete users")); if (!$errors) { if(!ldap_mod_del($ldap->connection, 'cn=maintainer,cn=internal,'.domain_dn(), array('member' => $dn ) )) { - $errors[] = _("LDAP Error: Could not remove $dn from maintainer group: ") - .ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not remove %s from maintainer group: %s"), $dn, + ldap_error($ldap->connection)); } if( !$errors ) { $delete_template['kolabdeleteflag'] = 'TRUE'; if( !$ldap->deleteObject($dn)) { - array_push($errors, _("LDAP Error: could not mark $dn for deletion ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not mark %s for deletion: %s"), $dn, + ldap_error($ldap->connection))); } } } From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:41 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/service index.php, 1.22.2.2, 1.22.2.3 Message-ID: <20051013015027.3B9F21006D2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/service Modified Files: Tag: kolab_2_0_branch index.php Log Message: Fix for issue886 (i18n problem) Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/service/index.php,v retrieving revision 1.22.2.2 retrieving revision 1.22.2.3 diff -u -d -r1.22.2.2 -r1.22.2.3 --- index.php 12 Oct 2005 11:04:16 -0000 1.22.2.2 +++ index.php 13 Oct 2005 01:50:25 -0000 1.22.2.3 @@ -92,7 +92,7 @@ $mail = trim($_REQUEST['systemaliasmail']); $dn = $ldap->dnForMailOrAlias( $mail ); if( !$dn ) { - $errors[] = _("No account found for email address $mail"); + $errors[] = sprintf( _("No account found for email address %s"), $mail ); } else { foreach( array( 'postmaster', 'hostmaster', 'abuse', 'virusalert', 'MAILER-DAEMON' ) as $group ) { $attrs = array( 'objectClass' => array( 'top', 'kolabGroupOfNames' ), @@ -100,9 +100,9 @@ 'mail' => $group.'@'.$postfixmydomain, 'member' => $dn ); if( !ldap_add( $ldap->connection, "cn=$group,".$_SESSION['base_dn'], $attrs ) ) { - $errors[] = _("LDAP Error: Failed to add distribution list $group: ").$ldap->error(); + $errors[] = sprintf( _("LDAP Error: Failed to add distribution list %s: %s"), $group, $ldap->error() ); } else { - $messages[] = "Successfully created distribution list $group"; + $messages[] = sprintf( _("Successfully created distribution list %s"), $group ); } } } From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:42 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder index.php, 1.7, 1.7.2.1 sf.php, 1.20.2.1, 1.20.2.2 Message-ID: <20051013015027.46CB71006D4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/sharedfolder Modified Files: Tag: kolab_2_0_branch index.php sf.php Log Message: Fix for issue886 (i18n problem) Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/index.php,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -d -r1.7 -r1.7.2.1 --- index.php 11 Mar 2005 09:11:15 -0000 1.7 +++ index.php 13 Oct 2005 01:50:25 -0000 1.7.2.1 @@ -36,7 +36,7 @@ $result = ldap_search($ldap->connection, $base_dn, $filter); if( $result ) { $count = ldap_count_entries($ldap->connection, $result); - $title = _("Manage Shared Folders ($count Folders)"); + $title = sprintf( _("Manage Shared Folders (%d Folders)"), $count ); $template = 'sflistall.tpl'; ldap_sort($ldap->connection,$result,'cn'); $entry = ldap_first_entry($ldap->connection, $result); Index: sf.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/sf.php,v retrieving revision 1.20.2.1 retrieving revision 1.20.2.2 diff -u -d -r1.20.2.1 -r1.20.2.2 --- sf.php 28 Jul 2005 01:45:41 -0000 1.20.2.1 +++ sf.php 13 Oct 2005 01:50:25 -0000 1.20.2.2 @@ -97,7 +97,7 @@ } } } - $errors[] = _("No UID or GID $uid"); + $errors[] = sprintf( _("No UID or GID %s"), $uid); return false; } @@ -138,7 +138,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, _("Error: DN required for $action operation")); + array_push($errors, sprintf( _("Error: DN required for %s operation"), $action )); } } @@ -212,18 +212,18 @@ ($oldattrs=ldap_get_attributes($ldap->connection,$entry))) { if (!ldap_add($ldap->connection,$newdn, $ldap_object) || !ldap_delete($ldap->connection,$dn)) { - array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); } else { $messages[] = _('Shared folder updated'); } $dn = $newdn; - } else array_push($errors,_("LDAP Error: could not read $dn: ") - .ldap_error($ldap->connection)); + } else array_push($errors, sprintf(_("LDAP Error: could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { if (!ldap_modify($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not modify object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not modify object %s: %s"), $dn, + ldap_error($ldap->connection))); else $messages[] = _('Shared folder updated'); } } @@ -232,9 +232,9 @@ $dn = "cn=".$ldap_object['cn'].",".$sf_root; $ldap_object['kolabHomeServer'] = trim($_POST['kolabhomeserver']); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ") - .ldap_error($ldap->connection)); - else $messages[] = _("Shared folder '$cn' added"); + array_push($errors, sprintf(_("LDAP Error: could not add object %s: %s"), $dn, + ldap_error($ldap->connection))); + else $messages[] = sprintf( _("Shared folder '%s' added"), $cn ); } if ($errors) { //print("
Create New Address Book Entry
\n"); @@ -266,7 +266,7 @@ $heading = _('Modify Shared Folder'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN $dn")); + array_push($errors, sprintf( _("Error: No results returned for DN %s"), $dn )); } break; case 'delete': @@ -281,17 +281,17 @@ $heading = _('Delete Shared Folder'); $content = $form->outputForm(); } else { - array_push($errors, _("Error: No results returned for DN $dn")); + array_push($errors, sprintf( _("Error: No results returned for DN %s"), $dn) ); } break; case 'kill': if (!$errors) { if( $ldap->deleteSharedFolder($dn) ) { - $messages[] = _('Shared folder ').$_REQUEST['cn']._(' marked for deletion'); + $messages[] = sprintf( _("Shared folder %s marked for deletion"), $_REQUEST['cn'] );; $heading = _('Entry Deleted'); $contenttemplate = 'sfdeleted.tpl'; } else { - array_push($errors, _("LDAP Error: Could not mark $dn for deletion: ").ldap_error($link)); + array_push($errors, sprintf(_("LDAP Error: Could not mark %s for deletion: %s"), $dn, ldap_error($link))); } } break; From cvs at intevation.de Thu Oct 13 03:50:27 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 03:50:43 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/user deliver.php, 1.1.2.2, 1.1.2.3 forward.php, 1.11.2.1, 1.11.2.2 index.php, 1.12, 1.12.2.1 user.php, 1.62.2.2, 1.62.2.3 Message-ID: <20051013015027.5490B1006D6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user In directory doto:/tmp/cvs-serv29446/kolab-webadmin/www/admin/user Modified Files: Tag: kolab_2_0_branch deliver.php forward.php index.php user.php Log Message: Fix for issue886 (i18n problem) Index: deliver.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/deliver.php,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 --- deliver.php 29 Aug 2005 21:28:50 -0000 1.1.2.2 +++ deliver.php 13 Oct 2005 01:50:25 -0000 1.1.2.3 @@ -71,8 +71,8 @@ } if( !$errors ) { - if( $active ) $messages[] = _("Delivery to '$inbox' successfully activated"); - else $messages[] = _("Delivery to '$inbox' successfully deactivated"); + if( $active ) $messages[] = sprintf( _("Delivery to '%s' successfully activated"), $inbox ); + else $messages[] = sprintf( _("Delivery to '%s' successfully deactivated"), $inbox ); } } Index: forward.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/forward.php,v retrieving revision 1.11.2.1 retrieving revision 1.11.2.2 diff -u -d -r1.11.2.1 -r1.11.2.2 --- forward.php 29 Aug 2005 21:28:50 -0000 1.11.2.1 +++ forward.php 13 Oct 2005 01:50:25 -0000 1.11.2.2 @@ -75,8 +75,8 @@ } if( !$errors ) { - if( $active ) $messages[] = _("Forwarding to '$address' successfully activated"); - else $messages[] = _("Forwarding to '$address' successfully deactivated"); + if( $active ) $messages[] = sprintf( _("Forwarding to '%s' successfully activated"), $address ); + else $messages[] = sprintf( _("Forwarding to '%s' successfully deactivated"), $address ); } } } Index: index.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/index.php,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -d -r1.12 -r1.12.2.1 --- index.php 22 Apr 2005 01:34:52 -0000 1.12 +++ index.php 13 Oct 2005 01:50:25 -0000 1.12.2.1 @@ -92,7 +92,7 @@ if( $result ) { $count = ldap_count_entries($ldap->connection, $result); - $title = _("Manage Email User ($count Users)"); + $title = sprintf( _("Manage Email User (%d Users)"), $count ); // if there are more than 2000 entries, split in 26 categories for every letter, // or if more than 50, put in groups, or else just show all. if (false && $count > 2000) { Index: user.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php,v retrieving revision 1.62.2.2 retrieving revision 1.62.2.3 diff -u -d -r1.62.2.2 -r1.62.2.3 --- user.php 17 Sep 2005 22:30:13 -0000 1.62.2.2 +++ user.php 13 Oct 2005 01:50:25 -0000 1.62.2.3 @@ -62,7 +62,7 @@ $domain = trim($kolab['postfix-mydomain'][0]); debug("value=$value, domain=$domain"); if( !endsWith( $value, '@'.$domain ) ) { - return _("Email address $value not in domain $domain"); + return sprintf( _("Email address %1\$s not in domain %2\$s"), $value, $domain ); } if( $ldap->countMail( $_SESSION['base_dn'], $value ) > 0 ) { @@ -114,7 +114,7 @@ $str = ''; foreach( $lst as $delegate ) { if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(mail='.$ldap->escape($delegate).')' ) ) == 0 ) { - return _("Delegate $delegate does not exist"); + return sprintf( _("Delegate %s does not exist"), $delegate ); } } return ''; @@ -127,7 +127,7 @@ foreach( $value as $v ) { $v = trim($v); if( !empty($v) && !ereg('^([0-9a-zA-Z._@ ]|-)*$', $v ) ) { - return _("Illegal user or group $v"); + return sprintf( _("Illegal user or group %s"), $v ); } } return ''; @@ -384,12 +384,12 @@ 'options' => array( _('User Account'), _('Internal User Account'), _('Group Account'), _('Resource Account') ), 'value' => 0, 'comment' => _('NOTE: An internal user is a user that will not be visible in the address book')), - 'kolabinvitationpolicy' => array( 'name' => _('Invitation Policy'), + 'kolabinvitationpolicy' => array( 'name' => _("Invitation Policy"), 'type' => 'resourcepolicy', 'policies' => array('anyone' => 4), 'validation' => 'checkpolicy', - 'comment' => _('For automatic invitation handling') . '
' . - _('NOTE: For regular accounts to use this feature, give the \'calendar\' user access to the Calendar folder') ), + 'comment' => _("For automatic invitation handling") . '
' . + _("NOTE: For regular accounts to use this feature, give the 'calendar' user access to the Calendar folder") ), 'title_0' => array( 'name' => _('Title') ) ); $entries['alias'] = array( 'name' => _('Email Aliases'), 'type' => 'textarea', @@ -430,7 +430,7 @@ if( $dn ) { $ldap_object = $ldap->read( $dn ); if( !$ldap_object ) { - array_push($errors, _("LDAP Error: No such dn: $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf(_("LDAP Error: No such dn: %s: %s"), $dn, ldap_error($ldap->connection)) ); } } @@ -466,7 +466,7 @@ $pubkeydata=file_get_contents("$kolab_prefix/etc/kolab/res_pub.pem" ); $pkey = openssl_pkey_get_public( $pubkeydata ); if( $pkey === false ) { - $sslerr = _("Could not read resource encryption public key file://$kolab_prefix/etc/kolab/res_pub.pem: "); + $sslerr = sprintf( _("Could not read resource encryption public key file://%s/etc/kolab/res_pub.pem: "), $kolab_prefix); while( $msg = openssl_error_string() ) $sslerr .= $msg.' '; $errors[] = $sslerr; @@ -569,7 +569,7 @@ $dlcn = $distlist['mail'][0]; $errors[] = _("Account DN could not be modified, distribution list '$dlcn' depends on it. To modify this account, first remove it from the distribution list."); + sprintf(_("'>'%s' depends on it. To modify this account, first remove it from the distribution list."), $dlcn); } if (($result=ldap_read($ldap->connection,$dn,"(objectclass=*)")) && @@ -599,22 +599,22 @@ unset($explodeddn[0]); $tmpbasedn = join(",",$explodeddn); if ( !$errors && !ldap_rename($ldap->connection,$dn,$tmprdn,$tmpbasedn,false) ) { - array_push($errors, _("LDAP Error: Could not rename $dn to $tmprdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $tmprdn, + ldap_error($ldap->connection))); } if ( !$errors && !ldap_add($ldap->connection,$newdn, $ldap_object) ) { - array_push($errors, _("LDAP Error: Could not rename $dn to $newdn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not rename %1\$s to %2\$s: %3\$s"), $dn, $newdn, + ldap_error($ldap->connection))); } if( !$errors ) { if( !ldap_delete($ldap->connection,$tmprdn.','.$tmpbasedn)) { - array_push($errors, _("LDAP Error: Could not remove old entry $tmprdn,$tmpbasedn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not remove old entry %s,%s: %s"), $tmprdn, $tmpbasedn, + ldap_error($ldap->connection))); } } $dn = $newdn; - } else array_push($errors,_("LDAP Error: Could not read $dn: ") - .ldap_error($ldap->connection)); + } else array_push($errors,sprintf( _("LDAP Error: Could not read %s: %s"), $dn, + ldap_error($ldap->connection))); } else { //$ldap_object = fill_up($ldap_object); if ($auth->group() == "user") { @@ -626,8 +626,8 @@ } debug_var_dump($ldap_object); if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - array_push($errors, _("LDAP Error: Could not modify object $dn: ") - .ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: Could not modify object %s: %s"), $dn, + ldap_error($ldap->connection))); } } // Check for collisions on alias @@ -638,14 +638,14 @@ $newalias = md5sum( $dn.$alias ).'@'.substr( $alias, 0, strpos( $alias, '@' ) ); $ldap_object['alias'][$i] = $newalias; if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection); + $errors[] = sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, ldap_error($ldap->connection)); } - $error[] = _("Mid-air collision detected, alias $alias renamed to $newalias"); + $error[] = sprintf( _("Mid-air collision detected, alias %1\$s renamed to %2\$s"), $alias, $newalias ); } } } $heading = _('Modify User'); - if( !$errors ) $messages[] = _("User '$dn' successfully modified"); + if( !$errors ) $messages[] = sprintf( _("User '%s' successfully modified"), $dn ); $form->setValues(); $form->entries['mail']['attrs'] = 'readonly'; $form->entries['kolabhomeserver']['attrs'] = 'readonly'; @@ -663,7 +663,7 @@ } debug("Calling ldap_add with dn=$dn"); if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) - array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection)); + array_push($errors, sprintf( _("LDAP Error: could not add object %s: %s"), $dn, ldap_error($ldap->connection)) ); // Check for mid-air collisions on mail if( $ldap->countMail( $_SESSION['base_dn'], $ldap_object['mail'], $dn ) > 0 ) { @@ -672,9 +672,9 @@ $newmail = md5sum( $dn.$mail ).'@'.substr( $mail, 0, strpos( $mail, '@' ) ); $ldap_object['uid'] = $ldap_object['mail'] = $newmail; if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not modify object %s: %s"), $dn, ldap_error($ldap->connection) ); } - $error[] = _("Mid-air collision detected, email address $mail renamed to $newmail"); + $error[] = sprintf( _("Mid-air collision detected, alias %1\$s renamed to %2\$s"), $mail, $newmail ); } // Check for collisions on alias @@ -685,9 +685,9 @@ $newalias = md5sum( $dn.$alias ).'@'.substr( $alias, 0, strpos( $alias, '@' ) ); $ldap_object['alias'][$i] = $newalias; if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { - $errors[] = _("LDAP Error: Could not modify object $dn: ").ldap_error($ldap->connection); + $errors[] = sprintf( _("LDAP Error: Could not modify object %s: %s"), $dn, ldap_error($ldap->connection)); } - $error[] = _("Mid-air collision detected, alias $alias renamed to $newalias"); + $error[] = sprintf( _("Mid-air collision detected, alias %1\$s renamed to %2\$s"), $alias, $newalias ); } } @@ -737,7 +737,7 @@ $content = $form->outputForm(); break; case 'kill': - if (!$dn) array_push($errors, _("Error: need dn for delete operation")); + if (!$dn) array_push($errors, _("Error: need DN for delete operation")); elseif ($auth->group() != "maintainer" && $auth->group() != "admin") array_push($errors, _("Error: you need administrative permissions to delete users")); @@ -750,12 +750,12 @@ $dlmail = $distlist['mail'][0]; if( !$dlmail ) $dlmail = $distlist['cn'][0]; # Compatibility with old stuff if( $distlist['member']['count'] == 1 ) { - $errors[] = _("Account could not be deleted, distribution list '$dlmail' depends on it."); + $errors[] = sprintf( _("Account could not be deleted, distribution list '%s' depends on it."), $dlmail ); } else { if( ldap_mod_del( $ldap->connection, $distlist['dn'], array('member' => $dn ) ) ) { - $messages[] = _("Account removed from distribution list '$dlmail'."); + $messages[] = sprintf( _("Account removed from distribution list '%s'."), $dlmail ); } else { - $errors[] = _("Failure to remove account from distribution list '$dlmail', account will not be deleted."); + $errors[] = sprintf( _("Failure to remove account from distribution list '%s', account will not be deleted."), $dlmail); break; } } @@ -763,7 +763,7 @@ if( !$errors ) { if (!$ldap->deleteObject($dn)) { - array_push($errors, _("LDAP Error: could not mark '$dn' for deletion: ").$ldap->error()); + array_push($errors, sprintf( _("LDAP Error: could not mark '%s' for deletion: %s"), $dn, $ldap->error())); } else { $heading = _("User Deleted"); $contenttemplate = 'userdeleted.tpl'; From cvs at intevation.de Thu Oct 13 10:37:56 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 10:37:57 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/es - New directory Message-ID: <20051013083756.BBA561006BF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es In directory doto:/tmp/cvs-serv4797/es Log Message: Directory /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es added to the repository From cvs at intevation.de Thu Oct 13 10:38:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 10:38:19 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES - New directory Message-ID: <20051013083817.A7E0C1006CF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES In directory doto:/tmp/cvs-serv4832/LC_MESSAGES Log Message: Directory /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES added to the repository From cvs at intevation.de Thu Oct 13 10:38:51 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 10:38:53 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin Makefile.am, 1.22, 1.23 Message-ID: <20051013083851.932641006BF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin In directory doto:/tmp/cvs-serv4862/kolab-webadmin Modified Files: Makefile.am Log Message: Prepare for spanish translations Index: Makefile.am =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Makefile.am 7 Oct 2005 11:27:01 -0000 1.22 +++ Makefile.am 13 Oct 2005 08:38:49 -0000 1.23 @@ -171,6 +171,8 @@ PHP_LOCALE_NL_MO = php/admin/locale/nl/LC_MESSAGES/messages.mo PHP_LOCALE_IT_PO = php/admin/locale/it/LC_MESSAGES/messages.po PHP_LOCALE_IT_MO = php/admin/locale/it/LC_MESSAGES/messages.mo +PHP_LOCALE_ES_PO = php/admin/locale/es/LC_MESSAGES/messages.po +PHP_LOCALE_ES_MO = php/admin/locale/es/LC_MESSAGES/messages.mo localedir = $(phpadmindir)/locale @@ -178,11 +180,13 @@ phplocalefrdir = $(localedir)/fr/LC_MESSAGES phplocalenldir = $(localedir)/nl/LC_MESSAGES phplocaleitdir = $(localedir)/it/LC_MESSAGES +phplocaleesdir = $(localedir)/es/LC_MESSAGES phplocalede_DATA = $(PHP_LOCALE_DE_MO) phplocalefr_DATA = $(PHP_LOCALE_FR_MO) phplocalenl_DATA = $(PHP_LOCALE_NL_MO) phplocaleit_DATA = $(PHP_LOCALE_IT_MO) +phplocalees_DATA = $(PHP_LOCALE_ES_MO) EXTRA_DIST += $(WSTOPLEVEL_FILES) \ @@ -202,7 +206,8 @@ $(PHP_LOCALE_DE_PO) \ $(PHP_LOCALE_FR_PO) \ $(PHP_LOCALE_NL_PO) \ - $(PHP_LOCALE_IT_PO) + $(PHP_LOCALE_IT_PO) \ + $(PHP_LOCALE_ES_PO) install-data-hook: $(mkinstalldirs) $(DESTDIR)$(phpadmindir)/templates_c From cvs at intevation.de Thu Oct 13 10:38:51 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 10:38:54 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES messages.po, NONE, 1.1 Message-ID: <20051013083851.B74721006CF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES In directory doto:/tmp/cvs-serv4862/kolab-webadmin/php/admin/locale/es/LC_MESSAGES Added Files: messages.po Log Message: Prepare for spanish translations --- NEW FILE: messages.po --- # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2005-10-13 10:19+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: tpl_messages.php:2 [...2018 lines suppressed...] msgstr "" #: ../include/ldap.class.php:230 #, php-format msgid "Error searching for DN for Mail=%s" msgstr "" #: ../include/ldap.class.php:260 #, php-format msgid "Error searching for DN for alias=%s: %s" msgstr "" #: ../include/ldap.class.php:273 #, php-format msgid "Error searching for DN for mail or alias %s: %s" msgstr "" #: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " msgstr "" From cvs at intevation.de Thu Oct 13 10:38:51 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 10:38:54 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include locale.php, 1.8, 1.9 mysmarty.php, 1.10, 1.11 Message-ID: <20051013083851.BFF391006D0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include In directory doto:/tmp/cvs-serv4862/kolab-webadmin/php/admin/include Modified Files: locale.php mysmarty.php Log Message: Prepare for spanish translations Index: locale.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/locale.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- locale.php 7 Oct 2005 11:27:01 -0000 1.8 +++ locale.php 13 Oct 2005 08:38:49 -0000 1.9 @@ -37,7 +37,9 @@ "nl_nl" => "nl_NL", "en" => "en_US", "en_gb" => "en_US", - "en_us" => "en_US"); + "en_us" => "en_US", + "es" => "es_ES", + "es_es" => "es_ES"); // Locales must be in the format xx_YY to be recognized by xgettext $lang = strtolower(str_replace('-','_',$lang)); Index: mysmarty.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/mysmarty.php,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- mysmarty.php 29 Aug 2005 21:28:28 -0000 1.10 +++ mysmarty.php 13 Oct 2005 08:38:49 -0000 1.11 @@ -64,7 +64,9 @@ array( 'name' => 'Italiano', 'code' => 'it_IT' ), array( 'name' => 'Néerlandais', - 'code' => 'nl_NL' ) + 'code' => 'nl_NL' ), + array( 'name' => 'Español', + 'code' => 'es_ES' ) )); } From cvs at intevation.de Thu Oct 13 14:16:57 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 14:16:59 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/user user.php, 1.69, 1.70 vacation.php, 1.18, 1.19 Message-ID: <20051013121657.A42031006DC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user In directory doto:/tmp/cvs-serv30645/kolab-webadmin/www/admin/user Modified Files: user.php vacation.php Log Message: Fixed a couple of errors in the sprintf-changes and fixed issue960 (extra newlines in vacation text) Index: user.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/user.php,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- user.php 13 Oct 2005 01:50:01 -0000 1.69 +++ user.php 13 Oct 2005 12:16:55 -0000 1.70 @@ -630,7 +630,7 @@ } $dn = $newdn; } else array_push($errors, sprintf(_("LDAP Error: Could not read %s: %s"), $dn, - ldap_error($ldap->connection)); + ldap_error($ldap->connection))); } else { //$ldap_object = fill_up($ldap_object); if ($auth->group() == "user") { @@ -642,7 +642,7 @@ } if (!ldap_modify($ldap->connection, $dn, $ldap_object)) { array_push($errors, sprintf(_("LDAP Error: Could not modify object %s: %s"), $dn, - ldap_error($ldap->connection)); + ldap_error($ldap->connection))); debug_var_dump( $ldap_object ); } } Index: vacation.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/vacation.php,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- vacation.php 29 Aug 2005 21:28:28 -0000 1.18 +++ vacation.php 13 Oct 2005 12:16:55 -0000 1.19 @@ -44,7 +44,7 @@ ($reacttospam?"if header :contains \"X-Spam-Flag\" \"YES\" { keep; stop; }\r\n":""). "vacation :addresses [ \"".join('", "', $addresses )."\" ] :days ". $_REQUEST['days']." text:\r\n". - SieveUtils::dotstuff($_REQUEST['text'])."\r\n.\r\n;\r\n\r\n"; + SieveUtils::dotstuff(trim($_REQUEST['text']))."\r\n.\r\n;\r\n\r\n"; $active = isset($_REQUEST['active']); if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) { From cvs at intevation.de Thu Oct 13 15:17:04 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 15:17:05 2005 Subject: steffen: server obmtool.conf,1.201,1.202 Message-ID: <20051013131704.634631006B4@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv31469 Modified Files: obmtool.conf Log Message: openssl updated Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.201 retrieving revision 1.202 diff -u -d -r1.201 -r1.202 --- obmtool.conf 11 Oct 2005 12:42:26 -0000 1.201 +++ obmtool.conf 13 Oct 2005 13:17:02 -0000 1.202 @@ -65,7 +65,7 @@ @install ${loc}perl-util-5.8.7-2.4.0 @install ${loc}perl-parse-5.8.7-2.4.0 @install ${loc}perl-sys-5.8.7-2.4.0 - @install ${loc}openssl-0.9.7g-2.4.1 + @install ${loc}openssl-0.9.7g-2.4.2 @install ${loc}perl-mail-5.8.7-2.4.0 @install ${loc}perl-crypto-5.8.7-2.4.0 @install ${loc}perl-xml-5.8.7-2.4.0 From cvs at intevation.de Thu Oct 13 15:17:29 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 15:17:29 2005 Subject: steffen: server obmtool.conf,1.174.2.18,1.174.2.19 Message-ID: <20051013131729.18FB61006B4@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv31487 Modified Files: Tag: kolab_2_0_branch obmtool.conf Log Message: openssl updated Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.174.2.18 retrieving revision 1.174.2.19 diff -u -d -r1.174.2.18 -r1.174.2.19 --- obmtool.conf 10 Oct 2005 15:25:43 -0000 1.174.2.18 +++ obmtool.conf 13 Oct 2005 13:17:27 -0000 1.174.2.19 @@ -65,7 +65,7 @@ @install ${loc}perl-util-5.8.7-2.4.0 @install ${loc}perl-parse-5.8.7-2.4.0 @install ${loc}perl-sys-5.8.7-2.4.0 - @install ${loc}openssl-0.9.7g-2.4.1 + @install ${loc}openssl-0.9.7g-2.4.2 @install ${loc}perl-mail-5.8.7-2.4.0 @install ${loc}perl-crypto-5.8.7-2.4.0 @install ${loc}perl-xml-5.8.7-2.4.0 From cvs at intevation.de Thu Oct 13 16:20:25 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Thu Oct 13 16:20:26 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/user vacation.php, 1.17.2.1, 1.17.2.2 Message-ID: <20051013142025.39C32101EE2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user In directory doto:/tmp/cvs-serv32391 Modified Files: Tag: kolab_2_0_branch vacation.php Log Message: Fixed issue960 (extra newlines in vacation text) Index: vacation.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/user/vacation.php,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -u -d -r1.17.2.1 -r1.17.2.2 --- vacation.php 29 Aug 2005 21:28:50 -0000 1.17.2.1 +++ vacation.php 13 Oct 2005 14:20:23 -0000 1.17.2.2 @@ -44,7 +44,7 @@ ($reacttospam?"if header :contains \"X-Spam-Flag\" \"YES\" { keep; stop; }\r\n":""). "vacation :addresses [ \"".join('", "', $addresses )."\" ] :days ". $_REQUEST['days']." text:\r\n". - SieveUtils::dotstuff($_REQUEST['text'])."\r\n.\r\n;\r\n\r\n"; + SieveUtils::dotstuff(trim($_REQUEST['text']))."\r\n.\r\n;\r\n\r\n"; $active = isset($_REQUEST['active']); if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) { From cvs at intevation.de Fri Oct 14 01:56:53 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 01:56:54 2005 Subject: steffen: server/kolabd/kolabd Makefile.am,1.2,1.3 Message-ID: <20051013235653.40FD0101FBD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd In directory doto:/tmp/cvs-serv11122/kolabd Modified Files: Makefile.am Log Message: Grrr! ldap maps did not survive the autoconfiscation Index: Makefile.am =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 16 Sep 2005 12:50:54 -0000 1.2 +++ Makefile.am 13 Oct 2005 23:56:51 -0000 1.3 @@ -43,6 +43,9 @@ templates/ldap.conf.template \ templates/main.cf.template \ templates/master.cf.template \ + templates/ldapdistlist.cf.template \ + templates/ldaptransport.cf.template \ + templates/ldapvirtual.cf.template \ templates/kolab_smtpdpolicy.conf.template \ templates/php.ini.template \ templates/proftpd.conf.template \ From cvs at intevation.de Fri Oct 14 01:56:53 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 01:56:55 2005 Subject: steffen: server/kolabd/kolabd/templates main.cf.template.in, 1.4, 1.5 resmgr.conf.template.in, 1.1, 1.2 Message-ID: <20051013235653.52875101FBE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolabd/kolabd/templates In directory doto:/tmp/cvs-serv11122/kolabd/templates Modified Files: main.cf.template.in resmgr.conf.template.in Log Message: Grrr! ldap maps did not survive the autoconfiscation Index: main.cf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/main.cf.template.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- main.cf.template.in 11 Oct 2005 12:34:32 -0000 1.4 +++ main.cf.template.in 13 Oct 2005 23:56:51 -0000 1.5 @@ -63,9 +63,11 @@ # maps canonical_maps = hash:@emailserver_confdir@/canonical -virtual_maps = hash:@emailserver_confdir@/virtual, ldap:ldapdistlist, ldap:ldapvirtual +virtual_maps = hash:@emailserver_confdir@/virtual, + ldap:@emailserver_confdir@/ldapdistlist.cf, + ldap:@emailserver_confdir@/ldapvirtual.cf relocated_maps = hash:@emailserver_confdir@/relocated -transport_maps = hash:@emailserver_confdir@/transport, ldap:ldaptransport +transport_maps = hash:@emailserver_confdir@/transport, ldap:@emailserver_confdir@/ldaptransport.cf alias_maps = hash:@emailserver_confdir@/aliases alias_database = hash:@emailserver_confdir@/aliases #virtual_mailbox_maps = $virtual_maps @@ -144,62 +146,6 @@ # Support broken clients like Microsoft Outlook Express 4.x which expect AUTH=LOGIN instead of AUTH LOGIN broken_sasl_auth_clients = yes - -# -# LDAP Alias support -# - -ldapvirtual_server_host = @@@ldap_uri@@@ -ldapvirtual_search_base = @@@user_dn_list@@@ -ldapvirtual_query_filter = (&(!(kolabDeleteFlag=*))(|(alias=%s)(mail=%s))) -ldapvirtual_result_attribute = mail -ldapvirtual_result_filter = %s -ldapvirtual_search_timeout = 15 -ldapvirtual_scope = sub -ldapvirtual_bind = yes -ldapvirtual_bind_dn = @@@php_dn@@@ -ldapvirtual_bind_pw = @@@php_pw@@@ -ldapvirtual_version = 3 - -# -# LDAP Recipient map -# - - -# -# LDAP Distributionlist support -# - -ldapdistlist_server_host = @@@ldap_uri@@@ -ldapdistlist_search_base = @@@user_dn_list@@@ -ldapdistlist_domain = $mydestination -ldapdistlist_query_filter = (&(objectClass=kolabGroupOfNames)(!(kolabDeleteFlag=*))(mail=%s)) -ldapdistlist_special_result_attribute = member -ldapdistlist_exclude_internal = yes -ldapdistlist_result_attribute = mail -ldapdistlist_result_filter = %s -ldapdistlist_search_timeout = 15 -ldapdistlist_scope = sub -ldapdistlist_bind = yes -ldapdistlist_bind_dn = @@@php_dn@@@ -ldapdistlist_bind_pw = @@@php_pw@@@ -ldapdistlist_version = 3 - -# -# LDAP Transport for multilocation support -# - -ldaptransport_server_host = @@@ldap_uri@@@ -ldaptransport_search_base = @@@user_dn_list@@@ -ldaptransport_query_filter = (&(mail=%s)(objectClass=kolabInetOrgPerson)(!(kolabHomeServer=$myhostname))) -ldaptransport_result_attribute = kolabHomeServer -ldaptransport_result_filter = smtp:[%s] -ldaptransport_search_timeout = 15 -ldaptransport_scope = sub -ldaptransport_bind = yes -ldaptransport_bind_dn = @@@php_dn@@@ -ldaptransport_bind_pw = @@@php_pw@@@ -ldaptransport_version = 3 @@@if postfix-enable-virus-scan@@@ # Index: resmgr.conf.template.in =================================================================== RCS file: /kolabrepository/server/kolabd/kolabd/templates/resmgr.conf.template.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- resmgr.conf.template.in 13 Sep 2005 14:38:22 -0000 1.1 +++ resmgr.conf.template.in 13 Oct 2005 23:56:51 -0000 1.2 @@ -15,6 +15,9 @@ // '@domain' specified after their username as part of their email address. $params['email_domain'] = '@@@postfix-mydomain@@@'; +// List of kolab hosts that are priviledged +$params['kolabhosts'] = '@@@kolabhost|join(,)@@@'; + // Are we using virtual domains with Cyrus? $params['virtual_domains'] = true; From cvs at intevation.de Fri Oct 14 02:37:42 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 02:37:43 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder sf.php, 1.23, 1.24 Message-ID: <20051014003742.951FE1005AC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder In directory doto:/tmp/cvs-serv11854/admin/sharedfolder Modified Files: sf.php Log Message: syntax error Index: sf.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/sharedfolder/sf.php,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- sf.php 13 Oct 2005 01:50:01 -0000 1.23 +++ sf.php 14 Oct 2005 00:37:40 -0000 1.24 @@ -140,7 +140,7 @@ if( $_REQUEST['dn'] ) { $dn = $_REQUEST['dn']; } else { - array_push($errors, sprintf(_("Error: DN required for %s operation"), $action); + array_push($errors, sprintf(_("Error: DN required for %s operation"), $action)); } } From cvs at intevation.de Fri Oct 14 03:04:22 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 03:04:23 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES messages.po, 1.3, 1.4 Message-ID: <20051014010422.C19CD101FA5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES In directory doto:/tmp/cvs-serv12205/kolab-webadmin/php/admin/locale/it/LC_MESSAGES Modified Files: messages.po Log Message: updated italian translations Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES/messages.po,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- messages.po 13 Oct 2005 01:50:01 -0000 1.3 +++ messages.po 14 Oct 2005 01:04:20 -0000 1.4 @@ -1,11 +1,3 @@ -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to # This file is distributed under the same license as the PACKAGE package. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER. # Benoit Mortier , 2005. @@ -15,8 +7,8 @@ "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2005-10-13 03:40+0200\n" -"PO-Revision-Date: 2005-07-22 23:43+0100\n" -"Last-Translator: Alessandro Fiorino \n" +"PO-Revision-Date: 2005-10-14 23:43+0100\n" +"Last-Translator: Yvette Agostini \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -220,7 +212,7 @@ "for the implementation of the Kolab 2 server and the Kolab 2 clients." msgstr "" "Il concetto alla base di Kolab è nato da Erfrakon; la compagnia ha anche progettato e implementato il Server " +"\">Erfrakon; la società ha anche progettato e implementato il Server " "Kolab 1 e ha progettato l'architettura del Server Kolab 2 mentre forniva " "consulenza per l'implementazione del Server Kolab 2 e dei Client Kolab 2." @@ -232,13 +224,13 @@ "Kolab groupware solution and the creation of the Kolab 1 server." msgstr "" "erfrakon è una compagnia di " -"consulenza dedicata al software opensource e Linux. Il compito principale " +"consulenza dedicata al software opensource e Linux. I compiti principali " "della efrakon nel progetto Kolab sono il progetto dell'architettura della " "soluzione di groupware Kolab e la crezione del server Kolab 1." #: tpl_messages.php:41 msgid "The following people worked on Kolab for erfrakon:" -msgstr "Le seguenti persone hanno lavorato su Kolab per conto della erfrakon:" +msgstr "Le seguenti persone hanno lavorato a Kolab per conto della erfrakon:" #: tpl_messages.php:43 tpl_messages.php:53 tpl_messages.php:224 #: ../../../www/admin/user/index.php:170 @@ -282,7 +274,7 @@ #: tpl_messages.php:60 msgid "Kolab builds upon many other Free Software projects, namely:" msgstr "" -"Kolab è costruito sopra molti altri progetti Free Software, precisamente:" +"Kolab è costruito sulla base di molti altri progetti Free Software, precisamente:" #: tpl_messages.php:61 msgid "(HTTP Server)" @@ -309,12 +301,12 @@ "The following projects are used in binding the above together, in order to " "create the Kolab Server:" msgstr "" -"I seguenti progetti sono usati per collegare i suddetti assieme, per creare " +"I seguenti progetti sono stati usati come collegamento di quelli suindicati, per creare " "il Server Kolab:" #: tpl_messages.php:67 msgid "The following projects are used as a base for the Kolab Clients:" -msgstr "I seguenti progetti sono usati come base per i Client Kolab:" +msgstr "I seguenti progetti sono stati usati come base per i Client Kolab:" #: tpl_messages.php:68 msgid "" @@ -339,10 +331,10 @@ "client solution." msgstr "" "Per usare tutte le capacità di Kolab2 necessitate di un client compatibile. " -"Il Client Kolab KDE è stato il primo di questi client ad essere sviluppato " +"Il Client Kolab KDE è stato il primo ad essere sviluppato " "ed è ancora considerato la piattaforma di riferimento per gli altri che " "hanno seguito. Il componente KDE di groupware Kontact può funzionare come " -"Client Kolab2. Molti ringraziamento al KDE " +"Client Kolab2. Molti ringraziamenti vanno al KDE " "Project per aver fornito una base così potente su cui costruire questo " "client." @@ -354,11 +346,11 @@ "Network Technologies CC. Radley has worked closely with the Kolab community " "to help develop the Kolab2 storage format." msgstr "" -"Utenti di Outlook su Microsoft Windows possono usare plug-in proprietari per " +"Gli utenti di Outlook su Microsoft Windows possono usare plug-in proprietari per " "interagire con il server Kolab. Per Kolab2 il plug-in preferito è ilToltec Plug-in della Radley Network " "Technologies CC. Radley ha lavorato a stretto contatto con la comunità Kolab " -"ed ha aiutato a sviluppare il formato di memorizzazione di Kolab2." +"ed ha aiutato nello sviluppo del formato di memorizzazione di Kolab2." #: tpl_messages.php:71 msgid "" @@ -380,8 +372,8 @@ "without the excellent Horde project on " "which to build." msgstr "" -"C'è anche un client web " -"in sviluppo che fornisce complete funzionalità groupware agli utenti mobile " +"E' anche in sviluppo un client web " +"che fornisce complete funzionalità groupware agli utenti mobile " "tramite un'interfaccia web. Permette agli utenti di accedere all'email, " "calendario, attività, ecc. da dovunque nel mondo, semplicemente " "connettendosi attraverso un browser web. Il client web non sarebbe stato " @@ -417,7 +409,7 @@ "the Kolab2 storage format." msgstr "" "Code Fusion cc si è unita al " -"progetto poco dopo il rilascioa del server Kolab1 originale. I suoi " +"progetto poco dopo il rilascio del server Kolab1 originale. I suoi " "sviluppatori sono principalmente responsabili per il motore aggiornato (che " "forma la base del server Kolab2), il client web, così come hanno contribuito " "allo sviluppo del formato di memorizzazione di Kolab2." @@ -455,7 +447,6 @@ msgstr "Filtro" #: tpl_messages.php:85 -#, fuzzy msgid "Entry deleted, awaiting cleanup..." msgstr "Cartella cancellata, in attesa della pulizia..." @@ -496,8 +487,8 @@ "you have not yet created an account for this, please do so and then go" msgstr "" "Nessun account è configurato per ricevere mail per gli indirizzi " -"amministrativi. Se non avete ancora creato un account per questo, siete " -"pregati di farlo per poi proseguire" +"amministrativi. Se non è stato ancora creato un account per questo, fatelo " +"prima di proseguire" #: tpl_messages.php:95 msgid "here" @@ -548,7 +539,6 @@ msgstr "Pubblico" #: tpl_messages.php:108 -#, fuzzy msgid "List deleted, awaiting cleanup..." msgstr "Utente cancellato, in attesa di pulizia..." @@ -577,7 +567,7 @@ msgid "" "The following people worked on Kolab for Klarälvdalens Datakonsult AB:" msgstr "" -"Le seguenti persone hanno lavorato su Kolab per la Klarälvdalens " +"Le seguenti persone hanno lavorato a Kolab per la Klarälvdalens " "Datakonsult AB:" #: tpl_messages.php:114 @@ -731,7 +721,6 @@ msgstr "Server Relay SMTP ( \"smarthost/relayhost\")" #: tpl_messages.php:154 -#, fuzzy msgid "" "Smarthost (and optional port) to use to send outgoing mail (host.domain." "tld). Leave empty for no relayhost." @@ -840,7 +829,7 @@ #: tpl_messages.php:179 msgid "The following people worked on Kolab for Intevation:" -msgstr "Le seguenti persone hanno lavorato su Kolab per Intevation:" +msgstr "Le seguenti persone hanno lavorato a Kolab per Intevation:" #: tpl_messages.php:180 msgid "Vacation Notification" @@ -1057,12 +1046,12 @@ msgstr "Lo script era:" #: ../../../www/admin/user/deliver.php:74 -#, fuzzy, php-format +#, php-format msgid "Delivery to '%s' successfully activated" msgstr "Messagio di assenza attivato con successo" #: ../../../www/admin/user/deliver.php:75 -#, fuzzy, php-format +#, php-format msgid "Delivery to '%s' successfully deactivated" msgstr "Messagio di assenza disattivato con successo" @@ -1076,17 +1065,17 @@ #: ../../../www/admin/user/forward.php:64 ../../../www/admin/user/user.php:59 msgid "Please enter an email address" -msgstr "Prego inserire un indirizzo email" +msgstr "Si prega di inserire un indirizzo email" #: ../../../www/admin/user/forward.php:78 -#, fuzzy, php-format +#, php-format msgid "Forwarding to '%s' successfully activated" -msgstr "Messagio di assenza attivato con successo" +msgstr "Messaggio di assenza attivato con successo" #: ../../../www/admin/user/forward.php:79 -#, fuzzy, php-format +#, php-format msgid "Forwarding to '%s' successfully deactivated" -msgstr "Messagio di assenza disattivato con successo" +msgstr "Messaggio di assenza disattivato con successo" #: ../../../www/admin/user/index.php:33 #: ../../../www/admin/sharedfolder/index.php:22 @@ -1100,10 +1089,10 @@ #: ../../../www/admin/addressbook/index.php:21 #: ../../../www/admin/domainmaintainer/index.php:32 msgid "Error: You don't have Permissions to access this Menu" -msgstr "Errore: non avete i permessi per accedere a questo Menù" +msgstr "Errore: non si hanno i permessi per accedere a questo Menù" #: ../../../www/admin/user/index.php:106 -#, fuzzy, php-format +#, php-format msgid "Manage Email User (%d Users)" msgstr "Gestione Utenti Email" @@ -1135,7 +1124,7 @@ #: ../../../www/admin/user/user.php:76 #, php-format msgid "Email address %1$s not in domains %2$s" -msgstr "" +msgstr "L'indirizzo email non è nel dominio " #: ../../../www/admin/user/user.php:79 #: ../../../www/admin/addressbook/addr.php:71 @@ -1160,12 +1149,12 @@ #: ../../../www/admin/user/user.php:127 #, php-format msgid "Delegate %s does not exist" -msgstr "" +msgstr "Il delegato non esiste" #: ../../../www/admin/user/user.php:140 #, php-format msgid "Illegal user or group %s" -msgstr "" +msgstr "Utente o gruppo non lecito " #: ../../../www/admin/user/user.php:151 #: ../../../www/admin/maintainer/maintainer.php:60 @@ -1187,7 +1176,7 @@ #: ../../../www/admin/user/user.php:339 #: ../../../www/admin/sharedfolder/sf.php:112 #: ../../../www/admin/maintainer/maintainer.php:137 -#: ../../../www/admin/administrator/admin.php:144 +#: ../.../../www/admin/administrator/admin.php:144 #: ../../../www/admin/distributionlist/list.php:106 #: ../../../www/admin/addressbook/addr.php:101 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:112 @@ -1200,7 +1189,7 @@ #: ../../../www/admin/addressbook/addr.php:104 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:118 msgid "Error: You don't have the required Permissions" -msgstr "Errore: non avete i permessi richiesti" +msgstr "Errore: non si hanno i permessi richiesti" #: ../../../www/admin/user/user.php:367 ../../../www/admin/user/user.php:369 #: ../../../www/admin/sharedfolder/sf.php:126 @@ -1301,23 +1290,23 @@ #: ../../../www/admin/maintainer/maintainer.php:179 #: ../../../www/admin/administrator/admin.php:186 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:159 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: No such dn: %s: %s" -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: non esiste un dn " #: ../../../www/admin/user/user.php:485 #, php-format msgid "" "Could not read resource encryption public key file://%s/etc/kolab/res_pub." "pem: " -msgstr "" +msgstr "Non è possibile leggere il file con la chiave pubblica" #: ../../../www/admin/user/user.php:492 msgid "Could not encrypt password: " -msgstr "Impossibile cifrare la password" +msgstr "E' impossibile cifrare la password" #: ../../../www/admin/user/user.php:587 -#, fuzzy, php-format +#, php-format msgid "" "Account DN could not be modified, distribution list '%s' depends on it. To " @@ -1328,42 +1317,42 @@ #: ../../../www/admin/user/user.php:617 ../../../www/admin/user/user.php:621 #: ../../../www/admin/distributionlist/list.php:195 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not rename %1$s to %2$s: %3$s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/user/user.php:626 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove old entry %s,%s: %s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/user/user.php:632 #: ../../../www/admin/distributionlist/list.php:201 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not read %s: %s" -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: è impossibile leggere" #: ../../../www/admin/user/user.php:644 ../../../www/admin/user/user.php:657 #: ../../../www/admin/user/user.php:694 ../../../www/admin/user/user.php:709 #: ../../../www/admin/distributionlist/list.php:205 #: ../../../www/admin/distributionlist/list.php:234 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not modify object %s: %s" -msgstr "Errore LDAP: impossibile modificare l'oggetto" +msgstr "Errore LDAP: è impossibile modificare l'oggetto" #: ../../../www/admin/user/user.php:660 ../../../www/admin/user/user.php:712 #, php-format msgid "Mid-air collision detected, alias %1$s renamed to %2$s" -msgstr "" +msgstr "Collisione. L'alias è stato rinominato " #: ../../../www/admin/user/user.php:665 ../../../www/admin/user/user.php:745 msgid "Modify User" msgstr "Modifica utente" #: ../../../www/admin/user/user.php:666 -#, fuzzy, php-format +#, php-format msgid "User '%s' successfully modified" -msgstr " modificato con successo" +msgstr "L'utente è stato modificato con successo" #: ../../../www/admin/user/user.php:684 #: ../../../www/admin/sharedfolder/sf.php:237 @@ -1371,15 +1360,15 @@ #: ../../../www/admin/administrator/admin.php:279 #: ../../../www/admin/addressbook/addr.php:220 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:260 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not add object %s: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/user/user.php:697 #: ../../../www/admin/distributionlist/list.php:237 #, php-format msgid "Mid-air collision detected, email address %1$s renamed to %2$s" -msgstr "" +msgstr "Collisione. L'indirizzo email è stato rinominato" #: ../../../www/admin/user/user.php:718 msgid "User " @@ -1405,18 +1394,17 @@ #: ../../../www/admin/maintainer/maintainer.php:324 #: ../../../www/admin/administrator/admin.php:334 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:313 -#, fuzzy msgid "Error: need DN for delete operation" -msgstr "Errore: richiesto dn per operazione di cancellazione" +msgstr "Errore: per l'operazione di cancellazione è richiesto il DN" #: ../../../www/admin/user/user.php:765 #: ../../../www/admin/maintainer/maintainer.php:326 msgid "Error: you need administrative permissions to delete users" msgstr "" -"Errore: bisogna avere i permessi di amministratore per cancellare utenti" +"Errore: sono necessari i permessi di amministratore per cancellare utenti" #: ../../../www/admin/user/user.php:777 -#, fuzzy, php-format +#, php-format msgid "Account could not be deleted, distribution list '%s' depends on it." msgstr "" "Il DN dell'account non può essere modificato, la lista di distribuzione " -msgstr "" +msgstr "" #: ../../../www/admin/sharedfolder/index.php:52 -#, fuzzy, php-format +#, php-format msgid "Manage Shared Folders (%d Folders)" msgstr "Gestione Cartelle Condivise" @@ -1517,7 +1506,7 @@ #: ../../../www/admin/sharedfolder/sf.php:101 #, php-format msgid "No UID or GID %s" -msgstr "" +msgstr "Nessun UID o GID " #: ../../../www/admin/sharedfolder/sf.php:117 msgid "Folder Name" @@ -1542,9 +1531,9 @@ #: ../../../www/admin/sharedfolder/sf.php:143 #: ../../../www/admin/distributionlist/list.php:135 #: ../../../www/admin/addressbook/addr.php:142 -#, fuzzy, php-format +#, php-format msgid "Error: DN required for %s operation" -msgstr "Errore: richiesto dn per operazione di cancellazione" +msgstr "Errore: per l'operazione di cancellazione è necessario il DN" #: ../../../www/admin/sharedfolder/sf.php:153 ../include/menu.php:55 msgid "Add Shared Folder" @@ -1554,37 +1543,37 @@ #: ../../../www/admin/maintainer/maintainer.php:226 #: ../../../www/admin/administrator/admin.php:233 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:206 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not rename %1$s to %2$s: %3$s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/sharedfolder/sf.php:220 #: ../../../www/admin/sharedfolder/sf.php:229 msgid "Shared folder updated" -msgstr "Cartella Condivisa aggiornata" +msgstr "La cartella condivisa è stata aggiornata" #: ../../../www/admin/sharedfolder/sf.php:223 #: ../../../www/admin/maintainer/maintainer.php:250 #: ../../../www/admin/administrator/admin.php:257 #: ../../../www/admin/addressbook/addr.php:203 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:235 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not read %s: %s" -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: è impossibile leggere" #: ../../../www/admin/sharedfolder/sf.php:227 #: ../../../www/admin/maintainer/maintainer.php:254 #: ../../../www/admin/administrator/admin.php:261 #: ../../../www/admin/addressbook/addr.php:208 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:239 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not modify object %s: %s" -msgstr "Errore LDAP: impossibile modificare l'oggetto" +msgstr "Errore LDAP: è impossibile modificare l'oggetto" #: ../../../www/admin/sharedfolder/sf.php:239 -#, fuzzy, php-format +#, php-format msgid "Shared folder '%s' added" -msgstr "Cartella Condivisa aggiornata" +msgstr "La cartella condivisa è stata aggiornata" #: ../../../www/admin/sharedfolder/sf.php:251 #: ../../../www/admin/sharedfolder/sf.php:268 @@ -1596,7 +1585,7 @@ #: ../../../www/admin/distributionlist/list.php:289 #, php-format msgid "Error: No results returned for DN '%s'" -msgstr "" +msgstr "Errore: non è stato trovato nessun DN " #: ../../../www/admin/sharedfolder/sf.php:283 msgid "Delete Shared Folder" @@ -1617,23 +1606,23 @@ msgstr "Voce Cancellata" #: ../../../www/admin/sharedfolder/sf.php:296 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not mark %s for deletion: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/service/index.php:97 #, php-format msgid "No account found for email address %s" -msgstr "" +msgstr "Nessun account è stato trovato per l'indirizzo email " #: ../../../www/admin/service/index.php:105 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Failed to add distribution list %s: %s" msgstr "" "Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " #: ../../../www/admin/service/index.php:107 -#, fuzzy, php-format +#, php-format msgid "Successfully created distribution list %s" msgstr "Crea liste di distribuzione" @@ -1649,13 +1638,13 @@ #: ../../../www/admin/service/index.php:232 #: ../../../www/admin/service/index.php:249 #: ../../../www/admin/service/index.php:262 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: failed to modify kolab configuration object: %s" msgstr "" "Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " #: ../../../www/admin/service/index.php:220 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Failed to delete domain object %s: %s" msgstr "" "Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " @@ -1725,23 +1714,23 @@ #: ../../../www/admin/maintainer/maintainer.php:230 #: ../../../www/admin/administrator/admin.php:237 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:210 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not remove old entry %s: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/maintainer/maintainer.php:240 #: ../../../www/admin/administrator/admin.php:247 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:220 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not add new group entry %s: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/maintainer/maintainer.php:245 #: ../../../www/admin/administrator/admin.php:252 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:225 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove old group entry %s: %s" -msgstr "Errore LDAP: impossibile modificare l'oggetto" +msgstr "Errore LDAP: è impossibile modificare l'oggetto" #: ../../../www/admin/maintainer/maintainer.php:259 #: ../../../www/admin/maintainer/maintainer.php:306 @@ -1763,9 +1752,9 @@ #: ../../../www/admin/maintainer/maintainer.php:275 #: ../../../www/admin/administrator/admin.php:285 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:264 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not add object %s to maintainer group: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/maintainer/maintainer.php:280 #: ../../../www/admin/maintainer/maintainer.php:286 @@ -1779,16 +1768,16 @@ #: ../../../www/admin/maintainer/maintainer.php:330 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:319 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove %s from maintainer group: %s" -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +msgstr "Errore LDAP: è impossibile la rimozione dal gruppo dei maintainer:" #: ../../../www/admin/maintainer/maintainer.php:336 #: ../../../www/admin/administrator/admin.php:345 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:325 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not mark %s for deletion: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/maintainer/maintainer.php:342 msgid "Maintainer Deleted" @@ -1821,13 +1810,13 @@ #: ../../../www/admin/administrator/admin.php:336 msgid "Error: you need administrative permissions to delete administrators" msgstr "" -"Errore: devi avere i permessi di amministrazione per cancellare degli " +"Errore: sono necessari i permessi di amministrazione per cancellare degli " "amministratori" #: ../../../www/admin/administrator/admin.php:340 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove %s from admin group: %s" -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +msgstr "Errore LDAP: la rimozione dal gruppo degli amministratori non è possibile:" #: ../../../www/admin/administrator/admin.php:351 msgid "Administrator Deleted" @@ -1843,12 +1832,12 @@ #: ../../../www/admin/distributionlist/list.php:46 msgid "Please add at least one member" -msgstr "Prego aggiungere almeno un membro" +msgstr "Aggiungere almeno un membro" #: ../../../www/admin/distributionlist/list.php:50 #, php-format msgid "No user with email address, UID or alias %s" -msgstr "" +msgstr "Nessun utente presente con questo indirizzo email, UID o alias " #: ../../../www/admin/distributionlist/list.php:62 msgid "User or distribution list with this email address already exists" @@ -1876,7 +1865,7 @@ "Check here to make this distribution list available only to authenticated " "users" msgstr "" -"Selezionare qui per rendere questa lista di distribuzione disponibile sono " +"Selezionare qui per rendere questa lista di distribuzione disponibile solo " "agli utenti autenticati" #: ../../../www/admin/distributionlist/list.php:145 @@ -1886,7 +1875,7 @@ #: ../../../www/admin/distributionlist/list.php:179 #, php-format msgid "No user with address %s" -msgstr "" +msgstr "Non sono presenti utenti con questo indirizzo" #: ../../../www/admin/distributionlist/list.php:198 #: ../../../www/admin/distributionlist/list.php:207 @@ -1894,12 +1883,12 @@ msgstr "Lista di Distribuzione aggiornata" #: ../../../www/admin/distributionlist/list.php:216 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not add object %s: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/distributionlist/list.php:245 -#, fuzzy, php-format +#, php-format msgid "Distribution List '%s' added" msgstr "Lista di Distribuzione aggiornata" @@ -1910,8 +1899,8 @@ #: ../../../www/admin/distributionlist/list.php:274 #, php-format -msgid "Error: No results returned for DN ''" -msgstr "" +msgid "Error: No results returned for DN '%s'" +msgstr "Errore: nessun risultato per il DN '%s'" #: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" @@ -1926,12 +1915,12 @@ msgstr " cancellata" #: ../../../www/admin/distributionlist/list.php:300 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Nould not delete %s: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/distributionlist/index.php:53 -#, fuzzy, php-format +#, php-format msgid "Manage Distribution Lists (%d Lists)" msgstr "Gestione Liste di Distribuzione" @@ -1956,18 +1945,18 @@ msgstr "Aggiungi indirizzi esterni" #: ../../../www/admin/addressbook/addr.php:196 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not rename %s to %s: %s" msgstr "Errore LDAP: impossibile rinominare" #: ../../../www/admin/addressbook/addr.php:199 #: ../../../www/admin/addressbook/addr.php:211 -#, fuzzy, php-format +#, php-format msgid "%s successfully updated" msgstr " creato con successo" #: ../../../www/admin/addressbook/addr.php:223 -#, fuzzy, php-format +#, php-format msgid "%s successfully added" msgstr " creato con successo" @@ -1987,27 +1976,25 @@ msgstr "Cancella Indirizzo Esterno" #: ../../../www/admin/addressbook/addr.php:286 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not delete %s: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/addressbook/addr.php:290 #, php-format msgid "Address book entry with DN %s was deleted" -msgstr "" +msgstr "La voce di Rubrica è stata cancellata" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:149 msgid "Check domains this domain maintainer should be able to maintain" -msgstr "" +msgstr "Selezionare quali domini il maintainer può amministrare" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:250 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:295 -#, fuzzy msgid "Modify Domain Maintainer" msgstr "Modifica Maintainer" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:271 -#, fuzzy msgid "Domain maintainer " msgstr "Maintainer " @@ -2015,24 +2002,20 @@ #: ../../../www/admin/domainmaintainer/domainmaintainer.php:276 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:286 #: ../include/menu.php:77 -#, fuzzy msgid "Create New Domain Maintainer" msgstr "Crea un nuovo Maintainer" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:301 -#, fuzzy msgid "Delete Domain Maintainer" msgstr "Cancella un Maintainer" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:315 -#, fuzzy msgid "Error: you need administrative permissions to delete domain maintainers" msgstr "" -"Errore: devi avere i permessi di amministrazione per cancellare degli " +"Errore: sono necessari permessi di amministrazione per cancellare degli " "amministratori" #: ../../../www/admin/domainmaintainer/domainmaintainer.php:331 -#, fuzzy msgid "Domain Maintainer Deleted" msgstr "Maintainer Cancellato" @@ -2093,12 +2076,10 @@ msgstr "Gestione Amministratori" #: ../include/menu.php:73 -#, fuzzy msgid "Domain Maintainers" msgstr "Gestione Maintainer" #: ../include/menu.php:75 -#, fuzzy msgid "Manage Domain Maintainers" msgstr "Gestione Maintainer" @@ -2196,11 +2177,11 @@ #: ../include/auth.class.php:45 msgid "Could not bind to LDAP server: " -msgstr "Non riesco a collegarmi con il server LDAP:" +msgstr "Non è possibile il collegamento con il server LDAP:" #: ../include/auth.class.php:56 msgid "Could not bind to LDAP server" -msgstr "Non riesco a collegarmi con il server LDAP" +msgstr "Il collegamento con il server LDAP non è possibile" #: ../include/auth.class.php:83 ../include/auth.class.php:87 msgid "Wrong username or password" @@ -2214,14 +2195,14 @@ msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" msgstr "" -"Errore impostanto il protocollo LDAP alla versione 3. Prego contattare " +"Si è verificato un errore impostando il protocollo LDAP alla versione 3. Contattare " "l'amministratore di sistema" #: ../include/ldap.class.php:184 ../include/ldap.class.php:214 #: ../include/ldap.class.php:244 #, php-format msgid "No such object %s" -msgstr "" +msgstr "Questo oggetto non esiste" #: ../include/ldap.class.php:187 ../include/ldap.class.php:217 #: ../include/ldap.class.php:247 @@ -2232,26 +2213,26 @@ #: ../include/ldap.class.php:200 #, php-format msgid "Error searching for DN for UID=%s" -msgstr "" +msgstr "Errore nella ricerca del DN per l'utente" #: ../include/ldap.class.php:230 #, php-format msgid "Error searching for DN for Mail=%s" -msgstr "" +msgstr "Errore nella ricerca del DN per la Mail" #: ../include/ldap.class.php:260 #, php-format msgid "Error searching for DN for alias=%s: %s" -msgstr "" +msgstr "Errore nella ricerca del DN per l'alias: " #: ../include/ldap.class.php:273 #, php-format msgid "Error searching for DN for mail or alias %s: %s" -msgstr "" +msgstr "Errore nella ricerca del DN per la mail o l'alias: " #: ../include/ldap.class.php:336 msgid "LDAP Error: Can't read maintainers group: " -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +msgstr "Errore LDAP: è impossibile leggere il gruppo dei maintainer:" #~ msgid "Enable MX lookup for relayhost (if in doubt, leave it off)" #~ msgstr "" From cvs at intevation.de Fri Oct 14 03:04:22 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 03:04:26 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist list.php, 1.21, 1.22 Message-ID: <20051014010422.D5436101FBD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist In directory doto:/tmp/cvs-serv12205/kolab-webadmin/www/admin/distributionlist Modified Files: list.php Log Message: updated italian translations Index: list.php =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/www/admin/distributionlist/list.php,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- list.php 13 Oct 2005 01:50:01 -0000 1.21 +++ list.php 14 Oct 2005 01:04:20 -0000 1.22 @@ -271,7 +271,7 @@ $heading = _('Modify Distribution List'); $content = $form->outputForm(); } else { - array_push($errors, sprintf( _("Error: No results returned for DN ''"), $dn)); + array_push($errors, sprintf( _("Error: No results returned for DN '%s'"), $dn)); } break; case 'delete': From cvs at intevation.de Fri Oct 14 03:07:35 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 03:07:36 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES messages.po, 1.1.2.2, 1.1.2.3 Message-ID: <20051014010735.D281F101FA5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES In directory doto:/tmp/cvs-serv12474/it/LC_MESSAGES Modified Files: Tag: kolab_2_0_branch messages.po Log Message: updated italian translations Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES/messages.po,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 --- messages.po 13 Oct 2005 01:50:24 -0000 1.1.2.2 +++ messages.po 14 Oct 2005 01:07:33 -0000 1.1.2.3 @@ -1,11 +1,3 @@ -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to -# translation of messages.po to # This file is distributed under the same license as the PACKAGE package. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER. # Benoit Mortier , 2005. @@ -16,7 +8,7 @@ "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2005-10-13 01:19+0200\n" "PO-Revision-Date: 2005-07-22 23:43+0100\n" -"Last-Translator: Alessandro Fiorino \n" +"Last-Translator: Yvette Agostini \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -76,7 +68,7 @@ #: tpl_messages.php:12 tpl_messages.php:192 msgid "[ OTHER ]" -msgstr "[ ALTRI ]" +msgstr "[ ALTRO ]" #: tpl_messages.php:13 tpl_messages.php:193 msgid "Filter:" @@ -87,7 +79,6 @@ msgstr "Filtro" #: tpl_messages.php:17 -#, fuzzy msgid "Entry deleted, awaiting cleanup..." msgstr "Cartella cancellata, in attesa della pulizia..." @@ -139,7 +130,7 @@ "The following people from Code Fusion are involved in the Kolab project (in " "alphabetical order):" msgstr "" -"Il seguente personale di Code Fusion prendono parte al progetto Kolab (in " +"Il seguente personale di Code Fusion prende parte al progetto Kolab (in " "ordine alfabetico):" #: tpl_messages.php:32 @@ -281,7 +272,7 @@ #: tpl_messages.php:60 ../../../www/admin/user/user.php:414 msgid "Leave blank for unlimited" -msgstr "Lasciare bianco per illimitata" +msgstr "Lasciare vuoto per illimitata" #: tpl_messages.php:61 ../include/form.class.php:40 msgid "Submit" @@ -342,7 +333,7 @@ "for the implementation of the Kolab 2 server and the Kolab 2 clients." msgstr "" "Il concetto alla base di Kolab è nato da Erfrakon; la compagnia ha anche progettato e implementato il Server " +"\">Erfrakon; questa società ha anche progettato e implementato il Server " "Kolab 1 e ha progettato l'architettura del Server Kolab 2 mentre forniva " "consulenza per l'implementazione del Server Kolab 2 e dei Client Kolab 2." @@ -389,7 +380,7 @@ "Intevation did most of the quality assurance." msgstr "" "Intevation GmbH coordina i Progetti: Kroupware e Proko2, che sono la " -"principale forza guida dietro Kolab1&2. In aggiunta al management del " +"principale forza guida dietro Kolab1&2. Oltre al management del " "progetto Intevation ha effettuato buona parte del controllo qualità." #: tpl_messages.php:84 @@ -489,7 +480,7 @@ #: tpl_messages.php:94 msgid "Kolab builds upon many other Free Software projects, namely:" msgstr "" -"Kolab è costruito sopra molti altri progetti Free Software, precisamente:" +"Kolab è costruito sulla base di molti altri progetti Free Software, precisamente:" #: tpl_messages.php:95 msgid "(HTTP Server)" @@ -516,7 +507,7 @@ "The following projects are used in binding the above together, in order to " "create the Kolab Server:" msgstr "" -"I seguenti progetti sono usati per collegare i suddetti assieme, per creare " +"I seguenti progetti sono stati usati per collegare i suddetti assieme, per creare " "il Server Kolab:" #: tpl_messages.php:101 @@ -561,7 +552,7 @@ "Network Technologies CC. Radley has worked closely with the Kolab community " "to help develop the Kolab2 storage format." msgstr "" -"Utenti di Outlook su Microsoft Windows possono usare plug-in proprietari per " +"Gli utenti di Outlook su Microsoft Windows possono usare plug-in proprietari per " "interagire con il server Kolab. Per Kolab2 il plug-in preferito è ilToltec Plug-in della Radley Network " "Technologies CC. Radley ha lavorato a stretto contatto con la comunità Kolab " @@ -587,8 +578,8 @@ "without the excellent Horde project on " "which to build." msgstr "" -"C'è anche un client web " -"in sviluppo che fornisce complete funzionalità groupware agli utenti mobile " +"E' anche in sviluppo un client web " +"che fornisce funzionalità di groupware complete per utenti mobile " "tramite un'interfaccia web. Permette agli utenti di accedere all'email, " "calendario, attività, ecc. da dovunque nel mondo, semplicemente " "connettendosi attraverso un browser web. Il client web non sarebbe stato " @@ -607,10 +598,10 @@ "Datakonsult (client)." msgstr "" "Poichè Kolab è un progetto Free Software, chiunque può aiutare ad estendere " -"le funzionalità del software. Un' attiva comunità si è sviluppata intorno al " +"le funzionalità del software. Un'attiva comunità si è sviluppata intorno al " "software con il contributo di molte persone da tutto il mondo. Il progetto è " "stato originariamente iniziato nel 2002 da una joint-venture di tre " -"compagnie: erfrakon (design, " +"società: erfrakon (design, " "architettura e server); Intevation " "(gestione progetto) e Klarälvdalens Datakonsult (client)." @@ -624,7 +615,7 @@ "the Kolab2 storage format." msgstr "" "Code Fusion cc si è unita al " -"progetto poco dopo il rilascioa del server Kolab1 originale. I suoi " +"progetto poco dopo il rilascio del server Kolab1 originale. I suoi " "sviluppatori sono principalmente responsabili per il motore aggiornato (che " "forma la base del server Kolab2), il client web, così come hanno contribuito " "allo sviluppo del formato di memorizzazione di Kolab2." @@ -695,7 +686,7 @@ #: tpl_messages.php:131 msgid "Kolab Server Settings" -msgstr "Impostazioni Server Kolab" +msgstr "Impostazioni del Server Kolab" #: tpl_messages.php:132 msgid "Administrative email addresses" @@ -736,7 +727,7 @@ "Using legacy services poses a security thread due to leakage of cleartext " "passwords, lack of authenticity and privacy." msgstr "" -"L'utilizzo di servizi obsoleti pone problemi di sicurezza a causa della " +"L'uso di servizi obsoleti pone problemi di sicurezza a causa della " "tramissione di password in chiaro, con mancanza di autenticazione e privacy." #: tpl_messages.php:138 @@ -748,7 +739,7 @@ msgstr "" "Il supporto per la generazione di liste di disponibilità (Freebusy) tramite " "servizi obsoleti (FTP e HTTP) è richiesto solo per i client Outlook2000. In " -"tutte le altre circostanze invece è consigliato usare la funzionalità di " +"tutte le altre circostanze è invece consigliato usare la funzionalità di " "creazione di liste di disponibilità lato server tramite HTTP sicuro (HTTPS) " "(questo è abilitato di default e non può essere disattivato)." @@ -757,7 +748,7 @@ "Further details with regards to security considerations are available on the " "internet at the Kolab webserver." msgstr "" -"Maggiori dettagli a riguardo alle considerazioni di sicurezza sono " +"Maggiori dettagli relativi alle considerazioni di sicurezza sono " "disponibili su internet sul webserver Kolab" @@ -824,7 +815,6 @@ msgstr "Server Relay SMTP ( \"smarthost/relayhost\")" #: tpl_messages.php:158 -#, fuzzy msgid "" "Smarthost (and optional port) to use to send outgoing mail (host.domain." "tld). Leave empty for no relayhost." @@ -888,7 +878,7 @@ "Da notare che abilitando questa impostazione si farà sì che il server " "rifiuti qualunque mail con intestazioni Sender e From non corrispondenti se " "il mittente è un account sul server. Questo è una riconosciuta fonte di " -"problemi come ad esempio le mailinglist." +"problemi con ad esempio le mailinglist." #: tpl_messages.php:170 msgid "Kolab Hosts" @@ -924,8 +914,8 @@ "you have not yet created an account for this, please do so and then go" msgstr "" "Nessun account è configurato per ricevere mail per gli indirizzi " -"amministrativi. Se non avete ancora creato un account per questo, siete " -"pregati di farlo per poi proseguire" +"amministrativi. Se non avete ancora creato un account a questo scopo, siete " +"pregati di farlo prima di proseguire" #: tpl_messages.php:185 msgid "here" @@ -1086,7 +1076,7 @@ #: ../../../www/admin/addressbook/addr.php:142 #: ../../../www/admin/distributionlist/list.php:144 #: ../../../www/admin/sharedfolder/sf.php:141 -#, fuzzy, php-format +#, php-format msgid "Error: DN required for %s operation" msgstr "Errore: richiesto dn per operazione di cancellazione" @@ -1100,7 +1090,7 @@ #: ../../../www/admin/addressbook/addr.php:199 #: ../../../www/admin/addressbook/addr.php:209 -#, fuzzy, php-format +#, php-format msgid "%s successfully updated" msgstr " creato con successo" @@ -1117,7 +1107,7 @@ msgstr "Errore LDAP: non posso aggiungere l'oggetto" #: ../../../www/admin/addressbook/addr.php:220 -#, fuzzy, php-format +#, php-format msgid "%s successfully added" msgstr " creato con successo" @@ -1216,45 +1206,45 @@ msgstr "ID univoco dell'utilizzatore" #: ../../../www/admin/administrator/admin.php:186 -#, fuzzy +#, msgid "LDAP Error: No such dn: " -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: è impossibile leggere" #: ../../../www/admin/administrator/admin.php:233 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not rename %s to %s: " -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/administrator/admin.php:236 -#, fuzzy +#, msgid "LDAP Error: could not remove old entry " -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/administrator/admin.php:245 #: ../../../www/admin/maintainer/maintainer.php:240 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not add new group entry %s: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/administrator/admin.php:250 #: ../../../www/admin/maintainer/maintainer.php:245 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove old group entry %s: %s" -msgstr "Errore LDAP: impossibile modificare l'oggetto" +msgstr "Errore LDAP: è impossibile modificare l'oggetto" #: ../../../www/admin/administrator/admin.php:255 #: ../../../www/admin/maintainer/maintainer.php:250 #: ../../../www/admin/sharedfolder/sf.php:221 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not read %s: %s" -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: è impossibile leggere" #: ../../../www/admin/administrator/admin.php:259 #: ../../../www/admin/maintainer/maintainer.php:254 #: ../../../www/admin/sharedfolder/sf.php:225 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not modify object %s: %s" -msgstr "Errore LDAP: impossibile modificare l'oggetto" +msgstr "Errore LDAP: è impossibile modificare l'oggetto" #: ../../../www/admin/administrator/admin.php:264 #: ../../../www/admin/administrator/admin.php:313 @@ -1275,15 +1265,15 @@ #: ../../../www/admin/maintainer/maintainer.php:271 #: ../../../www/admin/sharedfolder/sf.php:235 #: ../../../www/admin/user/user.php:666 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not add object %s: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/administrator/admin.php:282 #: ../../../www/admin/maintainer/maintainer.php:274 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not add object %s to maintainer group: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/administrator/admin.php:286 #: ../../../www/admin/maintainer/maintainer.php:278 @@ -1304,26 +1294,26 @@ #: ../../../www/admin/administrator/admin.php:331 #: ../../../www/admin/maintainer/maintainer.php:323 #: ../../../www/admin/user/user.php:740 -#, fuzzy +#, msgid "Error: need DN for delete operation" -msgstr "Errore: richiesto dn per operazione di cancellazione" +msgstr "Errore: è richiesto dn per operazione di cancellazione" #: ../../../www/admin/administrator/admin.php:333 msgid "Error: you need administrative permissions to delete administrators" msgstr "" -"Errore: devi avere i permessi di amministrazione per cancellare degli " +"Errore: sono necessari permessi di amministrazione per cancellare degli " "amministratori" #: ../../../www/admin/administrator/admin.php:337 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove %s from admin group: %s" -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +msgstr "Errore LDAP: è impossibile leggere il gruppo dei maintainer:" #: ../../../www/admin/administrator/admin.php:342 #: ../../../www/admin/maintainer/maintainer.php:335 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not mark %s for deletion: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/administrator/admin.php:347 msgid "Administrator Deleted" @@ -1338,7 +1328,7 @@ msgstr " Amministratori)" #: ../../../www/admin/distributionlist/index.php:52 -#, fuzzy, php-format +#, php-format msgid "Manage Distribution Lists (%d Lists)" msgstr "Gestione Liste di Distribuzione" @@ -1348,12 +1338,12 @@ #: ../../../www/admin/distributionlist/list.php:45 msgid "Please add at least one member" -msgstr "Prego aggiungere almeno un membro" +msgstr "Aggiungere almeno un membro" #: ../../../www/admin/distributionlist/list.php:49 #, php-format msgid "No user with email address, UID or alias %s" -msgstr "" +msgstr "Nessun utente con indirizzo email, UID o alias" #: ../../../www/admin/distributionlist/list.php:71 msgid "User or distribution list with this email address already exists" @@ -1381,7 +1371,7 @@ "Check here to make this distribution list available only to authenticated " "users" msgstr "" -"Selezionare qui per rendere questa lista di distribuzione disponibile sono " +"Selezionare qui per rendere questa lista di distribuzione disponibile solo " "agli utenti autenticati" #: ../../../www/admin/distributionlist/list.php:154 @@ -1391,12 +1381,12 @@ #: ../../../www/admin/distributionlist/list.php:188 #, php-format msgid "No user with address %s" -msgstr "" +msgstr "Non sono presenti utenti con l'indirizzo" #: ../../../www/admin/distributionlist/list.php:204 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not rename %s to %s: %s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/distributionlist/list.php:207 #: ../../../www/admin/distributionlist/list.php:216 @@ -1405,30 +1395,30 @@ #: ../../../www/admin/distributionlist/list.php:210 #: ../../../www/admin/user/user.php:616 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not read %s: %s" -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: è impossibile leggere" #: ../../../www/admin/distributionlist/list.php:214 #: ../../../www/admin/distributionlist/list.php:243 #: ../../../www/admin/user/user.php:629 ../../../www/admin/user/user.php:641 #: ../../../www/admin/user/user.php:675 ../../../www/admin/user/user.php:688 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not modify object %s: %s" -msgstr "Errore LDAP: impossibile modificare l'oggetto" +msgstr "Errore LDAP: è impossibile modificare l'oggetto" #: ../../../www/admin/distributionlist/list.php:225 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not add object %s: %s" -msgstr "Errore LDAP: non posso aggiungere l'oggetto" +msgstr "Errore LDAP: non è possibile aggiungere l'oggetto" #: ../../../www/admin/distributionlist/list.php:246 #, php-format msgid "Mid-air collision detected, email address %1$s was renamed to %2$s" -msgstr "" +msgstr "Collisione di indirizzi, l'indirizzo email è stato rinominato come " #: ../../../www/admin/distributionlist/list.php:253 -#, fuzzy, php-format +#, php-format msgid "Distribution List '%s' added" msgstr "Lista di Distribuzione aggiornata" @@ -1441,21 +1431,21 @@ #: ../../../www/admin/distributionlist/list.php:297 #, php-format msgid "Error: No results returned for DN '%s'" -msgstr "" +msgstr "Errore: non sono disponibili risultati per il DN " #: ../../../www/admin/distributionlist/list.php:294 msgid "Delete Distribution List" msgstr "Cancella Lista di Distribuzione" #: ../../../www/admin/distributionlist/list.php:304 -#, fuzzy, php-format +#, php-format msgid "Distribution List %s deleted" msgstr "Lista di Distribuzione aggiornata" #: ../../../www/admin/distributionlist/list.php:308 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not delete %s: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/maintainer/index.php:59 msgid "Manage Maintainers (" @@ -1467,19 +1457,19 @@ #: ../../../www/admin/maintainer/maintainer.php:179 #: ../../../www/admin/user/user.php:433 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: No such dn: %s: %s" -msgstr "Errore LDAP: impossibile leggere" +msgstr "Errore LDAP: è impossibile leggere" #: ../../../www/admin/maintainer/maintainer.php:226 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not rename %s to %s: %s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/maintainer/maintainer.php:230 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not remove old entry %s: %s" -msgstr "Errore LDAP: impossibile cancellare" +msgstr "Errore LDAP: è impossibile cancellare" #: ../../../www/admin/maintainer/maintainer.php:259 #: ../../../www/admin/maintainer/maintainer.php:305 @@ -1505,12 +1495,12 @@ #: ../../../www/admin/user/user.php:742 msgid "Error: you need administrative permissions to delete users" msgstr "" -"Errore: bisogna avere i permessi di amministratore per cancellare utenti" +"Errore: sono necessari permessi di amministratore per cancellare utenti" #: ../../../www/admin/maintainer/maintainer.php:329 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove %s from maintainer group: %s" -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +msgstr "Errore LDAP: è impossibile leggere il gruppo dei maintainer:" #: ../../../www/admin/maintainer/maintainer.php:341 msgid "Maintainer Deleted" @@ -1519,16 +1509,16 @@ #: ../../../www/admin/service/index.php:95 #, php-format msgid "No account found for email address %s" -msgstr "" +msgstr "Non c'è nessun account con indirizzo email " #: ../../../www/admin/service/index.php:103 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Failed to add distribution list %s: %s" -msgstr "" +msgstr "Errore LDAP: Non è stato possibile aggiungere la lista di distribuzione " "Errore LDAP: errore nella modifica dell'oggetto di configurazione kolab: " #: ../../../www/admin/service/index.php:105 -#, fuzzy, php-format +#, php-format msgid "Successfully created distribution list %s" msgstr "Crea liste di distribuzione" @@ -1581,7 +1571,7 @@ msgstr "Servizio di verifica Email Amavis (Virus/Spam)" #: ../../../www/admin/sharedfolder/index.php:39 -#, fuzzy, php-format +#, php-format msgid "Manage Shared Folders (%d Folders)" msgstr "Gestione Cartelle Condivise" @@ -1625,7 +1615,7 @@ msgstr "Aggiungi Cartella condivisa" #: ../../../www/admin/sharedfolder/sf.php:215 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: could not rename %1$s to %2$s: %3$s" msgstr "Errore LDAP: impossibile rinominare" @@ -1635,7 +1625,7 @@ msgstr "Cartella Condivisa aggiornata" #: ../../../www/admin/sharedfolder/sf.php:237 -#, fuzzy, php-format +#, php-format msgid "Shared folder '%s' added" msgstr "Cartella Condivisa aggiornata" @@ -1655,12 +1645,12 @@ msgstr "Cancella Cartella Condivisa" #: ../../../www/admin/sharedfolder/sf.php:290 -#, fuzzy, php-format +#, php-format msgid "Shared folder %s marked for deletion" msgstr " segnata per la cancellazione" #: ../../../www/admin/sharedfolder/sf.php:294 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not mark %s for deletion: %s" msgstr "Errore LDAP: impossibile cancellare" @@ -1677,12 +1667,12 @@ msgstr "Lo script era:" #: ../../../www/admin/user/deliver.php:74 -#, fuzzy, php-format +#, php-format msgid "Delivery to '%s' successfully activated" msgstr "Messagio di assenza attivato con successo" #: ../../../www/admin/user/deliver.php:75 -#, fuzzy, php-format +#, php-format msgid "Delivery to '%s' successfully deactivated" msgstr "Messagio di assenza disattivato con successo" @@ -1699,17 +1689,17 @@ msgstr "Prego inserire un indirizzo email" #: ../../../www/admin/user/forward.php:78 -#, fuzzy, php-format +#, php-format msgid "Forwarding to '%s' successfully activated" msgstr "Messagio di assenza attivato con successo" #: ../../../www/admin/user/forward.php:79 -#, fuzzy, php-format +#, php-format msgid "Forwarding to '%s' successfully deactivated" msgstr "Messagio di assenza disattivato con successo" #: ../../../www/admin/user/index.php:95 -#, fuzzy, php-format +#, php-format msgid "Manage Email User (%d Users)" msgstr "Gestione Utenti Email" @@ -1834,30 +1824,30 @@ msgid "" "'>'%s' depends on it. To modify this account, first remove it from the " "distribution list." -msgstr "" +msgstr "Per modificare questo account è necessario rimuoverlo dalla lista di distribuzione" #: ../../../www/admin/user/user.php:602 ../../../www/admin/user/user.php:606 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not rename %1$s to %2$s: %3$s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/user/user.php:611 -#, fuzzy, php-format +#, php-format msgid "LDAP Error: Could not remove old entry %s,%s: %s" -msgstr "Errore LDAP: impossibile rinominare" +msgstr "Errore LDAP: è impossibile rinominare" #: ../../../www/admin/user/user.php:643 ../../../www/admin/user/user.php:677 #: ../../../www/admin/user/user.php:690 #, php-format msgid "Mid-air collision detected, alias %1$s renamed to %2$s" -msgstr "" +msgstr "L'alias è stato rinominato " #: ../../../www/admin/user/user.php:647 ../../../www/admin/user/user.php:722 msgid "Modify User" msgstr "Modifica utente" #: ../../../www/admin/user/user.php:648 -#, fuzzy, php-format +#, php-format msgid "User '%s' successfully modified" msgstr " modificato con successo" @@ -1875,7 +1865,7 @@ msgstr "Cancella Utente" #: ../../../www/admin/user/user.php:753 -#, fuzzy, php-format +#, php-format msgid "Account could not be deleted, distribution list '%s' depends on it." msgstr "" "Il DN dell'account non può essere modificato, la lista di distribuzione " -msgstr "" +msgstr "" #: ../include/form.class.php:60 msgid "AttributeValueComment" @@ -2000,7 +1990,7 @@ msgstr "Chiunque" #: ../include/form.class.php:256 -#, fuzzy, php-format +#, php-format msgid "Required field %s is empty" msgstr "Campo obbligatorio" @@ -2010,16 +2000,16 @@ #: ../include/auth.class.php:45 msgid "Could not bind to LDAP server: " -msgstr "Non riesco a collegarmi con il server LDAP:" +msgstr "Il collegamento con il server LDAP non è riuscito:" #: ../include/auth.class.php:56 msgid "Could not bind to LDAP server" -msgstr "Non riesco a collegarmi con il server LDAP" +msgstr "Il collegamento con il server LDAP non è riuscito" #: ../include/auth.class.php:70 #, php-format msgid "User class '%s' is denied access" -msgstr "" +msgstr "Alla classe dell'utente è negato l'accesso" #: ../include/auth.class.php:83 ../include/auth.class.php:87 msgid "Wrong username or password" @@ -2033,43 +2023,43 @@ msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" msgstr "" -"Errore impostanto il protocollo LDAP alla versione 3. Prego contattare " +"Errore impostanto il protocollo LDAP alla versione 3. Contattare " "l'amministratore di sistema" #: ../include/ldap.class.php:188 ../include/ldap.class.php:218 #, php-format msgid "No such object %s" -msgstr "" +msgstr "Non esiste un oggetto del tipo" #: ../include/ldap.class.php:191 ../include/ldap.class.php:221 #: ../include/ldap.class.php:251 #, php-format msgid "LDAP Error searching for DN %s: %s" -msgstr "" +msgstr "Errore LDAP durante la ricerca del DN " #: ../include/ldap.class.php:204 #, php-format msgid "Error searching for DN for UID=%s" -msgstr "" +msgstr "Errore durante la ricerca del DN dell'UID " #: ../include/ldap.class.php:234 #, php-format msgid "Error searching for DN for Mail=%s" -msgstr "" +msgstr "Errore durante la ricerca del DN per la Mail " #: ../include/ldap.class.php:264 #, php-format msgid "Error searching for DN for alias=%s: %s" -msgstr "" +msgstr "Errore durante la ricerca del DN per l'alias " #: ../include/ldap.class.php:277 #, php-format msgid "Error searching for DN for mail_or_alias=%s: %s" -msgstr "" +msgstr "Errore durante la ricerca del DN per mail_or_alias " #: ../include/ldap.class.php:308 msgid "LDAP Error: Can't read maintainers group: " -msgstr "Errore LDAP: Impossibile leggere il gruppo dei maintainer:" +msgstr "Errore LDAP: è impossibile leggere il gruppo dei maintainer:" #: ../include/menu.php:26 msgid "Users" From cvs at intevation.de Fri Oct 14 11:08:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:08:18 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES messages.po, 1.12, 1.13 Message-ID: <20051014090816.E5975101F13@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES In directory doto:/tmp/cvs-serv22219/kolab-webadmin/php/admin/locale/de/LC_MESSAGES Modified Files: messages.po Log Message: messages Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/de/LC_MESSAGES/messages.po,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- messages.po 13 Oct 2005 01:50:01 -0000 1.12 +++ messages.po 14 Oct 2005 09:08:14 -0000 1.13 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: kolab-messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-13 03:40+0200\n" +"POT-Creation-Date: 2005-10-14 11:07+0200\n" "PO-Revision-Date: 2005-03-11 14:50+0100\n" "Last-Translator: Matthias Kalle Dalheimer \n" @@ -1593,6 +1593,7 @@ #: ../../../www/admin/sharedfolder/sf.php:271 #: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:274 #: ../../../www/admin/distributionlist/list.php:289 #, php-format msgid "Error: No results returned for DN '%s'" @@ -1906,11 +1907,6 @@ #: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Verteilerliste verändern" - -#: ../../../www/admin/distributionlist/list.php:274 -#, php-format -msgid "Error: No results returned for DN ''" -msgstr "" #: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" From cvs at intevation.de Fri Oct 14 11:08:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:08:20 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES messages.po, 1.1, 1.2 Message-ID: <20051014090816.EE456101FC0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES In directory doto:/tmp/cvs-serv22219/kolab-webadmin/php/admin/locale/es/LC_MESSAGES Modified Files: messages.po Log Message: messages Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/es/LC_MESSAGES/messages.po,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- messages.po 13 Oct 2005 08:38:49 -0000 1.1 +++ messages.po 14 Oct 2005 09:08:14 -0000 1.2 @@ -8,12 +8,12 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-13 10:19+0200\n" +"POT-Creation-Date: 2005-10-14 11:07+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: tpl_messages.php:2 @@ -1418,6 +1418,7 @@ #: ../../../www/admin/sharedfolder/sf.php:271 #: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:274 #: ../../../www/admin/distributionlist/list.php:289 #, php-format msgid "Error: No results returned for DN '%s'" @@ -1721,11 +1722,6 @@ #: ../../../www/admin/distributionlist/list.php:257 #: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" -msgstr "" - -#: ../../../www/admin/distributionlist/list.php:274 -#, php-format -msgid "Error: No results returned for DN ''" msgstr "" #: ../../../www/admin/distributionlist/list.php:286 From cvs at intevation.de Fri Oct 14 11:08:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:08:23 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES messages.po, 1.4, 1.5 Message-ID: <20051014090817.0291B101FC1@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES In directory doto:/tmp/cvs-serv22219/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES Modified Files: messages.po Log Message: messages Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/fr/LC_MESSAGES/messages.po,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- messages.po 13 Oct 2005 01:50:01 -0000 1.4 +++ messages.po 14 Oct 2005 09:08:14 -0000 1.5 @@ -14,7 +14,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-13 03:40+0200\n" +"POT-Creation-Date: 2005-10-14 11:07+0200\n" "PO-Revision-Date: 2005-06-13 18:10+0200\n" "Last-Translator: Benoit Mortier \n" "Language-Team: \n" @@ -1598,6 +1598,7 @@ #: ../../../www/admin/sharedfolder/sf.php:271 #: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:274 #: ../../../www/admin/distributionlist/list.php:289 #, php-format msgid "Error: No results returned for DN '%s'" @@ -1915,11 +1916,6 @@ #: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Modifier la liste de distribution" - -#: ../../../www/admin/distributionlist/list.php:274 -#, php-format -msgid "Error: No results returned for DN ''" -msgstr "" #: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" From cvs at intevation.de Fri Oct 14 11:08:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:08:25 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES messages.po, 1.4, 1.5 Message-ID: <20051014090817.1790F101FC2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES In directory doto:/tmp/cvs-serv22219/kolab-webadmin/php/admin/locale/it/LC_MESSAGES Modified Files: messages.po Log Message: messages Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/it/LC_MESSAGES/messages.po,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- messages.po 14 Oct 2005 01:04:20 -0000 1.4 +++ messages.po 14 Oct 2005 09:08:14 -0000 1.5 @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-13 03:40+0200\n" +"POT-Creation-Date: 2005-10-14 11:07+0200\n" "PO-Revision-Date: 2005-10-14 23:43+0100\n" "Last-Translator: Yvette Agostini \n" "Language-Team: \n" @@ -274,7 +274,8 @@ #: tpl_messages.php:60 msgid "Kolab builds upon many other Free Software projects, namely:" msgstr "" -"Kolab è costruito sulla base di molti altri progetti Free Software, precisamente:" +"Kolab è costruito sulla base di molti altri progetti Free Software, " +"precisamente:" #: tpl_messages.php:61 msgid "(HTTP Server)" @@ -301,8 +302,8 @@ "The following projects are used in binding the above together, in order to " "create the Kolab Server:" msgstr "" -"I seguenti progetti sono stati usati come collegamento di quelli suindicati, per creare " -"il Server Kolab:" +"I seguenti progetti sono stati usati come collegamento di quelli suindicati, " +"per creare il Server Kolab:" #: tpl_messages.php:67 msgid "The following projects are used as a base for the Kolab Clients:" @@ -331,12 +332,11 @@ "client solution." msgstr "" "Per usare tutte le capacità di Kolab2 necessitate di un client compatibile. " -"Il Client Kolab KDE è stato il primo ad essere sviluppato " -"ed è ancora considerato la piattaforma di riferimento per gli altri che " -"hanno seguito. Il componente KDE di groupware Kontact può funzionare come " -"Client Kolab2. Molti ringraziamenti vanno al KDE " -"Project per aver fornito una base così potente su cui costruire questo " -"client." +"Il Client Kolab KDE è stato il primo ad essere sviluppato ed è ancora " +"considerato la piattaforma di riferimento per gli altri che hanno seguito. " +"Il componente KDE di groupware Kontact può funzionare come Client Kolab2. " +"Molti ringraziamenti vanno al KDE Project " +"per aver fornito una base così potente su cui costruire questo client." #: tpl_messages.php:70 msgid "" @@ -346,9 +346,9 @@ "Network Technologies CC. Radley has worked closely with the Kolab community " "to help develop the Kolab2 storage format." msgstr "" -"Gli utenti di Outlook su Microsoft Windows possono usare plug-in proprietari per " -"interagire con il server Kolab. Per Kolab2 il plug-in preferito è ilToltec Plug-in della Radley Network " +"Gli utenti di Outlook su Microsoft Windows possono usare plug-in proprietari " +"per interagire con il server Kolab. Per Kolab2 il plug-in preferito è ilToltec Plug-in della Radley Network " "Technologies CC. Radley ha lavorato a stretto contatto con la comunità Kolab " "ed ha aiutato nello sviluppo del formato di memorizzazione di Kolab2." @@ -372,10 +372,10 @@ "without the excellent Horde project on " "which to build." msgstr "" -"E' anche in sviluppo un client web " -"che fornisce complete funzionalità groupware agli utenti mobile " -"tramite un'interfaccia web. Permette agli utenti di accedere all'email, " -"calendario, attività, ecc. da dovunque nel mondo, semplicemente " +"E' anche in sviluppo un client web che fornisce complete funzionalità groupware agli utenti " +"mobile tramite un'interfaccia web. Permette agli utenti di accedere " +"all'email, calendario, attività, ecc. da dovunque nel mondo, semplicemente " "connettendosi attraverso un browser web. Il client web non sarebbe stato " "possibile senza l'eccellente Horde " "project su cui è costruito." @@ -1176,7 +1176,7 @@ #: ../../../www/admin/user/user.php:339 #: ../../../www/admin/sharedfolder/sf.php:112 #: ../../../www/admin/maintainer/maintainer.php:137 -#: ../.../../www/admin/administrator/admin.php:144 +#: ../../../www/admin/administrator/admin.php:144 #: ../../../www/admin/distributionlist/list.php:106 #: ../../../www/admin/addressbook/addr.php:101 #: ../../../www/admin/domainmaintainer/domainmaintainer.php:112 @@ -1420,8 +1420,9 @@ msgid "" "Failure to remove account from distribution list '', account will not be " "deleted." -msgstr "Rimozione dell'account dalla lista di distribuzione fallito. L'account " -"non sarà cancellato." +msgstr "" +"Rimozione dell'account dalla lista di distribuzione fallito. L'account non " +"sarà cancellato." #: ../../../www/admin/user/user.php:791 #, php-format @@ -1582,10 +1583,11 @@ #: ../../../www/admin/sharedfolder/sf.php:271 #: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:274 #: ../../../www/admin/distributionlist/list.php:289 #, php-format msgid "Error: No results returned for DN '%s'" -msgstr "Errore: non è stato trovato nessun DN " +msgstr "Errore: nessun risultato per il DN '%s'" #: ../../../www/admin/sharedfolder/sf.php:283 msgid "Delete Shared Folder" @@ -1816,7 +1818,8 @@ #: ../../../www/admin/administrator/admin.php:340 #, php-format msgid "LDAP Error: Could not remove %s from admin group: %s" -msgstr "Errore LDAP: la rimozione dal gruppo degli amministratori non è possibile:" +msgstr "" +"Errore LDAP: la rimozione dal gruppo degli amministratori non è possibile:" #: ../../../www/admin/administrator/admin.php:351 msgid "Administrator Deleted" @@ -1897,11 +1900,6 @@ msgid "Modify Distribution List" msgstr "Modifica Lista di Distribuzione" -#: ../../../www/admin/distributionlist/list.php:274 -#, php-format -msgid "Error: No results returned for DN '%s'" -msgstr "Errore: nessun risultato per il DN '%s'" - #: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" msgstr "Cancella Lista di Distribuzione" @@ -2195,8 +2193,8 @@ msgid "" "Error setting LDAP protocol to v3. Please contact your system administrator" msgstr "" -"Si è verificato un errore impostando il protocollo LDAP alla versione 3. Contattare " -"l'amministratore di sistema" +"Si è verificato un errore impostando il protocollo LDAP alla versione 3. " +"Contattare l'amministratore di sistema" #: ../include/ldap.class.php:184 ../include/ldap.class.php:214 #: ../include/ldap.class.php:244 From cvs at intevation.de Fri Oct 14 11:08:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:08:27 2005 Subject: steffen: server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES messages.po, 1.4, 1.5 Message-ID: <20051014090817.24F18101FC3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES In directory doto:/tmp/cvs-serv22219/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES Modified Files: messages.po Log Message: messages Index: messages.po =================================================================== RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/locale/nl/LC_MESSAGES/messages.po,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- messages.po 13 Oct 2005 01:50:01 -0000 1.4 +++ messages.po 14 Oct 2005 09:08:15 -0000 1.5 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: messages\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-13 03:40+0200\n" +"POT-Creation-Date: 2005-10-14 11:07+0200\n" "PO-Revision-Date: 2005-06-16 19:35+0200\n" "Last-Translator: Vincent Seynhaeve \n" "Language-Team: Nerlandais \n" @@ -1572,6 +1572,7 @@ #: ../../../www/admin/sharedfolder/sf.php:271 #: ../../../www/admin/sharedfolder/sf.php:286 +#: ../../../www/admin/distributionlist/list.php:274 #: ../../../www/admin/distributionlist/list.php:289 #, php-format msgid "Error: No results returned for DN '%s'" @@ -1881,11 +1882,6 @@ #: ../../../www/admin/distributionlist/list.php:271 msgid "Modify Distribution List" msgstr "Distributielijst wijzigen" - -#: ../../../www/admin/distributionlist/list.php:274 -#, php-format -msgid "Error: No results returned for DN ''" -msgstr "" #: ../../../www/admin/distributionlist/list.php:286 msgid "Delete Distribution List" From cvs at intevation.de Fri Oct 14 11:22:04 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:22:05 2005 Subject: steffen: server obmtool.conf,1.202,1.203 Message-ID: <20051014092204.A5F72101F13@lists.intevation.de> Author: steffen Update of /kolabrepository/server In directory doto:/tmp/cvs-serv22436 Modified Files: obmtool.conf Log Message: versions Index: obmtool.conf =================================================================== RCS file: /kolabrepository/server/obmtool.conf,v retrieving revision 1.202 retrieving revision 1.203 diff -u -d -r1.202 -r1.203 --- obmtool.conf 13 Oct 2005 13:17:02 -0000 1.202 +++ obmtool.conf 14 Oct 2005 09:22:02 -0000 1.203 @@ -15,7 +15,7 @@ %kolab echo "---- boot/build ${NODE} %${CMD} ----" - kolab_version="pre-2.1-snapshot-20051011"; + kolab_version="pre-2.1-snapshot-20051014"; PREFIX=/${CMD}; loc='' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path plusloc='+' @@ -133,9 +133,9 @@ # @install ${loc}vim-6.3.78-2.4.0 # @install ${plusloc}dcron-2.9-2.4.0 @install ${altloc}perl-kolab-5.8.7-20051003 - @install ${altloc}kolabd-2.0.99-20051011 --define kolab_version=$kolab_version - @install ${altloc}kolab-webadmin-2.0.99-20051007 --define kolab_version=$kolab_version - @install ${altloc}kolab-resource-handlers-2.0.99-20051003 --define kolab_version=$kolab_version + @install ${altloc}kolabd-2.0.99-20051014 --define kolab_version=$kolab_version + @install ${altloc}kolab-webadmin-2.0.99-20051014 --define kolab_version=$kolab_version + @install ${altloc}kolab-resource-handlers-2.0.99-20051014 --define kolab_version=$kolab_version @check if test ! -e "/usr/bin/kolab" ; then From cvs at intevation.de Fri Oct 14 11:22:04 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 11:22:06 2005 Subject: steffen: server/kolab-resource-handlers kolab-resource-handlers.spec, 1.137, 1.138 Message-ID: <20051014092204.B7286101FC0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-resource-handlers In directory doto:/tmp/cvs-serv22436/kolab-resource-handlers Modified Files: kolab-resource-handlers.spec Log Message: versions Index: kolab-resource-handlers.spec =================================================================== RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers.spec,v retrieving revision 1.137 retrieving revision 1.138 diff -u -d -r1.137 -r1.138 --- kolab-resource-handlers.spec 12 Oct 2005 03:21:49 -0000 1.137 +++ kolab-resource-handlers.spec 14 Oct 2005 09:22:02 -0000 1.138 @@ -8,7 +8,7 @@ URL: http://www.kolab.org/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) Version: %{V_kolab_reshndl} -Release: 20051011 +Release: 20051014 Class: JUNK License: GPL Group: MAIL From cvs at intevation.de Fri Oct 14 12:49:45 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 12:49:46 2005 Subject: thomas: doc/www/src/security kolab-vendor-notice-04.txt,NONE,1.1 Message-ID: <20051014104945.10F50101FC6@lists.intevation.de> Author: thomas Update of /kolabrepository/doc/www/src/security In directory doto:/tmp/cvs-serv24023 Added Files: kolab-vendor-notice-04.txt Log Message: Added kolab-vendor-notice-04.txt for openssl (draft). --- NEW FILE: kolab-vendor-notice-04.txt --- Kolab Security Issue 04 20051014 ================================ Package: openssl Vulnerability: Potential SSL 2.0 Rollback (CAN-2005-2969) Kolab Specific: no Dependent Packages: apache imapd openldap perl-ssl php postfix proftpd sasl Summary ------- According to a vendor security advisory, a potential SSL 2.0 protocol rollback attack vulnerability exists in the cryptography toolkit OpenSSL. The vulnerability potentially affects applications that use the SSL/TLS server implementation provided by OpenSSL. Such applications are affected if they use the option "SSL_OP_MSIE_SSLV2_RSA_PADDING". Applications using neither "SSL_OP_MSIE_SSLV2_RSA_PADDING" nor "SSL_OP_ALL" are not affected. Also, applications that disable use of SSL 2.0 are not affected. Affected Versions ----------------- OpenPKG packages of openssl-0.9.7g-2.4.1 or earlier are affected. Kolab Server 2.0.1 and previous releases of the 2.0 branch are affected. You can check the installed version with: /kolab/bin/openpkg rpm -q openssl Fixes ----- Since SSLv2 can't be disabled via a configuration setting for all services running on a Kolab server, the OpenSSL package has to be updated. Install OpenPKG package openssl-0.9.7g-2.4.2: A new OpenSSL RPM is available from the Kolab download mirrors as security-updates/20051014/openssl-0.9.7g-2.4.2.src.rpm A binary RPM for Debian woody (ix86) is available as security-updates/20051014/openssl-0.9.7g-2.4.2.ix86-debian3.0-kolab.rpm The mirrors are listed on http://kolab.org/mirrors.html While the mirrors are catching up, you can also get the package via rsync: # rsync -tzv rsync://rsync.kolab.org/kolab/server/security-updates/20051014/openssl-0.9.7g-2.4.2.src.rpm . This package can be installed on your Kolab Server with # /kolab/bin/openpkg rpm --rebuild openssl-0.9.7g-2.4.2.src.rpm # /kolab/bin/openpkg rpm \ -Uvh /kolab/RPM/PKG/openssl-0.9.7g-2.4.2.--kolab.rpm FIXME: recompile dependent packages, restart servers Details ------- http://www.openpkg.org/security/OpenPKG-SA-2005.022-openssl.html OpenPKG Security Advisory OpenPKG-SA-2005.022 http://www.openssl.org/news/secadv_20051011.txt OpenSSL Security Advisory on the vendor's site http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-2969 Common Vulnerabilities and Exposures (CVE): CAN-2005-2969 Timeline -------- 20051011 OpenSSL vendor released patch and new versions containing the fix 20051011 OpenPKG created new package containing the fix, not yet announced 20051014 Kolab update and security advisory published From cvs at intevation.de Fri Oct 14 12:50:45 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 12:50:46 2005 Subject: thomas: doc/www/src/security kolab-vendor-notice-05.txt,NONE,1.1 Message-ID: <20051014105045.1D1DB101FC6@lists.intevation.de> Author: thomas Update of /kolabrepository/doc/www/src/security In directory doto:/tmp/cvs-serv24047 Added Files: kolab-vendor-notice-05.txt Log Message: Added beginnings of kolab-vendor-notice-05.txt (curl) --- NEW FILE: kolab-vendor-notice-05.txt --- Kolab Security Issue 05 200510?? ================================ Package: curl Vulnerability: libcurl NTLM Buffer Overflow Kolab Specific: no Dependent Packages: clamav Summary ------- FIXME Affected Versions ----------------- OpenPKG packages of curl-FIXME earlier are affected. Kolab Server 2.0.1 and previous releases of the 2.0 branch are affected. You can check the installed version with: /kolab/bin/openpkg rpm -q curl Fixes ----- FIXME Install OpenPKG package curl-FIXME Details ------- http://curl.haxx.se/docs/security.html#BID15102 curl Security vendor page http://www.securityfocus.com/bid/15102 Bugtraq ID 15102 http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-3185 Common Vulnerabilities and Exposures (CVE): CAN-2005-3185 Timeline -------- 20051012 iDEFENSE Security Advisory [IDEF1202] posted to wget.general 20051013 vendor patch and fixed version published 200510?? Kolab update and security advisory published From cvs at intevation.de Fri Oct 14 16:28:01 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:28:02 2005 Subject: steffen: server/kolab-horde-framework - New directory Message-ID: <20051014142801.3F4F5102BC9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework In directory doto:/tmp/cvs-serv28160/kolab-horde-framework Log Message: Directory /kolabrepository/server/kolab-horde-framework added to the repository From cvs at intevation.de Fri Oct 14 16:28:30 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:28:31 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework - New directory Message-ID: <20051014142830.B3491102BC9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework In directory doto:/tmp/cvs-serv28194/kolab-horde-framework Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:30:38 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/UI - New directory Message-ID: <20051014143037.74E9D102BC9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI In directory doto:/tmp/cvs-serv28229/UI Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:30:50 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/UI/UI - New directory Message-ID: <20051014143037.7F7F6102BCA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI/UI In directory doto:/tmp/cvs-serv28229/UI/UI Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI/UI added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:30:52 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/UI/UI/VarRenderer - New directory Message-ID: <20051014143037.86EAF102BCB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI/UI/VarRenderer In directory doto:/tmp/cvs-serv28229/UI/UI/VarRenderer Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI/UI/VarRenderer added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:30:55 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VC - New directory Message-ID: <20051014143037.8BE06102BCC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC In directory doto:/tmp/cvs-serv28229/VC Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:30:57 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VC/VC - New directory Message-ID: <20051014143037.96E1E102BCD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC/VC In directory doto:/tmp/cvs-serv28229/VC/VC Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC/VC added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:00 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VC/docs - New directory Message-ID: <20051014143037.981F7102BCE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC/docs In directory doto:/tmp/cvs-serv28229/VC/docs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC/docs added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:02 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/CLI - New directory Message-ID: <20051014143037.A031C102BCF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/CLI In directory doto:/tmp/cvs-serv28229/CLI Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/CLI added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/NLS - New directory Message-ID: <20051014143037.A1AB9102BD0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/NLS In directory doto:/tmp/cvs-serv28229/NLS Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/NLS added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:05 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/RPC - New directory Message-ID: <20051014143037.AB78E102BD2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC In directory doto:/tmp/cvs-serv28229/RPC Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:05 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/NLS/NLS - New directory Message-ID: <20051014143037.A9D15102BD1@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/NLS/NLS In directory doto:/tmp/cvs-serv28229/NLS/NLS Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/NLS/NLS added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:06 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/RPC/RPC - New directory Message-ID: <20051014143037.B1082102BD3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC/RPC In directory doto:/tmp/cvs-serv28229/RPC/RPC Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC/RPC added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:07 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/RPC/tests - New directory Message-ID: <20051014143037.B3983102BD4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC/tests In directory doto:/tmp/cvs-serv28229/RPC/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:08 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SQL - New directory Message-ID: <20051014143037.B5381102BD5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SQL In directory doto:/tmp/cvs-serv28229/SQL Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SQL added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:09 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VFS - New directory Message-ID: <20051014143037.BF3BF102BD7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS In directory doto:/tmp/cvs-serv28229/VFS Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:09 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SQL/SQL - New directory Message-ID: <20051014143037.BDF62102BD6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SQL/SQL In directory doto:/tmp/cvs-serv28229/SQL/SQL Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SQL/SQL added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VFS/VFS - New directory Message-ID: <20051014143037.C1F9A102BD8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS/VFS In directory doto:/tmp/cvs-serv28229/VFS/VFS Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS/VFS added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VFS/scripts - New directory Message-ID: <20051014143037.C8E56102BD9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS/scripts In directory doto:/tmp/cvs-serv28229/VFS/scripts Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS/scripts added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:11 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Auth - New directory Message-ID: <20051014143037.CBFD4102BDA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Auth In directory doto:/tmp/cvs-serv28229/Auth Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Auth added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:12 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Auth/Auth - New directory Message-ID: <20051014143037.CEDFD102BDB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Auth/Auth In directory doto:/tmp/cvs-serv28229/Auth/Auth Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Auth/Auth added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:12 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Data/Data - New directory Message-ID: <20051014143037.D5129102BDD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data/Data In directory doto:/tmp/cvs-serv28229/Data/Data Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data/Data added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:13 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Data - New directory Message-ID: <20051014143037.D2A3E102BDC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data In directory doto:/tmp/cvs-serv28229/Data Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:14 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Data/tests - New directory Message-ID: <20051014143037.D825E102BDE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data/tests In directory doto:/tmp/cvs-serv28229/Data/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:14 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/IMAP - New directory Message-ID: <20051014143037.DA976102BDF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP In directory doto:/tmp/cvs-serv28229/IMAP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:15 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP - New directory Message-ID: <20051014143037.E2542102BE0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP In directory doto:/tmp/cvs-serv28229/IMAP/IMAP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:15 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Form - New directory Message-ID: <20051014143037.E62F9102BE2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form In directory doto:/tmp/cvs-serv28229/Form Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:16 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Form/Form/Action - New directory Message-ID: <20051014143037.EAF81102BE4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form/Form/Action In directory doto:/tmp/cvs-serv28229/Form/Form/Action Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form/Form/Action added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:17 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Form/Form - New directory Message-ID: <20051014143037.E9FF2102BE3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form/Form In directory doto:/tmp/cvs-serv28229/Form/Form Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form/Form added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:18 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/LDAP - New directory Message-ID: <20051014143037.F0030102BE5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/LDAP In directory doto:/tmp/cvs-serv28229/LDAP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/LDAP added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:19 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/MIME - New directory Message-ID: <20051014143038.00BBC102BC9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME In directory doto:/tmp/cvs-serv28229/MIME Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME added to the repository From cvs at intevation.de Fri Oct 14 16:30:37 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:20 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP/ACL - New directory Message-ID: <20051014143037.E2EBF102BE1@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP/ACL In directory doto:/tmp/cvs-serv28229/IMAP/IMAP/ACL Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP/ACL added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:20 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/MIME/MIME - New directory Message-ID: <20051014143038.05023102BE6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME In directory doto:/tmp/cvs-serv28229/MIME/MIME Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:21 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/MIME/MIME/Viewer - New directory Message-ID: <20051014143038.0714A102BE7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME/Viewer In directory doto:/tmp/cvs-serv28229/MIME/MIME/Viewer Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME/Viewer added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:22 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/MIME/MIME/Viewer/ooo - New directory Message-ID: <20051014143038.0DDFD102BE8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME/Viewer/ooo In directory doto:/tmp/cvs-serv28229/MIME/MIME/Viewer/ooo Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME/Viewer/ooo added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:22 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Menu - New directory Message-ID: <20051014143038.0FBF2102BE9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Menu In directory doto:/tmp/cvs-serv28229/Menu Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Menu added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:23 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text - New directory Message-ID: <20051014143038.1301E102BEA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text In directory doto:/tmp/cvs-serv28229/Text Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:24 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text/Text/Filter - New directory Message-ID: <20051014143038.152C3102BEB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text/Text/Filter In directory doto:/tmp/cvs-serv28229/Text/Text/Filter Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text/Text/Filter added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:24 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text/Text - New directory Message-ID: <20051014143038.167CC102BEC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text/Text In directory doto:/tmp/cvs-serv28229/Text/Text Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text/Text added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:25 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text/tests - New directory Message-ID: <20051014143038.18FB3102BED@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text/tests In directory doto:/tmp/cvs-serv28229/Text/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:25 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Tree - New directory Message-ID: <20051014143038.1B942102BEE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Tree In directory doto:/tmp/cvs-serv28229/Tree Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Tree added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:26 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Util - New directory Message-ID: <20051014143038.20540102BF0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Util In directory doto:/tmp/cvs-serv28229/Util Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Util added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:27 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Tree/Tree - New directory Message-ID: <20051014143038.1F575102BEF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Tree/Tree In directory doto:/tmp/cvs-serv28229/Tree/Tree Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Tree/Tree added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:27 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Util/tests - New directory Message-ID: <20051014143038.22E8A102BF1@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Util/tests In directory doto:/tmp/cvs-serv28229/Util/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Util/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:28 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher - New directory Message-ID: <20051014143038.25269102BF2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher In directory doto:/tmp/cvs-serv28229/Cipher Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:29 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher/BlockMode - New directory Message-ID: <20051014143038.2A1A8102BF4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher/BlockMode In directory doto:/tmp/cvs-serv28229/Cipher/Cipher/BlockMode Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher/BlockMode added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:30 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher - New directory Message-ID: <20051014143038.29400102BF3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher In directory doto:/tmp/cvs-serv28229/Cipher/Cipher Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:30 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/tests - New directory Message-ID: <20051014143038.2C774102BF5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/tests In directory doto:/tmp/cvs-serv28229/Cipher/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:31 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/History - New directory Message-ID: <20051014143038.2FF04102BF6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/History In directory doto:/tmp/cvs-serv28229/History Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/History added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:32 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Identity - New directory Message-ID: <20051014143038.3310E102BF7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Identity In directory doto:/tmp/cvs-serv28229/Identity Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Identity added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:33 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Editor - New directory Message-ID: <20051014143038.33E1A102BF8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Editor In directory doto:/tmp/cvs-serv28229/Editor Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Editor added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:33 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Editor/Editor - New directory Message-ID: <20051014143038.36530102BF9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Editor/Editor In directory doto:/tmp/cvs-serv28229/Editor/Editor Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Editor/Editor added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:34 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/File_PDF - New directory Message-ID: <20051014143038.3F857102BFA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF In directory doto:/tmp/cvs-serv28229/File_PDF Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:35 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF - New directory Message-ID: <20051014143038.41075102BFB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF In directory doto:/tmp/cvs-serv28229/File_PDF/PDF Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:36 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cache - New directory Message-ID: <20051014143038.45FD0102BFD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cache In directory doto:/tmp/cvs-serv28229/Cache Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cache added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:36 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF/fonts - New directory Message-ID: <20051014143038.42A38102BFC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF/fonts In directory doto:/tmp/cvs-serv28229/File_PDF/PDF/fonts Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF/fonts added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:37 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Block - New directory Message-ID: <20051014143038.4AE23102BFF@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block In directory doto:/tmp/cvs-serv28229/Block Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:38 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Block/Block - New directory Message-ID: <20051014143038.4C7B0102C00@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block/Block In directory doto:/tmp/cvs-serv28229/Block/Block Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block/Block added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:39 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Crypt - New directory Message-ID: <20051014143038.4E111102C01@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt In directory doto:/tmp/cvs-serv28229/Crypt Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:44 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph - New directory Message-ID: <20051014143038.553F8102C03@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph In directory doto:/tmp/cvs-serv28229/Graph Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:46 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Crypt/Crypt - New directory Message-ID: <20051014143038.51D6F102C02@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt/Crypt In directory doto:/tmp/cvs-serv28229/Crypt/Crypt Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt/Crypt added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:47 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/Graph - New directory Message-ID: <20051014143038.56F77102C04@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph In directory doto:/tmp/cvs-serv28229/Graph/Graph Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:47 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot - New directory Message-ID: <20051014143038.593D6102C05@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot In directory doto:/tmp/cvs-serv28229/Graph/Graph/Plot Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:48 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Chart - New directory Message-ID: <20051014143038.5BD53102C06@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Chart In directory doto:/tmp/cvs-serv28229/Graph/Graph/Chart Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Chart added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:49 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/tests - New directory Message-ID: <20051014143038.5E6FD102C07@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/tests In directory doto:/tmp/cvs-serv28229/Graph/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:50 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Group - New directory Message-ID: <20051014143038.62D35102C08@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Group In directory doto:/tmp/cvs-serv28229/Group Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Group added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:51 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Group/Group - New directory Message-ID: <20051014143038.6413B102C09@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Group/Group In directory doto:/tmp/cvs-serv28229/Group/Group Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Group/Group added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:52 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Horde - New directory Message-ID: <20051014143038.6775C102C0A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Horde In directory doto:/tmp/cvs-serv28229/Horde Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Horde added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:54 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Horde/Horde - New directory Message-ID: <20051014143038.69F75102C0B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Horde/Horde In directory doto:/tmp/cvs-serv28229/Horde/Horde Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Horde/Horde added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:55 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cache/Cache - New directory Message-ID: <20051014143038.4DFD7102BFE@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cache/Cache In directory doto:/tmp/cvs-serv28229/Cache/Cache Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cache/Cache added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:56 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image - New directory Message-ID: <20051014143038.71678102C0C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image In directory doto:/tmp/cvs-serv28229/Image Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:57 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image/Image - New directory Message-ID: <20051014143038.761C4102C0D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/Image In directory doto:/tmp/cvs-serv28229/Image/Image Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/Image added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:58 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image/Image/Decorator - New directory Message-ID: <20051014143038.793BD102C0E@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/Image/Decorator In directory doto:/tmp/cvs-serv28229/Image/Image/Decorator Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/Image/Decorator added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:31:59 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image/tests - New directory Message-ID: <20051014143038.799D9102C0F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/tests In directory doto:/tmp/cvs-serv28229/Image/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:00 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Kolab - New directory Message-ID: <20051014143038.7DA78102C10@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Kolab In directory doto:/tmp/cvs-serv28229/Kolab Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Kolab added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:01 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Links - New directory Message-ID: <20051014143038.81149102C11@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Links In directory doto:/tmp/cvs-serv28229/Links Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Links added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:02 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Perms - New directory Message-ID: <20051014143038.874D5102C12@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Perms In directory doto:/tmp/cvs-serv28229/Perms Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Perms added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:03 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Perms/Perms - New directory Message-ID: <20051014143038.8CC51102C13@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Perms/Perms In directory doto:/tmp/cvs-serv28229/Perms/Perms Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Perms/Perms added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:03 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Prefs/Prefs - New directory Message-ID: <20051014143038.8E865102C16@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Prefs/Prefs In directory doto:/tmp/cvs-serv28229/Prefs/Prefs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Prefs/Prefs added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Prefs - New directory Message-ID: <20051014143038.8D283102C14@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Prefs In directory doto:/tmp/cvs-serv28229/Prefs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Prefs added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:05 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Share - New directory Message-ID: <20051014143038.936DB102C17@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Share In directory doto:/tmp/cvs-serv28229/Share Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Share added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:06 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Timer - New directory Message-ID: <20051014143038.9848D102C24@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Timer In directory doto:/tmp/cvs-serv28229/Timer Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Timer added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:07 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Token - New directory Message-ID: <20051014143038.9D2EE102C25@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Token In directory doto:/tmp/cvs-serv28229/Token Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Token added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:08 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Token/Token - New directory Message-ID: <20051014143038.A2373102C26@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Token/Token In directory doto:/tmp/cvs-serv28229/Token/Token Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Token/Token added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:09 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Mobile - New directory Message-ID: <20051014143038.A7041102C27@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile In directory doto:/tmp/cvs-serv28229/Mobile Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile/Renderer - New directory Message-ID: <20051014143038.AA740102C29@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile/Renderer In directory doto:/tmp/cvs-serv28229/Mobile/Mobile/Renderer Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile/Renderer added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:11 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile - New directory Message-ID: <20051014143038.AA0CE102C28@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile In directory doto:/tmp/cvs-serv28229/Mobile/Mobile Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:12 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Compress - New directory Message-ID: <20051014143038.AE612102C2A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress In directory doto:/tmp/cvs-serv28229/Compress Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:13 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Compress/Compress - New directory Message-ID: <20051014143038.B0C54102C2B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress/Compress In directory doto:/tmp/cvs-serv28229/Compress/Compress Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress/Compress added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:13 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Search - New directory Message-ID: <20051014143038.B5966102C2C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Search In directory doto:/tmp/cvs-serv28229/Search Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Search added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:14 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Secret - New directory Message-ID: <20051014143038.BF882102BCA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Secret In directory doto:/tmp/cvs-serv28229/Secret Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Secret added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:16 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Search/Search - New directory Message-ID: <20051014143038.B82D1102C2D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Search/Search In directory doto:/tmp/cvs-serv28229/Search/Search Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Search/Search added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:17 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML - New directory Message-ID: <20051014143038.C2925102C2E@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML In directory doto:/tmp/cvs-serv28229/SyncML Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:18 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/docs - New directory Message-ID: <20051014143038.C2AD7102C2F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/docs In directory doto:/tmp/cvs-serv28229/SyncML/docs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/docs added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:19 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Sync - New directory Message-ID: <20051014143038.C9312102C38@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Sync In directory doto:/tmp/cvs-serv28229/SyncML/SyncML/Sync Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Sync added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:20 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML - New directory Message-ID: <20051014143038.C6C3B102C37@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML In directory doto:/tmp/cvs-serv28229/SyncML/SyncML Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:21 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command - New directory Message-ID: <20051014143038.D09D3102C39@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command In directory doto:/tmp/cvs-serv28229/SyncML/SyncML/Command Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:22 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff - New directory Message-ID: <20051014143038.D8576102C3B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff In directory doto:/tmp/cvs-serv28229/Text_Diff Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:24 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync - New directory Message-ID: <20051014143038.D569B102C3A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync In directory doto:/tmp/cvs-serv28229/SyncML/SyncML/Command/Sync Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:25 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff/Diff - New directory Message-ID: <20051014143038.D85FF102C3C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/Diff In directory doto:/tmp/cvs-serv28229/Text_Diff/Diff Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/Diff added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:26 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff/Diff/Renderer - New directory Message-ID: <20051014143038.DCB12102C3D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/Diff/Renderer In directory doto:/tmp/cvs-serv28229/Text_Diff/Diff/Renderer Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/Diff/Renderer added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:27 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs - New directory Message-ID: <20051014143038.E7B66102C3E@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs In directory doto:/tmp/cvs-serv28229/Text_Diff/docs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:28 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff/tests - New directory Message-ID: <20051014143038.E9179102C3F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/tests In directory doto:/tmp/cvs-serv28229/Text_Diff/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:31 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs/examples - New directory Message-ID: <20051014143038.E9E2C102C40@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs/examples In directory doto:/tmp/cvs-serv28229/Text_Diff/docs/examples Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/docs/examples added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:32 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST - New directory Message-ID: <20051014143038.EE59B102C41@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST In directory doto:/tmp/cvs-serv28229/Text_reST Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:33 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST/Formatter - New directory Message-ID: <20051014143039.01649102C43@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST/Formatter In directory doto:/tmp/cvs-serv28229/Text_reST/reST/Formatter Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST/Formatter added to the repository From cvs at intevation.de Fri Oct 14 16:30:38 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:34 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST - New directory Message-ID: <20051014143038.EE682102C42@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST In directory doto:/tmp/cvs-serv28229/Text_reST/reST Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:36 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST/tests - New directory Message-ID: <20051014143039.03799102C44@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/tests In directory doto:/tmp/cvs-serv28229/Text_reST/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:37 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Browser - New directory Message-ID: <20051014143039.084E6102C45@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Browser In directory doto:/tmp/cvs-serv28229/Browser Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Browser added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:38 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Browser/Browser - New directory Message-ID: <20051014143039.0AE5B102C47@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Browser/Browser In directory doto:/tmp/cvs-serv28229/Browser/Browser Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Browser/Browser added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:39 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML - New directory Message-ID: <20051014143039.0F8C5102C48@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML In directory doto:/tmp/cvs-serv28229/XML_WBXML Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:40 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/docs - New directory Message-ID: <20051014143039.12CF0102C49@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/docs In directory doto:/tmp/cvs-serv28229/XML_WBXML/docs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/docs added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:41 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/docs/examples - New directory Message-ID: <20051014143039.12E95102C4A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/docs/examples In directory doto:/tmp/cvs-serv28229/XML_WBXML/docs/examples Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/docs/examples added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:42 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML - New directory Message-ID: <20051014143039.1701C102C4B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML In directory doto:/tmp/cvs-serv28229/XML_WBXML/WBXML Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:44 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/tests - New directory Message-ID: <20051014143039.1E346102C4F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/tests In directory doto:/tmp/cvs-serv28229/XML_WBXML/tests Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/tests added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:45 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML/DTD - New directory Message-ID: <20051014143039.19D08102C4D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML/DTD In directory doto:/tmp/cvs-serv28229/XML_WBXML/WBXML/DTD Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML/DTD added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:46 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/iCalendar - New directory Message-ID: <20051014143039.231C2102C50@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/iCalendar In directory doto:/tmp/cvs-serv28229/iCalendar Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/iCalendar added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:47 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/iCalendar/iCalendar - New directory Message-ID: <20051014143039.280FA102C51@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/iCalendar/iCalendar In directory doto:/tmp/cvs-serv28229/iCalendar/iCalendar Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/iCalendar/iCalendar added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:48 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMAP - New directory Message-ID: <20051014143039.2B1EF102C52@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMAP In directory doto:/tmp/cvs-serv28229/Net_IMAP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMAP added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:49 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMAP/docs - New directory Message-ID: <20051014143039.2B277102C53@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMAP/docs In directory doto:/tmp/cvs-serv28229/Net_IMAP/docs Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMAP/docs added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:50 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMSP - New directory Message-ID: <20051014143039.2F65D102C54@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP In directory doto:/tmp/cvs-serv28229/Net_IMSP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:51 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP - New directory Message-ID: <20051014143039.31DAD102C55@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP In directory doto:/tmp/cvs-serv28229/Net_IMSP/IMSP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:52 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP/Auth - New directory Message-ID: <20051014143039.45485102C56@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP/Auth In directory doto:/tmp/cvs-serv28229/Net_IMSP/IMSP/Auth Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP/Auth added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:53 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SessionHandler - New directory Message-ID: <20051014143039.4CC29102BCB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionHandler In directory doto:/tmp/cvs-serv28229/SessionHandler Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionHandler added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:55 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_LMTP - New directory Message-ID: <20051014143039.47D51102C57@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_LMTP In directory doto:/tmp/cvs-serv28229/Net_LMTP Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_LMTP added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:56 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SessionHandler/SessionHandler - New directory Message-ID: <20051014143039.51ACF102C58@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionHandler/SessionHandler In directory doto:/tmp/cvs-serv28229/SessionHandler/SessionHandler Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionHandler/SessionHandler added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:57 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SessionObjects - New directory Message-ID: <20051014143039.56907102C59@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionObjects In directory doto:/tmp/cvs-serv28229/SessionObjects Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionObjects added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:58 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification - New directory Message-ID: <20051014143039.59626102C5A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification In directory doto:/tmp/cvs-serv28229/Notification Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:32:59 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification - New directory Message-ID: <20051014143039.596B0102C5B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification In directory doto:/tmp/cvs-serv28229/Notification/Notification Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:00 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener - New directory Message-ID: <20051014143039.5DB12102C5C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener In directory doto:/tmp/cvs-serv28229/Notification/Notification/Listener Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:01 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Serialize - New directory Message-ID: <20051014143039.604D9102C5D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Serialize In directory doto:/tmp/cvs-serv28229/Serialize Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Serialize added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:02 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Maintenance - New directory Message-ID: <20051014143039.67889102C5E@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Maintenance In directory doto:/tmp/cvs-serv28229/Maintenance Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Maintenance added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/DataTree - New directory Message-ID: <20051014143039.6A150102C5F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/DataTree In directory doto:/tmp/cvs-serv28229/DataTree Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/DataTree added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/DataTree/DataTree - New directory Message-ID: <20051014143039.6EF39102C60@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/DataTree/DataTree In directory doto:/tmp/cvs-serv28229/DataTree/DataTree Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/DataTree/DataTree added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:16 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_SMS - New directory Message-ID: <20051014143039.71E78102C61@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_SMS In directory doto:/tmp/cvs-serv28229/Net_SMS Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_SMS added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:20 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_SMS/SMS - New directory Message-ID: <20051014143039.7201C102C62@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_SMS/SMS In directory doto:/tmp/cvs-serv28229/Net_SMS/SMS Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_SMS/SMS added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:26 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_Cyrus - New directory Message-ID: <20051014143039.7B147102C63@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_Cyrus In directory doto:/tmp/cvs-serv28229/Net_Cyrus Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_Cyrus added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:30 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_RAX - New directory Message-ID: <20051014143039.7FDC2102C64@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_RAX In directory doto:/tmp/cvs-serv28229/XML_RAX Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_RAX added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:33 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_SVG - New directory Message-ID: <20051014143039.8E82F102C65@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_SVG In directory doto:/tmp/cvs-serv28229/XML_SVG Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_SVG added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:34 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Template - New directory Message-ID: <20051014143039.A211B102C66@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Template In directory doto:/tmp/cvs-serv28229/Template Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Template added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:35 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Scheduler/Scheduler - New directory Message-ID: <20051014143039.DF13A102C67@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Scheduler/Scheduler In directory doto:/tmp/cvs-serv28229/Scheduler/Scheduler Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Scheduler/Scheduler added to the repository From cvs at intevation.de Fri Oct 14 16:30:39 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:36 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Scheduler - New directory Message-ID: <20051014143039.D06F9102BCC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Scheduler In directory doto:/tmp/cvs-serv28229/Scheduler Log Message: Directory /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Scheduler added to the repository From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:42 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework .htaccess, NONE, 1.1 install-packages.bat, NONE, 1.1 install-packages.php, NONE, 1.1 Message-ID: <20051014143305.3943A102BDA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework Added Files: .htaccess install-packages.bat install-packages.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: .htaccess --- Deny from all --- NEW FILE: install-packages.bat --- @echo off :: ---------------------------------------------------------------------- :: Copyright (c) 2003 Peter Magnusson (kmpm@telia.com) :: ---------------------------------------------------------------------- :: Author: Peter Magnusson (kmpm@telia.com) :: ---------------------------------------------------------------------- :: :: You must have PHP PEAR installed to successfully use this script. :: Please check that you have the environment variables :: PHP_PEAR_BIN_DIR and PHP_PEAR_PHP_BIN set to the correct paths. :: :: Uncomment and modify the lines below to match your PHP installation :: Check environment variables :: if "%PHP_CLI_BIN%"=="" set PHP_PEAR_PHP_BIN=C:\php\cli\php.exe :: if "%PHP_PEAR_BIN_DIR%"=="" set PHP_PEAR_BIN_DIR=C:\PHP :: Check that the files and folders exist if not exist "%PHP_PEAR_BIN_DIR%" GOTO DIR_ERROR if not exist "%PHP_PEAR_PHP_BIN%" GOTO BIN_ERROR :: launch Horde install-packages.php goto INSTALL :DIR_ERROR echo PHP_PEAR_BIN_DIR is not set correctly. echo The current value is:%PHP_PEAR_BIN_DIR% goto END :BIN_ERROR echo PHP_PEAR_PHP_BIN is not set correctly. echo The current value is:%PHP_PEAR_PHP_BIN% goto END :INSTALL ::Save the current path so that we can modify it and restore it later set OLD_PATH=%PATH% ::Set the new path with PHP_PEAR_BIN_DIR included set PATH=%PATH%;%PHP_PEAR_BIN_DIR% "%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d include_path="%PHP_PEAR_BIN_DIR%" -f "install-packages.php" ::Restore the path to the previous set PATH=%OLD_PATH% :END ::Pause to display information pause --- NEW FILE: install-packages.php --- #!@l_prefix@/bin/php Author: steffen Update of /kolabrepository/server/kolab-horde-framework In directory doto:/tmp/cvs-serv28903/kolab-horde-framework Added Files: Makefile kolab-horde-framework.spec Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Makefile --- RPM = /kolab/bin/openpkg rpm VERSION = 2.0.99 PEARVERSION = 1.3 PACKAGE = kolab-horde-framework ifeq "x$(KOLABRPMSRC)" "x" KOLABRPMSRC = /kolab/RPM/SRC endif all: test -d $(KOLABRPMSRC)/$(PACKAGE) || mkdir $(KOLABRPMSRC)/$(PACKAGE) tar -cvj --exclude=CVS --exclude=\*~ -f $(KOLABRPMSRC)/$(PACKAGE)/$(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE) cp $(PACKAGE).spec $(KOLABRPMSRC)/$(PACKAGE)/ cd $(KOLABRPMSRC)/$(PACKAGE) && wget -c "ftp://ftp.horde.org/pub/pear/pear-$(PEARVERSION).tar.bz2" cd $(KOLABRPMSRC)/$(PACKAGE) && $(RPM) -ba $(PACKAGE).spec --- NEW FILE: kolab-horde-framework.spec --- # Versions %define V_php_horde_pear 1.3 %define V_kolab_horde 2.0.99 # Package Information Name: kolab-horde-framework Summary: Horde framework components tailored for Kolab URL: http://www.kolab.org/ Packager: Steffen Hansen (Klaraelvdalens Datakonsult AB) Version: %{V_kolab_horde} Release: 20051014 Class: JUNK License: GPL Group: MAIL Distribution: OpenPKG # List of Sources Source0: http://ftp.horde.org/pub/pear/pear-%{V_php_horde_pear}.tar.bz2 Source1: kolab-horde-framework-%{V_kolab_horde}.tar.bz2 # Build Info Prefix: %{l_prefix} BuildRoot: %{l_buildroot} BuildPreReq: apache, php, php::with_pear = yes PreReq: kolabd >= 2.0.99-20051014, apache, php, php::with_pear = yes AutoReq: no AutoReqProv: no #BuildArch: noarch %description Blah blah %prep %setup0 -q -T -b 0 -n pear # rpmtool barfs on files with spaces... mv docs/Text_Wiki/docs/free\ links.wiki.txt docs/Text_Wiki/docs/free_links.wiki.txt %setup1 -q -T -b 1 -n kolab-horde-framework %{l_shtool} subst \ -e 's;@l_prefix@;%{l_prefix};' \ install-packages.php %build %install rm -rf $RPM_BUILD_ROOT %{l_shtool} install -d $RPM_BUILD_ROOT%{l_prefix}/var/kolab/php cp -r ../pear $RPM_BUILD_ROOT%{l_prefix}/var/kolab/php env PHP_PEAR_PHP_BIN="%{l_prefix}/bin/php -d safe_mode=off" %{l_prefix}/bin/php -d safe_mode=off install-packages.php --install-dir $RPM_BUILD_ROOT%{l_prefix}/var/kolab/php/pear %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} %clean rm -rf $RPM_BUILD_ROOT %files -f files #%post # cd %{l_prefix}/var/kolab/www/fbview/framework && env PHP_PEAR_PHP_BIN="%{l_prefix}/bin/php -d safe_mode=off" %{l_prefix}/bin/php -d safe_mode=off install-packages.php --install-dir %{l_prefix}/var/kolab/php/pear From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:45 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Auth Auth.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143305.542F9102BD6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Auth In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Auth Added Files: Auth.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Auth.php --- Horde_Auth Horde Authentication API The Auth:: class provides a common abstracted interface into the various backends for the Horde authentication system. This package contains implementations for: * A Horde Application * Dummy Auto Login * Composite Auth Driver * Custom SQL * Cyrus with SQL Support * FTP * HTTP * IMAP * IMSP * IP Based * Kerberos * LDAP * System Login * mcal * PAM * Passwd File * Radius * SASL * SMB * SQL * Yahoo! LGPL chuck lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org yunosh lead Jan Schneider jan@horde.org 0.0.1 alpha 2003-07-03 Initial Release. gettext pam_auth sasl Horde_DataTree Horde_Form Horde_Framework Horde_Secret Horde_Util 0.0.1 alpha 2003-07-03 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:46 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Block/Block Collection.php, NONE, 1.1 Layout.php, NONE, 1.1 UI.php, NONE, 1.1 Message-ID: <20051014143305.70275102BE0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block/Block In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Block/Block Added Files: Collection.php Layout.php UI.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Collection.php --- * Copyright 2003-2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Block */ class Horde_Block_Collection { /** * A hash storing the information about all available blocks from * all applications. * * @var array $_blocks */ var $_blocks = array(); /** * Constructor. */ function Horde_Block_Collection() { if (isset($_SESSION['horde']['blocks'])) { $this->_blocks = $_SESSION['horde']['blocks']; return; } global $registry; require_once 'Horde/Block.php'; foreach ($registry->listApps() as $app) { if (is_a($registry->pushApp($app), 'PEAR_Error')) { continue; } $blockdir = $registry->getParam('fileroot', $app) . '/lib/Block'; $dh = @opendir($blockdir); if (is_resource($dh)) { while (($file = readdir($dh)) !== false) { if (substr($file, -4) == '.php') { $block_name = null; @include_once $blockdir . '/' . $file; if (!empty($block_name)) { $this->_blocks[$app][substr($file, 0, -4)]['name'] = $block_name; } } } closedir($dh); } $registry->popApp($app); } uksort($this->_blocks, create_function('$a, $b', 'global $registry; return strcasecmp($registry->getParam("name", $a), $registry->getParam("name", $b));') ); $_SESSION['horde']['blocks'] = $this->_blocks; } /** * Returns a single instance of the Horde_Blocks class. * * @static * * @return object Horde_Blocks The Horde_Blocks intance. */ function &singleton() { static $instance; if (!isset($instance)) { $instance = &new Horde_Block_Collection(); } return $instance; } /** * Returns a pretty printed list of all available blocks. * * @return array A hash with block IDs as keys and application plus block * block names as values. */ function getBlocksList() { static $blocks = array(); if (!empty($blocks)) { return $blocks; } global $registry; /* Get available blocks from all apps. */ foreach ($this->_blocks as $app => $app_blocks) { foreach ($app_blocks as $block_id => $block) { $blocks[$app . ':' . $block_id] = $registry->getParam('name', $app) . ': ' . $block['name']; } } return $blocks; } /** * Returns a select widget with all available blocks. * * @param string $cur_app The block from this application gets selected. * @param string $cur_block The block with this name gets selected. * * @return string The select tag with all available blocks. */ function getBlocksWidget($cur_app = null, $cur_block = null, $onchange = false) { global $registry; $widget = '\n"; return $widget; } /** * Returns the option type. */ function getOptionType($app, $block, $param_id) { return $this->_blocks[$app][$block]['params'][$param_id]['type']; } /** * Returns whether the option is required or not. Defaults to true. */ function getOptionRequired($app, $block, $param_id) { if (!isset($this->_blocks[$app][$block]['params'][$param_id]['required'])) { return true; } else { return $this->_blocks[$app][$block]['params'][$param_id]['required']; } } /** * Returns the values for an option. */ function &getOptionValues($app, $block, $param_id) { return $this->_blocks[$app][$block]['params'][$param_id]['values']; } /** * Returns the widget necessary to configure this block. */ function getOptionsWidget($app, $block, $param_id, $val = null) { $widget = ''; $param = $this->_blocks[$app][$block]['params'][$param_id]; switch ($param['type']) { case 'checkbox': $checked = !empty($val[$param_id]) ? ' checked="checked"' : ''; $widget = sprintf('', $param_id, $checked); break; case 'enum': $widget = sprintf(''; break; case 'multienum': $widget = sprintf(''; break; case 'mlenum': // Multi-level enum. if (is_array($val) && isset($val['__' . $param_id])) { $firstval = $val['__' . $param_id]; } else { $firstval = current(array_keys($param['values'])); } $blockvalues = $param['values'][$firstval]; asort($blockvalues); $widget = sprintf('
\n"; $widget .= sprintf("
\n"; break; case 'color': $val = isset($block->_params[$param_id]) ? $block->_params[$param_id] : ''; $widget = sprintf('', $val, $param_id, $val); $url = $registry->getParam('webroot', 'horde'); $url .= Util::addParameter('/services/images/colorpicker.php?target=params[' . $param_id . ']', 'form', 'blockform'); $widget .= sprintf('', $url, $url, _("Color Picker")); $widget .= Horde::img('colorpicker.gif', _("Color Picker"), 'height="16"', $registry->getParam('graphics', 'horde')); $widget .= ''; break; case 'int': case 'text': $widget = sprintf('', $param_id, empty($val) ? $param['default'] : $val[$param_id]); break; case 'error': $widget = '' . $val[$param_id] . ''; break; } return $widget; } /** * Returns the name of the specified block. * * @param string $app An application name. * @param string $block A block name. * * @return string The name of the specified block. */ function getName($app, $block) { return $this->_blocks[$app][$block]['name']; } /** * Returns the parameter list of the specified block. * * @param string $app An application name. * @param string $block A block name. * * @return array An array with all paramter names. */ function getParams($app, $block) { if (empty($this->_blocks[$app][$block]['params'])) { global $registry; if ($registry->hasMethod('defineBlock', $app) && !is_a(($class = $registry->callByPackage($app, 'defineBlock', array($block))), 'PEAR_Error')) { $this->_blocks[$app][$block]['params'] = call_user_func(array($class, 'getParams')); } } if (isset($this->_blocks[$app][$block]['params']) && is_array($this->_blocks[$app][$block]['params'])) { return array_keys($this->_blocks[$app][$block]['params']); } else { return array(); } } /** * Returns the (clear text) name of the specified parameter. * * @param string $app An application name. * @param string $block A block name. * @param string $param A parameter name. * * @return string The name of the specified parameter. */ function getParamName($app, $block, $param) { return $this->_blocks[$app][$block]['params'][$param]['name']; } /** * Returns the default value of the specified parameter. * * @param string $app An application name. * @param string $block A block name. * @param string $param A parameter name. * * @return string The default value of the specified parameter or null. */ function getDefaultValue($app, $block, $param) { if (isset($this->_blocks[$app][$block]['params'][$param]['default'])) { return $this->_blocks[$app][$block]['params'][$param]['default']; } return null; } /** * Returns if the specified block is customizeable by the user. * * @param string $app An application name. * @param string $block A block name. * * @return boolean True is the block is customizeable. */ function isEditable($app, $block) { return isset($this->_blocks[$app][$block]['params']) && count($this->_blocks[$app][$block]['params']); } } --- NEW FILE: Layout.php --- * Copyright 2003-2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 [...1065 lines suppressed...] * @param integer $row A layout row. * @param integer $col A layout column. */ function shrinkRight($row, $col) { if ($this->getWidth($row, $col) > 1) { $lastcol = $col + $this->getWidth($row, $col) - 1; $height = $this->getHeight($row, $col); for ($i = 0; $i < $height; $i++) { $this->_layout[$row + $i][$lastcol] = 'empty'; } $this->_layout[$row][$col]['width'] = $this->getWidth($row, $col) - 1; $this->removeColIfEmpty($lastcol); $this->_changed_row = $row; $this->_changed_col = $col; } } } --- NEW FILE: UI.php --- * * See the enclosed file COPYING for license information (LGPL). If you did * not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Block/Block/UI.php,v 1.8 2004/04/07 14:43:05 chuck Exp $ * * @author Marko Djukic * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Block */ class Horde_Block_UI { var $_blocks = array(); var $_form = null; var $_vars = null; function Horde_Block_UI() { require_once 'Horde/Block.php'; require_once 'Horde/Block/Collection.php'; $this->_blocks = &Horde_Block_Collection::singleton(); } function &setForm(&$form) { $this->_form = &$form; } function &setVars(&$vars) { $this->_vars = &$vars; } function &setupEditForm($field = 'block') { if (is_null($this->_vars)) { /* No existing vars set, get them now. */ require_once 'Horde/Variables.php'; $this->_vars = &Variables::getDefaultVariables(); } if (!is_a($this->_form, 'Horde_Form')) { /* No existing valid form object set so set up a new one. */ require_once 'Horde/Form.php'; $this->_form = &Horde_Form::singleton('', $this->_vars, _("Edit Block")); } /* Get the current value of the block selection. */ $value = $this->_vars->get($field); /* Field to select apps. */ $apps = $this->_blocks->getBlocksList(); $v = &$this->_form->addVariable(_("Application"), $field . '[app]', 'enum', true, false, null, array($apps)); $v->setOption('trackchange', true); if (empty($value['app'])) { return; } /* If a block has been selected, output any options input. */ list($app, $block) = explode(':', $value['app']); /* Get the options for the requested block. */ $options = $this->_blocks->getParams($app, $block); /* Go through the options for this block and set up any required * extra input. */ foreach ($options as $option) { $name = $this->_blocks->getParamName($app, $block, $option); $type = $this->_blocks->getOptionType($app, $block, $option); $required = $this->_blocks->getOptionRequired($app, $block, $option); $values = $this->_blocks->getOptionValues($app, $block, $option); /* TODO: the setting 'string' should be changed in all blocks * to 'text' so that it conforms with Horde_Form syntax. */ if ($type == 'string') { $type = 'text'; } $params = array(); if ($type == 'enum' || $type == 'mlenum') { $params = array($values, true); } $this->_form->addVariable($name, $field . '[options][' . $option . ']', $type, $required, false, null, $params); } } } From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:47 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Block Block.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143305.68BE7102BDD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Block In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Block Added Files: Block.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Block.php --- * Copyright 2003-2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Block */ class Horde_Block { /** * Block specific parameters. * * @var array $_params */ var $_params = array(); /** * Application that this block originated from. * * @var string $_app */ var $_app; /** * Constructor. * * @param array $params Any parameters the block needs. */ function Horde_Block($params = array()) { $this->_params = $params; } /** * Returns the application that this block belongs to. * * @return string The application name. */ function getApp() { return $this->_app; } /** * Returns any settable parameters for this block. This is a * static method. It does *not* reference $this->_params; that is * for runtime parameters (the choices made from these options). * * @static * * @return array The block's configurable parameters. */ function getParams() { return array(); } /** * Returns the text to go in the title of this block. * * This function handles the changing of current application as needed * so code is executed in the scope of the application the block * originated from. * * @return string The title text */ function getTitle() { global $registry; /* Switch application contexts, if necessary. Return an * error immediately if pushApp() fails. */ $pushed = $registry->pushApp($this->_app); if (is_a($pushed, 'PEAR_Error')) { return $pushed->getMessage(); } $title = $this->_title(); /* If we changed application context in the course of this * call, undo that change now. */ if ($pushed === true) { $registry->popApp(); } return $title; } /** * Returns the content for this block. * * This function handles the changing of current application as needed * so code is executed in the scope of the application the block * originated from. * * @return string The content */ function getContent() { global $registry; /* Switch application contexts, if necessary. Return an error * immediately if pushApp() fails. */ $pushed = $registry->pushApp($this->_app); if (is_a($pushed, 'PEAR_Error')) { return $pushed->getMessage(); } $content = $this->_content(); /* If we changed application context in the course of this * call, undo that change now. */ if ($pushed === true) { $registry->popApp(); } return $content; } /** * The title to go in this block. * This function should be defined in all subclasses of this class. * * @abstract * @return string The title text. */ function _title() { return 'No title'; } /** * The content to go in this block. * This function should be defined in all subclasses of this class. * * @abstract * @return string The content */ function _content() { return 'No content'; } } --- NEW FILE: package.xml --- Horde_Block Horde Block API The Horde_Block API provides a mechanism for displaying content blocks from numerous Horde applications or other sources, manipulating those blocks, configuring them, etc. LGPL chuck lead Chuck Hagenbuch chuck@horde.org jan lead Jan Schneider jan@horde.org 0.0.1 alpha 2004-02-13 Initial packaging gettext Horde_Framework Horde_Util 0.0.1 alpha 2004-02-13 Initial packaging From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:49 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Browser/Browser imode.php, NONE, 1.1 Message-ID: <20051014143305.7786D102BE4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Browser/Browser In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Browser/Browser Added Files: imode.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: imode.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Browser */ class Browser_imode { /** * Device data. From http://www.nttdocomo.co.jp/i/tag/s5.html#5_1 * * @var array $_data */ var $_data = array( 'D209i' => array( 'imagewidth' => 96, 'imageheight' => 90, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'F209i' => array( 'imagewidth' => 96, 'imageheight' => 91, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'N209i' => array( 'imagewidth' => 108, 'imageheight' => 82, 'textwidth' => 9, 'textheight' => 6, 'color' => 'grey', 'imageformats' => array('gif') ), 'P209i' => array( 'imagewidth' => 96, 'imageheight' => 87, 'textwidth' => 8, 'textheight' => 6, 'color' => 'grey', 'imageformats' => array('gif') ), 'P209is' => array( 'imagewidth' => 96, 'imageheight' => 87, 'textwidth' => 8, 'textheight' => 6, 'color' => 256, 'imageformats' => array('gif') ), 'R209i' => array( 'imagewidth' => 96, 'imageheight' => 72, 'textwidth' => 8, 'textheight' => 6, 'color' => 'grey', 'imageformats' => array('gif') ), 'ER209i' => array( 'imagewidth' => 120, 'imageheight' => 72, 'textwidth' => 10, 'textheight' => 6, 'color' => 'grey', 'imageformats' => array('gif') ), 'KO209i' => array( 'imagewidth' => 96, 'imageheight' => 96, 'textwidth' => 8, 'textheight' => 8, 'color' => 256, 'imageformats' => array('gif') ), 'D210i' => array( 'imagewidth' => 96, 'imageheight' => 91, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'F210i' => array( 'imagewidth' => 96, 'imageheight' => 113, 'textwidth' => 8, 'textheight' => 8, 'color' => 256, 'imageformats' => array('gif') ), 'N210i' => array( 'imagewidth' => 118, 'imageheight' => 113, 'textwidth' => 10, 'textheight' => 8, 'color' => 256, 'imageformats' => array('gif') ), 'P210i' => array( 'imagewidth' => 96, 'imageheight' => 91, 'textwidth' => 8, 'textheight' => 6, 'color' => 256, 'imageformats' => array('gif') ), 'KO210i' => array( 'imagewidth' => 96, 'imageheight' => 96, 'textwidth' => 8, 'textheight' => 8, 'color' => 256, 'imageformats' => array('gif') ), 'SO210i' => array( 'imagewidth' => 120, 'imageheight' => 113, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'D501i' => array( 'imagewidth' => 96, 'imageheight' => 72, 'textwidth' => 8, 'textheight' => 6, 'color' => 'black', 'imageformats' => array('gif') ), 'F501i' => array( 'imagewidth' => 112, 'imageheight' => 84, 'textwidth' => 8, 'textheight' => 6, 'color' => 'black', 'imageformats' => array('gif') ), 'N501i' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' =>10, 'color' => 'black', 'imageformats' => array('gif') ), 'P501i' => array( 'imagewidth' => 96, 'imageheight' => 120, 'textwidth' => 8, 'textheight' => 8, 'color' => 'black', 'imageformats' => array('gif') ), 'D502i' => array( 'imagewidth' => 96, 'imageheight' => 90, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'F502i' => array( 'imagewidth' => 96, 'imageheight' => 91, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'F502it' => array( 'imagewidth' => 96, 'imageheight' => 91, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'N502i' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' => 10, 'color' => 'grey', 'imageformats' => array('gif') ), 'N502it' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' => 10, 'color' => 256, 'imageformats' => array('gif') ), 'P502i' => array( 'imagewidth' => 96, 'imageheighth' => 117, 'textwidth' => 8, 'textheight' => 8, 'color' => 'grey', 'imageformats' => array('gif') ), 'NM502i' => array( 'imagewidth' => 111, 'imageheight' => 77, 'textwidth' => 8, 'textheight' => 6, 'color' => 'black', 'imageformats' => array('gif') ), 'SO502i' => array( 'imagewidth' => 120, 'imageheight' => 120, 'textwidth' => 8, 'textheight' => 8, 'color' => 'grey', 'imageformats' => array('gif') ), 'SO502iwm' => array( 'imagewidth' => 120, 'imageheight' => 113, 'textwidth' => 8, 'textheight' => 7, 'color' => 256, 'imageformats' => array('gif') ), 'F503i' => array( 'imagewidth' => 120, 'imageheight' => 130, 'textwidth' => 10, 'textheight' => 10, 'color' => 256, 'imageformats' => array('gif') ), 'F503iS' => array( 'imagewidth' => 120, 'imageheight' => 130, 'textwidth' => 12, 'textheight' => 12, 'color' => 4096, 'imageformats' => array('gif') ), 'P503i' => array( 'imagewidth' => 120, 'imageheight' => 130, 'textwidth' => 12, 'textheight' => 10, 'color' => 256, 'imageformats' => array('gif') ), 'P503iS' => array( 'imagewidth' => 120, 'imageheight' => 130, 'textwidth' => 12, 'textheight' => 10, 'color' => 256, 'imageformats' => array('gif') ), 'SO503i' => array( 'imagewidth' => 120, 'imageheight' => 113, 'textwidth' => 8.5, 'textheight' => 7, 'color' => 65536, 'imageformats' => array('gif') ), 'D503i' => array( 'imagewidth' => 132, 'imageheight' => 126, 'textwidth' => 8, 'textheight' => 7, 'color' => 4096, 'imageformats' => array('gif') ), 'N503i' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' => 10, 'color' => 4096, 'imageformats' => array('gif', 'jpg') ), 'N503iS' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' => 10, 'color' => 4096, 'imageformats' => array('gif', 'jpg') ), 'N691i' => array( 'imagewidth' => 96, 'imageheight' => 72, 'textwidth' => 8, 'textheight' => 6, 'color' => 'grey', 'imageformats' => array('gif') ), 'SH821i' => array( 'imagewidth' => 96, 'imageheight' => 78, 'textwidth' => 8, 'textheight' => 6, 'color' => 256, 'imageformats' => array('gif') ), 'N821i' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' => 10, 'color' => 'grey', 'imageformats' => array('gif') ), 'P821i' => array( 'imagewidth' => 118, 'imageheight' => 128, 'textwidth' => 10, 'textheight' => 10, 'color' => 'grey', 'imageformats' => array('gif') ), 'safe' => array( 'imagewidth' => 94, 'imageheight' => 72, 'textwidth' => 8, 'textheight' => 6, 'color' => 'black', 'imageformats' => array('gif') ) ); var $_manufacturerlist = array( 'D' => 'Mitsubishi', 'P' => 'Panasonic (Matsushita)', 'NM' => 'Nokia', 'SO' => 'Sony', 'F' => 'Fujitsu', 'N' => 'Nec', 'SH' => 'Sharp', 'ER' => 'Ericsson', 'R' => 'Japan Radio', 'KO' => 'Kokusai (Hitachi)' ); var $_extra = array( 't' => 'Transport layer', 'e' => 'English language', 's' => 'Second version' ); // properties. meant be private. // var $_user_agent; var $_model; var $_manufacturer; var $_httpversion; var $_cache = 5; var $_extra; // Constructor // This gets called when new object is initialized. Does not // handle bogus user_agents or most of the other error situation // properly yet. // // Parameters: // String describing the user_agent. // // Returns: // Object // // Example usage: // $ua = new Imode_User_Agent($HTTP_USER_AGENT); // function Browser_imode($input) { //DoCoMo/1.0/SO502i //DoCoMo/1.0/N502it/c10 $_error = 0; $temp = explode('/', $input); $this->_user_agent = $input; $this->_httpversion = $temp[1]; $this->_model = $temp[2]; if ($temp[3]) { $this->_cache = substr($temp[3], 1); } preg_match('/(^[a-zA-Z]+)([0-9]+i)(.*)\/?(.*)/', $this->_model, $matches); // TODO: Fix situation of unknown manufacturer. Implement // extrainfo properly // $this->_manufacturer = $this->_manufacturerlist[$matches[1]]; $this->_extra = $matches[3]; if (!($this->_data[$this->_model])) { $_error = PEAR::raiseError('Unknown User Agent'); } } // Method // // Returns: // Array containing maximum imagewidth and imageheight // to fit on the handset screen without scrolling. // // Example usage: // $imagedim = $ua->getImageDimensions(); // $imagewidth = $imagedim[0]; // $imageheight = $imagedim[1]; // function getImageDimensions() { $data = $this->_data[$this->_model]; return array($data['imagewidth'], $data['imageheight']); } // Method // // Returns: // Array containing maximum textwidth and textheight // to fit on the handset screen without scrolling. // // Example usage: // $textdim = $ua->getTextDimensions(); // $textwidth = $textdim[0]; // $textheight = $textdim[1]; // function getTextDimensions() { $data = $this->_data[$this->_model]; return array($data['textwidth'], $data['textheight']); } // Method // // Returns: // Integer containing the amount of handset cache in // kilobytes. // // Example usage: // $cache = $ua->getCache(); // function getCache() { return (int)$this->_cache; } function getManufacturer() { return $this->_manufacturer; } function getExtra() { return $this->_extra; } function getImageFormats() { return $this->_data[$this->_model]['imageformats']; } // Method // // Returns: // Integer describing what color model the handset supports. // Values have the following meaning: // 0 -> black and white // 1 -> 4 tone greyscale // 2 -> 256 color // // Example usage: // $ua->getColor() // function getColor() { return $this->_data[$this->_model]['color']; } function getHTTPVersion() { return $this->_httpversion; } function isColor() { $color = $this->_data[$this->_model]['color']; return ($color == 256); } function isGreyScale() { $color = $this->_data[$this->_model]['color']; return ($color == 'grey'); } function isBlackAndWhite() { $color = $this->_data[$this->_model]['color']; return ($color == 'black'); } } From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:50 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Browser Browser.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143305.7AEB4102BE8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Browser In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Browser Added Files: Browser.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Browser.php --- * Copyright 1999-2004 Jon Parise * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Browser */ class Browser { /** * Major version number. * * @var integer $_majorVersion */ var $_majorVersion = 0; /** * Minor version number. * * @var integer $_minorVersion */ var $_minorVersion = 0; /** * Browser name. * * @var string $_browser */ var $_browser = ''; /** * Full user agent string. * * @var string $_agent */ var $_agent = ''; /** * HTTP_ACCEPT string * * @var string $_accept */ var $_accept = ''; /** * Platform the browser is running on. * * @var string $_platform */ var $_platform = ''; /** * Known robots. * * @var array $_robots */ var $_robots = array( 'ZyBorg', 'Googlebot', 'Scooter/', 'Slurp.so', 'MuscatFerret', 'ArchitextSpider', 'Arachnoidea', 'ExtractorPro', 'ia_archiver', 'webbandit', 'Gulliver/', 'Slurp/cat', 'geckobot', 'KIT-Fireball', 'InfoSeek', 'Lycos_Spider', 'fido/', 'LEIA/', 'polybot', 'msnbot' ); /** * Is this a mobile browser? * * @var boolean $_mobile */ var $_mobile = false; /** * Features. * * @var array $_features */ var $_features = array( 'html' => true, 'hdml' => false, 'wml' => false, 'images' => true, 'iframes' => false, 'frames' => true, 'tables' => true, 'java' => true, 'javascript' => true, 'dom' => false, 'utf' => false, 'rte' => false, 'homepage' => false, 'accesskey' => false, 'optgroup' => false, 'xmlhttpreq' => false ); /** * Quirks * * @var array $_quirks */ var $_quirks = array( 'must_cache_forms' => false, 'avoid_popup_windows' => false, 'cache_ssl_downloads' => false, 'break_disposition_header' => false, 'break_disposition_filename' => false, 'empty_file_input_value' => false, 'scrollbar_in_way' => false, 'cache_same_url' => false, 'ow_gui_1.3' => false, 'scroll_tds' => false, 'no_filename_spaces' => false, 'broken_multipart_form' => false, 'double_linebreak_textarea' => false, 'buggy_compression' => false ); /** * List of viewable image MIME subtypes. * This list of viewable images works for IE and Netscape/Mozilla. * * @var array $_images */ var $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp', 'tiff'); /** /** * Returns a reference to the global Browser object, only creating it * if it doesn't already exist. * * This method must be invoked as: * $browser = &Browser::singleton([$userAgent[, $accept]]); * * @access public * * @param optional string $userAgent The browser string to parse. * @param optional string $accept The HTTP_ACCEPT settings to use. * * @return object Browser The Browser object. */ function &singleton($userAgent = null, $accept = null) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($userAgent, $accept)); if (empty($instances[$signature])) { $instances[$signature] = new Browser($userAgent, $accept); } return $instances[$signature]; } /** * Create a browser instance (Constructor). * * @access public * * @param optional string $userAgent The browser string to parse. * @param optional string $accept The HTTP_ACCEPT settings to use. */ function Browser($userAgent = null, $accept = null) { $this->match($userAgent, $accept); } /** * Parses the user agent string and inititializes the object with * all the known features and quirks for the given browser. * * @access public * * @param optional string $userAgent The browser string to parse. * @param optional string $accept The HTTP_ACCEPT settings to use. */ function match($userAgent = null, $accept = null) { // Set our agent string. if (is_null($userAgent)) { if (isset($_SERVER['HTTP_USER_AGENT'])) { $this->_agent = trim($_SERVER['HTTP_USER_AGENT']); } } else { $this->_agent = $userAgent; } // Set our accept string. if (is_null($accept)) { if (isset($_SERVER['HTTP_ACCEPT'])) { $this->_accept = String::lower(trim($_SERVER['HTTP_ACCEPT'])); } } else { $this->_accept = String::lower($accept); } // Check for UTF support. if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) { $this->setFeature('utf', strstr(String::lower($_SERVER['HTTP_ACCEPT_CHARSET']), 'utf')); } if (!empty($this->_agent)) { $this->_setPlatform(); if (preg_match('|Opera[/ ]([0-9.]+)|', $this->_agent, $version)) { $this->setBrowser('opera'); list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); $this->setFeature('javascript', true); $this->setQuirk('no_filename_spaces'); switch ($this->_majorVersion) { case 7: $this->setFeature('dom'); $this->setFeature('iframes'); $this->setFeature('accesskey'); $this->setFeature('optgroup'); $this->setQuirk('double_linebreak_textarea'); break; } } elseif ((preg_match('|MSIE ([0-9.]+)|', $this->_agent, $version)) || (preg_match('|Internet Explorer/([0-9.]+)|', $this->_agent, $version))) { $this->setBrowser('msie'); $this->setQuirk('cache_ssl_downloads'); $this->setQuirk('cache_same_url'); $this->setQuirk('break_disposition_filename'); if (strstr($version[1], '.')) { list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); } else { $this->_majorVersion = $version[1]; $this->_minorVersion = 0; } /* Some IE 6's have buggy compression: * http://lists.horde.org/archives/imp/Week-of-Mon-20030407/031952.html */ if (preg_match('|Mozilla/4.0 \(compatible; MSIE 6.0; Windows NT 5.|', $this->_agent)) { $this->setQuirk('buggy_compression'); } switch ($this->_majorVersion) { case 6: $this->setFeature('javascript', 1.4); $this->setFeature('dom'); $this->setFeature('iframes'); $this->setFeature('utf'); $this->setFeature('rte'); $this->setFeature('homepage'); $this->setFeature('accesskey'); $this->setFeature('optgroup'); $this->setFeature('xmlhttpreq'); $this->setQuirk('scrollbar_in_way'); $this->setQuirk('broken_multipart_form'); break; case 5: if ($this->getPlatform() == 'mac') { $this->setFeature('javascript', 1.2); $this->setFeature('optgroup'); } else { // MSIE 5 for Windows. $this->setFeature('javascript', 1.4); $this->setFeature('dom'); $this->setFeature('xmlhttpreq'); if ($this->_minorVersion >= 5) { $this->setFeature('rte'); } } $this->setFeature('iframes'); $this->setFeature('utf'); $this->setFeature('homepage'); $this->setFeature('accesskey'); if ($this->_minorVersion == 5) { $this->setQuirk('break_disposition_header'); $this->setQuirk('broken_multipart_form'); } break; case 4: $this->setFeature('javascript', 1.2); $this->setFeature('accesskey'); if ($this->_minorVersion > 0) { $this->setFeature('utf'); } break; case 3: $this->setFeature('javascript', 1.1); $this->setQuirk('avoid_popup_windows'); break; } } elseif (preg_match('|Elaine/([0-9]+)|', $this->_agent, $version) || preg_match('|Digital Paths|', $this->_agent, $version)) { $this->setBrowser('palm'); $this->setFeature('images', false); $this->setFeature('frames', false); $this->setFeature('javascript', false); $this->setQuirk('avoid_popup_windows'); $this->_mobile = true; } elseif (preg_match('|ANTFresco/([0-9]+)|', $this->_agent, $version)) { $this->setBrowser('fresco'); $this->setFeature('javascript', 1.1); $this->setQuirk('avoid_popup_windows'); } elseif (preg_match('|Konqueror/([0-9]+)|', $this->_agent, $version) || preg_match('|Safari/([0-9]+)\.?([0-9]+)?|', $this->_agent, $version)) { // Konqueror and Apple's Safari both use the KHTML // rendering engine. $this->setBrowser('konqueror'); $this->setQuirk('empty_file_input_value'); $this->_majorVersion = $version[1]; if (isset($version[2])) { $this->_minorVersion = $version[2]; } if (strpos($this->_agent, 'Safari') !== false && $this->_majorVersion >= 60) { // Safari. $this->setFeature('javascript', 1.4); $this->setFeature('dom'); $this->setFeature('iframes'); if ($this->_majorVersion > 125 || ($this->_majorVersion == 125 && $this->_minorVersion >= 1)) { $this->setFeature('accesskey'); $this->setFeature('xmlhttpreq'); } } else { // Konqueror. $this->setBrowser('konqueror'); $this->setFeature('javascript', 1.1); switch ($this->_majorVersion) { case 3: $this->setFeature('dom'); $this->setFeature('iframes'); break; } } } elseif (preg_match('|Mozilla/([0-9.]+)|', $this->_agent, $version)) { $this->setBrowser('mozilla'); $this->setQuirk('must_cache_forms'); list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); switch ($this->_majorVersion) { case 5: if ($this->getPlatform() == 'win') { $this->setQuirk('break_disposition_filename'); } $this->setFeature('javascript', 1.4); $this->setFeature('dom'); $this->setFeature('accesskey'); $this->setFeature('xmlhttpreq'); if (preg_match('|rv:(.*)\)|', $this->_agent, $revision)) { if ($revision[1] >= 1) { $this->setFeature('iframes'); } if ($revision[1] >= 1.3) { $this->setFeature('rte'); } } break; case 4: $this->setFeature('javascript', 1.3); $this->setQuirk('buggy_compression'); break; case 3: default: $this->setFeature('javascript', 1); $this->setQuirk('buggy_compression'); break; } } elseif (preg_match('|Lynx/([0-9]+)|', $this->_agent, $version)) { $this->setBrowser('lynx'); $this->setFeature('images', false); $this->setFeature('frames', false); $this->setFeature('javascript', false); $this->setQuirk('avoid_popup_windows'); } elseif (preg_match('|Links \(([0-9]+)|', $this->_agent, $version)) { $this->setBrowser('links'); $this->setFeature('images', false); $this->setFeature('frames', false); $this->setFeature('javascript', false); $this->setQuirk('avoid_popup_windows'); } elseif (preg_match('|HotJava/([0-9]+)|', $this->_agent, $version)) { $this->setBrowser('hotjava'); $this->setFeature('javascript', false); } elseif (strstr($this->_agent, 'UP/') || strstr($this->_agent, 'UP.B')) { $this->setBrowser('up'); $this->setFeature('html', false); $this->setFeature('javascript', false); $this->setFeature('hdml'); $this->setFeature('wml'); if (strstr($this->_agent, 'GUI') && strstr($this->_agent, 'UP.Link')) { /* The device accepts Openwave GUI extensions for WML 1.3. Non-UP.Link gateways sometimes have problems, so exclude them. */ $this->setQuirk('ow_gui_1.3'); } $this->_mobile = true; } elseif (strstr($this->_agent, 'Xiino/') ) { $this->setBrowser('xiino'); $this->setFeature('hdml'); $this->setFeature('wml'); $this->_mobile = true; } elseif (strstr($this->_agent, 'Palmscape/') ) { $this->setBrowser('palmscape'); $this->setFeature('javascript', false); $this->setFeature('hdml'); $this->setFeature('wml'); $this->_mobile = true; } elseif (strstr($this->_agent, 'Nokia')) { $this->setBrowser('nokia'); $this->setFeature('html', false); $this->setFeature('wml'); $this->setFeature('xhtml'); $this->_mobile = true; } elseif (strstr($this->_agent, 'Ericsson')) { $this->setBrowser('ericsson'); $this->setFeature('html', false); $this->setFeature('wml'); $this->_mobile = true; } elseif (stristr($this->_agent, 'Wap')) { $this->setBrowser('wap'); $this->setFeature('html', false); $this->setFeature('javascript', false); $this->setFeature('hdml'); $this->setFeature('wml'); $this->_mobile = true; } elseif (strstr(String::lower($this->_agent), 'docomo') || strstr(String::lower($this->_agent), 'portalmmm')) { $this->setBrowser('imode'); $this->setFeature('images', false); $this->_mobile = true; } elseif (strstr(String::lower($this->_agent), 'avantgo')) { $this->setBrower('avantgo'); $this->_mobile = true; } elseif (strstr(String::lower($this->_agent), 'j-')) { $this->setBrowser('mml'); $this->_mobile = true; } } } /** * Match the platform of the browser. * * This is a pretty simplistic implementation, but it's intended * to let us tell what line breaks to send, so it's good enough * for its purpose. * * @access public * * @since Horde 2.2 */ function _setPlatform() { if (stristr($this->_agent, 'wind')) { $this->_platform = 'win'; } elseif (stristr($this->_agent, 'mac')) { $this->_platform = 'mac'; } else { $this->_platform = 'unix'; } } /** * Return the currently matched platform. * * @return string The user's platform. * * @since Horde 2.2 */ function getPlatform() { return $this->_platform; } /** * Sets the current browser. * * @access public * * @param string $browser The browser to set as current. */ function setBrowser($browser) { $this->_browser = $browser; } /** * Determine if the given browser is the same as the current. * * @access public * * @param string $browser The browser to check. * * @return boolean Is the given browser the same as the current? */ function isBrowser($browser) { return ($this->_browser === $browser); } /** * Do we consider the current browser to be a mobile device? * * @return boolean True if we do, false if we don't. */ function isMobile() { return $this->_mobile; } /** * Determines if the browser is a robot or not. * * @access public * * @return boolean True if browser is a known robot. */ function isRobot() { if (in_array($this->_agent, $this->_robots)) { return true; } else { return false; } } /** * Retrieve the current browser. * * @access public * * @return string The current browser. */ function getBrowser() { return $this->_browser; } /** * Retrieve the current browser's major version. * * @access public * * @return int The current browser's major version. */ function getMajor() { return $this->_majorVersion; } /** * Retrieve the current browser's minor version. * * @access public * * @return int The current browser's minor version. */ function getMinor() { return $this->_minorVersion; } /** * Retrieve the current browser's version. * * @access public * * @return string The current browser's version. */ function getVersion() { return $this->_majorVersion . '.' . $this->_minorVersion; } /** * Return the full browser agent string. * * @access public * * @return string The browser agent string. */ function getAgentString() { return $this->_agent; } /** * Set unique behavior for the current browser. * * @access public * * @param string $quirk The behavior to set. * @param optional string $value Special behavior parameter. */ function setQuirk($quirk, $value = true) { $this->_quirks[$quirk] = $value; } /** * Check unique behavior for the current browser. * * @access public * * @param string $quirk The behavior to check. * * @return boolean Does the browser have the behavior set? */ function hasQuirk($quirk) { return !empty($this->_quirks[$quirk]); } /** * Retreive unique behavior for the current browser. * * @access public * * @param string $quirk The behavior to retreive. * * @return string The value for the requested behavior. */ function getQuirk($quirk) { return isset($this->_quirks[$quirk]) ? $this->_quirks[$quirk] : null; } /** * Set capabilities for the current browser. * * @access public * * @param string $feature The capability to set. * @param optional string $value Special capability parameter. */ function setFeature($feature, $value = true) { $this->_features[$feature] = $value; } /** * Check the current browser capabilities. * * @access public * * @param string $feature The capability to check. * * @return boolean Does the browser have the capability set? */ function hasFeature($feature) { return !empty($this->_features[$feature]); } /** * Retreive the current browser capability. * * @access public * * @param string $feature The capability to retreive. * * @return string The value of the requested capability. */ function getFeature($feature) { return isset($this->_features[$feature]) ? $this->_features[$feature] : null; } /** * Determine if we are using a secure (SSL) connection. * * @access public * * @return boolean True if using SSL, false if not. */ function usingSSLConnection() { return ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) || getenv('SSL_PROTOCOL_VERSION')); } /** * Returns the server protocol in use on the current server. * * @access public * * @return string The HTTP server protocol version. */ function getHTTPProtocol() { if (isset($_SERVER['SERVER_PROTOCOL'])) { if (($pos = strrpos($_SERVER['SERVER_PROTOCOL'], '/'))) { return substr($_SERVER['SERVER_PROTOCOL'], $pos + 1); } } return null; } /** * Determine if files can be uploaded to the system. * * @access public * * @return integer If uploads allowed, returns the maximum size of the * upload in bytes. Returns 0 if uploads are not * allowed. */ function allowFileUploads() { if (ini_get('file_uploads')) { if (($dir = ini_get('upload_tmp_dir')) && !is_writable($dir)) { return 0; } $size = ini_get('upload_max_filesize'); switch (strtolower(substr($size, -1, 1))) { case 'k': $size = intval(floatval($size) * 1024); break; case 'm': $size = intval(floatval($size) * 1024 * 1024); break; default: $size = intval($size); break; } return $size; } else { return 0; } } /** * Determines if the file was uploaded or not. If not, will return the * appropriate error message. * * @access public * * @param string $field The name of the field containing the * uploaded file. * @param optional string $name The file description string to use in the * error message. Default: 'file'. * * @return mixed True on success, PEAR_Error on error. */ function wasFileUploaded($field, $name = null) { if (is_null($name)) { $name = _("file"); } /* TODO: These error constants appeared in PHP 4.3.0. This * code should be removed once Horde requires PHP 4.3.0+. */ if (!defined('UPLOAD_ERR_OK')) { $upload_const = array( 'UPLOAD_ERR_OK' => 0, 'UPLOAD_ERR_INI_SIZE' => 1, 'UPLOAD_ERR_FORM_SIZE' => 2, 'UPLOAD_ERR_PARTIAL' => 3, 'UPLOAD_ERR_NO_FILE' => 4 ); foreach ($upload_const as $key => $val) { define($key, $val); } } if (!($uploadSize = Browser::allowFileUploads())) { return PEAR::raiseError(_("File uploads not supported.")); } /* Get any index on the field name. */ require_once 'Horde/Array.php'; $index = Horde_Array::getArrayParts($field, $base, $keys); if ($index) { /* Index present, fetch the error var to check. */ $keys_path = array_merge(array($base, 'error'), $keys); $error = Horde_Array::getElement($_FILES, $keys_path); /* Index present, fetch the tmp_name var to check. */ $keys_path = array_merge(array($base, 'tmp_name'), $keys); $tmp_name = Horde_Array::getElement($_FILES, $keys_path); } else { /* No index, simple set up of vars to check. */ if (!isset($_FILES[$field])) { return PEAR::raiseError(_("No file uploaded"), UPLOAD_ERR_NO_FILE); } $error = $_FILES[$field]['error']; $tmp_name = $_FILES[$field]['tmp_name']; } if (!isset($_FILES) || ($error == UPLOAD_ERR_NO_FILE)) { return PEAR::raiseError(sprintf(_("There was a problem with the file upload: No %s was uploaded."), $name), UPLOAD_ERR_NO_FILE); } elseif (($error == UPLOAD_ERR_OK) && is_uploaded_file($tmp_name)) { return true; } elseif (($error == UPLOAD_ERR_INI_SIZE) || ($error == UPLOAD_ERR_FORM_SIZE)) { return PEAR::raiseError(sprintf(_("There was a problem with the file upload: The %s was larger than the maximum allowed size (%d bytes)."), $name, $uploadSize), $error); } elseif ($error == UPLOAD_ERR_PARTIAL) { return PEAR::raiseError(sprintf(_("There was a problem with the file upload: The %s was only partially uploaded."), $name), $error); } } /** * Returns the headers for a browser download. * * @access public * * @param optional string $filename The filename of the download. * @param optional string $cType The content-type description of the * file. * @param optional boolean $inline True if inline, false if attachment. * @param optional string $cLength The content-length of this file. * * @since Horde 2.2 */ function downloadHeaders($filename = 'unknown', $cType = null, $inline = false, $cLength = null) { /* Some browsers don't like spaces in the filename. */ if ($this->hasQuirk('no_filename_spaces')) { $filename = strtr($filename, ' ', '_'); } /* MSIE doesn't like multiple periods in the file name. Convert all periods (except the last one) to underscores. */ if ($this->isBrowser('msie')) { if (($pos = strrpos($filename, '.'))) { $filename = strtr(substr($filename, 0, $pos), '.', '_') . substr($filename, $pos); } } /* Content-Type/Content-Disposition Header. */ if ($inline) { if (!is_null($cType)) { header('Content-Type: ' . trim($cType)); } elseif ($this->isBrowser('msie')) { header('Content-Type: application/x-msdownload'); } else { header('Content-Type: application/octet-stream'); } header('Content-Disposition: inline; filename="' . $filename . '"'); } else { if ($this->isBrowser('msie')) { header('Content-Type: application/x-msdownload'); } elseif (!is_null($cType)) { header('Content-Type: ' . trim($cType)); } else { header('Content-Type: application/octet-stream'); } if ($this->hasQuirk('break_disposition_header')) { header('Content-Disposition: filename="' . $filename . '"'); } else { header('Content-Disposition: attachment; filename="' . $filename . '"'); } } /* Content-Length Header. Don't send Content-Length for * HTTP/1.1 servers. */ if (($this->getHTTPProtocol() != '1.1') && !is_null($cLength)) { header('Content-Length: ' . $cLength); } /* Overwrite Pragma: and other caching headers for IE. */ if ($this->hasQuirk('cache_ssl_downloads')) { header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } } /** * Determines if a browser can display a given MIME type. * * @access public * * @param string $mimetype The MIME type to check. * * @return boolean True if the browser can display the MIME type. */ function isViewable($mimetype) { $mimetype = String::lower($mimetype); list($type, $subtype) = explode('/', $mimetype); if (!empty($this->_accept)) { $wildcard_match = false; if (strstr($this->_accept, $mimetype) !== false) { return true; } if (strstr($this->_accept, '*/*') !== false) { $wildcard_match = true; if ($type != 'image') { return true; } } /* image/jpeg and image/pjpeg *appear* to be the same * entity, but Mozilla doesn't seem to want to accept the * latter. For our purposes, we will treat them the * same. */ if ($this->isBrowser('mozilla') && ($mimetype == 'image/pjpeg') && (strstr($this->_accept, 'image/jpeg') !== false)) { return true; } if (!$wildcard_match) { return false; } } if (!$this->hasFeature('images') || ($type != 'image')) { return false; } return (in_array($subtype, $this->_images)); } /** * Escape characters in javascript code if the browser requires it. * %23, %26, and %2B (for IE) and %27 need to be escaped or else * jscript will interpret it as a single quote, pound sign, or * ampersand and refuse to work. * * @access public * * @param string $code The JS code to escape. * * @return string The escaped code. */ function escapeJSCode($code) { $from = $to = array(); if ($this->isBrowser('msie') || ($this->isBrowser('mozilla') && ($this->getMajor() >= 5))) { $from = array('%23', '%26', '%2B'); $to = array(urlencode('%23'), urlencode('%26'), urlencode('%2B')); } $from[] = '%27'; $to[] = '\%27'; return str_replace($from, $to, $code); } } --- NEW FILE: package.xml --- Horde_Browser Horde Browser API The Horde_Browser:: class provides an API for getting information about the current user's browser and its capabilities. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2004-02-12 Initial packaging Horde_Util 0.0.1 alpha 2004-02-12 Initial packaging From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:51 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/CLI CLI.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143305.971A7102BED@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/CLI In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/CLI Added Files: CLI.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: CLI.php --- * Copyright 2003-2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_CLI */ class Horde_CLI { /** * Are we running on a console? * @var bool $_console */ var $_console; /** * The newline string to use. * @var string $_newline */ var $_newline; /** * The indent string to use. * @var string $_indent */ var $_indent; /** * The string to mark the beginning of bold text. * @var string $_bold_start */ var $_bold_start = ''; /** * The string to mark the end of bold text. * @var string $_bold_start */ var $_bold_end = ''; /** * The strings to mark the beginning of coloured text. */ var $_red_start = ''; var $_green_start = ''; var $_yellow_start = ''; var $_blue_start = ''; /** * The strings to mark the end of coloured text. */ var $_red_end = ''; var $_green_end = ''; var $_yellow_end = ''; var $_blue_end = ''; /** * Returns a single instance of the Horde_CLI class. */ function &singleton() { static $instance; if (!isset($instance)) { $instance = &new Horde_CLI(); } return $instance; } /** * Constructor. * Detects the current environment (web server or console) * and sets internal values accordingly. */ function Horde_CLI() { $this->_console = $this->runningFromCLI(); if ($this->_console) { $this->_newline = "\n"; $this->_indent = ' '; $term = getenv('TERM'); if ($term) { if (preg_match('/^(xterm|vt220|linux)/', $term)) { $this->_bold_start = "\x1b[1m"; $this->_red_start = "\x1b[01;31m"; $this->_green_start = "\x1b[01;32m"; $this->_yellow_start = "\x1b[01;33m"; $this->_blue_start = "\x1b[01;34m"; $this->_bold_end = $this->_red_end = $this->_green_end = $this->_yellow_end = $this->_blue_end = "\x1b[0m"; } elseif (preg_match('/^vt100/', $term)) { $this->_bold_start = "\x1b[1m"; $this->_bold_end = "\x1b[0m"; } } } else { $this->_newline = '
'; $this->_indent = str_repeat(' ', 4); $this->_bold_start = ''; $this->_bold_end = ''; $this->_red_start = ''; $this->_green_start = ''; $this->_yellow_start = ''; $this->_blue_start = ''; $this->_red_end = $this->_green_end = $this->_yellow_end = $this->_blue_end = ''; } } /** * Prints $text on a single line. * * @param string $text The text to print. * @param bool $pre If true the linebreak is printed before * the text instead of after it. */ function writeln($text = '', $pre = false) { if ($pre) { echo $this->_newline . $text; } else { echo $text . $this->_newline; } } /** * Returns the indented string. * * @param string $text The text to indent. */ function indent($text) { return $this->_indent . $text; } /** * Returns a bold version of $text. * * @param string $text The text to bold. */ function bold($text) { return $this->_bold_start . $text . $this->_bold_end; } /** * Returns a red version of $text. * * @param string $text The text to print in red. */ function red($text) { return $this->_red_start . $text . $this->_red_end; } /** * Returns a green version of $text. * * @param string $text The text to print in green. */ function green($text) { return $this->_green_start . $text . $this->_green_end; } /** * Returns a blue version of $text. * * @param string $text The text to print in blue. */ function blue($text) { return $this->_blue_start . $text . $this->_blue_end; } /** * Returns a yellow version of $text. * * @param string $text The text to print in yellow. */ function yellow($text) { return $this->_yellow_start . $text . $this->_yellow_end; } /** * Displays a message. * * @param string $event The message string. * @param optional string $type The type of message: 'cli.error', * 'cli.warning', 'cli.success', or * 'cli.message'. */ function message($message, $type = 'cli.message') { switch ($type) { case 'cli.error': $type_message = $this->red('[ ERROR! ] '); break; case 'cli.warning': $type_message = $this->yellow('[ WARN ] '); break; case 'cli.success': $type_message = $this->green('[ OK ] '); break; case 'cli.message': $type_message = $this->blue('[ INFO ] '); break; } $this->writeln($type_message . $message); } /** * Displays a fatal error message. * * @param string $error The error text to display. */ function fatal($error) { $this->writeln($this->red('====================')); $this->writeln(); $this->writeln($this->red(_("Fatal Error!"))); $this->writeln($this->red($error)); $this->writeln(); $this->writeln($this->red('====================')); exit; } /** * Prompts for a user response. * * @param string $prompt The message to display when * prompting the user. * @param optional array $choices The choices available to the * user or null for a text input. * * @return mixed The user's response to the prompt. */ function prompt($prompt, $choices = null) { $stdin = fopen('php://stdin', 'r'); // Main event loop to capture top level command. while (true) { // Print out the prompt message. $this->writeln($prompt . ' ', !is_array($choices)); if (is_array($choices) && !empty($choices)) { foreach ($choices as $key => $choice) { $key = $this->bold($key); $this->writeln($this->indent('(' . $key . ') ' . $choice)); } $this->writeln(_("Type your choice: "), true); // Get the user choice. $response = trim(fgets($stdin, 256)); if (isset($choices[$response])) { // Close standard in. fclose($stdin); return $response; } else { $this->writeln(sprintf(_("'%s' is not a valid choice."), $response)); } } else { $response = trim(fgets($stdin, 256)); fclose($stdin); return $response; } } return true; } /** * CLI scripts shouldn't timeout, so try to set the time limit to * none. Also initialize a few variables in $_SERVER that aren't * present from the CLI. * * @access static */ function init() { @set_time_limit(0); ob_implicit_flush(true); ini_set('html_errors', false); $_SERVER['HTTP_HOST'] = '127.0.0.1'; $_SERVER['SERVER_NAME'] = '127.0.0.1'; $_SERVER['SERVER_PORT'] = ''; $_SERVER['REMOTE_ADDR'] = ''; $_SERVER['PHP_SELF'] = isset($argv) ? $argv[0] : ''; } /** * Make sure we're being called from the command line, and not via * the web. * * @access static * * @return boolean True if we are, false otherwise. */ function runningFromCLI() { // STDIN isn't a CLI constant before 4.3.0 $sapi = php_sapi_name(); if (version_compare(PHP_VERSION, '4.3.0') >= 0 && $sapi != 'cgi') { return @is_resource(STDIN); } else { return in_array($sapi, array('cli', 'cgi')) && empty($_SERVER['REMOTE_ADDR']); } } } --- NEW FILE: package.xml --- Horde_CLI Horde CLI API Horde_CLI:: API for basic command-line functionality/checks LGPL chuck lead Chuck Hagenbuch chuck@horde.org yunosh lead Jan Schneider jan@horde.org 0.0.1 alpha 2003-07-04 Initial Release. gettext 0.0.1 alpha 2003-07-04 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:52 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cache/Cache file.php, NONE, 1.1 zps.php, NONE, 1.1 Message-ID: <20051014143305.AF6BA102BF6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cache/Cache In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cache/Cache Added Files: file.php zps.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: file.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anil Madhavapeddy * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Cache */ class Horde_Cache_file extends Horde_Cache { /** * The location of the temp directory. * * @var string $dir */ var $_dir; /** * The filename prefix for cache files. * * @var string $prefix */ var $_prefix = 'cache_'; /** * Construct a new Horde_Cache_file object. * * @access public * * @param array $params Parameter array. */ function Horde_Cache_file($params = array()) { if (array_key_exists('dir', $params) && @is_dir($params['dir'])) { $this->_dir = $params['dir']; } else { require_once 'Horde/Util.php'; $this->_dir = Util::getTempDir(); } if (array_key_exists('prefix', $params)) { $this->_prefix = $params['prefix']; } } /** * Attempts to store an object to the filesystem. * * @access protected * * @param string $oid Object ID used as the caching key. * @param mixed $data Data to store in the cache. * * @return boolean True on success, false on failure. */ function _store($oid, $data) { require_once 'Horde/Util.php'; $filename = $this->_oidToFile($oid); $tmp_file = Util::getTempFile('HordeCache', true, $this->_dir); if ($fd = fopen($tmp_file, 'w')) { if (fwrite($fd, $data) < strlen($data)) { fclose($fd); return false; } else { fclose($fd); @rename($tmp_file, $filename); } } } /** * Attempts to retrieve a cached object from the filesystem and * return it to the caller. * * @access protected * * @param string $oid Object ID to query. * @param integer $lifetime Lifetime of the object in seconds. * * @return mixed Cached data, or false if none was found. */ function _fetch($oid, $lifetime = 1) { $filename = $this->_oidToFile($oid); if ($this->_isValid($filename, $lifetime)) { $fd = @fopen($filename, 'r'); if ($fd) { $data = fread($fd, filesize($filename)); fclose($fd); return $data; } } /* Nothing cached, return failure. */ return false; } /** * Attempts to directly output a cached object from the * filesystem. * * @access protected * * @param string $oid Object ID to query. * @param integer $lifetime Lifetime of the object in seconds. * * @return mixed Cached data, or false if none was found. */ function _output($oid, $lifetime = 1) { $filename = $this->_oidToFile($oid); if ($this->_isValid($filename, $lifetime)) { $fd = @fopen($filename, 'r'); if ($fd) { fpassthru($fd); return true; } } /* Nothing cached, return failure. */ return false; } /** * Check to see if the object exists in the cache, and whether or * not it's expired. If it has expired, delete it. * * @param string $filename The file to check. * @param integer $lifetime The max age (in seconds) of the object. * * @return boolean Whether or not there is a current copy of the object * in the cache. */ function _isValid($filename, $lifetime) { /* An object exists in the cache */ if (file_exists($filename)) { /* 0 means no expire. */ if ($lifetime == 0) { return true; } $lastmod = filemtime($filename); /* If the object has been created after the supplied * value, the object is valid. */ if (time() - $lifetime <= $lastmod) { return true; } else { @unlink($filename); } } return false; } /** * Map an object ID to a unique filename. * * @access private * * @param string $oid Object ID * * @return string Fully qualified filename. */ function _oidToFile($oid) { return $this->_dir . '/' . $this->_prefix . md5($oid); } } --- NEW FILE: zps.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Cache */ class Horde_Cache_zps extends Horde_Cache { /** * Returns the result of a cacheable function or method that * returns its results, only actually calling it if there isn't a * cached version or the cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $foo = $cache->getData('myContent', 'function($arg1, $arg2)', $date); * * @return mixed The return value of the function or method. * @access public */ function getData($oid, $code, $lifetime) { return output_cache_fetch($oid, $code, $lifetime); } /** * Outputs the result of a function that returns its results, only * actually calling it if there isn't a cached version or the * cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $cache->printData('myContent', 'function($arg1, $arg2)', $date); * * @return mixed The return value of the function or method. * @access public */ function printData($oid, $code, $lifetime) { echo output_cache_fetch($oid, $code, $lifetime); } /** * Returns the result of a cacheable function or method that * prints its results, only actually calling it if there isn't a * cached version or the cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $foo = $cache->getOutput('myContent', 'function($arg1, $arg2)', $date); * * @return mixed Any return status. * @access public */ function getOutput($oid, $code, $lifetime) { ob_start(); output_cache_output($oid, $code, $lifetime); $output = ob_get_contents(); ob_end_clean(); return $output; } /** * Outputs the result of a cacheable function or method that * prints its results, only actually calling it if there isn't a * cached version or the cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $cache->printOutput('myContent', 'function($arg1, $arg2)', $date); * * @return mixed Any return status. * @access public */ function printOutput($oid, $code, $lifetime) { return output_cache_output($oid, $code, $lifetime); } } From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:53 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cache Cache.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143305.A5E0C102BF0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cache In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cache Added Files: Cache.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Cache.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anil Madhavapeddy * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Cache */ class Horde_Cache { /** * Returns the result of a cacheable function or method that * returns its results, only actually calling it if there isn't a * cached version or the cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $foo = $cache->getData('myContent', 'function($arg1, $arg2)', $date); * * @return mixed The return value of the function or method. * @access public */ function getData($oid, $code, $lifetime) { if ($data = $this->_fetch($oid, $lifetime)) { return $data; } else { $data = $this->_call($code, 'result'); if (!is_a($data, 'PEAR_Error')) { $this->_store($oid, $data); } return $data; } } /** * Outputs the result of a function that returns its results, only * actually calling it if there isn't a cached version or the * cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $cache->printData('myContent', 'function($arg1, $arg2)', $date); * * @return mixed The return value of the function or method. * @access public */ function printData($oid, $code, $lifetime) { if ($this->_output($oid, $lifetime)) { return true; } else { $data = $this->_call($code, 'result'); if (is_a($data, 'PEAR_Error')) { return $data; } $this->_store($oid, $data); echo $data; return true; } } /** * Returns the result of a cacheable function or method that * prints its results, only actually calling it if there isn't a * cached version or the cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $foo = $cache->getOutput('myContent', 'function($arg1, $arg2)', $date); * * @return mixed Any return status. * @access public */ function getOutput($oid, $code, $lifetime) { if ($data = $this->_fetch($oid, $lifetime)) { return $data; } else { $data = $this->_call($code, 'output'); if (!is_a($data, 'PEAR_Error')) { $this->_store($oid, $data); } return $data; } } /** * Outputs the result of a cacheable function or method that * prints its results, only actually calling it if there isn't a * cached version or the cache has expired. * * @param string $oid The cache key. * @param string $code The code to execute if the value isn't cached. * @param integer $lifetime The lifetime of the object in the cache. * * Example: * * $cache->printOutput('myContent', 'function($arg1, $arg2)', $date); * * @return mixed Any return status. * @access public */ function printOutput($oid, $code, $lifetime) { if ($this->_output($oid, $lifetime)) { return true; } else { $data = $this->_call($code, 'output'); if (is_a($data, 'PEAR_Error')) { return $data; } $this->_store($oid, $data); echo $data; return true; } } /** * Static utility method for caching the results of object calls. * When called with $object and $function set, they are stored as * the current object/function to call. When called with no * arguments, $object->$function() is executed. * * Example: * Horde_Cache::cacheObject($this, 'getCacheable'); * $ob = $cache->getData($cid, 'Horde_Cache::cacheObject()', $conf['cache']['default_lifetime']); */ function setCacheObject(&$object, $function) { $GLOBALS['_horde_cache_object'] = &$object; $GLOBALS['_horde_cache_function'] = $function; } /** * Static utility method for caching the results of object * calls. Executes the cached object function. * * Example: * Horde_Cache::setCacheObject($this, 'getCacheable'); * $ob = $cache->getData($cid, 'Horde_Cache::getCacheObject()', $conf['cache']['default_lifetime']); */ function getCacheObject() { if (is_null($GLOBALS['_horde_cache_object']) || is_null($GLOBALS['_horde_cache_function'])) { return ''; } else { return $GLOBALS['_horde_cache_object']->$GLOBALS['_horde_cache_function'](); } } /** * Execute $code. $code is expected to EITHER return its results * or to output them. If it does both, only the output will be * returned. * * @access private * * @param string $code The PHP code to execute. * @param string $mode (optional) Return 'result' or 'output'? * Defaults to an array of both. * * @return string The results or output of $code. */ function _call($code, $mode = null) { // Make sure we have a trailing ;. if (substr($code, -1) != ';') { $code .= ';'; } // Store the result in $result. $code = '$result = ' . $code; // Initialize $result so we always have something to return. $result = null; // Start the output buffer so that we can catch if $code // outputs results instead of returning them. ob_start(); @eval($code); // Check output/results. $output = ob_get_contents(); ob_end_clean(); switch ($mode) { case 'result': return $result; case 'output': return $output; default: return array('result' => $result, 'output' => $output); } } /** * Attempts to store an object in the cache. * * @access abstract * * @param string $oid Object ID used as the caching key. * @param mixed $data Data to store in the cache. * * @return boolean True on success, false on failure. */ function _store($oid, $data) { return true; } /** * Attempts to retrieve a cached object and return it to the * caller. * * @access abstract * * @param string $oid Object ID to query. * @param integer $lifetime Lifetime of the object in seconds. * * @return mixed Cached data, or false if none was found. */ function _fetch($oid, $lifetime = 1) { return false; } /** * Attempts to directly output a cached object. * * @access abstract * * @param string $oid Object ID to query. * @param integer $lifetime Lifetime of the object in seconds. * * @return mixed Cached data, or false if none was found. */ function _output($oid, $lifetime = 1) { return false; } /** * Attempts to return a concrete Horde_Cache instance based on * $driver. * * @access public * * @param mixed $driver The type of concrete Horde_Cache subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. If $driver is an * array, then we will look in * $driver[0]/lib/Cache/ for the subclass * implementation named $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Horde_Cache The newly created concrete Horde_Cache instance, * or false on error. */ function &factory($driver, $params = array()) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } $driver = basename($driver); if (empty($driver) || $driver == 'none') { return $ret = &new Horde_Cache($params); } if (!empty($app)) { require_once $app . '/lib/Cache/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Cache/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Cache/' . $driver . '.php'; } else { @include_once 'Horde/Cache/' . $driver . '.php'; } $class = 'Horde_Cache_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Horde_Cache * instance based on $driver. It will only create a new instance * if no Horde_Cache instance with the same parameters currently * exists. * * This should be used if multiple cache backends (and, thus, * multiple Horde_Cache instances) are required. * * This method must be invoked as: * $var = &Horde_Cache::singleton() * * @access public * * @param mixed $driver The type of concrete Horde_Cache subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. If $driver is an * array, then we will look in * $driver[0]/lib/Cache/ for the subclass * implementation named $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @since Horde 2.2 * * @return object Horde_Cache The concrete Horde_Cache reference, * or false on error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!array_key_exists($signature, $instances)) { $instances[$signature] = &Horde_Cache::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_Cache Caching API This package provides a simple, functional Caching API, with the option to store the cached data either on the filesystem, or using the Zend Performance Suite's content cache. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-02-11 Initial packaging. Horde_Util From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:55 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher Cipher.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143305.ACF28102BF3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cipher Added Files: Cipher.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Cipher.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Cipher/Cipher.php,v 1.16 2004/01/01 15:14:08 jan Exp $ * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher { /** * The block mode for the cipher chaining * @var string $_blockMode */ var $_blockMode = 'CBC'; /** * The initialization vector * @var string $_iv */ var $_iv = null; /** * Set the block mode for cipher chaining * * @param String $blockMode The new blockmode */ function setBlockMode($blockMode) { $this->_blockMode = $blockMode; } /** * Set the iv * * @param String $iv The new iv. */ function setIV($iv) { $this->_iv = $iv; } /** * Encrypt a string * * @param String $plaintext The data to encrypt * * @return String The encrypted data */ function encrypt($plaintext) { require_once dirname(__FILE__) . '/Cipher/BlockMode.php'; $blockMode = &Horde_Cipher_BlockMode::factory($this->_blockMode); if (!is_null($this->_iv)) { $blockMode->setIV($this->_iv); } return $blockMode->encrypt($this, $plaintext); } /** * Decrypt a string * * @param String $ciphertext The data to decrypt * * @return String The decrypted data */ function decrypt($ciphertext) { require_once dirname(__FILE__) . '/Cipher/BlockMode.php'; $blockMode = &Horde_Cipher_BlockMode::factory($this->_blockMode); if (!is_null($this->_iv)) { $blockMode->setIV($this->_iv); } return $blockMode->decrypt($this, $ciphertext); } /** * Attempts to return a concrete Cipher instance based on $driver. * * @access public * * @param mixed $cipher The type of concrete Cipher subclass to * return. * @param optional array $params A hash containing any additional * parameters a subclass might need. * * @return object Cipher The newly created concrete Cipher instance, or PEAR_Error * on an error. */ function &factory($cipher, $params = null) { $driver = basename($cipher); if (@file_exists(dirname(__FILE__) . '/Cipher/' . $cipher . '.php')) { require_once dirname(__FILE__) . '/Cipher/' . $cipher . '.php'; } $class = 'Horde_Cipher_' . $cipher; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } } --- NEW FILE: package.xml --- Horde_Cipher Cipher API This package provides a Block Mode Cipher API, supporting the following ciphers: * Blowfish * Cast128 * DES * RC2 * RC4 And supporting the following block modes: * CBC * ECB * CFB64 * OFB64 LGPL mac lead Mike Cochrane mike@graftonhall.co.nz 0.0.1 alpha 2003-07-03 Initial Release. 0.0.1 alpha 2003-07-03 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:56 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher BlockMode.php, NONE, 1.1 blowfish.php, NONE, 1.1 cast128.php, NONE, 1.1 des.php, NONE, 1.1 rc2.php, NONE, 1.1 rc4.php, NONE, 1.1 Message-ID: <20051014143305.DC87D102BFA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher Added Files: BlockMode.php blowfish.php cast128.php des.php rc2.php rc4.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: BlockMode.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_BlockMode { /* String containing the initilization vector. */ var $_iv = "\0\0\0\0\0\0\0\0"; /** * Attempts to return a concrete CipherBlockMode instance based on $mode. * * @access public * * @param mixed $cipher The type of concrete CipherBlockMode * subclass to return. * @param optional array $params A hash containing any additional * parameters a subclass might need. * * @return object CipherBlockMode The newly created concrete Cipher * instance, or PEAR_Error on an error. */ function &factory($mode, $params = null) { $mode = basename($mode); if (@file_exists(dirname(__FILE__) . '/BlockMode/' . $mode . '.php')) { require_once dirname(__FILE__) . '/BlockMode/' . $mode . '.php'; } $class = 'Horde_Cipher_BlockMode_' . $mode; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Set the iv * * @param String $iv The new iv. */ function setIV($iv) { $this->_iv = $iv; } } --- NEW FILE: blowfish.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_blowfish extends Horde_Cipher { /* Pi Array */ var $p = array( 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89, 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917, 0x9216D5D9, 0x8979FB1B); /* S Boxes */ var $s1 = array( 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013, 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E, 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440, 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A, 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677, 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032, 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239, 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0, 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98, 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE, 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D, 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7, 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463, 0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F, 0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09, 0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3, 0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB, 0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279, 0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8, 0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB, 0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82, 0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB, 0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573, 0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0, 0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B, 0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790, 0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8, 0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4, 0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0, 0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7, 0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C, 0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD, 0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1, 0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299, 0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9, 0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477, 0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF, 0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49, 0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF, 0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA, 0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5, 0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41, 0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915, 0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400, 0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915, 0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664, 0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A); var $s2 = array( 0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623, 0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266, 0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1, 0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E, 0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6, 0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1, 0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E, 0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1, 0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737, 0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8, 0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF, 0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD, 0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701, 0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7, 0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41, 0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331, 0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF, 0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF, 0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E, 0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87, 0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C, 0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2, 0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16, 0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD, 0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B, 0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509, 0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E, 0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3, 0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F, 0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A, 0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4, 0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960, 0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66, 0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28, 0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802, 0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84, 0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510, 0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF, 0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14, 0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E, 0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50, 0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7, 0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8, 0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281, 0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99, 0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696, 0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128, 0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73, 0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0, 0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0, 0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105, 0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250, 0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3, 0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285, 0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00, 0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061, 0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB, 0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E, 0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735, 0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC, 0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9, 0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340, 0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20, 0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7); var $s3 = array( 0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934, 0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068, 0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF, 0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840, 0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45, 0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504, 0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A, 0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB, 0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE, 0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6, 0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42, 0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B, 0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2, 0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB, 0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527, 0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B, 0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33, 0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C, 0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3, 0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC, 0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17, 0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564, 0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B, 0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115, 0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922, 0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728, 0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0, 0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E, 0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37, 0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D, 0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804, 0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B, 0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3, 0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB, 0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D, 0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C, 0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350, 0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9, 0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A, 0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE, 0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D, 0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC, 0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F, 0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61, 0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2, 0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9, 0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2, 0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C, 0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E, 0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633, 0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10, 0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169, 0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52, 0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027, 0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5, 0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62, 0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634, 0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76, 0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24, 0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC, 0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4, 0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C, 0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837, 0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0); var $s4 = array( 0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B, 0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE, 0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B, 0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4, 0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8, 0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6, 0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304, 0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22, 0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4, 0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6, 0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9, 0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59, 0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593, 0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51, 0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28, 0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C, 0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B, 0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28, 0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C, 0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD, 0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A, 0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319, 0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB, 0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F, 0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991, 0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32, 0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680, 0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166, 0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE, 0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB, 0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5, 0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47, 0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370, 0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D, 0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84, 0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048, 0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8, 0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD, 0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9, 0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7, 0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38, 0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F, 0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C, 0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525, 0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1, 0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442, 0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964, 0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E, 0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8, 0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D, 0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F, 0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299, 0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02, 0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC, 0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614, 0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A, 0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6, 0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B, 0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0, 0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060, 0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E, 0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9, 0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F, 0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6); /* The number of rounds to do */ var $_rounds = 16; /* Constructor */ function Cipher_blowfish($params = null) { } /** * Set the key to be used for en/decryption * * @param String $key The key to use */ function setKey($key) { $key = $this->_formatKey($key); $keyPos = 0; $keyXor = 0; $iMax = count($this->p); $keyLen = count($key); for ($i = 0; $i < $iMax; $i++) { for ($t = 0; $t < 4; $t++) { $keyXor = ($keyXor << 8) | (($key[$keyPos]) & 0x0ff); if (++$keyPos == $keyLen) { $keyPos = 0; } } $this->p[$i] = $this->p[$i] ^ $keyXor; } $encZero = array('L' => 0, 'R' => 0); for ($i = 0; $i + 1 < $iMax; $i+=2) { $encZero = $this->_encryptBlock($encZero['L'], $encZero['R']); $this->p[$i] = $encZero['L']; $this->p[$i + 1] = $encZero['R']; } $iMax = count($this->s1); for ($i = 0; $i < $iMax; $i+=2) { $encZero = $this->_encryptBlock($encZero['L'], $encZero['R']); $this->s1[$i] = $encZero['L']; $this->s1[$i + 1] = $encZero['R']; } $iMax = count($this->s2); for ($i = 0; $i < $iMax; $i+=2) { $encZero = $this->_encryptBlock($encZero['L'], $encZero['R']); $this->s2[$i] = $encZero['L']; $this->s2[$i + 1] = $encZero['R']; } $iMax = count($this->s3); for ($i = 0; $i < $iMax; $i+=2) { $encZero = $this->_encryptBlock($encZero['L'], $encZero['R']); $this->s3[$i] = $encZero['L']; $this->s3[$i + 1] = $encZero['R']; } $iMax = count($this->s4); for ($i = 0; $i < $iMax; $i+=2) { $encZero = $this->_encryptBlock($encZero['L'], $encZero['R']); $this->s4[$i] = $encZero['L']; $this->s4[$i + 1] = $encZero['R']; } } /** * Return the size of the blocks that this cipher needs * * @return Integer The number of characters per block */ function getBlockSize() { return 8; } /** * Encrypt a block on data. * * @param String $block The data to encrypt * @param optional String $key The key to use * @param optional boolean $allparts Return an array containing the two * 32bit ints also. * * @return String the encrypted output */ function encryptBlock($block, $key = null, $allparts = false) { if (!is_null($key)) { $this->setKey($key); } list($L, $R) = array_values(unpack('N*', $block)); $parts = $this->_encryptBlock($L, $R); return pack("NN", $parts['L'], $parts['R']); } /** * Encrypt a block on data. * * @param String $block The data to encrypt * * @return String the encrypted output */ function _encryptBlock($L, $R) { $L ^= $this->p[0]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[1]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[2]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[3]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[4]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[5]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[6]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[7]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[8]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[9]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[10]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[11]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[12]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[13]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[14]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[15]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[16]; $R ^= $this->p[17]; return array('L' => $R, 'R' => $L); } /** * Decrypt a block on data. * * @param String $block The data to decrypt * @param optional String $key The key to use * * @return String the decrypted output */ function decryptBlock($block, $key = null) { if (!is_null($key)) { $this->setKey($key); } list($L, $R) = array_values(unpack('N*', $block)); $L ^= $this->p[17]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[16]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[15]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[14]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[13]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[12]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[11]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[10]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[9]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[8]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[7]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[6]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[5]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[4]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[3]; $R ^= ((($this->s1[($L >> 24) & 0xFF] + $this->s2[($L >> 16) & 0x0ff]) ^ $this->s3[($L >> 8) & 0x0ff]) + $this->s4[$L & 0x0ff]) ^ $this->p[2]; $L ^= ((($this->s1[($R >> 24) & 0xFF] + $this->s2[($R >> 16) & 0x0ff]) ^ $this->s3[($R >> 8) & 0x0ff]) + $this->s4[$R & 0x0ff]) ^ $this->p[1]; $decrypted = pack("NN", $R ^ $this->p[0], $L); return $decrypted; } /** * Converts a text key into an array * * @return array The key */ function _formatKey($key) { return array_values(unpack('C*', $key)); } } --- NEW FILE: cast128.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_cast128 extends Horde_Cipher { /* S boxes */ var $s1 = array( 0x30fb40d4, 0x9fa0ff0b, 0x6beccd2f, 0x3f258c7a, 0x1e213f2f, 0x9c004dd3, 0x6003e540, 0xcf9fc949, 0xbfd4af27, 0x88bbbdb5, 0xe2034090, 0x98d09675, 0x6e63a0e0, 0x15c361d2, 0xc2e7661d, 0x22d4ff8e, 0x28683b6f, 0xc07fd059, 0xff2379c8, 0x775f50e2, 0x43c340d3, 0xdf2f8656, 0x887ca41a, 0xa2d2bd2d, 0xa1c9e0d6, 0x346c4819, 0x61b76d87, 0x22540f2f, 0x2abe32e1, 0xaa54166b, 0x22568e3a, 0xa2d341d0, 0x66db40c8, 0xa784392f, 0x004dff2f, 0x2db9d2de, 0x97943fac, 0x4a97c1d8, 0x527644b7, 0xb5f437a7, 0xb82cbaef, 0xd751d159, 0x6ff7f0ed, 0x5a097a1f, 0x827b68d0, 0x90ecf52e, 0x22b0c054, 0xbc8e5935, 0x4b6d2f7f, 0x50bb64a2, 0xd2664910, 0xbee5812d, 0xb7332290, 0xe93b159f, 0xb48ee411, 0x4bff345d, 0xfd45c240, 0xad31973f, 0xc4f6d02e, 0x55fc8165, 0xd5b1caad, 0xa1ac2dae, 0xa2d4b76d, 0xc19b0c50, 0x882240f2, 0x0c6e4f38, 0xa4e4bfd7, 0x4f5ba272, 0x564c1d2f, 0xc59c5319, 0xb949e354, 0xb04669fe, 0xb1b6ab8a, 0xc71358dd, 0x6385c545, 0x110f935d, 0x57538ad5, 0x6a390493, 0xe63d37e0, 0x2a54f6b3, 0x3a787d5f, 0x6276a0b5, 0x19a6fcdf, 0x7a42206a, 0x29f9d4d5, 0xf61b1891, 0xbb72275e, 0xaa508167, 0x38901091, 0xc6b505eb, 0x84c7cb8c, 0x2ad75a0f, 0x874a1427, 0xa2d1936b, 0x2ad286af, 0xaa56d291, 0xd7894360, 0x425c750d, 0x93b39e26, 0x187184c9, 0x6c00b32d, 0x73e2bb14, 0xa0bebc3c, 0x54623779, 0x64459eab, 0x3f328b82, 0x7718cf82, 0x59a2cea6, 0x04ee002e, 0x89fe78e6, 0x3fab0950, 0x325ff6c2, 0x81383f05, 0x6963c5c8, 0x76cb5ad6, 0xd49974c9, 0xca180dcf, 0x380782d5, 0xc7fa5cf6, 0x8ac31511, 0x35e79e13, 0x47da91d0, 0xf40f9086, 0xa7e2419e, 0x31366241, 0x051ef495, 0xaa573b04, 0x4a805d8d, 0x548300d0, 0x00322a3c, 0xbf64cddf, 0xba57a68e, 0x75c6372b, 0x50afd341, 0xa7c13275, 0x915a0bf5, 0x6b54bfab, 0x2b0b1426, 0xab4cc9d7, 0x449ccd82, 0xf7fbf265, 0xab85c5f3, 0x1b55db94, 0xaad4e324, 0xcfa4bd3f, 0x2deaa3e2, 0x9e204d02, 0xc8bd25ac, 0xeadf55b3, 0xd5bd9e98, 0xe31231b2, 0x2ad5ad6c, 0x954329de, 0xadbe4528, 0xd8710f69, 0xaa51c90f, 0xaa786bf6, 0x22513f1e, 0xaa51a79b, 0x2ad344cc, 0x7b5a41f0, 0xd37cfbad, 0x1b069505, 0x41ece491, 0xb4c332e6, 0x032268d4, 0xc9600acc, 0xce387e6d, 0xbf6bb16c, 0x6a70fb78, 0x0d03d9c9, 0xd4df39de, 0xe01063da, 0x4736f464, 0x5ad328d8, 0xb347cc96, 0x75bb0fc3, 0x98511bfb, 0x4ffbcc35, 0xb58bcf6a, 0xe11f0abc, 0xbfc5fe4a, 0xa70aec10, 0xac39570a, 0x3f04442f, 0x6188b153, 0xe0397a2e, 0x5727cb79, 0x9ceb418f, 0x1cacd68d, 0x2ad37c96, 0x0175cb9d, 0xc69dff09, 0xc75b65f0, 0xd9db40d8, 0xec0e7779, 0x4744ead4, 0xb11c3274, 0xdd24cb9e, 0x7e1c54bd, 0xf01144f9, 0xd2240eb1, 0x9675b3fd, 0xa3ac3755, 0xd47c27af, 0x51c85f4d, 0x56907596, 0xa5bb15e6, 0x580304f0, 0xca042cf1, 0x011a37ea, 0x8dbfaadb, 0x35ba3e4a, 0x3526ffa0, 0xc37b4d09, 0xbc306ed9, 0x98a52666, 0x5648f725, 0xff5e569d, 0x0ced63d0, 0x7c63b2cf, 0x700b45e1, 0xd5ea50f1, 0x85a92872, 0xaf1fbda7, 0xd4234870, 0xa7870bf3, 0x2d3b4d79, 0x42e04198, 0x0cd0ede7, 0x26470db8, 0xf881814c, 0x474d6ad7, 0x7c0c5e5c, 0xd1231959, 0x381b7298, 0xf5d2f4db, 0xab838653, 0x6e2f1e23, 0x83719c9e, 0xbd91e046, 0x9a56456e, 0xdc39200c, 0x20c8c571, 0x962bda1c, 0xe1e696ff, 0xb141ab08, 0x7cca89b9, 0x1a69e783, 0x02cc4843, 0xa2f7c579, 0x429ef47d, 0x427b169c, 0x5ac9f049, 0xdd8f0f00, 0x5c8165bf); var $s2 = array( 0x1f201094, 0xef0ba75b, 0x69e3cf7e, 0x393f4380, 0xfe61cf7a, 0xeec5207a, 0x55889c94, 0x72fc0651, 0xada7ef79, 0x4e1d7235, 0xd55a63ce, 0xde0436ba, 0x99c430ef, 0x5f0c0794, 0x18dcdb7d, 0xa1d6eff3, 0xa0b52f7b, 0x59e83605, 0xee15b094, 0xe9ffd909, 0xdc440086, 0xef944459, 0xba83ccb3, 0xe0c3cdfb, 0xd1da4181, 0x3b092ab1, 0xf997f1c1, 0xa5e6cf7b, 0x01420ddb, 0xe4e7ef5b, 0x25a1ff41, 0xe180f806, 0x1fc41080, 0x179bee7a, 0xd37ac6a9, 0xfe5830a4, 0x98de8b7f, 0x77e83f4e, 0x79929269, 0x24fa9f7b, 0xe113c85b, 0xacc40083, 0xd7503525, 0xf7ea615f, 0x62143154, 0x0d554b63, 0x5d681121, 0xc866c359, 0x3d63cf73, 0xcee234c0, 0xd4d87e87, 0x5c672b21, 0x071f6181, 0x39f7627f, 0x361e3084, 0xe4eb573b, 0x602f64a4, 0xd63acd9c, 0x1bbc4635, 0x9e81032d, 0x2701f50c, 0x99847ab4, 0xa0e3df79, 0xba6cf38c, 0x10843094, 0x2537a95e, 0xf46f6ffe, 0xa1ff3b1f, 0x208cfb6a, 0x8f458c74, 0xd9e0a227, 0x4ec73a34, 0xfc884f69, 0x3e4de8df, 0xef0e0088, 0x3559648d, 0x8a45388c, 0x1d804366, 0x721d9bfd, 0xa58684bb, 0xe8256333, 0x844e8212, 0x128d8098, 0xfed33fb4, 0xce280ae1, 0x27e19ba5, 0xd5a6c252, 0xe49754bd, 0xc5d655dd, 0xeb667064, 0x77840b4d, 0xa1b6a801, 0x84db26a9, 0xe0b56714, 0x21f043b7, 0xe5d05860, 0x54f03084, 0x066ff472, 0xa31aa153, 0xdadc4755, 0xb5625dbf, 0x68561be6, 0x83ca6b94, 0x2d6ed23b, 0xeccf01db, 0xa6d3d0ba, 0xb6803d5c, 0xaf77a709, 0x33b4a34c, 0x397bc8d6, 0x5ee22b95, 0x5f0e5304, 0x81ed6f61, 0x20e74364, 0xb45e1378, 0xde18639b, 0x881ca122, 0xb96726d1, 0x8049a7e8, 0x22b7da7b, 0x5e552d25, 0x5272d237, 0x79d2951c, 0xc60d894c, 0x488cb402, 0x1ba4fe5b, 0xa4b09f6b, 0x1ca815cf, 0xa20c3005, 0x8871df63, 0xb9de2fcb, 0x0cc6c9e9, 0x0beeff53, 0xe3214517, 0xb4542835, 0x9f63293c, 0xee41e729, 0x6e1d2d7c, 0x50045286, 0x1e6685f3, 0xf33401c6, 0x30a22c95, 0x31a70850, 0x60930f13, 0x73f98417, 0xa1269859, 0xec645c44, 0x52c877a9, 0xcdff33a6, 0xa02b1741, 0x7cbad9a2, 0x2180036f, 0x50d99c08, 0xcb3f4861, 0xc26bd765, 0x64a3f6ab, 0x80342676, 0x25a75e7b, 0xe4e6d1fc, 0x20c710e6, 0xcdf0b680, 0x17844d3b, 0x31eef84d, 0x7e0824e4, 0x2ccb49eb, 0x846a3bae, 0x8ff77888, 0xee5d60f6, 0x7af75673, 0x2fdd5cdb, 0xa11631c1, 0x30f66f43, 0xb3faec54, 0x157fd7fa, 0xef8579cc, 0xd152de58, 0xdb2ffd5e, 0x8f32ce19, 0x306af97a, 0x02f03ef8, 0x99319ad5, 0xc242fa0f, 0xa7e3ebb0, 0xc68e4906, 0xb8da230c, 0x80823028, 0xdcdef3c8, 0xd35fb171, 0x088a1bc8, 0xbec0c560, 0x61a3c9e8, 0xbca8f54d, 0xc72feffa, 0x22822e99, 0x82c570b4, 0xd8d94e89, 0x8b1c34bc, 0x301e16e6, 0x273be979, 0xb0ffeaa6, 0x61d9b8c6, 0x00b24869, 0xb7ffce3f, 0x08dc283b, 0x43daf65a, 0xf7e19798, 0x7619b72f, 0x8f1c9ba4, 0xdc8637a0, 0x16a7d3b1, 0x9fc393b7, 0xa7136eeb, 0xc6bcc63e, 0x1a513742, 0xef6828bc, 0x520365d6, 0x2d6a77ab, 0x3527ed4b, 0x821fd216, 0x095c6e2e, 0xdb92f2fb, 0x5eea29cb, 0x145892f5, 0x91584f7f, 0x5483697b, 0x2667a8cc, 0x85196048, 0x8c4bacea, 0x833860d4, 0x0d23e0f9, 0x6c387e8a, 0x0ae6d249, 0xb284600c, 0xd835731d, 0xdcb1c647, 0xac4c56ea, 0x3ebd81b3, 0x230eabb0, 0x6438bc87, 0xf0b5b1fa, 0x8f5ea2b3, 0xfc184642, 0x0a036b7a, 0x4fb089bd, 0x649da589, 0xa345415e, 0x5c038323, 0x3e5d3bb9, 0x43d79572, 0x7e6dd07c, 0x06dfdf1e, 0x6c6cc4ef, 0x7160a539, 0x73bfbe70, 0x83877605, 0x4523ecf1); var $s3 = array( 0x8defc240, 0x25fa5d9f, 0xeb903dbf, 0xe810c907, 0x47607fff, 0x369fe44b, 0x8c1fc644, 0xaececa90, 0xbeb1f9bf, 0xeefbcaea, 0xe8cf1950, 0x51df07ae, 0x920e8806, 0xf0ad0548, 0xe13c8d83, 0x927010d5, 0x11107d9f, 0x07647db9, 0xb2e3e4d4, 0x3d4f285e, 0xb9afa820, 0xfade82e0, 0xa067268b, 0x8272792e, 0x553fb2c0, 0x489ae22b, 0xd4ef9794, 0x125e3fbc, 0x21fffcee, 0x825b1bfd, 0x9255c5ed, 0x1257a240, 0x4e1a8302, 0xbae07fff, 0x528246e7, 0x8e57140e, 0x3373f7bf, 0x8c9f8188, 0xa6fc4ee8, 0xc982b5a5, 0xa8c01db7, 0x579fc264, 0x67094f31, 0xf2bd3f5f, 0x40fff7c1, 0x1fb78dfc, 0x8e6bd2c1, 0x437be59b, 0x99b03dbf, 0xb5dbc64b, 0x638dc0e6, 0x55819d99, 0xa197c81c, 0x4a012d6e, 0xc5884a28, 0xccc36f71, 0xb843c213, 0x6c0743f1, 0x8309893c, 0x0feddd5f, 0x2f7fe850, 0xd7c07f7e, 0x02507fbf, 0x5afb9a04, 0xa747d2d0, 0x1651192e, 0xaf70bf3e, 0x58c31380, 0x5f98302e, 0x727cc3c4, 0x0a0fb402, 0x0f7fef82, 0x8c96fdad, 0x5d2c2aae, 0x8ee99a49, 0x50da88b8, 0x8427f4a0, 0x1eac5790, 0x796fb449, 0x8252dc15, 0xefbd7d9b, 0xa672597d, 0xada840d8, 0x45f54504, 0xfa5d7403, 0xe83ec305, 0x4f91751a, 0x925669c2, 0x23efe941, 0xa903f12e, 0x60270df2, 0x0276e4b6, 0x94fd6574, 0x927985b2, 0x8276dbcb, 0x02778176, 0xf8af918d, 0x4e48f79e, 0x8f616ddf, 0xe29d840e, 0x842f7d83, 0x340ce5c8, 0x96bbb682, 0x93b4b148, 0xef303cab, 0x984faf28, 0x779faf9b, 0x92dc560d, 0x224d1e20, 0x8437aa88, 0x7d29dc96, 0x2756d3dc, 0x8b907cee, 0xb51fd240, 0xe7c07ce3, 0xe566b4a1, 0xc3e9615e, 0x3cf8209d, 0x6094d1e3, 0xcd9ca341, 0x5c76460e, 0x00ea983b, 0xd4d67881, 0xfd47572c, 0xf76cedd9, 0xbda8229c, 0x127dadaa, 0x438a074e, 0x1f97c090, 0x081bdb8a, 0x93a07ebe, 0xb938ca15, 0x97b03cff, 0x3dc2c0f8, 0x8d1ab2ec, 0x64380e51, 0x68cc7bfb, 0xd90f2788, 0x12490181, 0x5de5ffd4, 0xdd7ef86a, 0x76a2e214, 0xb9a40368, 0x925d958f, 0x4b39fffa, 0xba39aee9, 0xa4ffd30b, 0xfaf7933b, 0x6d498623, 0x193cbcfa, 0x27627545, 0x825cf47a, 0x61bd8ba0, 0xd11e42d1, 0xcead04f4, 0x127ea392, 0x10428db7, 0x8272a972, 0x9270c4a8, 0x127de50b, 0x285ba1c8, 0x3c62f44f, 0x35c0eaa5, 0xe805d231, 0x428929fb, 0xb4fcdf82, 0x4fb66a53, 0x0e7dc15b, 0x1f081fab, 0x108618ae, 0xfcfd086d, 0xf9ff2889, 0x694bcc11, 0x236a5cae, 0x12deca4d, 0x2c3f8cc5, 0xd2d02dfe, 0xf8ef5896, 0xe4cf52da, 0x95155b67, 0x494a488c, 0xb9b6a80c, 0x5c8f82bc, 0x89d36b45, 0x3a609437, 0xec00c9a9, 0x44715253, 0x0a874b49, 0xd773bc40, 0x7c34671c, 0x02717ef6, 0x4feb5536, 0xa2d02fff, 0xd2bf60c4, 0xd43f03c0, 0x50b4ef6d, 0x07478cd1, 0x006e1888, 0xa2e53f55, 0xb9e6d4bc, 0xa2048016, 0x97573833, 0xd7207d67, 0xde0f8f3d, 0x72f87b33, 0xabcc4f33, 0x7688c55d, 0x7b00a6b0, 0x947b0001, 0x570075d2, 0xf9bb88f8, 0x8942019e, 0x4264a5ff, 0x856302e0, 0x72dbd92b, 0xee971b69, 0x6ea22fde, 0x5f08ae2b, 0xaf7a616d, 0xe5c98767, 0xcf1febd2, 0x61efc8c2, 0xf1ac2571, 0xcc8239c2, 0x67214cb8, 0xb1e583d1, 0xb7dc3e62, 0x7f10bdce, 0xf90a5c38, 0x0ff0443d, 0x606e6dc6, 0x60543a49, 0x5727c148, 0x2be98a1d, 0x8ab41738, 0x20e1be24, 0xaf96da0f, 0x68458425, 0x99833be5, 0x600d457d, 0x282f9350, 0x8334b362, 0xd91d1120, 0x2b6d8da0, 0x642b1e31, 0x9c305a00, 0x52bce688, 0x1b03588a, 0xf7baefd5, 0x4142ed9c, 0xa4315c11, 0x83323ec5, 0xdfef4636, 0xa133c501, 0xe9d3531c, 0xee353783); var $s4 = array( 0x9db30420, 0x1fb6e9de, 0xa7be7bef, 0xd273a298, 0x4a4f7bdb, 0x64ad8c57, 0x85510443, 0xfa020ed1, 0x7e287aff, 0xe60fb663, 0x095f35a1, 0x79ebf120, 0xfd059d43, 0x6497b7b1, 0xf3641f63, 0x241e4adf, 0x28147f5f, 0x4fa2b8cd, 0xc9430040, 0x0cc32220, 0xfdd30b30, 0xc0a5374f, 0x1d2d00d9, 0x24147b15, 0xee4d111a, 0x0fca5167, 0x71ff904c, 0x2d195ffe, 0x1a05645f, 0x0c13fefe, 0x081b08ca, 0x05170121, 0x80530100, 0xe83e5efe, 0xac9af4f8, 0x7fe72701, 0xd2b8ee5f, 0x06df4261, 0xbb9e9b8a, 0x7293ea25, 0xce84ffdf, 0xf5718801, 0x3dd64b04, 0xa26f263b, 0x7ed48400, 0x547eebe6, 0x446d4ca0, 0x6cf3d6f5, 0x2649abdf, 0xaea0c7f5, 0x36338cc1, 0x503f7e93, 0xd3772061, 0x11b638e1, 0x72500e03, 0xf80eb2bb, 0xabe0502e, 0xec8d77de, 0x57971e81, 0xe14f6746, 0xc9335400, 0x6920318f, 0x081dbb99, 0xffc304a5, 0x4d351805, 0x7f3d5ce3, 0xa6c866c6, 0x5d5bcca9, 0xdaec6fea, 0x9f926f91, 0x9f46222f, 0x3991467d, 0xa5bf6d8e, 0x1143c44f, 0x43958302, 0xd0214eeb, 0x022083b8, 0x3fb6180c, 0x18f8931e, 0x281658e6, 0x26486e3e, 0x8bd78a70, 0x7477e4c1, 0xb506e07c, 0xf32d0a25, 0x79098b02, 0xe4eabb81, 0x28123b23, 0x69dead38, 0x1574ca16, 0xdf871b62, 0x211c40b7, 0xa51a9ef9, 0x0014377b, 0x041e8ac8, 0x09114003, 0xbd59e4d2, 0xe3d156d5, 0x4fe876d5, 0x2f91a340, 0x557be8de, 0x00eae4a7, 0x0ce5c2ec, 0x4db4bba6, 0xe756bdff, 0xdd3369ac, 0xec17b035, 0x06572327, 0x99afc8b0, 0x56c8c391, 0x6b65811c, 0x5e146119, 0x6e85cb75, 0xbe07c002, 0xc2325577, 0x893ff4ec, 0x5bbfc92d, 0xd0ec3b25, 0xb7801ab7, 0x8d6d3b24, 0x20c763ef, 0xc366a5fc, 0x9c382880, 0x0ace3205, 0xaac9548a, 0xeca1d7c7, 0x041afa32, 0x1d16625a, 0x6701902c, 0x9b757a54, 0x31d477f7, 0x9126b031, 0x36cc6fdb, 0xc70b8b46, 0xd9e66a48, 0x56e55a79, 0x026a4ceb, 0x52437eff, 0x2f8f76b4, 0x0df980a5, 0x8674cde3, 0xedda04eb, 0x17a9be04, 0x2c18f4df, 0xb7747f9d, 0xab2af7b4, 0xefc34d20, 0x2e096b7c, 0x1741a254, 0xe5b6a035, 0x213d42f6, 0x2c1c7c26, 0x61c2f50f, 0x6552daf9, 0xd2c231f8, 0x25130f69, 0xd8167fa2, 0x0418f2c8, 0x001a96a6, 0x0d1526ab, 0x63315c21, 0x5e0a72ec, 0x49bafefd, 0x187908d9, 0x8d0dbd86, 0x311170a7, 0x3e9b640c, 0xcc3e10d7, 0xd5cad3b6, 0x0caec388, 0xf73001e1, 0x6c728aff, 0x71eae2a1, 0x1f9af36e, 0xcfcbd12f, 0xc1de8417, 0xac07be6b, 0xcb44a1d8, 0x8b9b0f56, 0x013988c3, 0xb1c52fca, 0xb4be31cd, 0xd8782806, 0x12a3a4e2, 0x6f7de532, 0x58fd7eb6, 0xd01ee900, 0x24adffc2, 0xf4990fc5, 0x9711aac5, 0x001d7b95, 0x82e5e7d2, 0x109873f6, 0x00613096, 0xc32d9521, 0xada121ff, 0x29908415, 0x7fbb977f, 0xaf9eb3db, 0x29c9ed2a, 0x5ce2a465, 0xa730f32c, 0xd0aa3fe8, 0x8a5cc091, 0xd49e2ce7, 0x0ce454a9, 0xd60acd86, 0x015f1919, 0x77079103, 0xdea03af6, 0x78a8565e, 0xdee356df, 0x21f05cbe, 0x8b75e387, 0xb3c50651, 0xb8a5c3ef, 0xd8eeb6d2, 0xe523be77, 0xc2154529, 0x2f69efdf, 0xafe67afb, 0xf470c4b2, 0xf3e0eb5b, 0xd6cc9876, 0x39e4460c, 0x1fda8538, 0x1987832f, 0xca007367, 0xa99144f8, 0x296b299e, 0x492fc295, 0x9266beab, 0xb5676e69, 0x9bd3ddda, 0xdf7e052f, 0xdb25701c, 0x1b5e51ee, 0xf65324e6, 0x6afce36c, 0x0316cc04, 0x8644213e, 0xb7dc59d0, 0x7965291f, 0xccd6fd43, 0x41823979, 0x932bcdf6, 0xb657c34d, 0x4edfd282, 0x7ae5290c, 0x3cb9536b, 0x851e20fe, 0x9833557e, 0x13ecf0b0, 0xd3ffb372, 0x3f85c5c1, 0x0aef7ed2); var $s5 = array( 0x7ec90c04, 0x2c6e74b9, 0x9b0e66df, 0xa6337911, 0xb86a7fff, 0x1dd358f5, 0x44dd9d44, 0x1731167f, 0x08fbf1fa, 0xe7f511cc, 0xd2051b00, 0x735aba00, 0x2ab722d8, 0x386381cb, 0xacf6243a, 0x69befd7a, 0xe6a2e77f, 0xf0c720cd, 0xc4494816, 0xccf5c180, 0x38851640, 0x15b0a848, 0xe68b18cb, 0x4caadeff, 0x5f480a01, 0x0412b2aa, 0x259814fc, 0x41d0efe2, 0x4e40b48d, 0x248eb6fb, 0x8dba1cfe, 0x41a99b02, 0x1a550a04, 0xba8f65cb, 0x7251f4e7, 0x95a51725, 0xc106ecd7, 0x97a5980a, 0xc539b9aa, 0x4d79fe6a, 0xf2f3f763, 0x68af8040, 0xed0c9e56, 0x11b4958b, 0xe1eb5a88, 0x8709e6b0, 0xd7e07156, 0x4e29fea7, 0x6366e52d, 0x02d1c000, 0xc4ac8e05, 0x9377f571, 0x0c05372a, 0x578535f2, 0x2261be02, 0xd642a0c9, 0xdf13a280, 0x74b55bd2, 0x682199c0, 0xd421e5ec, 0x53fb3ce8, 0xc8adedb3, 0x28a87fc9, 0x3d959981, 0x5c1ff900, 0xfe38d399, 0x0c4eff0b, 0x062407ea, 0xaa2f4fb1, 0x4fb96976, 0x90c79505, 0xb0a8a774, 0xef55a1ff, 0xe59ca2c2, 0xa6b62d27, 0xe66a4263, 0xdf65001f, 0x0ec50966, 0xdfdd55bc, 0x29de0655, 0x911e739a, 0x17af8975, 0x32c7911c, 0x89f89468, 0x0d01e980, 0x524755f4, 0x03b63cc9, 0x0cc844b2, 0xbcf3f0aa, 0x87ac36e9, 0xe53a7426, 0x01b3d82b, 0x1a9e7449, 0x64ee2d7e, 0xcddbb1da, 0x01c94910, 0xb868bf80, 0x0d26f3fd, 0x9342ede7, 0x04a5c284, 0x636737b6, 0x50f5b616, 0xf24766e3, 0x8eca36c1, 0x136e05db, 0xfef18391, 0xfb887a37, 0xd6e7f7d4, 0xc7fb7dc9, 0x3063fcdf, 0xb6f589de, 0xec2941da, 0x26e46695, 0xb7566419, 0xf654efc5, 0xd08d58b7, 0x48925401, 0xc1bacb7f, 0xe5ff550f, 0xb6083049, 0x5bb5d0e8, 0x87d72e5a, 0xab6a6ee1, 0x223a66ce, 0xc62bf3cd, 0x9e0885f9, 0x68cb3e47, 0x086c010f, 0xa21de820, 0xd18b69de, 0xf3f65777, 0xfa02c3f6, 0x407edac3, 0xcbb3d550, 0x1793084d, 0xb0d70eba, 0x0ab378d5, 0xd951fb0c, 0xded7da56, 0x4124bbe4, 0x94ca0b56, 0x0f5755d1, 0xe0e1e56e, 0x6184b5be, 0x580a249f, 0x94f74bc0, 0xe327888e, 0x9f7b5561, 0xc3dc0280, 0x05687715, 0x646c6bd7, 0x44904db3, 0x66b4f0a3, 0xc0f1648a, 0x697ed5af, 0x49e92ff6, 0x309e374f, 0x2cb6356a, 0x85808573, 0x4991f840, 0x76f0ae02, 0x083be84d, 0x28421c9a, 0x44489406, 0x736e4cb8, 0xc1092910, 0x8bc95fc6, 0x7d869cf4, 0x134f616f, 0x2e77118d, 0xb31b2be1, 0xaa90b472, 0x3ca5d717, 0x7d161bba, 0x9cad9010, 0xaf462ba2, 0x9fe459d2, 0x45d34559, 0xd9f2da13, 0xdbc65487, 0xf3e4f94e, 0x176d486f, 0x097c13ea, 0x631da5c7, 0x445f7382, 0x175683f4, 0xcdc66a97, 0x70be0288, 0xb3cdcf72, 0x6e5dd2f3, 0x20936079, 0x459b80a5, 0xbe60e2db, 0xa9c23101, 0xeba5315c, 0x224e42f2, 0x1c5c1572, 0xf6721b2c, 0x1ad2fff3, 0x8c25404e, 0x324ed72f, 0x4067b7fd, 0x0523138e, 0x5ca3bc78, 0xdc0fd66e, 0x75922283, 0x784d6b17, 0x58ebb16e, 0x44094f85, 0x3f481d87, 0xfcfeae7b, 0x77b5ff76, 0x8c2302bf, 0xaaf47556, 0x5f46b02a, 0x2b092801, 0x3d38f5f7, 0x0ca81f36, 0x52af4a8a, 0x66d5e7c0, 0xdf3b0874, 0x95055110, 0x1b5ad7a8, 0xf61ed5ad, 0x6cf6e479, 0x20758184, 0xd0cefa65, 0x88f7be58, 0x4a046826, 0x0ff6f8f3, 0xa09c7f70, 0x5346aba0, 0x5ce96c28, 0xe176eda3, 0x6bac307f, 0x376829d2, 0x85360fa9, 0x17e3fe2a, 0x24b79767, 0xf5a96b20, 0xd6cd2595, 0x68ff1ebf, 0x7555442c, 0xf19f06be, 0xf9e0659a, 0xeeb9491d, 0x34010718, 0xbb30cab8, 0xe822fe15, 0x88570983, 0x750e6249, 0xda627e55, 0x5e76ffa8, 0xb1534546, 0x6d47de08, 0xefe9e7d4); var $s6 = array( 0xf6fa8f9d, 0x2cac6ce1, 0x4ca34867, 0xe2337f7c, 0x95db08e7, 0x016843b4, 0xeced5cbc, 0x325553ac, 0xbf9f0960, 0xdfa1e2ed, 0x83f0579d, 0x63ed86b9, 0x1ab6a6b8, 0xde5ebe39, 0xf38ff732, 0x8989b138, 0x33f14961, 0xc01937bd, 0xf506c6da, 0xe4625e7e, 0xa308ea99, 0x4e23e33c, 0x79cbd7cc, 0x48a14367, 0xa3149619, 0xfec94bd5, 0xa114174a, 0xeaa01866, 0xa084db2d, 0x09a8486f, 0xa888614a, 0x2900af98, 0x01665991, 0xe1992863, 0xc8f30c60, 0x2e78ef3c, 0xd0d51932, 0xcf0fec14, 0xf7ca07d2, 0xd0a82072, 0xfd41197e, 0x9305a6b0, 0xe86be3da, 0x74bed3cd, 0x372da53c, 0x4c7f4448, 0xdab5d440, 0x6dba0ec3, 0x083919a7, 0x9fbaeed9, 0x49dbcfb0, 0x4e670c53, 0x5c3d9c01, 0x64bdb941, 0x2c0e636a, 0xba7dd9cd, 0xea6f7388, 0xe70bc762, 0x35f29adb, 0x5c4cdd8d, 0xf0d48d8c, 0xb88153e2, 0x08a19866, 0x1ae2eac8, 0x284caf89, 0xaa928223, 0x9334be53, 0x3b3a21bf, 0x16434be3, 0x9aea3906, 0xefe8c36e, 0xf890cdd9, 0x80226dae, 0xc340a4a3, 0xdf7e9c09, 0xa694a807, 0x5b7c5ecc, 0x221db3a6, 0x9a69a02f, 0x68818a54, 0xceb2296f, 0x53c0843a, 0xfe893655, 0x25bfe68a, 0xb4628abc, 0xcf222ebf, 0x25ac6f48, 0xa9a99387, 0x53bddb65, 0xe76ffbe7, 0xe967fd78, 0x0ba93563, 0x8e342bc1, 0xe8a11be9, 0x4980740d, 0xc8087dfc, 0x8de4bf99, 0xa11101a0, 0x7fd37975, 0xda5a26c0, 0xe81f994f, 0x9528cd89, 0xfd339fed, 0xb87834bf, 0x5f04456d, 0x22258698, 0xc9c4c83b, 0x2dc156be, 0x4f628daa, 0x57f55ec5, 0xe2220abe, 0xd2916ebf, 0x4ec75b95, 0x24f2c3c0, 0x42d15d99, 0xcd0d7fa0, 0x7b6e27ff, 0xa8dc8af0, 0x7345c106, 0xf41e232f, 0x35162386, 0xe6ea8926, 0x3333b094, 0x157ec6f2, 0x372b74af, 0x692573e4, 0xe9a9d848, 0xf3160289, 0x3a62ef1d, 0xa787e238, 0xf3a5f676, 0x74364853, 0x20951063, 0x4576698d, 0xb6fad407, 0x592af950, 0x36f73523, 0x4cfb6e87, 0x7da4cec0, 0x6c152daa, 0xcb0396a8, 0xc50dfe5d, 0xfcd707ab, 0x0921c42f, 0x89dff0bb, 0x5fe2be78, 0x448f4f33, 0x754613c9, 0x2b05d08d, 0x48b9d585, 0xdc049441, 0xc8098f9b, 0x7dede786, 0xc39a3373, 0x42410005, 0x6a091751, 0x0ef3c8a6, 0x890072d6, 0x28207682, 0xa9a9f7be, 0xbf32679d, 0xd45b5b75, 0xb353fd00, 0xcbb0e358, 0x830f220a, 0x1f8fb214, 0xd372cf08, 0xcc3c4a13, 0x8cf63166, 0x061c87be, 0x88c98f88, 0x6062e397, 0x47cf8e7a, 0xb6c85283, 0x3cc2acfb, 0x3fc06976, 0x4e8f0252, 0x64d8314d, 0xda3870e3, 0x1e665459, 0xc10908f0, 0x513021a5, 0x6c5b68b7, 0x822f8aa0, 0x3007cd3e, 0x74719eef, 0xdc872681, 0x073340d4, 0x7e432fd9, 0x0c5ec241, 0x8809286c, 0xf592d891, 0x08a930f6, 0x957ef305, 0xb7fbffbd, 0xc266e96f, 0x6fe4ac98, 0xb173ecc0, 0xbc60b42a, 0x953498da, 0xfba1ae12, 0x2d4bd736, 0x0f25faab, 0xa4f3fceb, 0xe2969123, 0x257f0c3d, 0x9348af49, 0x361400bc, 0xe8816f4a, 0x3814f200, 0xa3f94043, 0x9c7a54c2, 0xbc704f57, 0xda41e7f9, 0xc25ad33a, 0x54f4a084, 0xb17f5505, 0x59357cbe, 0xedbd15c8, 0x7f97c5ab, 0xba5ac7b5, 0xb6f6deaf, 0x3a479c3a, 0x5302da25, 0x653d7e6a, 0x54268d49, 0x51a477ea, 0x5017d55b, 0xd7d25d88, 0x44136c76, 0x0404a8c8, 0xb8e5a121, 0xb81a928a, 0x60ed5869, 0x97c55b96, 0xeaec991b, 0x29935913, 0x01fdb7f1, 0x088e8dfa, 0x9ab6f6f5, 0x3b4cbf9f, 0x4a5de3ab, 0xe6051d35, 0xa0e1d855, 0xd36b4cf1, 0xf544edeb, 0xb0e93524, 0xbebb8fbd, 0xa2d762cf, 0x49c92f54, 0x38b5f331, 0x7128a454, 0x48392905, 0xa65b1db8, 0x851c97bd, 0xd675cf2f); var $s7 = array( 0x85e04019, 0x332bf567, 0x662dbfff, 0xcfc65693, 0x2a8d7f6f, 0xab9bc912, 0xde6008a1, 0x2028da1f, 0x0227bce7, 0x4d642916, 0x18fac300, 0x50f18b82, 0x2cb2cb11, 0xb232e75c, 0x4b3695f2, 0xb28707de, 0xa05fbcf6, 0xcd4181e9, 0xe150210c, 0xe24ef1bd, 0xb168c381, 0xfde4e789, 0x5c79b0d8, 0x1e8bfd43, 0x4d495001, 0x38be4341, 0x913cee1d, 0x92a79c3f, 0x089766be, 0xbaeeadf4, 0x1286becf, 0xb6eacb19, 0x2660c200, 0x7565bde4, 0x64241f7a, 0x8248dca9, 0xc3b3ad66, 0x28136086, 0x0bd8dfa8, 0x356d1cf2, 0x107789be, 0xb3b2e9ce, 0x0502aa8f, 0x0bc0351e, 0x166bf52a, 0xeb12ff82, 0xe3486911, 0xd34d7516, 0x4e7b3aff, 0x5f43671b, 0x9cf6e037, 0x4981ac83, 0x334266ce, 0x8c9341b7, 0xd0d854c0, 0xcb3a6c88, 0x47bc2829, 0x4725ba37, 0xa66ad22b, 0x7ad61f1e, 0x0c5cbafa, 0x4437f107, 0xb6e79962, 0x42d2d816, 0x0a961288, 0xe1a5c06e, 0x13749e67, 0x72fc081a, 0xb1d139f7, 0xf9583745, 0xcf19df58, 0xbec3f756, 0xc06eba30, 0x07211b24, 0x45c28829, 0xc95e317f, 0xbc8ec511, 0x38bc46e9, 0xc6e6fa14, 0xbae8584a, 0xad4ebc46, 0x468f508b, 0x7829435f, 0xf124183b, 0x821dba9f, 0xaff60ff4, 0xea2c4e6d, 0x16e39264, 0x92544a8b, 0x009b4fc3, 0xaba68ced, 0x9ac96f78, 0x06a5b79a, 0xb2856e6e, 0x1aec3ca9, 0xbe838688, 0x0e0804e9, 0x55f1be56, 0xe7e5363b, 0xb3a1f25d, 0xf7debb85, 0x61fe033c, 0x16746233, 0x3c034c28, 0xda6d0c74, 0x79aac56c, 0x3ce4e1ad, 0x51f0c802, 0x98f8f35a, 0x1626a49f, 0xeed82b29, 0x1d382fe3, 0x0c4fb99a, 0xbb325778, 0x3ec6d97b, 0x6e77a6a9, 0xcb658b5c, 0xd45230c7, 0x2bd1408b, 0x60c03eb7, 0xb9068d78, 0xa33754f4, 0xf430c87d, 0xc8a71302, 0xb96d8c32, 0xebd4e7be, 0xbe8b9d2d, 0x7979fb06, 0xe7225308, 0x8b75cf77, 0x11ef8da4, 0xe083c858, 0x8d6b786f, 0x5a6317a6, 0xfa5cf7a0, 0x5dda0033, 0xf28ebfb0, 0xf5b9c310, 0xa0eac280, 0x08b9767a, 0xa3d9d2b0, 0x79d34217, 0x021a718d, 0x9ac6336a, 0x2711fd60, 0x438050e3, 0x069908a8, 0x3d7fedc4, 0x826d2bef, 0x4eeb8476, 0x488dcf25, 0x36c9d566, 0x28e74e41, 0xc2610aca, 0x3d49a9cf, 0xbae3b9df, 0xb65f8de6, 0x92aeaf64, 0x3ac7d5e6, 0x9ea80509, 0xf22b017d, 0xa4173f70, 0xdd1e16c3, 0x15e0d7f9, 0x50b1b887, 0x2b9f4fd5, 0x625aba82, 0x6a017962, 0x2ec01b9c, 0x15488aa9, 0xd716e740, 0x40055a2c, 0x93d29a22, 0xe32dbf9a, 0x058745b9, 0x3453dc1e, 0xd699296e, 0x496cff6f, 0x1c9f4986, 0xdfe2ed07, 0xb87242d1, 0x19de7eae, 0x053e561a, 0x15ad6f8c, 0x66626c1c, 0x7154c24c, 0xea082b2a, 0x93eb2939, 0x17dcb0f0, 0x58d4f2ae, 0x9ea294fb, 0x52cf564c, 0x9883fe66, 0x2ec40581, 0x763953c3, 0x01d6692e, 0xd3a0c108, 0xa1e7160e, 0xe4f2dfa6, 0x693ed285, 0x74904698, 0x4c2b0edd, 0x4f757656, 0x5d393378, 0xa132234f, 0x3d321c5d, 0xc3f5e194, 0x4b269301, 0xc79f022f, 0x3c997e7e, 0x5e4f9504, 0x3ffafbbd, 0x76f7ad0e, 0x296693f4, 0x3d1fce6f, 0xc61e45be, 0xd3b5ab34, 0xf72bf9b7, 0x1b0434c0, 0x4e72b567, 0x5592a33d, 0xb5229301, 0xcfd2a87f, 0x60aeb767, 0x1814386b, 0x30bcc33d, 0x38a0c07d, 0xfd1606f2, 0xc363519b, 0x589dd390, 0x5479f8e6, 0x1cb8d647, 0x97fd61a9, 0xea7759f4, 0x2d57539d, 0x569a58cf, 0xe84e63ad, 0x462e1b78, 0x6580f87e, 0xf3817914, 0x91da55f4, 0x40a230f3, 0xd1988f35, 0xb6e318d2, 0x3ffa50bc, 0x3d40f021, 0xc3c0bdae, 0x4958c24c, 0x518f36b2, 0x84b1d370, 0x0fedce83, 0x878ddada, 0xf2a279c7, 0x94e01be8, 0x90716f4b, 0x954b8aa3); var $s8 = array( 0xe216300d, 0xbbddfffc, 0xa7ebdabd, 0x35648095, 0x7789f8b7, 0xe6c1121b, 0x0e241600, 0x052ce8b5, 0x11a9cfb0, 0xe5952f11, 0xece7990a, 0x9386d174, 0x2a42931c, 0x76e38111, 0xb12def3a, 0x37ddddfc, 0xde9adeb1, 0x0a0cc32c, 0xbe197029, 0x84a00940, 0xbb243a0f, 0xb4d137cf, 0xb44e79f0, 0x049eedfd, 0x0b15a15d, 0x480d3168, 0x8bbbde5a, 0x669ded42, 0xc7ece831, 0x3f8f95e7, 0x72df191b, 0x7580330d, 0x94074251, 0x5c7dcdfa, 0xabbe6d63, 0xaa402164, 0xb301d40a, 0x02e7d1ca, 0x53571dae, 0x7a3182a2, 0x12a8ddec, 0xfdaa335d, 0x176f43e8, 0x71fb46d4, 0x38129022, 0xce949ad4, 0xb84769ad, 0x965bd862, 0x82f3d055, 0x66fb9767, 0x15b80b4e, 0x1d5b47a0, 0x4cfde06f, 0xc28ec4b8, 0x57e8726e, 0x647a78fc, 0x99865d44, 0x608bd593, 0x6c200e03, 0x39dc5ff6, 0x5d0b00a3, 0xae63aff2, 0x7e8bd632, 0x70108c0c, 0xbbd35049, 0x2998df04, 0x980cf42a, 0x9b6df491, 0x9e7edd53, 0x06918548, 0x58cb7e07, 0x3b74ef2e, 0x522fffb1, 0xd24708cc, 0x1c7e27cd, 0xa4eb215b, 0x3cf1d2e2, 0x19b47a38, 0x424f7618, 0x35856039, 0x9d17dee7, 0x27eb35e6, 0xc9aff67b, 0x36baf5b8, 0x09c467cd, 0xc18910b1, 0xe11dbf7b, 0x06cd1af8, 0x7170c608, 0x2d5e3354, 0xd4de495a, 0x64c6d006, 0xbcc0c62c, 0x3dd00db3, 0x708f8f34, 0x77d51b42, 0x264f620f, 0x24b8d2bf, 0x15c1b79e, 0x46a52564, 0xf8d7e54e, 0x3e378160, 0x7895cda5, 0x859c15a5, 0xe6459788, 0xc37bc75f, 0xdb07ba0c, 0x0676a3ab, 0x7f229b1e, 0x31842e7b, 0x24259fd7, 0xf8bef472, 0x835ffcb8, 0x6df4c1f2, 0x96f5b195, 0xfd0af0fc, 0xb0fe134c, 0xe2506d3d, 0x4f9b12ea, 0xf215f225, 0xa223736f, 0x9fb4c428, 0x25d04979, 0x34c713f8, 0xc4618187, 0xea7a6e98, 0x7cd16efc, 0x1436876c, 0xf1544107, 0xbedeee14, 0x56e9af27, 0xa04aa441, 0x3cf7c899, 0x92ecbae6, 0xdd67016d, 0x151682eb, 0xa842eedf, 0xfdba60b4, 0xf1907b75, 0x20e3030f, 0x24d8c29e, 0xe139673b, 0xefa63fb8, 0x71873054, 0xb6f2cf3b, 0x9f326442, 0xcb15a4cc, 0xb01a4504, 0xf1e47d8d, 0x844a1be5, 0xbae7dfdc, 0x42cbda70, 0xcd7dae0a, 0x57e85b7a, 0xd53f5af6, 0x20cf4d8c, 0xcea4d428, 0x79d130a4, 0x3486ebfb, 0x33d3cddc, 0x77853b53, 0x37effcb5, 0xc5068778, 0xe580b3e6, 0x4e68b8f4, 0xc5c8b37e, 0x0d809ea2, 0x398feb7c, 0x132a4f94, 0x43b7950e, 0x2fee7d1c, 0x223613bd, 0xdd06caa2, 0x37df932b, 0xc4248289, 0xacf3ebc3, 0x5715f6b7, 0xef3478dd, 0xf267616f, 0xc148cbe4, 0x9052815e, 0x5e410fab, 0xb48a2465, 0x2eda7fa4, 0xe87b40e4, 0xe98ea084, 0x5889e9e1, 0xefd390fc, 0xdd07d35b, 0xdb485694, 0x38d7e5b2, 0x57720101, 0x730edebc, 0x5b643113, 0x94917e4f, 0x503c2fba, 0x646f1282, 0x7523d24a, 0xe0779695, 0xf9c17a8f, 0x7a5b2121, 0xd187b896, 0x29263a4d, 0xba510cdf, 0x81f47c9f, 0xad1163ed, 0xea7b5965, 0x1a00726e, 0x11403092, 0x00da6d77, 0x4a0cdd61, 0xad1f4603, 0x605bdfb0, 0x9eedc364, 0x22ebe6a8, 0xcee7d28a, 0xa0e736a0, 0x5564a6b9, 0x10853209, 0xc7eb8f37, 0x2de705ca, 0x8951570f, 0xdf09822b, 0xbd691a6c, 0xaa12e4f2, 0x87451c0f, 0xe0f6a27a, 0x3ada4819, 0x4cf1764f, 0x0d771c2b, 0x67cdb156, 0x350d8384, 0x5938fa0f, 0x42399ef3, 0x36997b07, 0x0e84093d, 0x4aa93e61, 0x8360d87b, 0x1fa98b0c, 0x1149382c, 0xe97625a5, 0x0614d1b7, 0x0e25244b, 0x0c768347, 0x589e8d82, 0x0d2059d1, 0xa466bb1e, 0xf8da0a82, 0x04f19130, 0xba6e4ec0, 0x99265164, 0x1ee7230d, 0x50b2ad80, 0xeaee6801, 0x8db2a283, 0xea8bf59e); /* Masking Keys */ var $_Km = array(); /* Rotate Keys */ var $_Kr = array(); /* The number of rounds to do */ var $_rounds = 16; /* Constructor */ function Horde_Cipher_cast128($params = null) { } /** * Set the key to be used for en/decryption * * @param String $key The key to use */ function setKey($key) { if (!is_null($key)) { $this->_rounds = (strlen($key) < 11) ? 12 : 16; $key = $this->_formatKey($key); $keySchedule = $this->_keySchedule($key); } } /** * Return the size of the blocks that this cipher needs * * @return Integer The number of characters per block */ function getBlockSize() { return 8; } /** * Encrypt a block on data. * * @param String $block The data to encrypt * @param optional String $key The key to use * * @return String the encrypted output */ function encryptBlock($block, $key = null) { if (!is_null($key)) { $this->_rounds = (strlen($key) < 11) ? 12 : 16; $key = $this->_formatKey($key); $keySchedule = $this->_keySchedule($key); } $L = $this->_formatData(substr($block, 0, 4)); $R = $this->_formatData(substr($block, 4, 4)); $L ^= $this->f1($R, $this->_Km[1], $this->_Kr[1]); $R ^= $this->f2($L, $this->_Km[2], $this->_Kr[2]); $L ^= $this->f3($R, $this->_Km[3], $this->_Kr[3]); $R ^= $this->f1($L, $this->_Km[4], $this->_Kr[4]); $L ^= $this->f2($R, $this->_Km[5], $this->_Kr[5]); $R ^= $this->f3($L, $this->_Km[6], $this->_Kr[6]); $L ^= $this->f1($R, $this->_Km[7], $this->_Kr[7]); $R ^= $this->f2($L, $this->_Km[8], $this->_Kr[8]); $L ^= $this->f3($R, $this->_Km[9], $this->_Kr[9]); $R ^= $this->f1($L, $this->_Km[10], $this->_Kr[10]); $L ^= $this->f2($R, $this->_Km[11], $this->_Kr[11]); $R ^= $this->f3($L, $this->_Km[12], $this->_Kr[12]); if ($this->_rounds > 12) { $L ^= $this->f1($R, $this->_Km[13], $this->_Kr[13]); $R ^= $this->f2($L, $this->_Km[14], $this->_Kr[14]); $L ^= $this->f3($R, $this->_Km[15], $this->_Kr[15]); $R ^= $this->f1($L, $this->_Km[16], $this->_Kr[16]); } $encrypted = pack("N", $R) . pack("N", $L); return $encrypted; } /** * Decrypt a block on data. * * @param String $block The data to decrypt * @param optional String $key The key to use * * @return String the decrypted output */ function decryptBlock($block, $key = null) { if (!is_null($key)) { $this->_rounds = (strlen($key) < 11) ? 12 : 16; $key = $this->_formatKey($key); $keySchedule = $this->_keySchedule($key); } $R = $this->_formatData(substr($block, 0, 4)); $L = $this->_formatData(substr($block, 4, 4)); if ($this->_rounds > 12) { $R ^= $this->f1($L, $this->_Km[16], $this->_Kr[16]); $L ^= $this->f3($R, $this->_Km[15], $this->_Kr[15]); $R ^= $this->f2($L, $this->_Km[14], $this->_Kr[14]); $L ^= $this->f1($R, $this->_Km[13], $this->_Kr[13]); } $R ^= $this->f3($L, $this->_Km[12], $this->_Kr[12]); $L ^= $this->f2($R, $this->_Km[11], $this->_Kr[11]); $R ^= $this->f1($L, $this->_Km[10], $this->_Kr[10]); $L ^= $this->f3($R, $this->_Km[9], $this->_Kr[9]); $R ^= $this->f2($L, $this->_Km[8], $this->_Kr[8]); $L ^= $this->f1($R, $this->_Km[7], $this->_Kr[7]); $R ^= $this->f3($L, $this->_Km[6], $this->_Kr[6]); $L ^= $this->f2($R, $this->_Km[5], $this->_Kr[5]); $R ^= $this->f1($L, $this->_Km[4], $this->_Kr[4]); $L ^= $this->f3($R, $this->_Km[3], $this->_Kr[3]); $R ^= $this->f2($L, $this->_Km[2], $this->_Kr[2]); $L ^= $this->f1($R, $this->_Km[1], $this->_Kr[1]); $decrypted = pack("N", $L) . pack("N", $R); return $decrypted; } /** * f1() */ function f1($d, $Km, $Kr) { $I = $Km + $d; /* Nasty Fix as * $I << $Kr | $I >> (32 - $Kr) * Doesn't always give the correct answer */ $bin = str_pad(decbin($I), 32, '0', STR_PAD_LEFT); $I = bindec(substr($bin, $Kr) . substr($bin, 0, $Kr)); $f = $this->s1[($I >> 24) & 0xFF] ^ $this->s2[($I >> 16) & 0xFF]; $f = $f - $this->s3[($I >> 8) & 0xFF]; $f = $f + $this->s4[$I & 0xFF]; return $f; } /** * f2() */ function f2($d, $Km, $Kr) { $I = $Km ^ $d; /* Nasty Fix as * $I << $Kr | $I >> (32 - $Kr) * Doesn't always give the correct answer */ $bin = str_pad(decbin($I), 32, '0', STR_PAD_LEFT); $I = bindec(substr($bin, $Kr) . substr($bin, 0, $Kr)); $f = $this->s1[($I >> 24) & 0xFF] - $this->s2[($I >> 16) & 0xFF]; $f = $f + $this->s3[($I >> 8) & 0xFF]; $f = $f ^ $this->s4[$I & 0xFF]; return $f; } /** * f3() */ function f3($d, $Km, $Kr) { $I = 0xFFFFFFFF & ($Km - $d); /* Nasty Fix as * $I << $Kr | $I >> (32 - $Kr) * Doesn't always give the correct answer */ $bin = str_pad(decbin($I), 32, '0', STR_PAD_LEFT); $I = bindec(substr($bin, $Kr) . substr($bin, 0, $Kr)); $f = ($this->s1[($I >> 24) & 0xFF] + $this->s2[($I >> 16) & 0xFF]); $f = $f ^ $this->s3[($I >> 8) & 0xFF]; $f = 0xFFFFFFFF & ($f - $this->s4[$I & 0xFF]); return $f; } /** * Convert a string into a array of the ordinates * of it's characters * * @return array The data */ function _formatData($data) { return $this->_combine4(unpack('C*', $data), 0x1); } /** * Converts a text key into an array * padding with \0's to a length of 128 bits * * @return array The key */ function _formatKey($key) { $res = array_values(unpack('C*', $key)); for($i = count($res); $i < 16; $i++) { $res[$i] = 0; } return $res; } /** * Create the complete key shedule * * @param array $key */ function _keySchedule($key) { $x0x1x2x3 = $this->_combine4($key, 0x0); $x4x5x6x7 = $this->_combine4($key, 0x4); $x8x9xAxB = $this->_combine4($key, 0x8); $xCxDxExF = $this->_combine4($key, 0xC); $b = $this->_split($x0x1x2x3); $x0 = $b[0]; $x1 = $b[1]; $x2 = $b[2]; $x3 = $b[3]; $b = $this->_split($x4x5x6x7); $x4 = $b[0]; $x5 = $b[1]; $x6 = $b[2]; $x7 = $b[3]; $b = $this->_split($x8x9xAxB); $x8 = $b[0]; $x9 = $b[1]; $xA = $b[2]; $xB = $b[3]; $b = $this->_split($xCxDxExF); $xC = $b[0]; $xD = $b[1]; $xE = $b[2]; $xF = $b[3]; $z0z1z2z3 = $x0x1x2x3 ^ $this->s5[$xD] ^ $this->s6[$xF] ^ $this->s7[$xC] ^ $this->s8[$xE] ^ $this->s7[$x8]; $b = $this->_split($z0z1z2z3); $z0 = $b[0]; $z1 = $b[1]; $z2 = $b[2]; $z3 = $b[3]; $z4z5z6z7 = $x8x9xAxB ^ $this->s5[$z0] ^ $this->s6[$z2] ^ $this->s7[$z1] ^ $this->s8[$z3] ^ $this->s8[$xA]; $b = $this->_split($z4z5z6z7); $z4 = $b[0]; $z5 = $b[1]; $z6 = $b[2]; $z7 = $b[3]; $z8z9zAzB = $xCxDxExF ^ $this->s5[$z7] ^ $this->s6[$z6] ^ $this->s7[$z5] ^ $this->s8[$z4] ^ $this->s5[$x9]; $b = $this->_split($z8z9zAzB); $z8 = $b[0]; $z9 = $b[1]; $zA = $b[2]; $zB = $b[3]; $zCzDzEzF = $x4x5x6x7 ^ $this->s5[$zA] ^ $this->s6[$z9] ^ $this->s7[$zB] ^ $this->s8[$z8] ^ $this->s6[$xB]; $b = $this->_split($zCzDzEzF); $zC = $b[0]; $zD = $b[1]; $zE = $b[2]; $zF = $b[3]; $this->_Km[1] = $this->s5[$z8] ^ $this->s6[$z9] ^ $this->s7[$z7] ^ $this->s8[$z6] ^ $this->s5[$z2]; $this->_Km[2] = $this->s5[$zA] ^ $this->s6[$zB] ^ $this->s7[$z5] ^ $this->s8[$z4] ^ $this->s6[$z6]; $this->_Km[3] = $this->s5[$zC] ^ $this->s6[$zD] ^ $this->s7[$z3] ^ $this->s8[$z2] ^ $this->s7[$z9]; $this->_Km[4] = $this->s5[$zE] ^ $this->s6[$zF] ^ $this->s7[$z1] ^ $this->s8[$z0] ^ $this->s8[$zC]; $x0x1x2x3 = $z8z9zAzB ^ $this->s5[$z5] ^ $this->s6[$z7] ^ $this->s7[$z4] ^ $this->s8[$z6] ^ $this->s7[$z0]; $b = $this->_split($x0x1x2x3); $x0 = $b[0]; $x1 = $b[1]; $x2 = $b[2]; $x3 = $b[3]; $x4x5x6x7 = $z0z1z2z3 ^ $this->s5[$x0] ^ $this->s6[$x2] ^ $this->s7[$x1] ^ $this->s8[$x3] ^ $this->s8[$z2]; $b = $this->_split($x4x5x6x7); $x4 = $b[0]; $x5 = $b[1]; $x6 = $b[2]; $x7 = $b[3]; $x8x9xAxB = $z4z5z6z7 ^ $this->s5[$x7] ^ $this->s6[$x6] ^ $this->s7[$x5] ^ $this->s8[$x4] ^ $this->s5[$z1]; $b = $this->_split($x8x9xAxB); $x8 = $b[0]; $x9 = $b[1]; $xA = $b[2]; $xB = $b[3]; $xCxDxExF = $zCzDzEzF ^ $this->s5[$xA] ^ $this->s6[$x9] ^ $this->s7[$xB] ^ $this->s8[$x8] ^ $this->s6[$z3]; $b = $this->_split($xCxDxExF); $xC = $b[0]; $xD = $b[1]; $xE = $b[2]; $xF = $b[3]; $this->_Km[5] = $this->s5[$x3] ^ $this->s6[$x2] ^ $this->s7[$xC] ^ $this->s8[$xD] ^ $this->s5[$x8]; $this->_Km[6] = $this->s5[$x1] ^ $this->s6[$x0] ^ $this->s7[$xE] ^ $this->s8[$xF] ^ $this->s6[$xD]; $this->_Km[7] = $this->s5[$x7] ^ $this->s6[$x6] ^ $this->s7[$x8] ^ $this->s8[$x9] ^ $this->s7[$x3]; $this->_Km[8] = $this->s5[$x5] ^ $this->s6[$x4] ^ $this->s7[$xA] ^ $this->s8[$xB] ^ $this->s8[$x7]; $z0z1z2z3 = $x0x1x2x3 ^ $this->s5[$xD] ^ $this->s6[$xF] ^ $this->s7[$xC] ^ $this->s8[$xE] ^ $this->s7[$x8]; $b = $this->_split($z0z1z2z3); $z0 = $b[0]; $z1 = $b[1]; $z2 = $b[2]; $z3 = $b[3]; $z4z5z6z7 = $x8x9xAxB ^ $this->s5[$z0] ^ $this->s6[$z2] ^ $this->s7[$z1] ^ $this->s8[$z3] ^ $this->s8[$xA]; $b = $this->_split($z4z5z6z7); $z4 = $b[0]; $z5 = $b[1]; $z6 = $b[2]; $z7 = $b[3]; $z8z9zAzB = $xCxDxExF ^ $this->s5[$z7] ^ $this->s6[$z6] ^ $this->s7[$z5] ^ $this->s8[$z4] ^ $this->s5[$x9]; $b = $this->_split($z8z9zAzB); $z8 = $b[0]; $z9 = $b[1]; $zA = $b[2]; $zB = $b[3]; $zCzDzEzF = $x4x5x6x7 ^ $this->s5[$zA] ^ $this->s6[$z9] ^ $this->s7[$zB] ^ $this->s8[$z8] ^ $this->s6[$xB]; $b = $this->_split($zCzDzEzF); $zC = $b[0]; $zD = $b[1]; $zE = $b[2]; $zF = $b[3]; $this->_Km[9] = $this->s5[$z3] ^ $this->s6[$z2] ^ $this->s7[$zC] ^ $this->s8[$zD] ^ $this->s5[$z9]; $this->_Km[10] = $this->s5[$z1] ^ $this->s6[$z0] ^ $this->s7[$zE] ^ $this->s8[$zF] ^ $this->s6[$zC]; $this->_Km[11] = $this->s5[$z7] ^ $this->s6[$z6] ^ $this->s7[$z8] ^ $this->s8[$z9] ^ $this->s7[$z2]; $this->_Km[12] = $this->s5[$z5] ^ $this->s6[$z4] ^ $this->s7[$zA] ^ $this->s8[$zB] ^ $this->s8[$z6]; $x0x1x2x3 = $z8z9zAzB ^ $this->s5[$z5] ^ $this->s6[$z7] ^ $this->s7[$z4] ^ $this->s8[$z6] ^ $this->s7[$z0]; $b = $this->_split($x0x1x2x3); $x0 = $b[0]; $x1 = $b[1]; $x2 = $b[2]; $x3 = $b[3]; $x4x5x6x7 = $z0z1z2z3 ^ $this->s5[$x0] ^ $this->s6[$x2] ^ $this->s7[$x1] ^ $this->s8[$x3] ^ $this->s8[$z2]; $b = $this->_split($x4x5x6x7); $x4 = $b[0]; $x5 = $b[1]; $x6 = $b[2]; $x7 = $b[3]; $x8x9xAxB = $z4z5z6z7 ^ $this->s5[$x7] ^ $this->s6[$x6] ^ $this->s7[$x5] ^ $this->s8[$x4] ^ $this->s5[$z1]; $b = $this->_split($x8x9xAxB); $x8 = $b[0]; $x9 = $b[1]; $xA = $b[2]; $xB = $b[3]; $xCxDxExF = $zCzDzEzF ^ $this->s5[$xA] ^ $this->s6[$x9] ^ $this->s7[$xB] ^ $this->s8[$x8] ^ $this->s6[$z3]; $b = $this->_split($xCxDxExF); $xC = $b[0]; $xD = $b[1]; $xE = $b[2]; $xF = $b[3]; $this->_Km[13] = $this->s5[$x8] ^ $this->s6[$x9] ^ $this->s7[$x7] ^ $this->s8[$x6] ^ $this->s5[$x3]; $this->_Km[14] = $this->s5[$xA] ^ $this->s6[$xB] ^ $this->s7[$x5] ^ $this->s8[$x4] ^ $this->s6[$x7]; $this->_Km[15] = $this->s5[$xC] ^ $this->s6[$xD] ^ $this->s7[$x3] ^ $this->s8[$x2] ^ $this->s7[$x8]; $this->_Km[16] = $this->s5[$xE] ^ $this->s6[$xF] ^ $this->s7[$x1] ^ $this->s8[$x0] ^ $this->s8[$xD]; $z0z1z2z3 = $x0x1x2x3 ^ $this->s5[$xD] ^ $this->s6[$xF] ^ $this->s7[$xC] ^ $this->s8[$xE] ^ $this->s7[$x8]; $b = $this->_split($z0z1z2z3); $z0 = $b[0]; $z1 = $b[1]; $z2 = $b[2]; $z3 = $b[3]; $z4z5z6z7 = $x8x9xAxB ^ $this->s5[$z0] ^ $this->s6[$z2] ^ $this->s7[$z1] ^ $this->s8[$z3] ^ $this->s8[$xA]; $b = $this->_split($z4z5z6z7); $z4 = $b[0]; $z5 = $b[1]; $z6 = $b[2]; $z7 = $b[3]; $z8z9zAzB = $xCxDxExF ^ $this->s5[$z7] ^ $this->s6[$z6] ^ $this->s7[$z5] ^ $this->s8[$z4] ^ $this->s5[$x9]; $b = $this->_split($z8z9zAzB); $z8 = $b[0]; $z9 = $b[1]; $zA = $b[2]; $zB = $b[3]; $zCzDzEzF = $x4x5x6x7 ^ $this->s5[$zA] ^ $this->s6[$z9] ^ $this->s7[$zB] ^ $this->s8[$z8] ^ $this->s6[$xB]; $b = $this->_split($zCzDzEzF); $zC = $b[0]; $zD = $b[1]; $zE = $b[2]; $zF = $b[3]; $this->_Kr[1] = 0x1F & ($this->s5[$z8] ^ $this->s6[$z9] ^ $this->s7[$z7] ^ $this->s8[$z6] ^ $this->s5[$z2]); $this->_Kr[2] = 0x1F & ($this->s5[$zA] ^ $this->s6[$zB] ^ $this->s7[$z5] ^ $this->s8[$z4] ^ $this->s6[$z6]); $this->_Kr[3] = 0x1F & ($this->s5[$zC] ^ $this->s6[$zD] ^ $this->s7[$z3] ^ $this->s8[$z2] ^ $this->s7[$z9]); $this->_Kr[4] = 0x1F & ($this->s5[$zE] ^ $this->s6[$zF] ^ $this->s7[$z1] ^ $this->s8[$z0] ^ $this->s8[$zC]); $x0x1x2x3 = $z8z9zAzB ^ $this->s5[$z5] ^ $this->s6[$z7] ^ $this->s7[$z4] ^ $this->s8[$z6] ^ $this->s7[$z0]; $b = $this->_split($x0x1x2x3); $x0 = $b[0]; $x1 = $b[1]; $x2 = $b[2]; $x3 = $b[3]; $x4x5x6x7 = $z0z1z2z3 ^ $this->s5[$x0] ^ $this->s6[$x2] ^ $this->s7[$x1] ^ $this->s8[$x3] ^ $this->s8[$z2]; $b = $this->_split($x4x5x6x7); $x4 = $b[0]; $x5 = $b[1]; $x6 = $b[2]; $x7 = $b[3]; $x8x9xAxB = $z4z5z6z7 ^ $this->s5[$x7] ^ $this->s6[$x6] ^ $this->s7[$x5] ^ $this->s8[$x4] ^ $this->s5[$z1]; $b = $this->_split($x8x9xAxB); $x8 = $b[0]; $x9 = $b[1]; $xA = $b[2]; $xB = $b[3]; $xCxDxExF = $zCzDzEzF ^ $this->s5[$xA] ^ $this->s6[$x9] ^ $this->s7[$xB] ^ $this->s8[$x8] ^ $this->s6[$z3]; $b = $this->_split($xCxDxExF); $xC = $b[0]; $xD = $b[1]; $xE = $b[2]; $xF = $b[3]; $this->_Kr[5] = 0x1F & ($this->s5[$x3] ^ $this->s6[$x2] ^ $this->s7[$xC] ^ $this->s8[$xD] ^ $this->s5[$x8]); $this->_Kr[6] = 0x1F & ($this->s5[$x1] ^ $this->s6[$x0] ^ $this->s7[$xE] ^ $this->s8[$xF] ^ $this->s6[$xD]); $this->_Kr[7] = 0x1F & ($this->s5[$x7] ^ $this->s6[$x6] ^ $this->s7[$x8] ^ $this->s8[$x9] ^ $this->s7[$x3]); $this->_Kr[8] = 0x1F & ($this->s5[$x5] ^ $this->s6[$x4] ^ $this->s7[$xA] ^ $this->s8[$xB] ^ $this->s8[$x7]); $z0z1z2z3 = $x0x1x2x3 ^ $this->s5[$xD] ^ $this->s6[$xF] ^ $this->s7[$xC] ^ $this->s8[$xE] ^ $this->s7[$x8]; $b = $this->_split($z0z1z2z3); $z0 = $b[0]; $z1 = $b[1]; $z2 = $b[2]; $z3 = $b[3]; $z4z5z6z7 = $x8x9xAxB ^ $this->s5[$z0] ^ $this->s6[$z2] ^ $this->s7[$z1] ^ $this->s8[$z3] ^ $this->s8[$xA]; $b = $this->_split($z4z5z6z7); $z4 = $b[0]; $z5 = $b[1]; $z6 = $b[2]; $z7 = $b[3]; $z8z9zAzB = $xCxDxExF ^ $this->s5[$z7] ^ $this->s6[$z6] ^ $this->s7[$z5] ^ $this->s8[$z4] ^ $this->s5[$x9]; $b = $this->_split($z8z9zAzB); $z8 = $b[0]; $z9 = $b[1]; $zA = $b[2]; $zB = $b[3]; $zCzDzEzF = $x4x5x6x7 ^ $this->s5[$zA] ^ $this->s6[$z9] ^ $this->s7[$zB] ^ $this->s8[$z8] ^ $this->s6[$xB]; $b = $this->_split($zCzDzEzF); $zC = $b[0]; $zD = $b[1]; $zE = $b[2]; $zF = $b[3]; $this->_Kr[9] = 0x1F & ($this->s5[$z3] ^ $this->s6[$z2] ^ $this->s7[$zC] ^ $this->s8[$zD] ^ $this->s5[$z9]); $this->_Kr[10] = 0x1F & ($this->s5[$z1] ^ $this->s6[$z0] ^ $this->s7[$zE] ^ $this->s8[$zF] ^ $this->s6[$zC]); $this->_Kr[11] = 0x1F & ($this->s5[$z7] ^ $this->s6[$z6] ^ $this->s7[$z8] ^ $this->s8[$z9] ^ $this->s7[$z2]); $this->_Kr[12] = 0x1F & ($this->s5[$z5] ^ $this->s6[$z4] ^ $this->s7[$zA] ^ $this->s8[$zB] ^ $this->s8[$z6]); $x0x1x2x3 = $z8z9zAzB ^ $this->s5[$z5] ^ $this->s6[$z7] ^ $this->s7[$z4] ^ $this->s8[$z6] ^ $this->s7[$z0]; $b = $this->_split($x0x1x2x3); $x0 = $b[0]; $x1 = $b[1]; $x2 = $b[2]; $x3 = $b[3]; $x4x5x6x7 = $z0z1z2z3 ^ $this->s5[$x0] ^ $this->s6[$x2] ^ $this->s7[$x1] ^ $this->s8[$x3] ^ $this->s8[$z2]; $b = $this->_split($x4x5x6x7); $x4 = $b[0]; $x5 = $b[1]; $x6 = $b[2]; $x7 = $b[3]; $x8x9xAxB = $z4z5z6z7 ^ $this->s5[$x7] ^ $this->s6[$x6] ^ $this->s7[$x5] ^ $this->s8[$x4] ^ $this->s5[$z1]; $b = $this->_split($x8x9xAxB); $x8 = $b[0]; $x9 = $b[1]; $xA = $b[2]; $xB = $b[3]; $xCxDxExF = $zCzDzEzF ^ $this->s5[$xA] ^ $this->s6[$x9] ^ $this->s7[$xB] ^ $this->s8[$x8] ^ $this->s6[$z3]; $b = $this->_split($xCxDxExF); $xC = $b[0]; $xD = $b[1]; $xE = $b[2]; $xF = $b[3]; $this->_Kr[13] = 0x1F & ($this->s5[$x8] ^ $this->s6[$x9] ^ $this->s7[$x7] ^ $this->s8[$x6] ^ $this->s5[$x3]); $this->_Kr[14] = 0x1F & ($this->s5[$xA] ^ $this->s6[$xB] ^ $this->s7[$x5] ^ $this->s8[$x4] ^ $this->s6[$x7]); $this->_Kr[15] = 0x1F & ($this->s5[$xC] ^ $this->s6[$xD] ^ $this->s7[$x3] ^ $this->s8[$x2] ^ $this->s7[$x8]); $this->_Kr[16] = 0x1F & ($this->s5[$xE] ^ $this->s6[$xF] ^ $this->s7[$x1] ^ $this->s8[$x0] ^ $this->s8[$xD]); } /** * Unpack the 32 bit value into an array of four 8 bit values * * @param Integer $x 32 bit value. * * @return Array Array containing four 8 bit values MS to LS. */ function _split($x) { return array(($x >> 24) & 0xFF, ($x >> 16) & 0xFF, ($x >> 8) & 0xFF, $x & 0xFF); } /** * Pack four 8 bit values into one 32 bit values * * @param Array $key Array of 8 bit values. * @param Integer $start Start position in array to get 4 values from. * * @return Interget 32 bit value. */ function _combine4($key, $start = 0) { $res = 0; if (array_key_exists($start, $key)) { $res |= ($key[$start]) << 24; } if (array_key_exists($start + 1, $key)) { $res |= ($key[$start + 1]) << 16; } if (array_key_exists($start + 2, $key)) { $res |= ($key[$start + 2]) << 8; } if (array_key_exists($start + 3, $key)) { $res |= ($key[$start + 3]); } return $res; } } --- NEW FILE: des.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Cipher */ class Horde_Cipher_des extends Horde_Cipher { /* Initial Permutation */ var $ip = array( 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8, 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7 ); /* Final Permutation IP^-1 */ var $fp = array( 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31, 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29, 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27, 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25 ); /* E Bit Selection Table */ var $e = array( 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 ); /* S boxes */ var $_s = array( /* S1 */ 1 => array( 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 ), /* S2 */ 2 => array( 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, ), /* S3 */ 3 => array( 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, ), /* S4 */ 4 => array( 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, ), /* S5 */ 5 => array( 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, ), /* S6 */ 6 => array( 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, ), /* S7 */ 7 => array( 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, ), /* S8 */ 8 => array( 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 ) ); /* Primitive function */ var $p = array( 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 ); /* Permuted Choice Table */ var $pc1 = array( 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 ); /* number left rotations of pc1 */ var $shifts = array( 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 ); /* Permuted Choice Table 2 */ var $pc2 = array( 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 ); /* Key Schedule */ var $_Ks = array(); /* Constructor */ function Horde_Cipher_des($params = null) { } /** * Set the key to be used for en/decryption * * @param String $key The key to use */ function setKey($key) { if (!is_null($key)) { $this->_Ks = $this->_keySchedule($key); } } /** * Return the size of the blocks that this cipher needs * * @return Integer The number of characters per block */ function getBlockSize() { return 8; } /** * Encrypt a block on data. * * @param String $block The data to encrypt * @param optional String $key The key to use * * @return String the encrypted output */ function encryptBlock($block, $key = null) { if (!is_null($key)) { $this->_Ks = $this->_keySchedule($key); } $block = $this->_initialPerm($block); $L = substr($block, 0, 4); $R = substr($block, 4, 4); for ($i = 1; $i <= 16; $i++ ) { $R_prev = $R; $L_prev = $L; $L = $R; $R = $L_prev ^ $this->_f($R_prev, $i); } $block = $R . $L; $block = $this->_finalPerm($block); return $block; } /** * Decrypt a block on data. * * @param String $block The data to decrypt * @param optional String $key The key to use * * @return String the decrypted output */ function decryptBlock($block, $key = null) { $block = $this->_initialPerm($block); if (!is_null($key)) { $this->_Ks = $this->_keySchedule($key); } $L = substr($block, 0, 4); $R = substr($block, 4, 4); for ($i = 16; $i >= 1; $i-- ) { $R_prev = $R; $L_prev = $L; $L = $R_prev; $R = $L_prev ^ $this->_f($R_prev, $i); } $block = $R . $L; $block = $this->_finalPerm($block); return $block; } /** * Put an input string through an initial permutation * * @param $input Input String * * @return String Permutated String */ function _initialPerm($input) { // TODO: Some stylie bitwise thing instead. $input_bin = ''; for ($i = 0; $i < 8; $i++) { $input_bin .= str_pad(decbin(ord($input[$i])), 8, '0', STR_PAD_LEFT); } $output_bin = ''; foreach ($this->ip as $offset) { $output_bin .= $input_bin[$offset - 1]; } $output = ''; for ($i = 0; $i < 8; $i++) { $output .= chr(bindec(substr($output_bin, 8 * $i, 8))); } return $output; } /** * Put an input string through a final permutation * * @param $input Input String * * @return String Permutated String */ function _finalPerm($input) { // TODO: Some stylie bitwise thing instead. $input_bin = ''; for ($i = 0; $i < 8; $i++) { $input_bin .= str_pad(decbin(ord($input[$i])), 8, '0', STR_PAD_LEFT); } $output_bin = ''; foreach ($this->fp as $offset) { $output_bin .= $input_bin[$offset - 1]; } $output = ''; for ($i = 0; $i < 8; $i++) { $output .= chr(bindec(substr($output_bin, 8 * $i, 8))); } return $output; } /** * f() The permutation function. */ function _f($input, $round) { // TODO: Some stylie bitwise thing instead. $key = $this->_Ks[$round]; $input_bin = ''; for ($i = 0; $i < 4; $i++) { $input_bin .= str_pad(decbin(ord($input[$i])), 8, '0', STR_PAD_LEFT); } $expanded_bin = ''; foreach ($this->e as $offset) { $expanded_bin .= $input_bin[$offset - 1]; } $expanded = array(); for ($i = 0; $i < 8; $i++) { $expanded[$i] = bindec('00' . substr($expanded_bin, $i * 6, 6)) ^ $key[$i]; } $combined_bin = ''; for ($i = 0; $i < 8; $i++) { $s_index = (($expanded[$i] & 0x20) >> 4) | ($expanded[$i] & 0x01); $s_index = 16 * $s_index + (($expanded[$i] & 0x1E) >> 1); $val = $this->_s[$i + 1][$s_index]; $combined_bin .= str_pad(decbin($val), 4, '0', STR_PAD_LEFT); } $output_bin = ''; foreach ($this->p as $offset) { $output_bin .= $combined_bin[$offset - 1]; } $output = ''; for ($i = 0; $i < 4; $i++) { $output .= chr(bindec(substr($output_bin, $i * 8, 8))); } return $output; } /** * Create the complete key shedule * * @param array $key */ function _keySchedule($key) { $key = str_pad($key, 8, "\0"); $ks = array(); $key_bin = ''; for ($i = 0; $i < 8; $i++) { $key_bin .= str_pad(decbin(ord($key[$i])), 8, '0', STR_PAD_LEFT); } $c = ''; $d = ''; for ($i = 0; $i < 28; $i++) { $c .= $key_bin[$this->pc1[$i] - 1]; $d .= $key_bin[$this->pc1[28 + $i] - 1]; } for ($i = 0; $i < 16; $i++) { $c = substr($c, $this->shifts[$i]) . substr($c, 0, $this->shifts[$i]); $d = substr($d, $this->shifts[$i]) . substr($d, 0, $this->shifts[$i]); $cd = $c . $d; $permutated_bin = ''; foreach ($this->pc2 as $offset) { $permutated_bin .= $cd[$offset - 1]; } for ($j = 0; $j < 8; $j++) { $ks[$i + 1][] = bindec('00' . substr($permutated_bin, $j * 6, 6)); } } return $ks; } } --- NEW FILE: rc2.php --- * http://www.mirrors.wiretapped.net/security/cryptography/ * algorithms/rc2/comments/gutman-960211 * * $Horde: framework/Cipher/Cipher/rc2.php,v 1.9 2004/01/01 15:14:10 jan Exp $ * * Copyright 2002-2004 Mike Cochrane * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_rc2 extends Horde_Cipher { /* Permutations array */ var $_perm = array( 0xD9, 0x78, 0xF9, 0xC4, 0x19, 0xDD, 0xB5, 0xED, 0x28, 0xE9, 0xFD, 0x79, 0x4A, 0xA0, 0xD8, 0x9D, 0xC6, 0x7E, 0x37, 0x83, 0x2B, 0x76, 0x53, 0x8E, 0x62, 0x4C, 0x64, 0x88, 0x44, 0x8B, 0xFB, 0xA2, 0x17, 0x9A, 0x59, 0xF5, 0x87, 0xB3, 0x4F, 0x13, 0x61, 0x45, 0x6D, 0x8D, 0x09, 0x81, 0x7D, 0x32, 0xBD, 0x8F, 0x40, 0xEB, 0x86, 0xB7, 0x7B, 0x0B, 0xF0, 0x95, 0x21, 0x22, 0x5C, 0x6B, 0x4E, 0x82, 0x54, 0xD6, 0x65, 0x93, 0xCE, 0x60, 0xB2, 0x1C, 0x73, 0x56, 0xC0, 0x14, 0xA7, 0x8C, 0xF1, 0xDC, 0x12, 0x75, 0xCA, 0x1F, 0x3B, 0xBE, 0xE4, 0xD1, 0x42, 0x3D, 0xD4, 0x30, 0xA3, 0x3C, 0xB6, 0x26, 0x6F, 0xBF, 0x0E, 0xDA, 0x46, 0x69, 0x07, 0x57, 0x27, 0xF2, 0x1D, 0x9B, 0xBC, 0x94, 0x43, 0x03, 0xF8, 0x11, 0xC7, 0xF6, 0x90, 0xEF, 0x3E, 0xE7, 0x06, 0xC3, 0xD5, 0x2F, 0xC8, 0x66, 0x1E, 0xD7, 0x08, 0xE8, 0xEA, 0xDE, 0x80, 0x52, 0xEE, 0xF7, 0x84, 0xAA, 0x72, 0xAC, 0x35, 0x4D, 0x6A, 0x2A, 0x96, 0x1A, 0xD2, 0x71, 0x5A, 0x15, 0x49, 0x74, 0x4B, 0x9F, 0xD0, 0x5E, 0x04, 0x18, 0xA4, 0xEC, 0xC2, 0xE0, 0x41, 0x6E, 0x0F, 0x51, 0xCB, 0xCC, 0x24, 0x91, 0xAF, 0x50, 0xA1, 0xF4, 0x70, 0x39, 0x99, 0x7C, 0x3A, 0x85, 0x23, 0xB8, 0xB4, 0x7A, 0xFC, 0x02, 0x36, 0x5B, 0x25, 0x55, 0x97, 0x31, 0x2D, 0x5D, 0xFA, 0x98, 0xE3, 0x8A, 0x92, 0xAE, 0x05, 0xDF, 0x29, 0x10, 0x67, 0x6C, 0xBA, 0xC9, 0xD3, 0x00, 0xE6, 0xCF, 0xE1, 0x9E, 0xA8, 0x2C, 0x63, 0x16, 0x01, 0x3F, 0x58, 0xE2, 0x89, 0xA9, 0x0D, 0x38, 0x34, 0x1B, 0xAB, 0x33, 0xFF, 0xB0, 0xBB, 0x48, 0x0C, 0x5F, 0xB9, 0xB1, 0xCD, 0x2E, 0xC5, 0xF3, 0xDB, 0x47, 0xE5, 0xA5, 0x9C, 0x77, 0x0A, 0xA6, 0x20, 0x68, 0xFE, 0x7F, 0xC1, 0xAD ); /* Array to hold the key shecdule */ var $_keySchedule = array(); /* Constructor */ function Horde_Cipher_rc2($params = null) { } /** * Set the key to be used for en/decryption * * @param String $key The key to use */ function setKey($key) { $key = array_values(unpack('C*', $key)); $bits = 1024; /* Expand input key to 128 bytes */ $len = count($key); $last = $key[$len - 1]; for ($i = $len; $i < 128; $i++) { $last = $this->_perm[($key[$i - $len] + $last) & 0xFF]; $key[$i] = $last; } /* Phase 2 - reduce effective key size to "bits" */ if ($len != 8) { $len = $len * 8; } $key[128 - $len] = $this->_perm[$key[128 - $len] & 0xFF]; for ($i = 127 - $len; $i >= 0; $i--) { $key[$i] = $this->_perm[$key[$i + $len] ^ $key[$i + 1]]; } /* Phase 3 - convert to 16 bit values */ for ($i = 63; $i >= 0; $i--) { $this->_keySchedule[$i] = ($key[$i * 2 + 1] << 8 | $key[$i * 2]) & 0xFFFF; } } /** * Return the size of the blocks that this cipher needs * * @return Integer The number of characters per block */ function getBlockSize() { return 8; } /** * Encrypt a block on data. * * @param String $block The data to encrypt * @param optional String $key The key to use * * @return String the encrypted output */ function encryptBlock($block, $key = null) { if (!is_null($key)) { $this->setKey($key); } $plain = unpack('v*', $block); for ($i = 0; $i < 16; $i++) { $plain[1] += ($plain[2] & ~$plain[4]) + ($plain[3] & $plain[4]) + $this->_keySchedule[4 * $i + 0]; $bin = str_pad(decbin(0xFFFF & $plain[1]), 32, '0', STR_PAD_LEFT); $plain[1] = bindec($bin . substr($bin, 16, 1)); $plain[2] += ($plain[3] & ~$plain[1]) + ($plain[4] & $plain[1]) + $this->_keySchedule[4 * $i + 1]; $bin = str_pad(decbin(0xFFFF & $plain[2]), 32, '0', STR_PAD_LEFT); $plain[2] = bindec($bin . substr($bin, 16, 2)); $plain[3] += ($plain[4] & ~$plain[2]) + ($plain[1] & $plain[2]) + $this->_keySchedule[4 * $i + 2]; $bin = str_pad(decbin(0xFFFF & $plain[3]), 16, '0', STR_PAD_LEFT); $plain[3] = bindec($bin . substr($bin, 0, 3)); $plain[4] += ($plain[1] & ~$plain[3]) + ($plain[2] & $plain[3]) + $this->_keySchedule[4 * $i + 3]; $bin = str_pad(decbin(0xFFFF & $plain[4]), 16, '0', STR_PAD_LEFT); $plain[4] = bindec($bin . substr($bin, 0, 5)); if ($i == 4 || $i == 10) { $plain[1] += $this->_keySchedule[$plain[4] & 0x3F]; $plain[2] += $this->_keySchedule[$plain[1] & 0x3F]; $plain[3] += $this->_keySchedule[$plain[2] & 0x3F]; $plain[4] += $this->_keySchedule[$plain[3] & 0x3F]; } } $encrypted = pack("v*", $plain[1], $plain[2], $plain[3], $plain[4]); return $encrypted; } /** * Decrypt a block on data. * * @param String $block The data to decrypt * @param optional String $key The key to use * * @return String the decrypted output */ function decryptBlock($block, $key = null) { if (!is_null($key)) { $this->setKey($key); } $cipher = unpack('v*', $block); for ($i = 15; $i >= 0; $i--) { $bin = str_pad(decbin(0xFFFF & $cipher[4]), 16, '0', STR_PAD_LEFT); $cipher[4] = bindec(substr($bin, -21, 21) . substr($bin, 0, 11)); $cipher[4] -= ($cipher[1] & ~$cipher[3]) + ($cipher[2] & $cipher[3]) + $this->_keySchedule[4 * $i + 3]; $bin = str_pad(decbin(0xFFFF & $cipher[3]), 16, '0', STR_PAD_LEFT); $cipher[3] = bindec(substr($bin, -19, 19) . substr($bin, 0, 13)); $cipher[3] -= ($cipher[4] & ~$cipher[2]) + ($cipher[1] & $cipher[2]) + $this->_keySchedule[4 * $i + 2]; $bin = str_pad(decbin(0xFFFF & $cipher[2]), 16, '0', STR_PAD_LEFT); $cipher[2] = bindec(substr($bin, -18, 18) . substr($bin, 0, 14)); $cipher[2] -= ($cipher[3] & ~$cipher[1]) + ($cipher[4] & $cipher[1]) + $this->_keySchedule[4 * $i + 1]; $bin = str_pad(decbin(0xFFFF & $cipher[1]), 16, '0', STR_PAD_LEFT); $cipher[1] = bindec(substr($bin, -17, 17) . substr($bin, 0, 15)); $cipher[1] -= ($cipher[2] & ~$cipher[4]) + ($cipher[3] & $cipher[4]) + $this->_keySchedule[4 * $i + 0]; if ($i == 5 || $i == 11) { $cipher[4] -= $this->_keySchedule[$cipher[3] & 0x3F]; $cipher[3] -= $this->_keySchedule[$cipher[2] & 0x3F]; $cipher[2] -= $this->_keySchedule[$cipher[1] & 0x3F]; $cipher[1] -= $this->_keySchedule[$cipher[4] & 0x3F]; } } $decrypted = pack("v*", $cipher[1], $cipher[2], $cipher[3], $cipher[4]); return $decrypted; } } --- NEW FILE: rc4.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_rc4 extends Horde_Cipher { /* Pointer to a PEAR Crypt_rc4 object */ var $_cipher = array(); /* Constructor */ function Horde_Cipher_rc4($params = null) { require_once 'Crypt/Rc4.php'; $this->_cipher = new Crypt_Rc4(); } /** * Set the key to be used for en/decryption * * @param String $key The key to use */ function setKey($key) { $this->_cipher->key($key); } /** * Return the size of the blocks that this cipher needs * * @return Integer The number of characters per block */ function getBlockSize() { return 8; } /** * Encrypt a block on data. * * @param String $block The data to encrypt * @param optional String $key The key to use * * @return String the encrypted output */ function encryptBlock($block, $key = null) { if (!is_null($key)) { $this->setKey($key); } // Make a copy of the cipher as it desctories its self during a crypt $cipher = $this->_cipher; $cipher->crypt($block); return $block; } /** * Decrypt a block on data. * * @param String $block The data to decrypt * @param optional String $key The key to use * * @return String the decrypted output */ function decryptBlock($block, $key = null) { if (!is_null($key)) { $this->setKey($key); } // Make a copy of the cipher as it desctories its self during a crypt $cipher = $this->_cipher; $cipher->decrypt($block); return $block; } } From cvs at intevation.de Fri Oct 14 16:33:05 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:57 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher/BlockMode cbc.php, NONE, 1.1 cfb64.php, NONE, 1.1 ecb.php, NONE, 1.1 ofb64.php, NONE, 1.1 Message-ID: <20051014143305.E1D46102BFB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher/BlockMode In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cipher/Cipher/BlockMode Added Files: cbc.php cfb64.php ecb.php ofb64.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: cbc.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_BlockMode_cbc extends Horde_Cipher_BlockMode { function encrypt(&$cipher, $plaintext) { $encrypted = ''; $blocksize = $cipher->getBlockSize(); $previousCipher = $this->_iv; $jMax = strlen($plaintext); for ($j = 0; $j < $jMax; $j += $blocksize) { $plain = substr($plaintext, $j, $blocksize); if (strlen($plain) < $blocksize) { // pad the block with \0's if it's not long enough $plain = str_pad($plain, 8, "\0"); } $plain = $plain ^ $previousCipher; $previousCipher = $cipher->encryptBlock($plain); $encrypted .= $previousCipher; } return $encrypted; } function decrypt(&$cipher, $ciphertext) { $decrypted = ''; $blocksize = $cipher->getBlockSize(); $previousCipher = $this->_iv; $jMax = strlen($ciphertext); for ($j = 0; $j < $jMax; $j += $blocksize) { $plain = substr($ciphertext, $j, $blocksize); $decrypted .= $cipher->decryptBlock($plain) ^ $previousCipher; $previousCipher = $plain; } // remove trailing \0's used to pad the last block while (substr($decrypted, -1, 1) == "\0") { $decrypted = substr($decrypted, 0, -1); } return $decrypted; } } --- NEW FILE: cfb64.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_BlockMode_cfb64 extends Horde_Cipher_BlockMode { function encrypt(&$cipher, $plaintext) { $encrypted = ''; $n = 0; $jMax = strlen($plaintext); for ($j = 0; $j < $jMax; $j++) { if ($n == 0) { $this->_iv = $cipher->encryptBlock($this->_iv); } $c = $plaintext[$j] ^ $this->_iv[$n]; $this->_iv = substr($this->_iv, 0, $n) . $c . substr($this->_iv, $n + 1); $encrypted .= $c; $n = (++$n) & 0x07; } return $encrypted; } function decrypt(&$cipher, $ciphertext) { $decrypted = ''; $n = 0; $jMax = strlen($ciphertext); for ($j = 0; $j < $jMax; $j++) { if ($n == 0) { $this->_iv = $cipher->encryptBlock($this->_iv); } $c = $ciphertext[$j] ^ $this->_iv[$n]; $this->_iv = substr($this->_iv, 0, $n) . substr($ciphertext, $j, 1) . substr($this->_iv, $n + 1); $decrypted .= $c; $n = (++$n) & 0x07; } // remove trailing \0's used to pad the last block while (substr($decrypted, -1, 1) == "\0") { $decrypted = substr($decrypted, 0, -1); } return $decrypted; } } --- NEW FILE: ecb.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_BlockMode_ecb extends Horde_Cipher_BlockMode { function encrypt(&$cipher, $plaintext) { $encrypted = ''; $blocksize = $cipher->getBlockSize(); $jMax = strlen($plaintext); for ($j = 0; $j < $jMax; $j += $blocksize) { $plain = substr($plaintext, $j, $blocksize); if (strlen($plain) < $blocksize) { // pad the block with \0's if it's not long enough $plain = str_pad($plain, 8, "\0"); } $encrypted .= $cipher->encryptBlock($plain); } return $encrypted; } function decrypt(&$cipher, $ciphertext) { $decrypted = ''; $blocksize = $cipher->getBlockSize(); $jMax = strlen($ciphertext); for ($j = 0; $j < $jMax; $j += $blocksize) { $plain = substr($ciphertext, $j, $blocksize); $decrypted .= $cipher->decryptBlock($plain); } // remove trailing \0's used to pad the last block while (substr($decrypted, -1, 1) == "\0") { $decrypted = substr($decrypted, 0, -1); } return $decrypted; } } --- NEW FILE: ofb64.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_Cipher */ class Horde_Cipher_BlockMode_ofb64 extends Horde_Cipher_BlockMode { function encrypt(&$cipher, $plaintext) { $encrypted = ''; $n = 0; $jMax = strlen($plaintext); for ($j = 0; $j < $jMax; $j++) { if ($n == 0) { $this->_iv = $cipher->encryptBlock($this->_iv); } $c = $plaintext[$j] ^ $this->_iv[$n]; $encrypted .= $c; $n = (++$n) & 0x07; } return $encrypted; } function decrypt(&$cipher, $ciphertext) { $decrypted = ''; $n = 0; $jMax = strlen($ciphertext); for ($j = 0; $j < $jMax; $j++) { if ($n == 0) { $this->_iv = $cipher->encryptBlock($this->_iv); } $c = $ciphertext[$j] ^ $this->_iv[$n]; $decrypted .= $c; $n = (++$n) & 0x07; } return $decrypted; } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:33:59 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Compress Compress.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.0A927102C01@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Compress Added Files: Compress.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Compress.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Compress */ class Horde_Compress { /** * Attempts to return a concrete Horde_Compress instance based on * $driver. * * @access public * * @param mixed $driver The type of concrete Horde_Compress * subclass to return. This is based on * the storage driver ($driver). The code * is dynamically included. If $driver is * an array, then we will look in * $driver[0]/lib/Compress/ for the * subclass implementation named * $driver[1].php. * @param optional array $params A hash containing any additional * configuration or parameters a subclass * might need. * * @return object Horde_Compress The newly created concrete * Horde_Compress instance, or false on an * error. */ function &factory($driver, $params = array()) { if (is_array($driver)) { list($app, $driver) = $driver; } $driver = basename($driver); if (!empty($app)) { require_once $app . '/lib/Compress/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Compress/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Compress/' . $driver . '.php'; } else { @include_once 'Horde/Compress/' . $driver . '.php'; } $class = 'Horde_Compress_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return false; } } /** * Attempts to return a reference to a concrete Horde_Compress instance * based on $driver. It will only create a new instance if no * Horde_Compress instance with the same parameters currently exists. * * This method must be invoked as: * $var = &Horde_Compress::singleton(); * * @access public * * @param mixed $driver See Horde_Compress::factory(). * @param optional array $params See Horde_Compress::factory(). * * @return object Horde_Compress The concrete Horde_Compress reference, * or false on an error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!array_key_exists($signature, $instances)) { $instances[$signature] = &Horde_Compress::factory($driver, $params); } return $instances[$signature]; } /** * Constructor. * * @access public * * @param optional array $params Parameter array. */ function Horde_Compress($params = array()) { } /** * Compress the data. * * @access public * * @param string $data The data to compress. * @param optional array $params An array of arguments needed to * compress the data. * * @return mixed The compressed data. * Returns PEAR_Error object on error. */ function &compress($data, $params = array()) { return PEAR::raiseError('Unsupported'); } /** * Decompress the data. * * @access public * * @param string $data The data to decompress. * @param optional array $params An array of arguments needed to * decompress the data. * * @return array The decompressed data. * Returns PEAR_Error object on error. */ function &decompress($data, $params = array()) { return PEAR::raiseError('Unsupported'); } } --- NEW FILE: package.xml --- Horde_Compress Horde Compression API The Horde_Compress:: class provides an API for various compression techniques. LGPL chuck lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org yunosh lead Jan Schneider jan@horde.org slusarz lead Michael Slusarz slusarz@bigworm.colorado.edu mac lead Mike Cochrane mike@graftonhall.co.nz 0.0.1 alpha 2003-07-03 Initial Release. gettext zlib Horde_Util 0.0.1 alpha 2003-07-03 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:00 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Cipher/tests Cipher1.phpt, NONE, 1.1 Cipher2.phpt, NONE, 1.1 Cipher3.phpt, NONE, 1.1 Cipher4.phpt, NONE, 1.1 Cipher5.phpt, NONE, 1.1 Cipher6.phpt, NONE, 1.1 cipherTest.php, NONE, 1.1 Message-ID: <20051014143306.01865102C00@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Cipher/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Cipher/tests Added Files: Cipher1.phpt Cipher2.phpt Cipher3.phpt Cipher4.phpt Cipher5.phpt Cipher6.phpt cipherTest.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Cipher1.phpt --- --TEST-- RC4 Cipher:: Tests --FILE-- setKey($key); echo "Testing Encryption: "; $res = $cipher->encryptBlock($plaintext); if ($res == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($ciphertext); $i++) { echo str_pad(dechex(ord(substr($ciphertext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "Testing Decryption: "; $res = $cipher->decryptBlock($ciphertext); if ($res == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($plaintext); $i++) { echo str_pad(dechex(ord(substr($plaintext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "\n"; flush(); } } /* RC4 Cipher */ echo "RC4:\n"; echo "----\n\n"; // 64 Bit key test echo "64-bit Key\n"; $key = "\x01\x23\x45\x67\x89\xab\xcd\xef"; $plaintext = "\x01\x23\x45\x67\x89\xab\xcd\xef"; $ciphertext = "\x75\xb7\x87\x80\x99\xe0\xc5\x96"; testCipher('rc4', $key, $plaintext, $ciphertext); // 64 Bit key test echo "64-bit Key\n"; $key = "\x01\x23\x45\x67\x89\xab\xcd\xef"; $plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00"; $ciphertext = "\x74\x94\xc2\xe7\x10\x4b\x08\x79"; testCipher('rc4', $key, $plaintext, $ciphertext); // 64 Bit key test echo "64-bit Key\n"; $key = "\x00\x00\x00\x00\x00\x00\x00\x00"; $plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00"; $ciphertext = "\xde\x18\x89\x41\xa3\x37\x5d\x3a"; testCipher('rc4', $key, $plaintext, $ciphertext); // 32 Bit key test echo "32-bit Key\n"; $key = "\xef\x01\x23\x45"; $plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00"; $ciphertext = "\xd6\xa1\x41\xa7\xec\x3c\x38\xdf"; testCipher('rc4', $key, $plaintext, $ciphertext); ?> --EXPECT-- RC4: ---- 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 32-bit Key Testing Encryption: Pass Testing Decryption: Pass --- NEW FILE: Cipher2.phpt --- --TEST-- DES Cipher:: Tests --FILE-- setKey($key); echo "Testing Encryption: "; $res = $cipher->encryptBlock($plaintext); if ($res == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($ciphertext); $i++) { echo str_pad(dechex(ord(substr($ciphertext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "Testing Decryption: "; $res = $cipher->decryptBlock($ciphertext); if ($res == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($plaintext); $i++) { echo str_pad(dechex(ord(substr($plaintext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "\n"; flush(); } } /* DES Cipher */ echo "DES:\n"; echo "----\n\n"; // 64 Bit key test $tests = array( "\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\x00", "\x8C\xA6\x4D\xE9\xC1\xB1\x23\xA7", "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", "\x73\x59\xB2\x16\x3E\x4E\xDC\x58", "\x30\x00\x00\x00\x00\x00\x00\x00", "\x10\x00\x00\x00\x00\x00\x00\x01", "\x95\x8E\x6E\x62\x7A\x05\x55\x7B", "\x01\x23\x45\x67\x89\xAB\xCD\xEF", "\x11\x11\x11\x11\x11\x11\x11\x11", "\x17\x66\x8D\xFC\x72\x92\x53\x2D", "\x11\x11\x11\x11\x11\x11\x11\x11", "\x01\x23\x45\x67\x89\xAB\xCD\xEF", "\x8A\x5A\xE1\xF8\x1A\xB8\xF2\xDD", // Initial Permutation and Expansion test "\x01\x01\x01\x01\x01\x01\x01\x01", "\x95\xF8\xA5\xE5\xDD\x31\xD9\x00", "\x80\x00\x00\x00\x00\x00\x00\x00", // Key Permutation test "\x80\x01\x01\x01\x01\x01\x01\x01", "\x00\x00\x00\x00\x00\x00\x00\x00", "\x95\xA8\xD7\x28\x13\xDA\xA9\x4D", // Data Permutation tests "\x10\x46\x91\x34\x89\x98\x01\x31", "\x00\x00\x00\x00\x00\x00\x00\x00", "\x88\xD5\x5E\x54\xF5\x4C\x97\xB4", // S-Box test "\x7C\xA1\x10\x45\x4A\x1A\x6E\x57", "\x01\xA1\xD6\xD0\x39\x77\x67\x42", "\x69\x0F\x5B\x0D\x9A\x26\x93\x9B", "\x01\x31\xD9\x61\x9D\xC1\x37\x6E", "\x5C\xD5\x4C\xA8\x3D\xEF\x57\xDA", "\x7A\x38\x9D\x10\x35\x4B\xD2\x71", ); for ($i = 0; $i < count($tests); $i+= 3) { echo "64-bit Key\n"; $key = $tests[$i]; $plaintext = $tests[$i + 1]; $ciphertext = $tests[$i + 2]; testCipher('des', $key, $plaintext, $ciphertext); } ?> --EXPECT-- DES: ---- 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass --- NEW FILE: Cipher3.phpt --- --TEST-- RC2 Cipher:: Tests --FILE-- setKey($key); echo "Testing Encryption: "; $res = $cipher->encryptBlock($plaintext); if ($res == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($ciphertext); $i++) { echo str_pad(dechex(ord(substr($ciphertext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "Testing Decryption: "; $res = $cipher->decryptBlock($ciphertext); if ($res == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($plaintext); $i++) { echo str_pad(dechex(ord(substr($plaintext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "\n"; flush(); } } /* RC2 Cipher */ echo "RC2:\n"; echo "----\n\n"; // 8 Bit key test echo "8-bit Key\n"; $key = "\x88"; $plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00"; $ciphertext = "\x61\xa8\xa2\x44\xad\xac\xcc\xf0"; testCipher('rc2', $key, $plaintext, $ciphertext); // 64 Bit key test echo "64-bit Key\n"; $key = "\x00\x00\x00\x00\x00\x00\x00\x00"; $plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00"; $ciphertext = "\xeb\xb7\x73\xf9\x93\x27\x8e\xff"; testCipher('rc2', $key, $plaintext, $ciphertext); // 128 Bit key test echo "128-bit Key\n"; $key = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"; $plaintext = "\x00\x00\x00\x00\x00\x00\x00\x00"; $ciphertext = "\x50\xDC\x01\x62\xBD\x75\x7F\x31"; testCipher('rc2', $key, $plaintext, $ciphertext); // 64 Bit key test echo "64-bit Key\n"; $key = "\xff\xff\xff\xff\xff\xff\xff\xff"; $plaintext = "\xff\xff\xff\xff\xff\xff\xff\xff"; $ciphertext = "\x27\x8b\x27\xe4\x2e\x2f\x0d\x49"; testCipher('rc2', $key, $plaintext, $ciphertext); ?> --EXPECT-- RC2: ---- 8-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 128-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass --- NEW FILE: Cipher4.phpt --- --TEST-- Cast128 Cipher:: Tests --FILE-- setKey($key); echo "Testing Encryption: "; $res = $cipher->encryptBlock($plaintext); if ($res == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($ciphertext); $i++) { echo str_pad(dechex(ord(substr($ciphertext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "Testing Decryption: "; $res = $cipher->decryptBlock($ciphertext); if ($res == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($plaintext); $i++) { echo str_pad(dechex(ord(substr($plaintext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "\n"; flush(); } } /* Cast 128 Cipher */ echo "Cast 128:\n"; echo "---------\n\n"; // 128 Bit key test echo "128-bit Key\n"; $key = "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45\x67\x89\x34\x56\x78\x9A"; $plaintext = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"; $ciphertext = "\x23\x8B\x4F\xE5\x84\x7E\x44\xB2"; testCipher('cast128', $key, $plaintext, $ciphertext); // 80 Bit key text echo "80-bit Key\n"; $key = "\x01\x23\x45\x67\x12\x34\x56\x78\x23\x45"; $plaintext = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"; $ciphertext = "\xEB\x6A\x71\x1A\x2C\x02\x27\x1B"; testCipher('cast128', $key, $plaintext, $ciphertext); // 40 Bit key text echo "40-bit Key\n"; $key = "\x01\x23\x45\x67\x12"; $plaintext = "\x01\x23\x45\x67\x89\xAB\xCD\xEF"; $ciphertext = "\x7A\xC8\x16\xD1\x6E\x9B\x30\x2E"; testCipher('cast128', $key, $plaintext, $ciphertext); ?> --EXPECT-- Cast 128: --------- 128-bit Key Testing Encryption: Pass Testing Decryption: Pass 80-bit Key Testing Encryption: Pass Testing Decryption: Pass 40-bit Key Testing Encryption: Pass Testing Decryption: Pass --- NEW FILE: Cipher5.phpt --- --TEST-- Blowfish Cipher:: Tests --FILE-- setKey($key); echo "Testing Encryption: "; $res = $cipher->encryptBlock($plaintext); if ($res == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($ciphertext); $i++) { echo str_pad(dechex(ord(substr($ciphertext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "Testing Decryption: "; $res = $cipher->decryptBlock($ciphertext); if ($res == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($plaintext); $i++) { echo str_pad(dechex(ord(substr($plaintext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "\n"; flush(); } } /* Blowfish */ // selection of tests from: http://www.counterpane.com/vectors.txt echo "Blowfish:\n"; echo "---------\n\n"; // 64 Bit key text echo "64-bit Key\n"; $key = "\x49\xE9\x5D\x6D\x4C\xA2\x29\xBF"; $plaintext = "\x02\xFE\x55\x77\x81\x17\xF1\x2A"; $ciphertext = "\xCF\x9C\x5D\x7A\x49\x86\xAD\xB5"; testCipher('blowfish', $key, $plaintext, $ciphertext); $plaintext = "\xFE\xDC\xBA\x98\x76\x54\x32\x10"; $c[ 1] = "\xF9\xAD\x59\x7C\x49\xDB\x00\x5E"; $k[ 1] = "\xF0"; $c[ 2] = "\xE9\x1D\x21\xC1\xD9\x61\xA6\xD6"; $k[ 2] = "\xF0\xE1"; $c[ 3] = "\xE9\xC2\xB7\x0A\x1B\xC6\x5C\xF3"; $k[ 3] = "\xF0\xE1\xD2"; $c[ 4] = "\xBE\x1E\x63\x94\x08\x64\x0F\x05"; $k[ 4] = "\xF0\xE1\xD2\xC3"; $c[ 5] = "\xB3\x9E\x44\x48\x1B\xDB\x1E\x6E"; $k[ 5] = "\xF0\xE1\xD2\xC3\xB4"; $c[ 6] = "\x94\x57\xAA\x83\xB1\x92\x8C\x0D"; $k[ 6] = "\xF0\xE1\xD2\xC3\xB4\xA5"; $c[ 7] = "\x8B\xB7\x70\x32\xF9\x60\x62\x9D"; $k[ 7] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96"; $c[ 8] = "\xE8\x7A\x24\x4E\x2C\xC8\x5E\x82"; $k[ 8] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87"; $c[ 9] = "\x15\x75\x0E\x7A\x4F\x4E\xC5\x77"; $k[ 9] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78"; $c[10] = "\x12\x2B\xA7\x0B\x3A\xB6\x4A\xE0"; $k[10] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69"; $c[11] = "\x3A\x83\x3C\x9A\xFF\xC5\x37\xF6"; $k[11] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A"; $c[12] = "\x94\x09\xDA\x87\xA9\x0F\x6B\xF2"; $k[12] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B"; $c[13] = "\x88\x4F\x80\x62\x50\x60\xB8\xB4"; $k[13] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C"; $c[14] = "\x1F\x85\x03\x1C\x19\xE1\x19\x68"; $k[14] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D"; $c[15] = "\x79\xD9\x37\x3A\x71\x4C\xA3\x4F"; $k[15] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E"; $c[16] = "\x93\x14\x28\x87\xEE\x3B\xE1\x5C"; $k[16] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F"; $c[17] = "\x03\x42\x9E\x83\x8C\xE2\xD1\x4B"; $k[17] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00"; $c[18] = "\xA4\x29\x9E\x27\x46\x9F\xF6\x7B"; $k[18] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11"; $c[19] = "\xAF\xD5\xAE\xD1\xC1\xBC\x96\xA8"; $k[19] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11\x22"; $c[20] = "\x10\x85\x1C\x0E\x38\x58\xDA\x9F"; $k[20] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11\x22\x33"; $c[21] = "\xE6\xF5\x1E\xD7\x9B\x9D\xB2\x1F"; $k[21] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11\x22\x33\x44"; $c[22] = "\x64\xA6\xE1\x4A\xFD\x36\xB4\x6F"; $k[22] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11\x22\x33\x44\x55"; $c[23] = "\x80\xC7\xD7\xD4\x5A\x54\x79\xAD"; $k[23] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11\x22\x33\x44\x55\x66"; $c[24] = "\x05\x04\x4B\x62\xFA\x52\xD0\x80"; $k[24] = "\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87\x78\x69\x5A\x4B\x3C\x2D\x1E\x0F\x00\x11\x22\x33\x44\x55\x66\x77"; foreach ($k as $id => $key) { echo (strlen($key) * 8) . "-bit Key\n"; testCipher('blowfish', $key, $plaintext, $c[$id]); } ?> --EXPECT-- Blowfish: --------- 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 8-bit Key Testing Encryption: Pass Testing Decryption: Pass 16-bit Key Testing Encryption: Pass Testing Decryption: Pass 24-bit Key Testing Encryption: Pass Testing Decryption: Pass 32-bit Key Testing Encryption: Pass Testing Decryption: Pass 40-bit Key Testing Encryption: Pass Testing Decryption: Pass 48-bit Key Testing Encryption: Pass Testing Decryption: Pass 56-bit Key Testing Encryption: Pass Testing Decryption: Pass 64-bit Key Testing Encryption: Pass Testing Decryption: Pass 72-bit Key Testing Encryption: Pass Testing Decryption: Pass 80-bit Key Testing Encryption: Pass Testing Decryption: Pass 88-bit Key Testing Encryption: Pass Testing Decryption: Pass 96-bit Key Testing Encryption: Pass Testing Decryption: Pass 104-bit Key Testing Encryption: Pass Testing Decryption: Pass 112-bit Key Testing Encryption: Pass Testing Decryption: Pass 120-bit Key Testing Encryption: Pass Testing Decryption: Pass 128-bit Key Testing Encryption: Pass Testing Decryption: Pass 136-bit Key Testing Encryption: Pass Testing Decryption: Pass 144-bit Key Testing Encryption: Pass Testing Decryption: Pass 152-bit Key Testing Encryption: Pass Testing Decryption: Pass 160-bit Key Testing Encryption: Pass Testing Decryption: Pass 168-bit Key Testing Encryption: Pass Testing Decryption: Pass 176-bit Key Testing Encryption: Pass Testing Decryption: Pass 184-bit Key Testing Encryption: Pass Testing Decryption: Pass 192-bit Key Testing Encryption: Pass Testing Decryption: Pass --- NEW FILE: Cipher6.phpt --- --TEST-- Blockmode Cipher:: Tests --FILE-- encrypt($plaintext) == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; } echo "Testing Decryption: "; if ($cipher->decrypt($ciphertext) == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; } echo "\n"; flush(); } } /* Block Mode Tests */ echo "Block Mode Tests:\n"; echo "-----------------\n"; echo "(using Blowfish test vectors)\n\n"; $key = "\x01\x23\x45\x67\x89\xAB\xCD\xEF\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87"; $iv = "\xFE\xDC\xBA\x98\x76\x54\x32\x10"; $plaintext = "7654321 Now is the time for "; echo "Cipher Block Chaining (CBC) Test\n"; $ciphertext = "\x6B\x77\xB4\xD6\x30\x06\xDE\xE6\x05\xB1\x56\xE2\x74\x03\x97\x93\x58\xDE\xB9\xE7\x15\x46\x16\xD9\x59\xF1\x65\x2B\xD5\xFF\x92\xCC"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("cbc"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); echo "Electronic Code Book (ECB) Test\n"; $ciphertext = "\x2a\xfd\x7d\xaa\x60\x62\x6b\xa3\x86\x16\x46\x8c\xc2\x9c\xf6\xe1\x29\x1e\x81\x7c\xc7\x40\x98\x2d\x6f\x87\xac\x5f\x17\x1a\xab\xea"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("ecb"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); echo "64 Bit Cipher Feedback (CFB64) Test\n"; $ciphertext = "\xE7\x32\x14\xA2\x82\x21\x39\xCA\xF2\x6E\xCF\x6D\x2E\xB9\xE7\x6E\x3D\xA3\xDE\x04\xD1\x51\x72\x00\x51\x9D\x57\xA6"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("cfb64"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); echo "64 Bit Output Feedback (OFB64) Test\n"; $ciphertext = "\xE7\x32\x14\xA2\x82\x21\x39\xCA\x62\xB3\x43\xCC\x5B\x65\x58\x73\x10\xDD\x90\x8D\x0C\x24\x1B\x22\x63\xC2\xCF\x80"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("ofb64"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); ?> --EXPECT-- Block Mode Tests: ----------------- (using Blowfish test vectors) Cipher Block Chaining (CBC) Test Testing Encryption: Pass Testing Decryption: Pass Electronic Code Book (ECB) Test Testing Encryption: Pass Testing Decryption: Pass 64 Bit Cipher Feedback (CFB64) Test Testing Encryption: Pass Testing Decryption: Pass 64 Bit Output Feedback (OFB64) Test Testing Encryption: Pass Testing Decryption: Pass --- NEW FILE: cipherTest.php --- #!/usr/local/bin/php $key) { echo (strlen($key) * 8) . "-bit Key\n"; testCipher('blowfish', $key, $plaintext, $c[$id]); } /* Block Mode Tests */ echo "Block Mode Tests:\n"; echo "-----------------\n"; echo "(using Blowfish test vectors)\n\n"; $key = "\x01\x23\x45\x67\x89\xAB\xCD\xEF\xF0\xE1\xD2\xC3\xB4\xA5\x96\x87"; $iv = "\xFE\xDC\xBA\x98\x76\x54\x32\x10"; $plaintext = "7654321 Now is the time for "; echo "Cipher Block Chaining (CBC) Test\n"; $ciphertext = "\x6B\x77\xB4\xD6\x30\x06\xDE\xE6\x05\xB1\x56\xE2\x74\x03\x97\x93\x58\xDE\xB9\xE7\x15\x46\x16\xD9\x59\xF1\x65\x2B\xD5\xFF\x92\xCC"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("cbc"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); echo "Electronic Code Book (ECB) Test\n"; $ciphertext = "\x2a\xfd\x7d\xaa\x60\x62\x6b\xa3\x86\x16\x46\x8c\xc2\x9c\xf6\xe1\x29\x1e\x81\x7c\xc7\x40\x98\x2d\x6f\x87\xac\x5f\x17\x1a\xab\xea"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("ecb"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); echo "64 Bit Cipher Feedback (CFB64) Test\n"; $ciphertext = "\xE7\x32\x14\xA2\x82\x21\x39\xCA\xF2\x6E\xCF\x6D\x2E\xB9\xE7\x6E\x3D\xA3\xDE\x04\xD1\x51\x72\x00\x51\x9D\x57\xA6"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("cfb64"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); echo "64 Bit Output Feedback (OFB64) Test\n"; $ciphertext = "\xE7\x32\x14\xA2\x82\x21\x39\xCA\x62\xB3\x43\xCC\x5B\x65\x58\x73\x10\xDD\x90\x8D\x0C\x24\x1B\x22\x63\xC2\xCF\x80"; $cipher = &Horde_Cipher::factory('blowfish'); $cipher->setBlockMode("ofb64"); $cipher->setKey($key); $cipher->setIV($iv); testBlockCipher($cipher, $plaintext, $ciphertext); function testBlockCipher(&$cipher, $plaintext, $ciphertext) { echo "Testing Encryption: "; if ($cipher->encrypt($plaintext) == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; } echo "Testing Decryption: "; if ($cipher->decrypt($ciphertext) == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; } echo "\n"; flush(); } function testCipher($cipher, $key, $plaintext, $ciphertext) { $cipher = &Horde_Cipher::factory($cipher); $cipher->setKey($key); echo "Testing Encryption: "; $res = $cipher->encryptBlock($plaintext); if ($res == $ciphertext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($ciphertext); $i++) { echo str_pad(dechex(ord(substr($ciphertext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "Testing Decryption: "; $res = $cipher->decryptBlock($ciphertext); if ($res == $plaintext) { echo "Pass\n"; } else { echo "Fail\n"; echo "Returned: "; for ($i = 0; $i < strlen($res); $i++) { echo str_pad(dechex(ord(substr($res, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; echo "Expected: "; for ($i = 0; $i < strlen($plaintext); $i++) { echo str_pad(dechex(ord(substr($plaintext, $i, 1))), 2, '0', STR_PAD_LEFT) . " "; } echo "\n"; } echo "\n"; flush(); } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:01 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Crypt Crypt.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.2BBA6102C0B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Crypt Added Files: Crypt.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Crypt.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Crypt */ class Horde_Crypt { /** * The temporary directory to use. * * @var string $_tempdir */ var $_tempdir; /** * Attempts to return a concrete Horde_Crypt instance based on $driver. * * @access public * * @param mixed $driver The type of concrete Crypt subclass to * return. This is based on the storage * driver ($driver). The code is dynamically * included. If $driver is an array, then we * will look in $driver[0]/lib/Crypt/ for * the subclass implementation named * $driver[1].php. * @param optional array $params A hash containing any additional * configuration or parameters a subclass * might need. * * @return object Horde_Crypt The newly created concrete Horde_Crypt * instance, or false on an error. */ function &factory($driver, $params = array()) { if (is_array($driver)) { list($app, $driver) = $driver; } /* Return a base Crypt object if no driver is specified. */ $driver = basename($driver); if (empty($driver) || (strcmp($driver, 'none') == 0)) { return $ret = &new Horde_Crypt(); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Crypt/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Crypt/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Crypt/' . $driver . '.php'; } else { @include_once 'Horde/Crypt/' . $driver . '.php'; } $class = 'Horde_Crypt_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Crypt instance * based on $driver. It will only create a new instance if no * Crypt instance with the same parameters currently exists. * * This should be used if multiple crypto backends (and, thus, * multiple Crypt instances) are required. * * This method must be invoked as: $var = &Crypt::singleton() * * @access public * * @param mixed $driver The type of concrete Crypt subclass to * return. This is based on the storage * driver ($driver). The code is dynamically * included. If $driver is an array, then * we will look in $driver[0]/lib/Crypt/ for * the subclass implementation named * $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Crypt The concrete Crypt reference, or false on an error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Crypt::factory($driver, $params); } return $instances[$signature]; } /** * Outputs error message if we are not using a secure connection. * * @access public * * @return object PEAR_Error Returns a PEAR_Error object if there is no * secure connection. */ function requireSecureConnection() { global $browser; if (!$browser->usingSSLConnection()) { return PEAR::raiseError(_("The encryption features require a secure web connection.")); } } /** * Encrypt the requested data. * This method should be provided by all classes that extend Horde_Crypt. * * @access public * * @param string $data The data to encrypt. * @param optional array $params An array of arguments needed to encrypt * the data. * * @return array The encrypted data. */ function encrypt($data, $params = array()) { return $data; } /** * Decrypt the requested data. * This method should be provided by all classes that extend Horde_Crypt. * * @access public * * @param string $data The data to decrypt. * @param optional array $params An array of arguments needed to decrypt * the data. * * @return array The decrypted data. */ function decrypt($data, $params = array()) { return $data; } /** * Create a temporary file that will be deleted at the end of this * process. * * @access private * * @param optional string $descrip Description string to use in filename. * @param optional boolean $delete Delete the file automatically? * * @return string Filename of a temporary file. */ function _createTempFile($descrip = 'horde-crypt', $delete = true) { return Util::getTempFile($descrip, $delete, $this->_tempdir, true); } } --- NEW FILE: package.xml --- Horde_Crypt Horde Cryptography API The Horde_Crypt:: class provides an API for various cryptographic systems LGPL slusarz Michael Slusarz slusarz@bigworm.colorado.edu lead mac developer Mike Cochrane mike@graftonhall.co.nz 0.0.1 alpha 2003-07-03 Initial Release. gettext Horde_MIME Horde_Util 0.0.1 2003-07-03 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:02 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Compress/Compress dbx.php, NONE, 1.1 gzip.php, NONE, 1.1 tar.php, NONE, 1.1 tnef.php, NONE, 1.1 zip.php, NONE, 1.1 Message-ID: <20051014143306.21D70102C04@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Compress/Compress In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Compress/Compress Added Files: dbx.php gzip.php tar.php tnef.php zip.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: dbx.php --- * http://uruds.gateway.bg/zeos/ * * $Horde: framework/Compress/Compress/dbx.php,v 1.3 2004/01/01 15:14:12 jan Exp $ * * Copyright 2003-2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Compress */ class Horde_Compress_dbx extends Horde_Compress { var $mails; var $tmp; /** * Decompresses a DBX file and gets information from it. * * @access public * * @param string $data The dbx file data. * * @return mixed The requested data. */ function &decompress(&$data, $params = null) { $this->mails = array(); $this->tmp = array(); $position = 0xC4; $header_info = unpack('Lposition/LDataLength/nHeaderLength/nFlagCount', substr($data, $position, 12)); $position += 12; // Go to the first table offest and process it. if ($header_info['position'] > 0) { $position = 0x30; $buf = unpack('Lposition', substr($data, $position, 4)); $position = $buf['position']; $result = $this->readIndex($data, $position); if (is_a($result, 'PEAR_Error')) { return $result; } } return $this->mails; } /** * Returns a null-terminated string from the specified data. */ function readString(&$buf, $pos) { if ($len = strpos(substr($buf, $pos), chr(0))) { return substr($buf, $pos, $len); } return ''; } function readMessage(&$data, $position) { $msg = ''; if ($position > 0) { $IndexItemsCount = array_pop(unpack('S', substr($data, 0xC4, 4))); if ($IndexItemsCount > 0) { $msg = ''; $part = 0; while ($position < strlen($data)) { $part++; $s = substr($data, $position, 528); if (strlen($s) == 0) { break; } $msg_item = unpack('LFilePos/LUnknown/LItemSize/LNextItem/a512Content', $s); //var_dump($msg_item); if ($msg_item['FilePos'] != $position) { return PEAR::raiseError(_("Invalid file format")); } $position += 528; $msg .= substr($msg_item['Content'], 0, $msg_item['ItemSize']); $position = $msg_item['NextItem']; if ($position == 0) { break; } } } } return $msg; } function readMessageInfo(&$data, $position) { $message_info = array(); $msg_header = unpack('Lposition/LDataLength/SHeaderLength/SFlagCount', substr($data, $position, 12)); if ($msg_header['position'] != $position) { return PEAR::raiseError(_("Invalid file format")); } $position += 12; $message_info['HeaderPosition'] = $msg_header['position']; $flags = $msg_header['FlagCount'] & 0xFF; $DataSize = $msg_header['DataLength'] - $flags * 4; $size = 4 * $flags; $FlagsBuffer = substr($data, $position, $size); $position += $size; $size = $DataSize; $DataBuffer = substr($data, $position, $size); $position += $size; $message_info = array(); //process flags for ($i = 0; $i < $flags; $i++) { $pos = 0; $f = array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))); switch ($f & 0xFF) { case 0x1: $pos = $pos + ($f >> 8); $message_info['MsgFlags'] = array_pop(unpack('C', substr($DataBuffer, $pos, 1))); $pos++; $message_info['MsgFlags'] += array_pop(unpack('C', substr($DataBuffer, $pos, 1))) * 256; $pos++; $message_info['MsgFlags'] += array_pop(unpack('C', substr($DataBuffer, $pos, 1))) * 65536; break; case 0x2: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Sent'] = array_pop(unpack('L', substr($DataBuffer, $pos, 4))); break; case 0x4: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['position'] = array_pop(unpack('L', substr($DataBuffer, $pos, 4))); break; case 0x7: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['MessageID'] = $this->readstring($DataBuffer, $pos); break; case 0x8: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Subject'] = $this->readstring($DataBuffer, $pos); break; case 0x9: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['From_reply'] = $this->readstring($DataBuffer, $pos); break; case 0xA: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['References'] = $this->readstring($DataBuffer, $pos); break; case 0xB: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Newsgroup'] = $this->readstring($DataBuffer, $pos); break; case 0xD: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['From'] = $this->readstring($DataBuffer, $pos); break; case 0xE: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Reply_To'] = $this->readstring($DataBuffer, $pos); break; case 0x12: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Received'] = array_pop(unpack('L', substr($DataBuffer, $pos, 4))); break; case 0x13: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Receipt'] = $this->readstring($DataBuffer, $pos); break; case 0x1A: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['Account'] = $this->readstring($DataBuffer, $pos); break; case 0x1B: $pos += array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; $message_info['AccountID'] = intval($this->readstring($DataBuffer, $pos)); break; case 0x80: $message_info['Msg'] = array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; break; case 0x81: $message_info['MsgFlags'] = array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; break; case 0x84: $message_info['position'] = array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; break; case 0x91: $message_info['size'] = array_pop(unpack('L', substr($FlagsBuffer, $i * 4, 4))) >> 8; break; } } return $message_info; } function readIndex(&$data, $position) { //var_dump($position); $index_header = unpack('LFilePos/LUnknown1/LPrevIndex/LNextIndex/LCount/LUnknown', substr($data, $position, 24)); //var_dump($index_header); if ($index_header['FilePos'] != $position) { return PEAR::raiseError(_("Invalid file format")); } // Push it into list of processed items. $this->tmp[$position] = true; if (($index_header['NextIndex'] > 0) && empty($this->tmp[$index_header['NextIndex']])) { $this->readIndex($data, $index_header['NextIndex']); } if (($index_header['PrevIndex'] > 0) && empty($this->tmp[$index_header['PrevIndex']])) { $this->readIndex($data, $index_header['PrevIndex']); } $position += 24; $icount = $index_header['Count'] >> 8; //var_dump($icount); if ($icount > 0) { $buf = substr($data, $position, 12 * $icount); for ($i = 0; $i < $icount; $i++) { $hdr_buf = substr($buf, $i * 12, 12); $IndexItem = unpack('LHeaderPos/LChildIndex/LUnknown', $hdr_buf); //var_dump($IndexItem); if ($IndexItem['HeaderPos'] > 0) { if (false && strtolower($this->fname) == 'folders.dbx') //read_folder($fp,$IndexItem['HeaderPos']); print 'Read folder not implemented in v1.0a
'; else { $mail['info'] = $this->readMessageInfo($data, $IndexItem['HeaderPos']); $mail['content'] = $this->readMessage($data, $mail['info']['position']); $this->mails[] = $mail; } } if (($IndexItem['ChildIndex'] > 0) && empty($this->tmp[$IndexItem['ChildIndex']])) { $this->readIndex($fp, $IndexItem['ChildIndex']); } } } } //debug function to display human readble message flags (Just for debugging purpose) function decode_flags($x) { $decode_flag['DOWNLOADED'] = 0x1; $decode_flag['MARKED'] = 0x20; $decode_flag['READED'] = 0x80; $decode_flag['DOWNLOAD_LATER'] = 0x100; $decode_flag['NEWS_MSG'] = 0x800; // to verify $decode_flag['ATTACHMENTS'] = 0x4000; $decode_flag['REPLY'] = 0x80000; $decode_flag['INSPECT_CONVERSATION'] = 0x400000; $decode_flag['IGNORE_CONVERSATION'] = 0x800000; $decoded_flags = ''; if(($x & $decode_flag['NEWS_MSG']) != 0) $decoded_flags .= "NEWS MESSAGE\n
"; if(($x & $decode_flag['DOWNLOAD_LATER']) != 0) $decoded_flags .= "DOWNLOAD LATER\n
"; if(($x & $decode_flag['DOWNLOADED']) != 0) $decoded_flags .= "DOWNLOADED\n
"; if(($x & $decode_flag['READED']) != 0) $decoded_flags .= "READED\n
"; if(($x & $decode_flag['MARKED']) != 0) $decoded_flags .= "MARKED\n
"; if(($x & $decode_flag['ATTACHMENTS']) != 0) $decoded_flags .= "ATTACHMENTS\n
"; if(($x & $decode_flag['REPLY']) != 0) $decoded_flags .= "REPLY\n
"; if(($x & $decode_flag['INSPECT_CONVERSATION']) != 0) $decoded_flags .= "INSPECT CONVERSATION\n
"; if(($x & $decode_flag['IGNORE_CONVERSATION']) != 0) $decoded_flags .= "IGNORE CONVERSATION\n
"; return $decoded_flags; } } --- NEW FILE: gzip.php --- * Copyright 2003-2004 Michael Slusarz * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Cochrane * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Compress */ class Horde_Compress_gzip extends Horde_Compress { /** * Gzip file flags. * * @var array $_flags */ var $_flags = array( 'FTEXT' => 0x01, 'FHCRC' => 0x02, 'FEXTRA' => 0x04, 'FNAME' => 0x08, 'FCOMMENT' => 0x10 ); /** * Decompress a gzip file and get information from it. * * @access public * * @param string &$data The tar file data. * @param array $params The parameter array (Unused). * * @return string The uncompressed data. */ function &decompress(&$data, $params = array()) { /* If gzip is not compiled into PHP, return now. */ if (!Util::extensionExists('zlib')) { return PEAR::raiseError(_("This server can't uncompress zip and gzip files.")); } /* Gzipped File - decompress it first. */ $position = 0; $info = unpack('CCM/CFLG/VTime/CXFL/COS', substr($data, $position + 2)); $position += 10; if ($info['FLG'] & $this->_flags['FEXTRA']) { $XLEN = unpack('vLength', substr($data, $position + 0, 2)); $XLEN = $XLEN['Length']; $position += $XLEN + 2; } if ($info['FLG'] & $this->_flags['FNAME']) { $filenamePos = strpos($data, "\x0", $position); $filename = substr($data, $position, $filenamePos - $position); $position = $filenamePos + 1; } if ($info['FLG'] & $this->_flags['FCOMMENT']) { $commentPos = strpos($data, "\x0", $position); $comment = substr($data, $position, $commentPos - $position); $position = $commentPos + 1; } if ($info['FLG'] & $this->_flags['FHCRC']) { $hcrc = unpack('vCRC', substr($data, $position + 0, 2)); $hcrc = $hcrc['CRC']; $position += 2; } $result = gzinflate(substr($data, $position, strlen($data) - $position)); if (empty($result)) { return PEAR::raiseError(_("Unable to decompress data.")); } return $result; } } --- NEW FILE: tar.php --- * Copyright 2003-2004 Michael Slusarz * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Cochrane * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Compress */ class Horde_Compress_tar extends Horde_Compress { /** * Tar file types. * * @var array $_types */ var $_types = array( 0x0 => 'Unix file', 0x30 => 'File', 0x31 => 'Link', 0x32 => 'Symbolic link', 0x33 => 'Character special file', 0x34 => 'Block special file', 0x35 => 'Directory', 0x36 => 'FIFO special file', 0x37 => 'Contiguous file' ); /** * Tar file flags. * * @var array $_flags */ var $_flags = array( 'FTEXT' => 0x01, 'FHCRC' => 0x02, 'FEXTRA' => 0x04, 'FNAME' => 0x08, 'FCOMMENT' => 0x10 ); /** * Decompress a tar file and get information from it. * * @access public * * @param string &$data The tar file data. * @param array $params The parameter array (Unused). * * @return array The requested data or PEAR_Error on error. *
     * KEY: Position in the array
     * VALUES: 'attr'  --  File attributes
     *         'data'  --  Raw file contents
     *         'date'  --  File modification time
     *         'name'  --  Filename
     *         'size'  --  Original file size
     *         'type'  --  File type
     * 
*/ function &decompress(&$data, $params = array()) { $position = 0; $return_array = array(); while ($position < strlen($data)) { $info = @unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/Ctypeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", substr($data, $position)); if (!$info) { return PEAR::raiseError(_("Unable to decompress data.")); } $position += 512; $contents = substr($data, $position, octdec($info['size'])); $position += ceil(octdec($info['size']) / 512) * 512; if ($info['filename']) { $file = array(); $file['size'] = octdec($info['size']); $file['date'] = octdec($info['mtime']); $file['name'] = trim($info['filename']); if (array_key_exists($info['typeflag'], $this->_types)) { $file['type'] = $this->_types[$info['typeflag']]; } else { $file['type'] = ''; } $file['data'] = ''; $file['attr'] = ''; if (($info['typeflag'] == 0) || ($info['typeflag'] == 0x30) || ($info['typeflag'] == 0x35)) { /* File or folder. */ $file['data'] = $contents; $file['attr'] = ($info['typeflag'] == 0x35) ? 'd' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x400) ? 'r' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x200) ? 'w' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x100) ? 'x' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x040) ? 'r' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x020) ? 'w' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x010) ? 'x' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x004) ? 'r' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x002) ? 'w' : '-'; $file['attr'] .= (hexdec(substr($info['mode'], 4, 3)) & 0x001) ? 'x' : '-'; } else { /* Some other type. */ } $return_array[] = $file; } } return $return_array; } } --- NEW FILE: tnef.php --- * Original design by: * Thomas Boll , Mark Simpson * * $Horde: framework/Compress/Compress/tnef.php,v 1.6 2004/01/01 15:14:13 jan Exp $ * * Copyright 2002-2004 Jan Schneider * Copyright 2002-2004 Michael Slusarz * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Compress */ class Horde_Compress_tnef extends Horde_Compress { /** * Decompress the data. * * @access public * * @param string $data The data to decompress. * @param optional array $params An array of arguments needed to * decompress the data. * * * @return mixed The decompressed data. * Returns a PEAR_Error object on error. */ function &decompress($data, $params = array()) { $out = array(); if ($this->_geti($data, 32) == TNEF_SIGNATURE) { $this->_geti($data, 16); while (strlen($data) > 0) { switch ($this->_geti($data, 8)) { case TNEF_LVL_MESSAGE: $this->_decodeMessage($data); break; case TNEF_LVL_ATTACHMENT: $this->_decodeAttachment($data, $out); break; } } } return array_reverse($out); } /** * TODO * * @access private * * @param string &$data The data string. * @param integer $bits How many bits to retrieve. * * @return TODO */ function _getx(&$data, $bits) { $value = null; if (strlen($data) >= $bits) { $value = substr($data, 0, $bits); $data = substr_replace($data, '', 0, $bits); } return $value; } /** * TODO * * @access private * * @param string &$data The data string. * @param integer $bits How many bits to retrieve. * * @return TODO */ function _geti(&$data, $bits) { $bytes = $bits / 8; $value = null; if (strlen($data) >= $bytes) { $value = ord($data{0}); if ($bytes >= 2) { $value += (ord($data{1}) << 8); } if ($bytes >= 4) { $value += (ord($data{2}) << 16) + (ord($data{3}) << 24); } $data = substr_replace($data, '', 0, $bytes); } return $value; } /** * TODO * * @access private * * @param string &$data The data string. * @param string $attribute TODO */ function _decodeAttribute(&$data, $attribute) { /* Data. */ $this->_getx($data, $this->_geti($data, 32)); /* Checksum. */ $this->_geti($data, 16); } /** * TODO * * @access private * * @param string $data The data string. * @param array &$attachment_data TODO */ function _extractMapiAttributes($data, &$attachment_data) { /* Number of attributes. */ $this->_geti($data, 32); while (strlen($data) > 0) { $value = null; $attr_type = $this->_geti($data, 16); $attr_name = $this->_geti($data, 16); switch ($attr_type) { case TNEF_MAPI_SHORT: $value = $this->_geti($data, 16); break; case TNEF_MAPI_INT: case TNEF_MAPI_BOOLEAN: $value = $this->_geti($data, 32); break; case TNEF_MAPI_FLOAT: $value = $this->_getx($data, 4); break; case TNEF_MAPI_DOUBLE: case TNEF_MAPI_SYSTIME: $value = $this->_getx($data, 8); break; case TNEF_MAPI_STRING: case TNEF_MAPI_UNICODE_STRING: case TNEF_MAPI_BINARY: $num_vals = $this->_geti($data, 32); for ($i = 0; $i < $num_vals; $i++) { $length = $this->_geti($data, 32); /* Pad to next 4 byte boundary. */ $datalen = $length + ((4 - ($length % 4)) % 4); /* Read and truncate to length. */ $value = substr($this->_getx($data, $datalen), 0, $length); } break; } /* Store any interesting attributes. */ switch ($attr_name) { case TNEF_MAPI_ATTACH_LONG_FILENAME: /* Used in preference to AFILENAME value. */ $attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/', '\1', $value); $attachment_data[0]['name'] = str_replace("\0", '', $attachment_data[0]['name']); break; case TNEF_MAPI_ATTACH_MIME_TAG: /* Is this ever set, and what is format? */ $attachment_data[0]['type'] = preg_replace('/^(.*)\/.*/', '\1', $value); $attachment_data[0]['subtype'] = preg_replace('/.*\/(.*)$/', '\1', $value); $attachment_data[0]['subtype'] = str_replace("\0", '', $attachment_data[0]['subtype']); break; } } } /** * TODO * * @access private * * @param string &$data The data string. */ function _decodeMessage(&$data) { $this->_decodeAttribute($data, $this->_geti($data, 32)); } /** * TODO * * @access private * * @param string &$data The data string. * @param array &$attachment_data TODO */ function _decodeAttachment(&$data, &$attachment_data) { $attribute = $this->_geti($data, 32); switch ($attribute) { case TNEF_ARENDDATA: /* Marks start of new attachment. */ $this->_getx($data, $this->_geti($data, 32)); /* Checksum */ $this->_geti($data, 16); /* Add a new default data block to hold details of this attachment. Reverse order is easier to handle later! */ array_unshift($attachment_data, array('type' => 'application', 'subtype' => 'octet-stream', 'name' => 'unknown', 'stream' => '')); break; case TNEF_AFILENAME: /* Strip path. */ $attachment_data[0]['name'] = preg_replace('/.*[\/](.*)$/', '\1', $this->_getx($data, $this->_geti($data, 32))); $attachment_data[0]['name'] = str_replace("\0", '', $attachment_data[0]['name']); /* Checksum */ $this->_geti($data, 16); break; case TNEF_ATTACHDATA: /* The attachment itself. */ $length = $this->_geti($data, 32); $attachment_data[0]['size'] = $length; $attachment_data[0]['stream'] = $this->_getx($data, $length); /* Checksum */ $this->_geti($data, 16); break; case TNEF_AMAPIATTRS: $length = $this->_geti($data, 32); $value = $this->_getx($data, $length); /* Checksum */ $this->_geti($data, 16); $this->_extractMapiAttributes($value, $attachment_data); break; default: $this->_decodeAttribute($data, $attribute); } } } --- NEW FILE: zip.php --- * http://www.zend.com/codex.php?id=535&single=1 * * Deins125 * http://www.zend.com/codex.php?id=470&single=1 * * The ZIP compression date code is partially based on code from * Peter Listiak * * Copyright 2000-2004 Chuck Hagenbuch * Copyright 2002-2004 Michael Cochrane * Copyright 2003-2004 Michael Slusarz * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Michael Cochrane * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Compress */ class Horde_Compress_zip extends Horde_Compress { /** * ZIP compression methods. * * @var array $_methods */ var $_methods = array( 0x0 => 'None', 0x1 => 'Shrunk', 0x2 => 'Super Fast', 0x3 => 'Fast', 0x4 => 'Normal', 0x5 => 'Maximum', 0x6 => 'Imploded', 0x8 => 'Deflated' ); /** * Beginning of central directory record. * * @var string $_ctrlDirHeader */ var $_ctrlDirHeader = "\x50\x4b\x01\x02"; /** * End of central directory record. * * @var string $_ctrlDirEnd */ var $_ctrlDirEnd = "\x50\x4b\x05\x06\x00\x00\x00\x00"; /** * Beginning of file contents. * * @var string $_fileHeader */ var $_fileHeader = "\x50\x4b\x03\x04"; /** * Create a ZIP compressed file from an array of file data. * * @access public * * @param array $data The data to compress. *
     * Requires an array of arrays - each subarray should contain the
     * following fields:
     * 'data' (string)   --  The data to compress.
     * 'name' (string)   --  The pathname to the file.
     * 'time' (integer)  --  [optional] The timestamp to use for the file.
     * 
* @param optional array $params The parameter array (Unused). * * @return string The ZIP file. */ function &compress($data, $params = array()) { $contents = $ctrldir = array(); foreach ($data as $val) { $this->_addToZIPFile($val, $contents, $ctrldir); } return $this->_createZIPFile($contents, $ctrldir); } /** * Decompress a ZIP file and get information from it. * * @access public * * @param string $data The zipfile data. * @param array $params The parameter array. *
     * The following parameters are REQUIRED:
     * 'action' (integer)  =>  The action to take on the data.  Either
     *                         HORDE_COMPRESS_ZIP_LIST or
     *                         HORDE_COMPRESS_ZIP_DATA.
     *
     * The following parameters are REQUIRED for HORDE_COMPRESS_ZIP_DATA also:
     * 'info' (array)   =>  The zipfile list.
     * 'key' (integer)  =>  The position of the file in the archive list.
     * 
* * @return mixed The requested data. */ function &decompress($data, $params) { if (array_key_exists('action', $params)) { if ($params['action'] == HORDE_COMPRESS_ZIP_LIST) { return $this->_getZipInfo($data); } elseif ($params['action'] == HORDE_COMPRESS_ZIP_DATA) { // TODO: Check for parameters. return $this->_getZipData($data, $params['info'], $params['key']); } else { return PEAR::raiseError(_("Incorrect action code given."), 'horde.error'); } } else { return PEAR::raiseError(_("You must specify what action to perform."), 'horde.error'); } } /** * Get the list of files/data from the zip archive. * * @access private * * @param string &$data The zipfile data. * * @return array KEY: Position in zipfile * VALUES: 'attr' -- File attributes * 'csize' -- Compressed file size * 'date' -- File modification time * 'name' -- Filename * 'method' -- Compression method * 'size' -- Original file size * 'type' -- File type */ function &_getZipInfo(&$data) { $entries = array(); /* Get details from local file header. */ $fhStart = strpos($data, $this->_fileHeader); do { $file = array(); $info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength/vExtraLength', substr($data, $fhStart + 8, 25)); $file['name'] = substr($data, $fhStart + 30, $info['Length']); $file['csize'] = $info['Compressed']; $file['size'] = $info['Uncompressed']; $file['method'] = $this->_methods[$info['Method']]; $file['crc'] = dechex($info['CRC32']); $modDate = $info['Time']; $file['date'] = mktime((($modDate >> 11) & 0x1f), (($modDate >> 5) & 0x3f), (($modDate << 1) & 0x3e), (($modDate >> 21) & 0x07), (($modDate >> 16) & 0x1f), ((($modDate >> 25) & 0x7f) + 80)); $file['_dataStart'] = $fhStart + 30 + $info['Length'] + $info['ExtraLength']; $file['_method'] = $info['Method']; /* Filenames are unique in zips so this can be done. */ $entries[$file['name']] = $file; } while (($fhStart = strpos($data, $this->_fileHeader, $fhStart + 30 + $info['Length'])) !== false); /* Get details from Central directory structure. */ $fhStart = strpos($data, $this->_ctrlDirHeader); do { $info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength', substr($data, $fhStart + 10, 20)); $name = substr($data, $fhStart + 46, $info['Length']); $entries[$name]['csize'] = $info['Compressed']; $entries[$name]['size'] = $info['Uncompressed']; $entries[$name]['crc'] = dechex($info['CRC32']); $info = unpack('vInternal/VExternal', substr($data, $fhStart + 36, 6)); if (array_key_exists($name, $entries)) { $entries[$name]['type'] = ($info['Internal'] & 0x01) ? 'text' : 'binary'; $entries[$name]['attr'] = ''; $entries[$name]['attr'] .= ($info['External'] & 0x10) ? 'D' : '-'; $entries[$name]['attr'] .= ($info['External'] & 0x20) ? 'A' : '-'; $entries[$name]['attr'] .= ($info['External'] & 0x03) ? 'S' : '-'; $entries[$name]['attr'] .= ($info['External'] & 0x02) ? 'H' : '-'; $entries[$name]['attr'] .= ($info['External'] & 0x01) ? 'R' : '-'; } } while (($fhStart = strpos($data, $this->_ctrlDirHeader, $fhStart + 46)) !== false); return array_values($entries); } /** * Returns the data for a specific archived file. * * @access private * * @param string &$data The zip archive contents. * @param array &$info The information array from _getZipInfo(). * @param integer $key The position of the file in the archive. * * @return string The file data. */ function &_getZipData(&$data, &$info, $key) { if (($info[$key]['_method'] == 0x8) && Util::extensionExists('zlib')) { /* If the file has been deflated, and zlib is installed, then inflate the data again. */ return gzinflate(substr($data, $info[$key]['_dataStart'], $info[$key]['csize'])); } elseif ($info[$key]['_method'] == 0x0) { /* Files that aren't compressed. */ return substr($data, $info[$key]['_dataStart'], $info[$key]['csize']); } else { return ''; } } /** * Checks to see if the data is a valid ZIP file. * * @access public * * @param string &$data The ZIP file data. * * @return boolean True if valid, false if invalid. */ function checkZipData(&$data) { if (strpos($data, $this->_fileHeader) === false) { return false; } else { return true; } } /** * Converts a UNIX timestamp to a 4-byte DOS date and time format * (date in high 2-bytes, time in low 2-bytes allowing magnitude * comparison). * * @access private * * @param optional integer $unixtime The current UNIX timestamp. * * @return integer The current date in a 4-byte DOS format. */ function _unix2DOSTime($unixtime = null) { $timearray = (is_null($unixtime)) ? getdate() : getdate($unixtime); if ($timearray['year'] < 1980) { $timearray['year'] = 1980; $timearray['mon'] = 1; $timearray['mday'] = 1; $timearray['hours'] = 0; $timearray['minutes'] = 0; $timearray['seconds'] = 0; } return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); } /** * Adds a "file" to the ZIP archive. * * @access private * * @param array &$file See Horde_Compress_zip::createZipFile(). * @param array &$contents An array of existing zipped files. * @param array &$ctrldir An array of central directory information. */ function _addToZIPFile(&$file, &$contents, &$ctrldir) { $data = &$file['data']; $name = str_replace('\\', '/', $file['name']); /* See if time/date information has been provided. */ $ftime = null; if (array_key_exists('time', $file)) { $ftime = $file['time']; } /* Get the hex time. */ $dtime = dechex($this->_unix2DosTime($ftime)); $hexdtime = chr(hexdec($dtime[6] . $dtime[7])) . chr(hexdec($dtime[4] . $dtime[5])) . chr(hexdec($dtime[2] . $dtime[3])) . chr(hexdec($dtime[0] . $dtime[1])); $fr = $this->_fileHeader; /* Begin creating the ZIP data. */ $fr .= "\x14\x00"; /* Version needed to extract. */ $fr .= "\x00\x00"; /* General purpose bit flag. */ $fr .= "\x08\x00"; /* Compression method. */ $fr .= $hexdtime; /* Last modification time/date. */ /* "Local file header" segment. */ $unc_len = strlen($data); $crc = crc32($data); $zdata = gzcompress($data); $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); $c_len = strlen($zdata); $fr .= pack('V', $crc); /* CRC 32 information. */ $fr .= pack('V', $c_len); /* Compressed filesize. */ $fr .= pack('V', $unc_len); /* Uncompressed filesize. */ $fr .= pack('v', strlen($name)); /* Length of filename. */ $fr .= pack('v', 0); /* Extra field length. */ $fr .= $name; /* File name. */ /* "File data" segment. */ $fr .= $zdata; /* "Data descriptor" segment (optional but necessary if archive is not served as file). */ $fr .= pack('V', $crc); $fr .= pack('V', $c_len); $fr .= pack('V', $unc_len); /* Add this entry to array. */ $old_offset = strlen(implode('', $contents)); $contents[] = &$fr; /* Add to central directory record. */ $cdrec = $this->_ctrlDirHeader; $cdrec .= "\x00\x00"; /* Version made by. */ $cdrec .= "\x14\x00"; /* Version needed to extract */ $cdrec .= "\x00\x00"; /* General purpose bit flag */ $cdrec .= "\x08\x00"; /* Compression method */ $cdrec .= $hexdtime; /* Last mod time/date. */ $cdrec .= pack('V', $crc); /* CRC 32 information. */ $cdrec .= pack('V', $c_len); /* Compressed filesize. */ $cdrec .= pack('V', $unc_len); /* Uncompressed filesize. */ $cdrec .= pack('v', strlen($name)); /* Length of filename. */ $cdrec .= pack('v', 0 ); /* Extra field length. */ $cdrec .= pack('v', 0 ); /* File comment length. */ $cdrec .= pack('v', 0 ); /* Disk number start. */ $cdrec .= pack('v', 0 ); /* Internal file attributes. */ $cdrec .= pack('V', 32 ); /* External file attributes - 'archive' bit set. */ $cdrec .= pack('V', $old_offset); /* Relative offset of local header. */ $cdrec .= $name; /* File name. */ /* Optional extra field, file comment goes here. */ // Save to central directory array. */ $ctrldir[] = &$cdrec; } /** * Creates the ZIP file. * Official ZIP file format: http://www.pkware.com/appnote.txt * * @access private * * @return string The ZIP file. */ function &_createZIPFile(&$contents, &$ctrlDir) { $data = implode('', $contents); $dir = implode('', $ctrlDir); return $data . $dir . $this->_ctrlDirEnd . /* Total # of entries "on this disk". */ pack('v', count($ctrlDir)) . /* Total # of entries overall. */ pack('v', count($ctrlDir)) . /* Size of central directory. */ pack('V', strlen($dir)) . /* Offset to start of central dir. */ pack('V', strlen($data)) . /* ZIP file comment length. */ "\x00\x00"; } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Data/Data csv.php, NONE, 1.1 icalendar.php, NONE, 1.1 imc.php, NONE, 1.1 palm.php, NONE, 1.1 pdb.php, NONE, 1.1 tsv.php, NONE, 1.1 vcard.php, NONE, 1.1 vnote.php, NONE, 1.1 vtodo.php, NONE, 1.1 Message-ID: <20051014143306.3CA3C102C0F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data/Data In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Data/Data Added Files: csv.php icalendar.php imc.php palm.php pdb.php tsv.php vcard.php vnote.php vtodo.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: csv.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Data */ class Horde_Data_csv extends Horde_Data { var $_extension = 'csv'; var $_contentType = 'text/comma-separated-values'; /** * Tries to dicover the CSV file's parameters. * * @access public * @param string $filename The name of the file to investigate * @return array An associative array with the following * possible keys: * 'sep': The field seperator * 'quote': The quoting character * 'fields': The number of fields (columns) */ function discoverFormat($filename) { @include_once('File/CSV.php'); if (class_exists('File_CSV')) { return File_CSV::discoverFormat($filename); } else { return array('sep' => ','); } } /** * Imports and parses a CSV file. * * @access public * * @param string $filename The name of the file to parse * @param boolean $header Does the first line contain the field/column names? * @param string $sep The field/column seperator * @param string $quote The quoting character * @param integer $fields The number or fields/columns * * @return array A two-dimensional array of all imported data rows. * If $header was true the rows are associative arrays * with the field/column names as the keys. */ function importFile($filename, $header = false, $sep = '', $quote = '', $fields = null) { @include_once('File/CSV.php'); $data = array(); /* File_CSV is present. */ if (class_exists('File_CSV')) { /* File_CSV is a bit picky at what parameter it expects. */ $conf = array(); if (!empty($quote)) { $conf['quote'] = $quote; } if (empty($sep)) { $conf['sep'] = ','; } else { $conf['sep'] = $sep; } if ($fields) { $conf['fields'] = $fields; } else { return $data; } /* Strip and keep the first line if it contains the field names. */ if ($header) { $head = File_CSV::read($filename, $conf); } while ($line = File_CSV::read($filename, $conf)) { if (!isset($head)) { $data[] = $line; } else { $newline = array(); for ($i = 0; $i < count($head); $i++) { $newline[$head[$i]] = empty($line[$i]) ? '' : $line[$i]; } $data[] = $newline; } } $fp = File_CSV::getPointer($filename, $conf); if ($fp) { rewind($fp); } /* Fall back to fgetcsv(). */ } else { $fp = fopen($filename, 'r'); if (!$fp) { return false; } /* Strip and keep the first line if it contains the field names. */ if ($header) { $head = fgetcsv($fp, 1024, $sep); } while ($line = fgetcsv($fp, 1024, $sep)) { if (!isset($head)) { $data[] = $line; } else { $newline = array(); for ($i = 0; $i < count($head); $i++) { $newline[$head[$i]] = empty($line[$i]) ? '' : $line[$i]; } $data[] = $newline; } } fclose($fp); } return $data; } /** * Builds a CSV file from a given data structure and returns it as * a string. * * @access public * * @param array $data A two-dimensional array containing the data * set. * @param boolean $header If true, the rows of $data are associative * arrays with field names as their keys. * * @return string The CSV data. */ function exportData($data, $header = false) { if (!is_array($data) || count($data) == 0) { return ''; } $export = ''; if ($header) { $head = current($data); foreach (array_keys($head) as $key) { if (!empty($key)) { $export .= '"' . $key . '"'; } $export .= ','; } $export = substr($export, 0, -1) . "\n"; } foreach ($data as $row) { foreach ($row as $cell) { if (!empty($cell) || $cell === 0) { $export .= '"' . $cell . '"'; } $export .= ','; } $export = substr($export, 0, -1) . "\n"; } return $export; } /** * Builds a CSV file from a given data structure and triggers its * download. It DOES NOT exit the current script but only outputs * the correct headers and data. * * @access public * * @param string $filename The name of the file to be downloaded. * @param array $data A two-dimensional array containing the data set. * @param boolean $header If true, the rows of $data are associative arrays * with field names as their keys. */ function exportFile($filename, $data, $header = false) { $export = $this->exportData($data, $header); $GLOBALS['browser']->downloadHeaders($filename, 'application/csv', false, strlen($export)); echo $export; } /** * Takes all necessary actions for the given import step, * parameters and form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optonal array $param An associative array containing needed * parameters for the current step. * * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { switch ($action) { case IMPORT_FILE: $next_step = parent::nextStep($action, $param); if (is_a($next_step, 'PEAR_Error')) { return $next_step; } /* Move uploaded file so that we can read it again in the next step after the user gave some format details. */ $file_name = Horde::getTempFile('import', false); if (!move_uploaded_file($_FILES['import_file']['tmp_name'], $file_name)) { return PEAR::raiseError(_("The uploaded file could not be saved.")); } $_SESSION['import_data']['file_name'] = $file_name; /* Try to discover the file format ourselves. */ $conf = $this->discoverFormat($file_name); if (!$conf) { $conf = array('sep' => ','); } $_SESSION['import_data'] = array_merge($_SESSION['import_data'], $conf); /* Read the file's first two lines to show them to the user. */ $_SESSION['import_data']['first_lines'] = ''; $fp = @fopen($file_name, 'r'); if ($fp) { $line_no = 1; while ($line_no < 3 && $line = fgets($fp)) { $newline = String::length($line) > 100 ? "\n" : ''; $_SESSION['import_data']['first_lines'] .= substr($line, 0, 100) . $newline; $line_no++; } } return IMPORT_CSV; case IMPORT_CSV: $_SESSION['import_data']['header'] = Util::getFormData('header'); $import_data = $this->importFile($_SESSION['import_data']['file_name'], $_SESSION['import_data']['header'], Util::getFormData('sep'), Util::getFormData('quote'), Util::getFormData('fields')); $_SESSION['import_data']['data'] = $import_data; unset($_SESSION['import_data']['map']); return IMPORT_MAPPED; default: return parent::nextStep($action, $param); } } } --- NEW FILE: icalendar.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @package Horde_Data * @since Horde 3.0 */ class Horde_Data_icalendar extends Horde_Data_imc { var $_params = array(); function _build($data, &$i, $return = false) { // We shouldn't call this unless we're about to begin an // object of some sort. $uname = String::upper($data[$i]['name']); if ($uname != 'BEGIN') { return PEAR::raiseError(sprintf(_("Import Error: Expecting BEGIN on line %d."), $i)); } $object = array('type' => String::upper($data[$i]['values'][0]), 'objects' => array(), 'params' => array()); $i++; while (String::upper($data[$i]['name']) != 'END') { if (String::upper($data[$i]['name']) == 'BEGIN') { $object['objects'][] = $this->_build($data, $i, true); } else { $object['params'][String::upper($data[$i]['name'])] = array('params' => $data[$i]['params'], 'values' => $data[$i]['values']); } $i++; } if (String::upper($data[$i]['values'][0]) != $object['type']) { return PEAR::raiseError(sprintf(_("Import Error: Mismatch; expecting END:%s on line %d"), $object['type'], $i)); } if ($return) { return $object; } else { if (String::upper($object['type']) == 'VCALENDAR') { $this->_objects = $object['objects']; $this->_params = $object['params']; } else { $this->_objects[] = $object; } } } function getValues($attribute, $event = 0) { $values = array(); $attribute = String::upper($attribute); if (isset($this->_objects[$event]['params'][$attribute])) { $count = count($this->_objects[$event]['params'][$attribute]['values']); for ($i = 0; $i < $count; $i++) { $values[$i] = $this->read($this->_objects[$event]['params'][$attribute], $i); } } return (count($values) > 0) ? $values : null; } function getAttributes($event = 0) { return array_keys($this->_objects[$event]['params']); } /** * Builds an iCalendar file from a given data structure and returns it as * a string. * * @access public * * @param array $data A two-dimensional array containing the data set. * @param string $method (optional) The iTip method to use. * * @return string The iCalendar data. */ function exportData($data, $method = 'REQUEST') { global $prefs; $DST = date('I'); $TZNAME = date('T'); $TZID = $prefs->getValue('timezone'); $TZOFFSET = date('O'); // These can be used later in a VTIMEZONE object: // $TZOffsetFrom = ($DST) ? $TZOFFSET - 100 : $TZOFFSET; // $TZOffsetTo = ($DST) ? $TZOFFSET : $TZOFFSET - 100; $file = implode($this->_newline, array('BEGIN:VCALENDAR', 'VERSION:2.0', 'PRODID:-//Horde.org//Kronolith Generated', 'METHOD:' . $method)) . $this->_newline; foreach ($data as $row) { $file .= 'BEGIN:VEVENT' . $this->_newline; foreach ($row as $key => $val) { if (!empty($val)) { // Basic encoding. Newlines for now; more work // here to make this RFC-compliant. $file .= $key . ':' . $this->_quoteAndFold($val); } } $file .= 'END:VEVENT' . $this->_newline; } $file .= 'END:VCALENDAR' . $this->_newline; return $file; } /** * Builds an iCalendar file from a given data structure and * triggers its download. It DOES NOT exit the current script but * only outputs the correct headers and data. * * @access public * @param string $filename The name of the file to be downloaded. * @param array $data A two-dimensional array containing the data set. */ function exportFile($filename, $data) { $export = $this->exportData($data); $GLOBALS['browser']->downloadHeaders($filename, 'text/calendar', false, strlen($export)); echo $export; } function toHash($i = 0) { $hash = array(); if (($title = $this->getValues('SUMMARY', $i)) !== null) { $hash['title'] = implode("\n", $title); } if (($desc = $this->getValues('DESCRIPTION', $i)) !== null) { $hash['description'] = implode("\n", $desc); } if (($location = $this->getValues('LOCATION', $i)) !== null) { $hash['location'] = implode("\n", $location); } if (($start = $this->getValues('DTSTART', $i)) !== null && count($start) == 1) { $start = $this->mapDate($start[0]); $hash['start_date'] = $start['year'] . '-' . $start['month'] . '-' . $start['mday']; $hash['start_time'] = $start['hour'] . ':' . $start['min'] . ':' . $start['sec']; } if (($start = $this->getValues('DURATION', $i)) != null && count($start) == 1) { preg_match('/^P([0-9]{1,2}[W])?([0-9]{1,2}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?/', $start[0], $duration); $hash['duration'] = $duration; } if (($start = $this->getValues('DTEND', $i)) !== null && count($start) == 1) { $end = $this->mapDate($start[0]); $hash['end_date'] = $end['year'] . '-' . $end['month'] . '-' . $end['mday']; $hash['end_time'] = $end['hour'] . ':' . $end['min'] . ':' . $end['sec']; } return $hash; } /** * Takes all necessary actions for the given import step, * parameters and form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optional array $param An associative array containing needed * parameters for the current step. * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { switch ($action) { case IMPORT_FILE: $next_step = parent::nextStep($action, $param); if (is_a($next_step, 'PEAR_Error')) { return $next_step; } $import_data = $this->importFile($_FILES['import_file']['tmp_name']); if (is_a($import_data, 'PEAR_Error')) { return $import_data; } /* Build the result data set as an associative array. */ $data = array(); for ($i = 0; $i < $this->count(); $i++) { $data[] = $this->toHash($i); } return $data; break; default: return parent::nextStep($action, $param); break; } } } --- NEW FILE: imc.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @package Horde_Data * @since Horde 3.0 */ class Horde_Data_imc extends Horde_Data { var $_objects = array(); /** * According to RFC 2425, we should always use CRLF-terminated * lines. * @var string $_newline */ var $_newline = "\r\n"; function importData($text) { $lines = preg_split('/(\r\n|\n|\r)/', $text); $data = array(); // Unfolding. $countData = 0; foreach ($lines as $line) { if (preg_match('/^[ \t]/', $line) && $countData > 1) { $data[$countData - 1] .= substr($line, 1); } elseif (trim($line) != '') { $data[] = $line; $countData++; } $data[$countData - 1] = trim($data[$countData - 1]); } $lines = $data; $data = array(); foreach ($lines as $line) { $line = preg_replace('/"([^":]*):([^":]*)"/', "\"\\1\x00\\2\"", $line); if (!strstr($line, ':')) { return PEAR::raiseError(_("Import Error: Malformed line.")); } list($name, $value) = explode(':', $line, 2); $name = preg_replace('/\0/', ':', $name); $value = preg_replace('/\0/', ':', $value); $name = explode(';', $name); $params = array(); if (isset($name[1])) { $iMax = count($name); for ($i = 1; $i < $iMax; $i++) { $name_value = explode('=', $name[$i]); $paramname = $name_value[0]; $paramvalue = isset($name_value[1]) ? $name_value[1] : null; if (isset($paramvalue)) { preg_match_all('/("((\\\\"|[^"])*)"|[^,]*)(,|$)/', $paramvalue, $split); for ($j = 0; $j < count($split[1]) - 1; $j++) { $params[$paramname][] = stripslashes($split[1][$j]); } } else { $params[$paramname] = true; } } } // Store unsplitted value for vCard 2.1. $value21 = $value; $value = preg_replace('/\\\\,/', "\x00", $value); $values = explode(',', $value); for ($i = 0; $i < count($values); $i++) { $values[$i] = preg_replace('/\0/', ',', $values[$i]); $values[$i] = preg_replace('/\\\\n/', "\n", $values[$i]); $values[$i] = preg_replace('/\\\\,/', ',', $values[$i]); $values[$i] = preg_replace('/\\\\\\\\/', '\\', $values[$i]); } $data[] = array('name' => $name[0], 'params' => $params, 'values' => $values, 'value21' => $value21); } $start = 0; $this->_build($data, $start); return $this->_objects; } function read($attribute, $index = 0) { $value = $attribute['values'][$index]; if (isset($attribute['params']['ENCODING'])) { switch ($attribute['params']['ENCODING'][0]) { case 'QUOTED-PRINTABLE': $value = quoted_printable_decode($value); break; } } if (isset($attribute['params']['QUOTED-PRINTABLE']) && ($attribute['params']['QUOTED-PRINTABLE'] == true)) { $value = quoted_printable_decode($value); } if (isset($attribute['params']['CHARSET'])) { $value = String::convertCharset($value, $attribute['params']['CHARSET'][0]); } else { // As per RFC 2279, assume UTF8 if we don't have an // explicit charset parameter. $value = String::convertCharset($value, 'utf-8'); } return $value; } function readAll($attribute) { $count = count($attribute['values']); $value = ''; for ($i = 0; $i < $count; $i++) { $value .= $this->read($attribute, $i) . $this->_newline; } return substr($value, 0, -(strlen($this->_newline))); } function makeDate($dateOb) { // FIXME: We currently handle only "full" offsets, not TZs // like +1030. $TZOffset = substr(date('O'), 0, 3); $thisHour = $dateOb->hour - $TZOffset; if ($thisHour < 0) { require_once 'Date/Calc.php'; $prevday = Date_Calc::prevDay($dateOb->mday, $dateOb->month, $dateOb->year); $dateOb->mday = substr($prevday, 6, 2); $dateOb->month = substr($prevday, 4, 2); $dateOb->year = substr($prevday, 0, 4); $thisHour += 24; } return sprintf('%04d%02d%02dT%02d%02d%02dZ', $dateOb->year, $dateOb->month, $dateOb->mday, $thisHour, $dateOb->min, $dateOb->sec); } function makeDuration($seconds) { $duration = ''; if ($seconds < 0) { $duration .= '-'; $seconds *= -1; } $duration .= 'P'; $days = floor($seconds / 86400); $seconds = $seconds % 86400; $weeks = floor($days / 7); $days = $days % 7; if ($weeks) { $duration .= $weeks . "W"; } if ($days) { $duration .= $days . "D"; } if ($seconds) { $duration .= 'T'; $hours = floor($seconds / 3600); $seconds = $seconds % 3600; if ($hours > 0) { $duration .= $hours . 'H'; } $minutes = floor($seconds / 60); $seconds = $seconds % 60; if ($minutes) { $duration .= $minutes . 'M'; } if ($seconds) { $seconds .= $seconds . 'S'; } } return $duration; } function mapDate($datestring) { if (strpos($datestring, 'T') !== false) { list($date, $time) = explode('T', $datestring); } else { $date = $datestring; } if (strlen($date) == 10) { $dates = explode('-', $date); } else { $dates = array(); $dates[] = substr($date, 0, 4); $dates[] = substr($date, 4, 2); $dates[] = substr($date, 6, 2); } $dateOb = array('mday' => $dates[2], 'month' => $dates[1], 'year' => $dates[0]); if (isset($time)) { @list($time, $zone) = explode('Z', $time); if (strstr($time, ':') !== false) { $times = explode(':', $time); } else { $times = array(substr($time, 0, 2), substr($time, 2, 2), substr($time, 4)); } if (isset($zone)) { // Map the timezone here. } $TZOffset = substr(date('O'), 0, 3); $dateOb['hour'] = $times[0] + $TZOffset; $dateOb['min'] = $times[1]; $dateOb['sec'] = $times[2]; } else { $dateOb['hour'] = 0; $dateOb['min'] = 0; $dateOb['sec'] = 0; } // Put a timestamp in here, too. $func = isset($zone) ? 'gmmktime' : 'mktime'; $dateOb['ts'] = $func($dateOb['hour'], $dateOb['min'], $dateOb['sec'], $dateOb['month'], $dateOb['mday'], $dateOb['year']); return $dateOb; } function count() { return count($this->_objects); } function toHash() { return array(); } function fromHash() { return array(); } function _quoteAndFold($string) { $lines = preg_split('/(\r\n|\n|\r)/', rtrim($string)); $valueLines = array(); foreach ($lines as $line) { if (strlen($line) > 75) { $foldedline = ''; $firstline = true; while (!empty($line)) { /* Make first line shorter to allow for the field * name. */ if ($firstline) { $len = 60; $firstline = false; } else { $len = 75; } $foldedline .= (empty($foldedline)) ? substr($line, 0, $len) : $this->_newline . ' ' . substr($line, 0, $len); if (strlen($line) <= $len) { $line = ''; } else { $line = substr($line, $len); } } $valueLines[] = $foldedline; } else { $valueLines[] = $line; } } return implode($this->_newline . ' ', $valueLines) . $this->_newline; } } --- NEW FILE: palm.php --- * @package Horde_Data */ class Data_palm extends Data { } /** * PHP-PDB -- PHP class to write PalmOS databases. * * Copyright (C) 2001 - PHP-PDB development team * Licensed under the GNU LGPL software license. * See the doc/LEGAL file for more information * See http://php-pdb.sourceforge.net/ for more information about the library * * As a note, storing all of the information as hexadecimal kinda * sucks, but it is tough to store and properly manipulate a binary * string in PHP. We double the size of the data but decrease the * difficulty level immensely. */ /** * Define constants */ // Sizes define('PDB_HEADER_SIZE', 72); // Size of the database header define('PDB_INDEX_HEADER_SIZE', 6); // Size of the record index header define('PDB_RECORD_HEADER_SIZE', 8); // Size of the record index entry define('PDB_RESOURCE_SIZE', 10); // Size of the resource index entry define('PDB_EPOCH_1904', 2082844800); // Difference between Palm's time and Unix // Attribute Flags define('PDB_ATTRIB_RESOURCE', 1); define('PDB_ATTRIB_READ_ONLY', 2); define('PDB_ATTRIB_APPINFO_DIRTY', 4); define('PDB_ATTRIB_BACKUP', 8); define('PDB_ATTRIB_OK_NEWER', 16); define('PDB_ATTRIB_RESET', 32); define('PDB_ATTRIB_OPEN', 64); define('PDB_ATTRIB_LAUNCHABLE', 512); // Record Flags // The first nibble is reserved for the category number // See PDB_CATEGORY_MASK define('PDB_RECORD_ATTRIB_PRIVATE', 16); define('PDB_RECORD_ATTRIB_DELETED', 32); define('PDB_RECORD_ATTRIB_DIRTY', 64); define('PDB_RECORD_ATTRIB_EXPUNGED', 128); // Category support define('PDB_CATEGORY_NUM', 16); // Number of categories define('PDB_CATEGORY_NAME_LENGTH', 16); // Bytes allocated for name define('PDB_CATEGORY_SIZE', 276); // 2 + (num * length) + num + 1 + 1 define('PDB_CATEGORY_MASK', 15); // Bitmask -- use with attribute of record // to get the category ID // Double conversion define('PDB_DOUBLEMETHOD_UNTESTED', 0); define('PDB_DOUBLEMETHOD_NORMAL', 1); define('PDB_DOUBLEMETHOD_REVERSE', 2); define('PDB_DOUBLEMETHOD_BROKEN', 3); /** * PalmDB Class * * Contains all of the required methods and variables to write a pdb file. * Extend this class to provide functionality for memos, addresses, etc. * * @package Horde_Data */ class PalmDB { var $Records = array(); // All of the data from the records is here // Key = record ID var $RecordAttrs = array(); // And their attributes are here var $CurrentRecord = 1; // Which record we are currently editing var $Name = ''; // Name of the PDB file var $TypeID = ''; // The 'Type' of the file (4 chars) var $CreatorID = ''; // The 'Creator' of the file (4 chars) var $Attributes = 0; // Attributes (bitmask) var $Version = 0; // Version of the file var $ModNumber = 0; // Modification number var $CreationTime = 0; // Stored in unix time (Jan 1, 1970) var $ModificationTime = 0; // Stored in unix time (Jan 1, 1970) var $BackupTime = 0; // Stored in unix time (Jan 1, 1970) var $AppInfo = ''; // Basic AppInfo block var $SortInfo = ''; // Basic SortInfo block var $DoubleMethod = PDB_DOUBLEMETHOD_UNTESTED; // What method to use for converting doubles // Creates a new database class function PalmDB($Type = '', $Creator = '', $Name = '') { $this->TypeID = $Type; $this->CreatorID = $Creator; $this->Name = $Name; $this->CreationTime = time(); $this->ModificationTime = time(); } /* * Data manipulation functions * * These convert various numbers and strings into the hexadecimal * format that is used internally to construct the file. We use hex * encoded strings since that is a lot easier to work with than binary * data in strings, and we can easily tell how big the true value is. * B64 encoding does some odd stuff, so we just make the memory * consumption grow tremendously and the complexity level drops * considerably. */ // Converts a byte and returns the value function Int8($value) { $value &= 0xFF; return sprintf("%02x", $value); } // Loads a single byte as a number from the file // Use if you want to make your own ReadFile function function LoadInt8($file) { if (is_resource($file)) $string = fread($file, 1); else $string = $file; return ord($string[0]); } // Converts an integer (two bytes) and returns the value function Int16($value) { $value &= 0xFFFF; return sprintf("%02x%02x", $value / 256, $value % 256); } // Loads two bytes as a number from the file // Use if you want to make your own ReadFile function function LoadInt16($file) { if (is_resource($file)) $string = fread($file, 2); else $string = $file; return ord($string[0]) * 256 + ord($string[1]); } // Converts an integer (three bytes) and returns the value function Int24($value) { $value &= 0xFFFFFF; return sprintf("%02x%02x%02x", $value / 65536, ($value / 256) % 256, $value % 256); } // Loads three bytes as a number from the file // Use if you want to make your own ReadFile function function LoadInt24($file) { if (is_resource($file)) $string = fread($file, 3); else $string = $file; return ord($string[0]) * 65536 + ord($string[1]) * 256 + ord($string[2]); } // Converts an integer (four bytes) and returns the value // 32-bit integers have problems with PHP when they are bigger than // 0x80000000 (about 2 billion) and that's why I don't use pack() here function Int32($value) { $negative = false; if ($value < 0) { $negative = true; $value = - $value; } $big = $value / 65536; settype($big, 'integer'); $little = $value - ($big * 65536); if ($negative) { // Little must contain a value $little = - $little; // Big might be zero, and should be 0xFFFF if that is the case. $big = 0xFFFF - $big; } $value = PalmDB::Int16($big) . PalmDB::Int16($little); return $value; } // Loads a four-byte string from a file into a number // Use if you want to make your own ReadFile function function LoadInt32($file) { if (is_resource($file)) $string = fread($file, 4); else $string = $file; $value = 0; $i = 0; while ($i < 4) { $value *= 256; $value += ord($string[$i]); $i ++; } return $value; } // Converts the number into a double and returns the encoded value // Not sure if this will work on all platforms. // Double(10.53) should return "40250f5c28f5c28f" function Double($value) { if ($this->DoubleMethod == PDB_DOUBLEMETHOD_UNTESTED) { $val = bin2hex(pack('d', 10.53)); $val = strtolower($val); if (substr($val, 0, 4) == '8fc2') $this->DoubleMethod = PDB_DOUBLEMETHOD_REVERSE; if (substr($val, 0, 4) == '4025') $this->DoubleMethod = PDB_DOUBLEMETHOD_NORMAL; if ($this->DoubleMethod == PDB_DOUBLEMETHOD_UNTESTED) $this->DoubleMethod = PDB_DOUBLEMETHOD_BROKEN; } if ($this->DoubleMethod == PDB_DOUBLEMETHOD_BROKEN) return '0000000000000000'; $value = bin2hex(pack('d', $value)); if ($this->DoubleMethod == PDB_DOUBLEMETHOD_REVERSE) $value = substr($value, 14, 2) . substr($value, 12, 2) . substr($value, 10, 2) . substr($value, 8, 2) . substr($value, 6, 2) . substr($value, 4, 2) . substr($value, 2, 2) . substr($value, 0, 2); return $value; } // The reverse? Not coded yet. // Use if you want to make your own ReadFile function function LoadDouble($file) { if (is_resource($file)) $string = fread($file, 8); else $string = $file; return 0; } // Converts a string into hexadecimal. // If $maxLen is specified and is greater than zero, the string is // trimmed and will contain up to $maxLen characters. // String("abcd", 2) will return "ab" hex encoded (a total of 4 // resulting bytes, but 2 encoded characters). // Returned string is *not* NULL-terminated. function String($value, $maxLen = false) { $value = bin2hex($value); if ($maxLen !== false && $maxLen > 0) $value = substr($value, 0, $maxLen * 2); return $value; } // Pads a hex-encoded value (typically a string) to a fixed size. // May grow too long if $value starts too long // $value = hex encoded value // $minLen = Append nulls to $value until it reaches $minLen // $minLen is the desired size of the string, unencoded. // PadString('6162', 3) results in '616200' (remember the hex encoding) function PadString($value, $minLen) { $PadBytes = '00000000000000000000000000000000'; $PadMe = $minLen - (strlen($value) / 2); while ($PadMe > 0) { if ($PadMe > 16) $value .= $PadBytes; else return $value . substr($PadBytes, 0, $PadMe * 2); $PadMe = $minLen - (strlen($value) / 2); } return $value; } /* * Record manipulation functions */ // Sets the current record pointer to the new record number if an // argument is passed in. // Returns the old record number (just in case you want to jump back) // Does not do basic record initialization if we are going to a new // record. function GoToRecord($num = false) { if ($num === false) return $this->CurrentRecord; if (gettype($num) == 'string' && ($num[0] == '+' || $num[0] == '-')) $num = $this->CurrentRecord + $num; $oldRecord = $this->CurrentRecord; $this->CurrentRecord = $num; return $oldRecord; } // Returns the size of the current record if no arguments. // Returns the size of the specified record if arguments. function GetRecordSize($num = false) { if ($num === false) $num = $this->CurrentRecord; if (! isset($this->Records[$num])) return 0; return strlen($this->Records[$num]) / 2; } // Adds to the current record. The input data must be already // hex encoded. Initializes the record if it doesn't exist. function AppendCurrent($value) { if (! isset($this->Records[$this->CurrentRecord])) $this->Records[$this->CurrentRecord] = ''; $this->Records[$this->CurrentRecord] .= $value; } // Adds a byte to the current record function AppendInt8($value) { $this->AppendCurrent($this->Int8($value)); } // Adds an integer (2 bytes) to the current record function AppendInt16($value) { $this->AppendCurrent($this->Int16($value)); } // Adds an integer (4 bytes) to the current record function AppendInt32($value) { $this->AppendCurrent($this->Int32($value)); } // Adds a double to the current record function AppendDouble($value) { $this->AppendCurrent($this->Double($value)); } // Adds a string (not NULL-terminated) function AppendString($value, $maxLen = false) { $this->AppendCurrent($this->String($value, $maxLen)); } // Returns true if the specified/current record exists and is set function RecordExists($Rec = false) { if ($Rec === false) $Rec = $this->CurrentRecord; if (isset($this->Records[$Rec])) return true; return false; } // Returns the hex-encoded data for the specified record or the current // record if not specified function GetRecord($Rec = false) { if ($Rec === false) $Rec = $this->CurrentRecord; if (isset($this->Records[$Rec])) return $this->Records[$Rec]; return ''; } // Returns the raw data inside the current/specified record. Use this // for odd record types (like a Datebook record). Also, use this // instead of just using $PDB->Records[] directly. function GetRecordRaw($Rec = false) { if ($Rec === false) $Rec = $this->CurrentRecord; if (isset($this->Records[$Rec])) return $this->Records[$Rec]; return false; } // Sets the hex-encoded data (or whatever) for the current record // Use this instead of the Append* functions if you have an odd // type of record (like a Datebook record). // Also, use this instead of just setting $PDB->Records[] // directly. // SetRecordRaw('data'); // SetRecordRaw(24, 'data'); (specifying the record num) function SetRecordRaw($A, $B = false) { if ($B === false) { $B = $A; $A = $this->CurrentRecord; } $this->Records[$A] = $B; } // Deletes the current record // You are urged to use GoToRecord() and jump to an existing record // after this function call so that the deleted record doesn't // get accidentally recreated/used -- all append functions will // create a new, empty record if the current record doesn't exist. function DeleteCurrentRecord() { if (isset($this->Records[$this->CurrentRecord])) unset($this->Records[$this->CurrentRecord]); if (isset($this->RecordAttrs[$this->CurrentRecord])) unset($this->RecordAttrs[$this->CurrentRecord]); } // Returns an array of available record IDs in the order they should // be written. // Probably should only be called within the class. function GetRecordIDs() { $keys = array_keys($this->Records); if (! is_array($keys) || count($keys) < 1) return array(); sort($keys, SORT_NUMERIC); return $keys; } // Returns the number of records. This should match the number of // keys returned by GetRecordIDs(). function GetRecordCount() { return count($this->Records); } // Returns the size of the AppInfo block. // Used only for writing function GetAppInfoSize() { if (! isset($this->AppInfo)) return 0; return strlen($this->AppInfo) / 2; } // Returns the AppInfo block (hex encoded) // Used only for writing function GetAppInfo() { if (! isset($this->AppInfo)) return 0; return $this->AppInfo; } // Returns the size of the SortInfo block // Used only for writing function GetSortInfoSize() { if (! isset($this->SortInfo)) return 0; return strlen($this->SortInfo) / 2; } // Returns the SortInfo block (hex encoded) // Used only for writing function GetSortInfo() { if (! isset($this->SortInfo)) return 0; return $this->SortInfo; } /* * Category Support */ // Creates the hex-encoded data to be stuck in the AppInfo // block if the database supports categories. // // Data format: // $categoryArray[id#] = name // Or: // $categoryArray[id#]['name'] = name // $categoryArray[id#]['renamed'] = true / false // // Tips: // * I'd suggest numbering your categories sequentially // * Do not have a category 0. It must always be 'Unfiled'. This // function will overwrite any category with the ID of 0. // * There is a maximum of 16 categories, including 'Unfiled'. // // Category 0 is reserved for 'Unfiled' // Categories 1-127 are used for handheld ID numbers // Categories 128-255 are used for desktop ID numbers // Do not let category numbers be created larger than 255 function CreateCategoryData($CategoryArray) { $CategoryArray[0] = array('Name' => 'Unfiled', 'Renamed' => false); $CatsWritten = 0; $LastIdWritten = 0; $RenamedFlags = 0; $CategoryStr = ''; $IdStr = ''; $keys = array_keys($CategoryArray); sort($keys); foreach ($keys as $id) { if ($CatsWritten < PDB_CATEGORY_NUM) { $CatsWritten ++; $LastIdWritten = $id; $RenamedFlags *= 2; if (is_array($CategoryArray[$id]) && isset($CategoryArray[$id]['Renamed']) && $CategoryArray[$id]['Renamed']) $RenamedFlags += 1; $name = ''; if (is_array($CategoryArray[$id])) { if (isset($CategoryArray[$id]['Name'])) $name = $CategoryArray[$id]['Name']; } else $name = $CategoryArray[$id]; $name = $this->String($name, PDB_CATEGORY_NAME_LENGTH); $CategoryStr .= $this->PadString($name, PDB_CATEGORY_NAME_LENGTH); $IdStr .= $this->Int8($id); } } while ($CatsWritten < PDB_CATEGORY_NUM) { $CatsWritten ++; $LastIdWritten ++; $RenamedFlags *= 2; $CategoryStr .= $this->PadString('', PDB_CATEGORY_NAME_LENGTH); $IdStr .= $this->Int8($LastIdWritten); } $TrailingBytes = $this->Int8($LastIdWritten); $TrailingBytes .= $this->Int8(0); // Error checking if ($LastIdWritten >= 256) return $this->PadString('', PDB_CATEGORY_SIZE); return $this->Int16($RenamedFlags) . $CategoryStr . $IdStr . $TrailingBytes; } // This should be called by other subclasses that use category support // It returns a category array. Each element in the array is another // array with the key 'name' set to the name of the category and // the key 'renamed' set to the renamed flag for that category. function LoadCategoryData($fileData) { $RenamedFlags = $this->LoadInt16(substr($fileData, 0, 2)); $Offset = 2; $StartingFlag = 65536; $Categories = array(); while ($StartingFlag > 1) { $StartingFlag /= 2; $Name = substr($fileData, $Offset, PDB_CATEGORY_NAME_LENGTH); $i = 0; while ($i < PDB_CATEGORY_NAME_LENGTH && $Name[$i] != "\0") $i ++; if ($i == 0) $Name = ''; elseif ($i < PDB_CATEGORY_NAME_LENGTH) $Name = substr($Name, 0, $i); if ($RenamedFlags & $StartingFlag) $RenamedFlag = true; else $RenamedFlag = false; $Categories[] = array('Name' => $Name, 'Renamed' => $RenamedFlag); $Offset += PDB_CATEGORY_NAME_LENGTH; } $CategoriesParsed = array(); foreach ($Categories as $CategoryData) { $UID = $this->LoadInt8(substr($fileData, $Offset, 1)); $Offset ++; if ($CategoryData['Name'] != '') $CategoriesParsed[$UID] = $CategoryData; } // Ignore the last ID return $CategoriesParsed; } /* * Database Writing Functions */ // *NEW* // Takes a hex-encoded string and makes sure that when decoded, the data // lies on a four-byte boundary. If it doesn't, it pads the string with // NULLs /* * Commented out because we don't use this function currently. * It is part of a test to see what is needed to get files to sync * properly with Desktop 4.0 * function PadTo4ByteBoundary($string) { while ((strlen($string)/2) % 4) { $string .= '00'; } return $string; } * */ // Returns the hex encoded header of the pdb file // Header = name, attributes, version, creation/modification/backup // dates, modification number, some offsets, record offsets, // record attributes, appinfo block, sortinfo block // Shouldn't be called from outside the class function MakeHeader() { // 32 bytes = name, but only 31 available (one for null) $header = $this->String($this->Name, 31); $header = $this->PadString($header, 32); // Attributes & version fields $header .= $this->Int16($this->Attributes); $header .= $this->Int16($this->Version); // Creation, modification, and backup date if ($this->CreationTime != 0) $header .= $this->Int32($this->CreationTime + PDB_EPOCH_1904); else $header .= $this->Int32(time() + PDB_EPOCH_1904); if ($this->ModificationTime != 0) $header .= $this->Int32($this->ModificationTime + PDB_EPOCH_1904); else $header .= $this->Int32(time() + PDB_EPOCH_1904); if ($this->BackupTime != 0) $header .= $this->Int32($this->BackupTime + PDB_EPOCH_1904); else $header .= $this->Int32(0); // Calculate the initial offset $Offset = PDB_HEADER_SIZE + PDB_INDEX_HEADER_SIZE; $Offset += PDB_RECORD_HEADER_SIZE * count($this->GetRecordIDs()); // Modification number, app information id, sort information id $header .= $this->Int32($this->ModNumber); $AppInfo_Size = $this->GetAppInfoSize(); if ($AppInfo_Size > 0) { $header .= $this->Int32($Offset); $Offset += $AppInfo_Size; } else $header .= $this->Int32(0); $SortInfo_Size = $this->GetSortInfoSize(); if ($SortInfo_Size > 0) { $header .= $this->Int32($Offset); $Offset += $SortInfo_Size; } else $header .= $this->Int32(0); // Type, creator $header .= $this->String($this->TypeID, 4); $header .= $this->String($this->CreatorID, 4); // Unique ID seed $header .= $this->Int32(0); // next record list $header .= $this->Int32(0); // Number of records $header .= $this->Int16($this->GetRecordCount()); // Compensate for the extra 2 NULL characters in the $Offset $Offset += 2; // Dump each record if ($this->GetRecordCount() != 0) { $keys = $this->GetRecordIDs(); sort($keys, SORT_NUMERIC); foreach ($keys as $index) { $header .= $this->Int32($Offset); if (isset($this->RecordAttrs[$index])) $header .= $this->Int8($this->RecordAttrs[$index]); else $header .= $this->Int8(0); // The unique id is just going to be the record number $header .= $this->Int24($index); $Offset += $this->GetRecordSize($index); // *new* method 3 //$Mod4 = $Offset % 4; //if ($Mod4) // $Offset += 4 - $Mod4; } } // These are the mysterious two NULL characters that we need $header .= $this->Int16(0); // AppInfo and SortInfo blocks go here if ($AppInfo_Size > 0) // *new* method 1 $header .= $this->GetAppInfo(); //$header .= $this->PadTo4ByteBoundary($this->GetAppInfo()); if ($SortInfo_Size > 0) // *new* method 2 $header .= $this->GetSortInfo(); //$header .= $this->PadTo4ByteBoundary($this->GetSortInfo()); return $header; } // Writes the database to the file handle specified. // Use this function like this: // $file = fopen("output.pdb", "wb"); // // "wb" = write binary for non-Unix systems // if (! $file) { // echo "big problem -- can't open file"; // exit; // } // $pdb->WriteToFile($file); // fclose($file); function WriteToFile($file) { $header = $this->MakeHeader(); fwrite($file, pack('H*', $header), strlen($header) / 2); $keys = $this->GetRecordIDs(); sort($keys, SORT_NUMERIC); foreach ($keys as $index) { // *new* method 3 //$data = $this->PadTo4ByteBoundary($this->GetRecord($index)); $data = $this->GetRecord($index); fwrite($file, pack('H*', $data), strlen($data) / 2); } fflush($file); } // Writes the database to the standard output (like echo). // Can be trapped with output buffering function WriteToStdout() { // You'd think these three lines would work. // If someone can figure out why they don't, please tell me. // // $fp = fopen('php://stdout', 'wb'); // $this->WriteToFile($fp); // fclose($fp); $header = $this->MakeHeader(); echo pack("H*", $header); $keys = $this->GetRecordIDs(); sort($keys, SORT_NUMERIC); foreach ($keys as $index) { // *new* method 3 $data = $this->GetRecord($index); //$data = $this->PadTo4ByteBoundary($this->GetRecord($index)); echo pack("H*", $data); } } // Writes the database to the standard output (like echo) but also // writes some headers so that the browser should prompt to save the // file properly. // // Use this only if you didn't send any content and you only want the // PHP script to output the PDB file and nothing else. An example // would be if you wanted to have 'download' link so the user can // stick the information they are currently viewing and transfer // it easily into their handheld. // // $filename is the desired filename to download the database as. // For example, DownloadPDB('memos.pdb'); function DownloadPDB($filename) { // Alter the filename to only allow certain characters. // Some platforms and some browsers don't respond well if // there are illegal characters (such as spaces) in the name of // the file being downloaded. $filename = preg_replace('/[^-a-zA-Z0-9\\.]/', '_', $filename); if (strstr($_SERVER['HTTP_USER_AGENT'], 'compatible; MSIE ') !== false && strstr($_SERVER['HTTP_USER_AGENT'], 'Opera') === false) { // IE doesn't properly download attachments. This should work // pretty well for IE 5.5 SP 1 header("Content-Disposition: inline; filename=$filename"); header("Content-Type: application/download; name=\"$filename\""); } else { // Use standard headers for Netscape, Opera, etc. header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Type: application/x-pilot; name=\"$filename\""); } $this->WriteToStdout(); } /* * Loading in a database */ // Reads data from the file and tries to load it properly // $file is the already-opened file handle. // Returns false if no error function ReadFile($file) { // 32 bytes = name, but only 31 available $this->Name = fread($file, 32); $i = 0; while ($i < 32 && $this->Name[$i] != "\0") $i ++; $this->Name = substr($this->Name, 0, $i); $this->Attributes = $this->LoadInt16($file); $this->Version = $this->LoadInt16($file); $this->CreationTime = $this->LoadInt32($file); if ($this->CreationTime != 0) $this->CreationTime -= PDB_EPOCH_1904; if ($this->CreationTime < 0) $this->CreationTime = 0; $this->ModificationTime = $this->LoadInt32($file); if ($this->ModificationTime != 0) $this->ModificationTime -= PDB_EPOCH_1904; if ($this->ModificationTime < 0) $this->ModificationTime = 0; $this->BackupTime = $this->LoadInt32($file); if ($this->BackupTime != 0) $this->BackupTime -= PDB_EPOCH_1904; if ($this->BackupTime < 0) $this->BackupTime = 0; // Modification number $this->ModNumber = $this->LoadInt32($file); // AppInfo and SortInfo size $AppInfoOffset = $this->LoadInt32($file); $SortInfoOffset = $this->LoadInt32($file); // Type, creator $this->TypeID = fread($file, 4); $this->CreatorID = fread($file, 4); // Skip unique ID seed fread($file, 4); // skip next record list (hope that's ok) fread($file, 4); $RecCount = $this->LoadInt16($file); $RecordData = array(); while ($RecCount > 0) { $RecCount --; $Offset = $this->LoadInt32($file); $Attrs = $this->LoadInt8($file); $UID = $this->LoadInt24($file); $RecordData[] = array('Offset' => $Offset, 'Attrs' => $Attrs, 'UID' => $UID); } // Create the offset list if ($AppInfoOffset != 0) $OffsetList[$AppInfoOffset] = 'AppInfo'; if ($SortInfoOffset != 0) $OffsetList[$SortInfoOffset] = 'SortInfo'; foreach ($RecordData as $data) $OffsetList[$data['Offset']] = array('Record', $data); fseek($file, 0, SEEK_END); $OffsetList[ftell($file)] = 'EOF'; // Parse each chunk ksort($OffsetList); $Offsets = array_keys($OffsetList); while (count($Offsets) > 1) { // Don't use the EOF (which should be the last offset) $ThisOffset = $Offsets[0]; $NextOffset = $Offsets[1]; if ($OffsetList[$ThisOffset] == 'EOF') // Messed up file. Stop here. return true; $FuncName = 'Load'; if (is_array($OffsetList[$ThisOffset])) { $FuncName .= $OffsetList[$ThisOffset][0]; $extraData = $OffsetList[$ThisOffset][1]; } else { $FuncName .= $OffsetList[$ThisOffset]; $extraData = false; } fseek($file, $ThisOffset); $fileData = fread($file, $NextOffset - $ThisOffset); if ($this->$FuncName($fileData, $extraData)) return -2; array_shift($Offsets); } return false; } // Generic function to load the AppInfo block into $this->AppInfo // Should only be called within this class // Return false to signal no error function LoadAppInfo($fileData) { $this->AppInfo = bin2hex($fileData); return false; } // Generic function to load the SortInfo block into $this->SortInfo // Should only be called within this class // Return false to signal no error function LoadSortInfo($fileData) { $this->SortInfo = bin2hex($fileData); return false; } // Generic function to load a record // Should only be called within this class // Return false to signal no error function LoadRecord($fileData, $recordInfo) { $this->Records[$recordInfo['UID']] = bin2hex($fileData); $this->RecordAttrs[$recordInfo['UID']] = $recordInfo['Attrs']; return false; } } --- NEW FILE: pdb.php --- * @package Horde_Data */ class Data_pdb extends Data_palm { var $_extension = 'pdb'; var $_pdb; function importFile($filename) { $this->_pdb = &new PalmDatebook(); $fp = fopen($filename, 'r'); if ($fp) { $this->_pdb->ReadFile($fp); fclose($fp); return $this->import(); } else { return false; } } function importData() { $nbrec = $this->_pdb->GetRecordCount(); $data = array(); foreach ($this->_pdb->GetRecordIDs() as $id) { $row = array(); $record = $this->_pdb->GetRecordRaw($id); $row['title'] = $record['Description']; $row['category'] = 'Palm'; if (!empty($record['Note'])) { $row['description'] = $record['Note']; } $row['start_date'] = $record['Date']; $row['end_date'] = $row['start_date']; if (!empty($record['StartTime'])) { $row['start_time'] = $record['StartTime'] . ":00"; if (!empty($record['EndTime'])) { $row['end_time'] = $record['EndTime'] . ":00" ; } } else { $row['start_time'] = "00:00:00"; $row['end_time'] = "00:00:00"; $date = explode('-', $row['start_date']); $date[2] = 1 + $date[2]; $row['end_date'] = implode('-', $date); } if (!empty($record['Alarm']) && preg_match('/(\d+)([dmh])/', $record['Alarm'], $matches)) { switch ($matches[2]) { case 'm': $row['alarm'] = $matches[1]; break; case 'h': $row['alarm'] = $matches[1]*60; break; case 'd': $row['alarm'] = $matches[1]*60*24; break; } } if (!empty($record['Repeat'])) { switch ($record['Repeat']['Type']) { case PDB_DATEBOOK_REPEAT_NONE: $row['recur_type'] = KRONOLITH_RECUR_NONE; break; case PDB_DATEBOOK_REPEAT_DAILY: $row['recur_type'] = KRONOLITH_RECUR_DAILY; if (!empty($record['Repeat']['Date'])) { $row['recur_end_date'] = $record['Repeat']['Date']; } $row['recur_interval'] = $record['Repeat']['Frequency']; break; case PDB_DATEBOOK_REPEAT_WEEKLY: $row['recur_type'] = KRONOLITH_RECUR_WEEKLY; if (!empty($record['Repeat']['Date'])) { $row['recur_end_date'] = $record['Repeat']['Date']; } $row['recur_interval'] = $record['Repeat']['Frequency']; if (!empty($record['Repeat']['Days'])) { $days=0; for ($c = 0; $c < strlen($record['Repeat']['Days']); $c++) { $days = $days | (int)pow(2, (int)$record['Repeat']['Days']{$c}); } $row['recur_data'] = $days; } break; case PDB_DATEBOOK_REPEAT_MONTH_BY_DAY: // TODO : to be completed with // $record['Repeat']['WeekNum'] and // $record['Repeat']['DayNum']. $row['recur_type'] = KRONOLITH_RECUR_DAY_OF_MONTH; if (!empty($record['Repeat']['Date'])) { $row['recur_end_date'] = $record['Repeat']['Date']; } $row['recur_interval'] = $record['Repeat']['Frequency']; break; case PDB_DATEBOOK_REPEAT_MONTH_BY_DATE: // TODO, verify the compliance with lib/Kronolith.php $row['recur_type'] = KRONOLITH_RECUR_WEEK_OF_MONTH; if (!empty($record['Repeat']['Date'])) { $row['recur_end_date'] = $record['Repeat']['Date']; } $row['recur_interval'] = $record['Repeat']['Frequency']; break; case PDB_DATEBOOK_REPEAT_YEARLY: $row['recur_type'] = KRONOLITH_RECUR_YEARLY; if (!empty($record['Repeat']['Date'])) { $row['recur_end_date'] = $record['Repeat']['Date']; } $row['recur_interval'] = $record['Repeat']['Frequency']; break; } } $data[] = $row; } return $data; } } /** * Class extender for PalmOS Datebook files * * Copyright (C) 2001 - PHP-PDB development team * Licensed under the GNU LGPL * See the doc/LEGAL file for more information * See http://php-pdb.sourceforge.net/ for more information about the library */ // Repeat types define('PDB_DATEBOOK_REPEAT_NONE', 0); define('PDB_DATEBOOK_REPEAT_DAILY', 1); define('PDB_DATEBOOK_REPEAT_WEEKLY', 2); define('PDB_DATEBOOK_REPEAT_MONTH_BY_DAY', 3); define('PDB_DATEBOOK_REPEAT_MONTH_BY_DATE', 4); define('PDB_DATEBOOK_REPEAT_YEARLY', 5); // Record flags define('PDB_DATEBOOK_FLAG_DESCRIPTION', 1024); // Record has description // (mandatory, as far as I know) define('PDB_DATEBOOK_FLAG_EXCEPTIONS', 2048); // Are there any exceptions? define('PDB_DATEBOOK_FLAG_NOTE', 4096); // Is there an associated note? define('PDB_DATEBOOK_FLAG_REPEAT', 8192); // Does the event repeat? define('PDB_DATEBOOK_FLAG_ALARM', 16384); // Is there an alarm set? define('PDB_DATEBOOK_FLAG_WHEN', 32768); // Was the 'when' updated? // (Internal use only?) /* The data for SetRecordRaw and from GetRecordRaw should be/return a * special array, detailed below. Optional values can be set to '' or not * defined. If they are anything else (including zero), they are considered * to be 'set'. Optional values are marked with a ^. * * Key Example Description * ------------------------------------------ * StartTime 2:00 Starting time of event, 24 hour format * EndTime 13:00 Ending time of event, 24 hour format * Date 2001-01-23 Year-Month-Day of event * Description Title This is the title of the event * Alarm 5d ^ Number of units (m=min, h=hours, d=days) * Repeat ??? ^ Repeating event data (array) * Note NoteNote ^ A note for the event * Exceptions ??? ^ Exceptions to the event * WhenChanged ??? ^ True if "when info" for event has changed * Flags 3 ^ User flags (highest bit allowed is 512) * * EndTime must happen at or after StartTime. The time the event occurs * may not pass midnight (0:00). If the event doesn't have a time, use '' * or do not define StartTime and EndTime. * * Repeating events: * * No repeat (or leave the array undefined): * $repeat['Type'] = PDB_DATEBOOK_REPEAT_NONE; * * Daily repeating events: * $repeat['Type'] = PDB_DATEBOOK_REPEAT_DAILY; * $repeat['Frequency'] = FREQ; // Explained below * $repeat['End'] = END_DATE; // Explained below * * Weekly repeating events: * $repeat['Type'] = PDB_DATEBOOK_REPEAT_WEEKLY; * $repeat['Frequency'] = FREQ; // Explained below * $repeat['Days'] = DAYS; // Explained below * $repeat['End'] = END_DATE; // Explained below * $repeat['StartOfWeek'] = SOW; // Explained below * * "Monthly by day" repeating events: * $repeat['Type'] = PDB_DATEBOOK_REPEAT_MONTH_BY_DAY; * $repeat['WeekNum'] = WEEKNUM; // Explained below * $repeat['DayNum'] = DAYNUM; // Explained below * $repeat['Frequency'] = FREQ; // Explained below * $repeat['End'] = END_DATE; // Explained below * * "Monthly by date" repeating events: * $repeat['Type'] = PDB_DATEBOOK_REPEAT_MONTH_BY_DATE; * $repeat['Frequency'] = FREQ; // Explained below * $repeat['End'] = END_DATE; // Explained below * * Yearly repeating events: * $repeat['Type'] = PDB_DATEBOOK_REPEAT_YEARLY; * $repeat['Frequency'] = FREQ; // Explained below * $repeat['End'] = END_DATE; // Explained below * * There is also two mysterious 'unknown' fields for the repeat event that * will be populated if the database is loaded from a file. They will * otherwise default to 0. They are 'unknown1' and 'unknown2'. * * FREQ = Frequency of the event. If it is a daily event and you want it * to happen every other day, set Frequency to 2. This will default * to 1 if not specified. * END_DATE = The last day, month, and year on which the event occurs. * Format is YYYY-MM-DD. If not specified, no end date will * be set. * DAYS = What days during the week the event occurs. This is a string of * numbers from 0 - 6. I'm not sure if 0 = Sunday or if 0 = * start of week from the preferences. * SOW = As quoted from P5-Palm: "I'm not sure what this is, but the * Datebook app appears to perform some hairy calculations * involving this." * WEEKNUM = The number of the week on which the event occurs. 5 is the * last week of the month. * DAYNUM = The day of the week on which the event occurs. Again, I don't * know if 0 = Sunday or if 0 = start of week from the prefs. * * Exceptions are specified in an array consisting of dates the event occured * and did not happen or should not be shown. Dates are in the format * YYYY-MM-DD * * @package Horde_Data */ class PalmDatebook extends PalmDB { var $FirstDay; // Constructor -- initialize the default values function PalmDatebook () { PalmDB::PalmDB('DATA', 'date', 'DatebookDB'); $this->FirstDay = 0; } // Returns an array with default data for a new record. // This doesn't actually add the record. function NewRecord() { // Default event is untimed // Event's date is today $Event['Date'] = date("Y-m-d"); // Set an alarm 10 min before the event $Event['Alarm'] = '10m'; return $Event; } // Converts a date string ( YYYY-MM-DD )( "2001-10-31" ) // into bitwise ( YYYY YYYM MMMD DDDD ) // Should only be used when saving function DateToInt16($date) { $YMD = explode('-', $date); return ($YMD[0] - 1904) * 512 + $YMD[1] * 32 + $YMD[2]; } // Converts a bitwise date ( YYYY YYYM MMMD DDDD ) // Into the human readable date string ( YYYY-MM-DD )( "2001-10-31" ) // Should only be used when loading function Int16ToDate($number) { $year = $number / 512; settype($year, "integer"); $year += 1904; $number = $number % 512; $month = $number / 32; settype($month, "integer"); $day = $number % 32; return $year . '-' . $month . '-' . $day; } // Prepares the record flags for the specified record; // Should only be used when saving function GetRecordFlags(& $data) { if (! isset($data['Flags'])) $data['Flags'] = 0; $Flags = $data['Flags'] % 1024; if (isset($data['Description']) && $data['Description'] != '') $Flags += PDB_DATEBOOK_FLAG_DESCRIPTION; if (isset($data['Exceptions']) && is_array($data['Exceptions']) && count($data['Exceptions']) > 0) $Flags += PDB_DATEBOOK_FLAG_EXCEPTIONS; if (isset($data['Note']) && $data['Note'] != '') $Flags += PDB_DATEBOOK_FLAG_NOTE; if (isset($data['Repeat']) && is_array($data['Repeat']) && count($data['Repeat']) > 0) $Flags += PDB_DATEBOOK_FLAG_REPEAT; if (isset($data['Alarm']) && $data['Alarm'] != '' && preg_match('/^([0-9]+)([mMhHdD])$/', $data['Alarm'], $AlarmMatch)) $Flags += PDB_DATEBOOK_FLAG_ALARM; if (isset($data['WhenChanged']) && $data['WhenChanged'] != '' && $data['WhenChanged']) $Flags += PDB_DATEBOOK_FLAG_WHEN; $data['Flags'] = $Flags; } // Overrides the GetRecordSize method. // Probably should only be used when saving function GetRecordSize($num = false) { if ($num === false) $num = $this->CurrentRecord; if (! isset($this->Records[$num]) || ! is_array($this->Records[$num])) return PalmDB::GetRecordSize($num); $data = $this->Records[$num]; // Start Time and End Time (4) // The day of the event (2) // Flags (2) $Bytes = 8; $this->GetRecordFlags($data); if ($data['Flags'] & PDB_DATEBOOK_FLAG_ALARM) $Bytes += 2; if ($data['Flags'] & PDB_DATEBOOK_FLAG_REPEAT) $Bytes += 8; if ($data['Flags'] & PDB_DATEBOOK_FLAG_EXCEPTIONS) $Bytes += 2 + count($data['Exceptions']) * 2; if ($data['Flags'] & PDB_DATEBOOK_FLAG_DESCRIPTION) $Bytes += strlen($data['Description']) + 1; if ($data['Flags'] & PDB_DATEBOOK_FLAG_NOTE) $Bytes += strlen($data['Note']) + 1; return $Bytes; } // Overrides the GetRecord method. We store data in associative arrays. // Just convert the data into the proper format and then return the // generated string. function GetRecord($num = false) { if ($num === false) $num = $this->CurrentRecord; if (! isset($this->Records[$num]) || ! is_array($this->Records[$num])) return PalmDB::GetRecord($num); $data = $this->Records[$num]; $RecordString = ''; // Start Time and End Time // 4 bytes // 0xFFFFFFFF if the event has no time if (! isset($data['StartTime']) || ! isset($data['EndTime']) || strpos($data['StartTime'], ':') === false || strpos($data['EndTime'], ':') === false) { $RecordString .= $this->Int16(65535); $RecordString .= $this->Int16(65535); } else { list($StartH, $StartM) = explode(':', $data['StartTime']); list($EndH, $EndM) = explode(':', $data['EndTime']); if ($StartH < 0 || $StartH > 23 || $StartM < 0 || $StartM > 59 || $EndH < 0 || $EndH > 23 || $EndM < 0 || $EndM > 59) { $RecordString .= $this->Int16(65535); $RecordString .= $this->Int16(65535); } else { if ($EndH < $StartH || ($EndH == $StartH && $EndM < $StartM)) { $EndM = $StartM; if ($StartH < 23) $EndH = $StartH + 1; else $EndH = $StartH; } $RecordString .= $this->Int8($StartH); $RecordString .= $this->Int8($StartM); $RecordString .= $this->Int8($EndH); $RecordString .= $this->Int8($EndM); } } // The day of the event // For repeating events, this is the first day the event occurs $RecordString .= $this->Int16($this->DateToInt16($data['Date'])); // Flags $this->GetRecordFlags($data); $Flags = $data['Flags']; $RecordString .= $this->Int16($Flags); if ($Flags & PDB_DATEBOOK_FLAG_ALARM && preg_match('/^([0-9]+)([mMhHdD])$/', $data['Alarm'], $AlarmMatch)) { $RecordString .= $this->Int8($AlarmMatch[1]); $AlarmMatch[2] = strtolower($AlarmMatch[2]); if ($AlarmMatch[2] == 'm') $RecordString .= $this->Int8(0); elseif ($AlarmMatch[2] == 'h') $RecordString .= $this->Int8(1); else $RecordString .= $this->Int8(2); } if ($Flags & PDB_DATEBOOK_FLAG_REPEAT) { $d = $data['Repeat']; $RecordString .= $this->Int8($d['Type']); if (! isset($d['unknown1'])) $d['unknown1'] = 0; $RecordString .= $this->Int8($d['unknown1']); if (isset($d['End'])) $RecordString .= $this->Int16($this->DateToInt16($d['End'])); else $RecordString .= $this->Int16(65535); if (! isset($d['Frequency'])) $d['Frequency'] = 1; $RecordString .= $this->Int8($d['Frequency']); if ($d['Type'] == PDB_DATEBOOK_REPEAT_WEEKLY) { $days = $d['Days']; $flags = 0; $QuickLookup = array(1, 2, 4, 8, 16, 32, 64); $i = 0; while ($i < strlen($days)) { $num = $days[$i]; settype($num, 'integer'); if (isset($QuickLookup[$num])) $flags = $flags | $QuickLookup[$num]; $i ++; } $RecordString .= $this->Int8($flags); if (isset($d['StartOfWeek']) && $d['StartOfWeek'] != '') $RecordString .= $this->Int8($d['StartOfWeek']); else $RecordString .= $this->Int8(0); } elseif ($d['Type'] == PDB_DATEBOOK_REPEAT_MONTH_BY_DAY) { if ($d['WeekNum'] > 5) $d['WeekNum'] = 5; $RecordString .= $this->Int8($d['WeekNum'] * 7 + $d['DayNum']); $RecordString .= $this->Int8(0); } else { $RecordString .= $this->Int16(0); } if (! isset($d['unknown2'])) $d['unknown2'] = 0; $RecordString .= $this->Int8($d['unknown2']); } if ($Flags & PDB_DATEBOOK_FLAG_EXCEPTIONS) { $d = $data['Exceptions']; $RecordString .= $this->Int16(count($d)); foreach ($d as $exception) { $RecordString .= $this->Int16($this->DateToInt16($exception)); } } if ($Flags & PDB_DATEBOOK_FLAG_DESCRIPTION) { $RecordString .= $this->String($data['Description']); $RecordString .= $this->Int8(0); } if ($Flags & PDB_DATEBOOK_FLAG_NOTE) { $RecordString .= $this->String($data['Note']); $RecordString .= $this->Int8(0); } return $RecordString; } // Returns the size of the AppInfo block. It is the size of the // category list plus four bytes. function GetAppInfoSize() { return PDB_CATEGORY_SIZE + 4; } // Returns the AppInfo block. It is composed of the category list (which // doesn't seem to be used and is just filled with NULL bytes) and four // bytes that specify the first day of the week. Not sure what that // value is supposed to be, so I just use zero. function GetAppInfo() { // Category list (Nulls) $this->AppInfo = $this->PadString('', PDB_CATEGORY_SIZE); // Unknown thing (first_day_in_week) // 00 00 FD 00 == where FD is the first day in week. // I'm using 0 as the default value since I don't know what it should be $this->AppInfo .= $this->Int16(0); $this->AppInfo .= $this->Int8($this->FirstDay); $this->AppInfo .= $this->Int8(0); return $this->AppInfo; } // Parses $fileData for the information we need when loading a datebook // file function LoadAppInfo($fileData) { $fileData = substr($fileData, PDB_CATEGORY_SIZE + 2); if (strlen($fileData < 1)) return; $this->FirstDay = $this->LoadInt8($fileData); } // Converts the datebook record data loaded from a file into the internal // storage method that is used for the rest of the class and for ease of // use. // Return false to signal no error function LoadRecord($fileData, $RecordInfo) { $this->RecordAttrs[$RecordInfo['UID']] = $RecordInfo['Attrs']; $NewRec = $this->NewRecord(); $StartH = $this->LoadInt8(substr($fileData, 0, 1)); $StartM = $this->LoadInt8(substr($fileData, 1, 1)); $EndH = $this->LoadInt8(substr($fileData, 2, 1)); $EndM = $this->LoadInt8(substr($fileData, 3, 1)); if ($StartH != 255 && $StartM != 255) { $NewRec['StartTime'] = $StartH . ':'; if ($StartM < 10) $NewRec['StartTime'] .= '0'; $NewRec['StartTime'] .= $StartM; } if ($EndH != 255 && $EndM != 255) { $NewRec['EndTime'] = $EndH . ':'; if ($EndM < 10) $NewRec['EndTime'] .= '0'; $NewRec['EndTime'] .= $EndM; } $NewRec['Date'] = $this->LoadInt16(substr($fileData, 4, 2)); $NewRec['Date'] = $this->Int16ToDate($NewRec['Date']); $Flags = $this->LoadInt16(substr($fileData, 6, 2)); $NewRec['Flags'] = $Flags; $fileData = substr($fileData, 8); if ($Flags & PDB_DATEBOOK_FLAG_WHEN) $NewRec['WhenChanged'] = true; if ($Flags & PDB_DATEBOOK_FLAG_ALARM) { $amount = $this->LoadInt8(substr($fileData, 0, 1)); $unit = $this->LoadInt8(substr($fileData, 1, 1)); if ($unit == 0) $unit = 'm'; elseif ($unit == 1) $unit = 'h'; else $unit = 'd'; $NewRec['Alarm'] = $amount . $unit; $fileData = substr($fileData, 2); } else unset($NewRec['Alarm']); if ($Flags & PDB_DATEBOOK_FLAG_REPEAT) { $Repeat = array(); $Repeat['Type'] = $this->LoadInt8(substr($fileData, 0, 1)); $Repeat['unknown1'] = $this->LoadInt8(substr($fileData, 1, 1)); $End = $this->LoadInt16(substr($fileData, 2, 2)); $Repeat['Frequency'] = $this->LoadInt8(substr($fileData, 4, 1)); $RepeatOn = $this->LoadInt8(substr($fileData, 5, 1)); $RepeatSoW = $this->LoadInt8(substr($fileData, 6, 1)); $Repeat['unknown2'] = $this->LoadInt8(substr($fileData, 7, 1)); $fileData = substr($fileData, 8); if ($End != 65535 && $End <= 0) $Repeat['End'] = $this->Int16ToDate($End); if ($Repeat['Type'] == PDB_DATEBOOK_REPEAT_WEEKLY) { $days = ''; if ($RepeatOn & 64) $days .= '0'; if ($RepeatOn & 32) $days .= '1'; if ($RepeatOn & 16) $days .= '2'; if ($RepeatOn & 8) $days .= '3'; if ($RepeatOn & 4) $days .= '4'; if ($RepeatOn & 2) $days .= '5'; if ($RepeatOn & 1) $days .= '6'; $Repeat['Days'] = $days; $Repeat['StartOfWeek'] = $RepeatSoW; } elseif ($Repeat['Type'] == PDB_DATEBOOK_REPEAT_MONTH_BY_DAY) { $Repeat['DayNum'] = $RepeatOn % 7; $RepeatOn /= 7; settype($RepeatOn, 'integer'); $Repeat['WeekNum'] = $RepeatOn; } $NewRec['Repeat'] = $Repeat; } if ($Flags & PDB_DATEBOOK_FLAG_EXCEPTIONS) { $Exceptions = array(); $number = $this->LoadInt16(substr($fileData, 0, 2)); $fileData = substr($fileData, 2); while ($number --) { $Exc = $this->LoadInt16(substr($fileData, 0, 2)); $Exceptions[] = $this->Int16ToDate($Exc); $fileData = substr($fileData, 2); } $NewRec['Exceptions'] = $Exceptions; } if ($Flags & PDB_DATEBOOK_FLAG_DESCRIPTION) { $i = 0; $NewRec['Description'] = ''; while ($i < strlen($fileData) && $fileData[$i] != "\0") { $NewRec['Description'] .= $fileData[$i]; $i ++; } $fileData = substr($fileData, $i + 1); } if ($Flags & PDB_DATEBOOK_FLAG_NOTE) { $i = 0; $NewRec['Note'] = ''; while ($i < strlen($fileData) && $fileData[$i] != "\0") { $NewRec['Note'] .= $fileData[$i]; $i ++; } $fileData = substr($fileData, 0, $i + 1); } $this->Records[$RecordInfo['UID']] = $NewRec; return false; } } --- NEW FILE: tsv.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Data */ class Horde_Data_tsv extends Horde_Data { var $_extension = 'tsv'; var $_contentType = 'text/tab-separated-values'; function importData($contents, $header = false, $delimiter = "\t") { $contents = explode("\n", $contents); $data = array(); if ($header) { $head = explode($delimiter, array_shift($contents)); } foreach ($contents as $line) { if (trim($line) == '') { continue; } $line = explode($delimiter, $line); if (!isset($head)) { $data[] = $line; } else { $newline = array(); for ($i = 0; $i < count($head); $i++) { $newline[$head[$i]] = empty($line[$i]) ? '' : $line[$i]; } $data[] = $newline; } } return $data; } /** * Builds a TSV file from a given data structure and returns it as a * string. * * @access public * @param array $data A two-dimensional array containing the data * set. * @param bool $header If true, the rows of $data are associative * arrays with field names as their keys. * @return string The TSV data. */ function exportData($data, $header = false) { if (!is_array($data) || count($data) == 0) { return ''; } $export = ''; if ($header) { $export = implode("\t", array_keys(current($data))) . "\n"; } foreach ($data as $row) { $export .= implode("\t", $row) . "\n"; } return $export; } /** * Builds a TSV file from a given data structure and triggers its download. * It DOES NOT exit the current script but only outputs the correct headers * and data. * * @access public * @param string $filename The name of the file to be downloaded. * @param array $data A two-dimensional array containing the data set. * @param bool $header If true, the rows of $data are associative arrays * with field names as their keys. */ function exportFile($filename, $data, $header = false) { $export = $this->exportData($data, $header); $GLOBALS['browser']->downloadHeaders($filename, 'text/tab-separated-values', false, strlen($export)); echo $export; } /** * Takes all necessary actions for the given import step, parameters and * form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optional array $param An associative array containing needed * parameters for the current step. * * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { switch ($action) { case IMPORT_FILE: $next_step = parent::nextStep($action, $param); if (is_a($next_step, 'PEAR_Error')) { return $next_step; } if ($_SESSION['import_data']['format'] == 'mulberry' || $_SESSION['import_data']['format'] == 'pine') { $_SESSION['import_data']['data'] = $this->importFile($_FILES['import_file']['tmp_name']); $format = $_SESSION['import_data']['format']; if ($format == 'mulberry') { $appKeys = array('alias', 'name', 'email', 'company', 'workAddress', 'workPhone', 'homePhone', 'fax', 'notes'); $dataKeys = array(0, 1, 2, 3, 4, 5, 6, 7, 9); } elseif ($format == 'pine') { $appKeys = array('alias', 'name', 'email', 'notes'); $dataKeys = array(0, 1, 2, 4); } foreach ($appKeys as $key => $app) { $map[$dataKeys[$key]] = $app; } $data = array(); foreach ($_SESSION['import_data']['data'] as $row) { $hash = array(); if ($format == 'mulberry') { if (preg_match("/^Grp:/", $row[0])) { continue; } $row[1] = preg_replace('/^([^,"]+),\s*(.*)$/', '$2 $1', $row[1]); foreach ($dataKeys as $key) { if (array_key_exists($key, $row)) { $hash[$key] = stripslashes(preg_replace('/\\\\r/', "\n", $row[$key])); } } } elseif ($format = 'pine') { if (count($row) < 3 || preg_match("/^#DELETED/", $row[0]) || preg_match("/[()]/", $row[2])) { continue; } $row[1] = preg_replace('/^([^,"]+),\s*(.*)$/', '$2 $1', $row[1]); foreach ($dataKeys as $key) { if (array_key_exists($key, $row)) { $hash[$key] = $row[$key]; } } } $data[] = $hash; } $_SESSION['import_data']['data'] = $data; $_SESSION['import_data']['map'] = $map; $ret = $this->nextStep(IMPORT_DATA, $param); return $ret; } /* Move uploaded file so that we can read it again in the next step after the user gave some format details. */ $uploaded = Browser::wasFileUploaded('import_file', _("TSV file")); if (is_a($uploaded, 'PEAR_Error')) { return PEAR::raiseError($uploaded->getMessage()); } $file_name = Horde::getTempFile('import', false); if (!move_uploaded_file($_FILES['import_file']['tmp_name'], $file_name)) { return PEAR::raiseError(_("The uploaded file could not be saved.")); } $_SESSION['import_data']['file_name'] = $file_name; /* Read the file's first two lines to show them to the user. */ $_SESSION['import_data']['first_lines'] = ''; $fp = @fopen($file_name, 'r'); if ($fp) { $line_no = 1; while ($line_no < 3 && $line = fgets($fp)) { $newline = String::length($line) > 100 ? "\n" : ''; $_SESSION['import_data']['first_lines'] .= substr($line, 0, 100) . $newline; $line_no++; } } return IMPORT_TSV; break; case IMPORT_TSV: $_SESSION['import_data']['header'] = Util::getFormData('header'); $import_data = $this->importFile($_SESSION['import_data']['file_name'], $_SESSION['import_data']['header']); $_SESSION['import_data']['data'] = $import_data; unset($_SESSION['import_data']['map']); return IMPORT_MAPPED; break; default: return parent::nextStep($action, $param); break; } } } --- NEW FILE: vcard.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Horde: framework/Data/Data/vcard.php,v 1.31 2004/05/10 13:41:07 jan Exp $ * @since Horde 3.0 * @package Horde_Data */ class Horde_Data_vcard extends Horde_Data_imc { /** * The vCard version. * * @access private * @var string $_version */ var $_version; function importData($text) { $res = parent::importData($text); if (is_a($res, 'PEAR_Error')) { return $res; } return $this->_objects; } /** * Builds a vCard file from a given data structure and returns it * as a string. * * @access public * * @param array $data A two-dimensional array containing the data set. * * @return string The vCard data. */ function exportData($data) { /* According to RFC 2425, we should always use CRLF-terminated lines. */ $newline = "\r\n"; $file = "BEGIN:VCARD${newline}VERSION:3.0${newline}"; foreach ($data as $key => $val) { if (!empty($val)) { // Basic encoding. Newlines for now; more work here to // make this RFC-compliant. $file .= $key . ':' . $this->_quoteAndFold($val); } } $file .= "END:VCARD$newline"; return $file; } /** * Builds a vCard file from a given data structure and triggers * its download. It DOES NOT exit the current script but only * outputs the correct headers and data. * * @access public * * @param string $filename The name of the file to be downloaded. * @param array $data A two-dimensional array containing the data set. */ function exportFile($filename, $data, $charset = null) { $export = $this->exportData($data); $cType = 'text/x-vcard'; if (!empty($charset)) { $cType .= '; charset="' . $charset . '"'; } $GLOBALS['browser']->downloadHeaders($filename, $cType, false, strlen($export)); echo $export; } function _build($data, &$i) { $objects = array(); while (isset($data[$i])) { if (String::upper($data[$i]['name']) != 'BEGIN') { return PEAR::raiseError(sprintf(_("Import Error: Expected \"BEGIN\" on line %d."), $i)); } $type = String::upper($data[$i]['values'][0]); $object = array('type' => $type); $object['objects'] = array(); $object['params'] = array(); $i++; while (isset($data[$i]) && String::upper($data[$i]['name']) != 'END') { if (String::upper($data[$i]['name']) == 'BEGIN') { $object['objects'][] = $this->_build($data, $i); } else { $object['params'][] = $data[$i]; if (String::upper($data[$i]['name']) == 'VERSION') { $object['version'] = $data[$i]['values'][0]; } } $i++; } if (!isset($data[$i])) { return PEAR::raiseError(_("Import Error: Unexpected end of file.")); } if (String::upper($data[$i]['values'][0]) != $type) { return PEAR::raiseError(sprintf(_("Import Error: Type mismatch. Expected \"END:%s\" on line %d."), $type, $i)); } $objects[] = $object; $i++; } $this->_objects = $objects; } function read($attribute, $index = 0) { if (($index == 0) && ($this->_version < 3.0)) { $value = $attribute['value21']; } else { $value = $attribute['values'][$index]; } if (isset($attribute['params']['ENCODING'])) { switch ($attribute['params']['ENCODING'][0]) { case 'QUOTED-PRINTABLE': $value = quoted_printable_decode($value); break; } } return $value; } function getValues($attribute, $card = 0) { $values = array(); $attribute = String::upper($attribute); if (isset($this->_objects[$card])) { for ($i = 0; $i < count($this->_objects[$card]['params']); $i++) { $param = $this->_objects[$card]['params'][$i]; if (String::upper($param['name']) == $attribute) { for ($j = 0; $j < count($param['values']); $j++) { $values[] = array('value' => $this->read($param, $j), 'params' => $param['params']); } } } } return $values; } function getBareEmail($address) { require_once 'Mail/RFC822.php'; require_once 'Horde/MIME.php'; static $rfc822; if (is_null($rfc822)) { $rfc822 = &new Mail_RFC822(); } $rfc822->validateMailbox($address); return MIME::rfc822WriteAddress($address->mailbox, $address->host); } /** * Return a data hash from a vCard object. * * @param array $card The card to convert. * * @return array The hashed data. * * @since Horde 3.0 */ function toHash($card) { $this->_version = isset($card['version']) ? $card['version'] : null; $hash = array(); foreach ($card['params'] as $item) { switch ($item['name']) { case 'FN': $hash['name'] = $this->read($item); break; case 'N': $name = explode(';', $this->read($item)); $hash['lastname'] = $name[VCARD_N_FAMILY]; $hash['firstname'] = $name[VCARD_N_GIVEN]; break; case 'NICKNAME': $hash['nickname'] = $this->read($item); break; // We use LABEL but also support ADR. case 'LABEL': if (isset($item['params']['HOME'])) { $hash['homeAddress'] = $this->read($item); } elseif (isset($item['params']['WORK'])) { $hash['workAddress'] = $this->read($item); } else { $hash['workAddress'] = $this->read($item); } break; // for vCard 3.0 case 'ADR': if (isset($item['params']['TYPE'])) { foreach ($item['params']['TYPE'] as $adr) { if (String::upper($adr) == 'HOME') { $address = explode(';', $this->read($item)); $hash['homeAddress'] = $address[VCARD_ADR_STREET]; $hash['homeCity'] = $address[VCARD_ADR_LOCALITY]; $hash['homeProvince'] = $address[VCARD_ADR_REGION]; $hash['homePostalCode'] = $address[VCARD_ADR_POSTCODE]; $hash['homeCountry'] = $address[VCARD_ADR_COUNTRY]; } elseif (String::upper($adr) == 'WORK') { $address = explode(';', $this->read($item)); $hash['workAddress'] = $address[VCARD_ADR_STREET]; $hash['workCity'] = $address[VCARD_ADR_LOCALITY]; $hash['workProvince'] = $address[VCARD_ADR_REGION]; $hash['workPostalCode'] = $address[VCARD_ADR_POSTCODE]; $hash['workCountry'] = $address[VCARD_ADR_COUNTRY]; } } } break; case 'TEL': if (isset($item['params']['VOICE'])) { if (isset($item['params']['HOME'])) { $hash['homePhone'] = $this->read($item); } elseif (isset($item['params']['WORK'])) { $hash['workPhone'] = $this->read($item); } elseif (isset($item['params']['CELL'])) { $hash['cellPhone'] = $this->read($item); } } elseif (isset($item['params']['FAX'])) { $hash['fax'] = $this->read($item); } elseif (isset($item['params']['TYPE'])) { // for vCard 3.0 foreach ($item['params']['TYPE'] as $tel) { if (String::upper($tel) == 'WORK') { $hash['workPhone'] = $this->read($item); } elseif (String::upper($tel) == 'HOME') { $hash['homePhone'] = $this->read($item); } elseif (String::upper($tel) == 'CELL') { $hash['cellPhone'] = $this->read($item); } elseif (String::upper($tel) == 'FAX') { $hash['fax'] = $this->read($item); } } } break; case 'EMAIL': if (isset($item['params']['PREF']) || !isset($hash['email'])) { $hash['email'] = $this->getBareEmail($this->read($item)); } break; case 'TITLE': $hash['title'] = $this->read($item); break; case 'ORG': $units = array(); for ($i = 0; $i < count($item['values']); $i++) { $units[] = $this->read($item, $i); } $hash['company'] = implode(', ', $units); break; case 'NOTE': $hash['notes'] = $this->read($item); break; case 'URL': $hash['website'] = $this->read($item); break; } } return $hash; } /** * Return an array of vCard properties -> values from a hash of * attributes. * * @param array $hash The hash of values to convert. * * @return array The vCard format data. * * @since Horde 3.0 */ function fromHash($hash) { $card = array(); foreach ($hash as $key => $val) { switch ($key) { case 'name': $card['FN'] = $val; break; case 'nickname': $card['NICKNAME'] = $val; break; case 'homePhone': $card['TEL;TYPE=HOME'] = $val; break; case 'workPhone': $card['TEL;TYPE=WORK'] = $val; break; case 'cellPhone': $card['TEL;TYPE=CELL'] = $val; break; case 'fax': $card['TEL;TYPE=FAX'] = $val; break; case 'email': $card['EMAIL'] = $this->getBareEmail($val); break; case 'title': $card['TITLE'] = $val; break; case 'company': $card['ORG'] = $val; break; case 'notes': $card['NOTE'] = $val; break; case 'website': $card['URL'] = $val; break; } } $card['N'] = implode(';', array( VCARD_N_FAMILY => isset($hash['lastname']) ? $hash['lastname'] : '', VCARD_N_GIVEN => isset($hash['firstname']) ? $hash['firstname'] : '', VCARD_N_ADDL => '', VCARD_N_PREFIX => '', VCARD_N_SUFFIX => '', )); $card['ADR;TYPE=HOME'] = implode(';', array( VCARD_ADR_POB => '', VCARD_ADR_EXTEND => '', VCARD_ADR_STREET => isset($hash['homeAddress']) ? $hash['homeAddress'] : '', VCARD_ADR_LOCALITY => isset($hash['homeCity']) ? $hash['homeCity'] : '', VCARD_ADR_REGION => isset($hash['homeProvince']) ? $hash['homeProvince'] : '', VCARD_ADR_POSTCODE => isset($hash['homePostalCode']) ? $hash['homePostalCode'] : '', VCARD_ADR_COUNTRY => isset($hash['homeCountry']) ? $hash['homeCountry'] : '', )); $card['ADR;TYPE=WORK'] = implode(';', array( VCARD_ADR_POB => '', VCARD_ADR_EXTEND => '', VCARD_ADR_STREET => isset($hash['workAddress']) ? $hash['workAddress'] : '', VCARD_ADR_LOCALITY => isset($hash['workCity']) ? $hash['workCity'] : '', VCARD_ADR_REGION => isset($hash['workProvince']) ? $hash['workProvince'] : '', VCARD_ADR_POSTCODE => isset($hash['workPostalCode']) ? $hash['workPostalCode'] : '', VCARD_ADR_COUNTRY => isset($hash['workCountry']) ? $hash['workCountry'] : '', )); return $card; } /** * Takes all necessary actions for the given import step, parameters and * form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optional array $param An associative array containing needed * parameters for the current step. * * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { switch ($action) { case IMPORT_FILE: $res = parent::nextStep($action, $param); if (is_a($res, 'PEAR_Error')) { return $res; } $import_data = $this->importFile($_FILES['import_file']['tmp_name']); if (is_a($import_data, 'PEAR_Error')) { return $import_data; } /* Build the result data set as an associative array. */ $data = array(); foreach ($import_data as $object) { if ($object['type'] == 'VCARD') { $data[] = $this->toHash($object); } } return $data; break; default: return parent::nextStep($action, $param); break; } } } --- NEW FILE: vnote.php --- * Copyright 1999-2004 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @package Horde_Data * @since Horde 3.0 */ class Horde_Data_vnote extends Horde_Data_imc { /** * The vNote version. * * @access private * @var string $_version */ var $_version; function importData($text) { $res = parent::importData($text); if (is_a($res, 'PEAR_Error')) { return $res; } return $this->_objects; } /** * Builds a vNote file from a given data structure and returns it * as a string. * * @access public * * @param array $data A two-dimensional array containing the data set. * * @return string The vNote data. */ function exportData($data) { /* According to RFC 2425, we should always use CRLF-terminated * lines. */ $newline = "\r\n"; $file = "BEGIN:VNOTE${newline}VERSION:1.1${newline}"; foreach ($data as $key => $val) { if (!empty($val)) { // Basic encoding. Newlines for now; more work here to // make this RFC-compliant. $file .= $key . ':' . $this->_quoteAndFold($val); } } $file .= "END:VNOTE$newline"; return $file; } /** * Builds a vNote file from a given data structure and triggers * its download. It DOES NOT exit the current script but only * outputs the correct headers and data. * * @access public * * @param string $filename The name of the file to be downloaded. * @param array $data A two-dimensional array containing the data set. */ function exportFile($filename, $data) { $export = $this->exportData($data); $GLOBALS['browser']->downloadHeaders($filename, 'text/plain', false, strlen($export)); echo $export; } /** * Return a data hash from a vNote object. * * @param array $note The note to convert. * * @return array The hashed data. * * @since Horde 3.0 */ function toHash($note) { $this->_version = isset($note['version']) ? $note['version'] : null; $hash = array(); foreach ($note['params'] as $item) { switch ($item['name']) { case 'DCREATED': $hash['created'] = $this->mapDate($this->read($item)); break; case 'LAST-MODIFIED': $hash['modified'] = $this->mapDate($this->read($item)); break; case 'BODY': $hash['body'] = $this->readAll($item); break; } } return $hash; } /** * Turn a hash (of the same format that we output in * Horde_Data_vnote) into an array of vNote data. * * @param array $hash The hash of attributes. * * @return array The array of vNote attributes -> vNote values. * * @since Horde 3.0 */ function fromHash($hash) { $note = array(); foreach ($hash as $key => $val) { switch ($key) { case 'created': $note['DCREATED'] = $this->makeDate((object)$val); break; case 'modified': $note['LAST-MODIFIED'] = $this->makeDate((object)$val); break; case 'body': $note['BODY'] = $val; break; } } return $note; } /** * Takes all necessary actions for the given import step, * parameters and form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optional array $param An associative array containing needed * parameters for the current step. * * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { switch ($action) { case IMPORT_FILE: $res = parent::nextStep($action, $param); if (is_a($res, 'PEAR_Error')) { return $res; } $import_data = $this->importFile($_FILES['import_file']['tmp_name']); if (is_a($import_data, 'PEAR_Error')) { return $import_data; } /* Build the result data set as an associative array. */ $data = array(); foreach ($import_data as $object) { if ($object['type'] == 'VNOTE') { $data[] = $this->toHash($object); } } return $data; break; default: return parent::nextStep($action, $param); break; } } function _build($data, &$i) { $objects = array(); while (isset($data[$i])) { if (String::upper($data[$i]['name']) != 'BEGIN') { return PEAR::raiseError(sprintf(_("Import Error: Expected \"BEGIN\" on line %d."), $i)); } $type = String::upper($data[$i]['values'][0]); $object = array('type' => $type); $object['objects'] = array(); $object['params'] = array(); $i++; while (isset($data[$i]) && String::upper($data[$i]['name']) != 'END') { if (String::upper($data[$i]['name']) == 'BEGIN') { $object['objects'][] = $this->_build($data, $i); } else { $object['params'][] = $data[$i]; if (String::upper($data[$i]['name']) == 'VERSION') { $object['version'] = $data[$i]['values'][0]; } } $i++; } if (!isset($data[$i])) { return PEAR::raiseError(_("Import Error: Unexpected end of file.")); } if (String::upper($data[$i]['values'][0]) != $type) { return PEAR::raiseError(sprintf(_("Import Error: Type mismatch. Expected \"END:%s\" on line %d."), $type, $i)); } $objects[] = $object; $i++; } $this->_objects = $objects; } } --- NEW FILE: vtodo.php --- * Copyright 1999-2004 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @package Horde_Data * @since Horde 3.0 */ class Horde_Data_vtodo extends Horde_Data { function importData($text) { $iCal = &new Horde_iCalendar(); if (!$iCal->parsevCalendar($text)) { return PEAR::raiseError('Error parsing iCalendar text.'); } return $iCal->getComponents(); } /** * Builds a vTodo file from a given data structure and returns it * as a string. * * @access public * * @param array $data A two-dimensional array containing the data set. * * @return string The vTodo data. */ function exportData($data) { $iCal = &new Horde_iCalendar(); foreach ($data as $todo) { $vTodo = Horde_iCalendar::newComponent('vtodo', $iCal); $vTodo->fromArray($todo); $iCal->addComponent($vTodo); } return $iCal->exportvCalendar(); } /** * Builds a vTodo file from a given data structure and triggers * its download. It DOES NOT exit the current script but only * outputs the correct headers and data. * * @access public * * @param string $filename The name of the file to be downloaded. * @param array $data A two-dimensional array containing the data set. */ function exportFile($filename, $data) { $export = $this->exportData($data); $GLOBALS['browser']->downloadHeaders($filename, 'text/calendar', false, strlen($export)); echo $export; } /** * Takes all necessary actions for the given import step, * parameters and form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optional array $param An associative array containing needed * parameters for the current step. * * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { switch ($action) { case IMPORT_FILE: $res = parent::nextStep($action, $param); if (is_a($res, 'PEAR_Error')) { return $res; } $import_data = $this->importFile($_FILES['import_file']['tmp_name']); if (is_a($import_data, 'PEAR_Error')) { return $import_data; } /* Build the result data set as an associative array. */ $data = array(); foreach ($import_data as $vtodo) { if (is_a($vtodo, 'Horde_iCalendar_vtodo')) { $data[] = $vtodo->toArray(); } } return $data; break; default: return parent::nextStep($action, $param); break; } } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:05 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Data Data.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.34A24102C0C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Data Added Files: Data.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Data.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Data */ class Horde_Data extends PEAR { var $_extension; var $_contentType = 'text/plain'; /** * Stub to import passed data. */ function importData() { } /** * Stub to return exported data. */ function exportData() { } /** * Stub to import a file. */ function importFile($filename, $header = false) { $fp = @fopen($filename, 'r'); $data = @fread($fp, @filesize($filename)); @fclose($fp); return $this->importData($data, $header); } /** * Stub to export data to a file. */ function exportFile() { } /** * Tries to determine the expected newline character based on the * platform information passed by the browser's agent header. * * @access public * @return string The guessed expected newline characters, either \n, \r * or \r\n. */ function getNewline() { require_once 'Horde/Browser.php'; $browser = &Browser::singleton(); switch ($browser->getPlatform()) { case 'win': return "\r\n"; case 'mac': return "\r"; case 'unix': default: return "\n"; } } function getFilename($basename) { return $basename . '.' . $this->_extension; } function getContentType() { return $this->_contentType; } /** * Attempts to return a concrete Data instance based on $format. * * @param mixed $format The type of concrete Data subclass to return. * This is based on the storage driver ($format). The * code is dynamically included. If $format is an array, * then we will look in $format[0]/lib/Data/ for the subclass * implementation named $format[1].php. * * @return object Data The newly created concrete Data instance, or false * on an error. */ function &factory($format) { if (is_array($format)) { $app = $format[0]; $format = $format[1]; } $format = basename($format); if (empty($format) || (strcmp($format, 'none') == 0)) { return $ret = &new Horde_Data(); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Data/' . $format . '.php'; } else { require_once 'Horde/Data/' . $format . '.php'; } $class = 'Horde_Data_' . $format; if (class_exists($class)) { return $ret = &new $class(); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Data instance * based on $format. It will only create a new instance if no Data * instance with the same parameters currently exists. * * This should be used if multiple data sources (and, * thus, multiple Data instances) are required. * * This method must be invoked as: $var = &Data::singleton() * * @param string $format The type of concrete Data subclass to return. * This is based on the storage driver ($format). The * code is dynamically included. * * @return object Data The concrete Data reference, or false on an error. */ function &singleton($format) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize($format); if (!isset($instances[$signature])) { $instances[$signature] = &Horde_Data::factory($format); } return $instances[$signature]; } /** * Maps a date/time string to an associative array. * * @access private * @param string $date The date. * @param string $type One of 'date', 'time' or 'datetime'. * @param string $delimiter The character that seperates the different * date/time parts. * @param optional string $format If 'ampm' and $date contains a time we * assume that it is in AM/PM format. * @return string The date or time in ISO format. */ function mapDate($date, $type, $delimiter, $format = null) { switch ($type) { case 'date': $dates = explode($delimiter, $date); if (count($dates) != 3) { return $date; } $index = array_flip(explode('/', $format)); return $dates[$index['year']] . '-' . $dates[$index['month']] . '-' . $dates[$index['mday']]; case 'time': $dates = explode($delimiter, $date); if (count($dates) < 2 || count($dates) > 3) { return $date; } if ($format == 'ampm') { if (strpos(strtolower($dates[count($dates)-1]), 'pm') !== false) { if ($dates[0] !== '12') { $dates[0] += 12; } } elseif ($dates[0] == '12') { $dates[0] = '0'; } $dates[count($dates)-1] = (int) $dates[count($dates)-1]; } return $dates[0] . ':' . $dates[1] . (count($dates) == 3 ? (':' . $dates[2]) : ':00'); case 'datetime': return ''; } } /** * Takes all necessary actions for the given import step, parameters and * form values and returns the next necessary step. * * @access public * * @param integer $action The current step. One of the IMPORT_* * constants. * @param optional array $param An associative array containing needed * parameters for the current step. * * @return mixed Either the next step as an integer constant or imported * data set after the final step. */ function nextStep($action, $param = array()) { /* First step. */ if (is_null($action)) { $_SESSION['import_data'] = array(); return IMPORT_FILE; } switch ($action) { case IMPORT_FILE: /* Sanitize uploaded file. */ $import_format = Util::getFormData('import_format'); $check_upload = Browser::wasFileUploaded('import_file', $param['file_types'][$import_format]); if (is_a($check_upload, 'PEAR_Error')) { return $check_upload; } if ($_FILES['import_file']['size'] <= 0) { return PEAR::raiseError(_("The file contained no data.")); } $_SESSION['import_data']['format'] = $import_format; break; case IMPORT_MAPPED: $dataKeys = Util::getFormData('dataKeys', ''); $appKeys = Util::getFormData('appKeys', ''); if (empty($dataKeys) || empty($appKeys)) { global $registry; return PEAR::raiseError(sprintf(_("You didn't map any fields from the imported file to the corresponding fields in %s."), $registry->getParam('name'))); } $dataKeys = explode("\t", $dataKeys); $appKeys = explode("\t", $appKeys); $map = array(); $dates = array(); foreach ($appKeys as $key => $app) { $map[$dataKeys[$key]] = $app; if (array_key_exists('time_fields', $param) && array_key_exists($app, $param['time_fields'])) { $dates[$dataKeys[$key]]['type'] = $param['time_fields'][$app]; $dates[$dataKeys[$key]]['values'] = array(); $i = 0; /* Build an example array of up to 10 date/time fields. */ while ($i < count($_SESSION['import_data']['data']) && count($dates[$dataKeys[$key]]['values']) < 10) { if (!empty($_SESSION['import_data']['data'][$i][$dataKeys[$key]])) { $dates[$dataKeys[$key]]['values'][] = $_SESSION['import_data']['data'][$i][$dataKeys[$key]]; } $i++; } } } $_SESSION['import_data']['map'] = $map; if (count($dates) > 0) { $_SESSION['import_data']['dates'] = $dates; return IMPORT_DATETIME; } return $this->nextStep(IMPORT_DATA, $param); case IMPORT_DATETIME: case IMPORT_DATA: if ($action == IMPORT_DATETIME) { $delimiter = Util::getFormData('delimiter'); $format = Util::getFormData('format'); } if (!array_key_exists('data', $_SESSION['import_data'])) { return PEAR::raiseError(_("The uploaded data was lost since the previous step.")); } /* Build the result data set as an associative array. */ $data = array(); foreach ($_SESSION['import_data']['data'] as $row) { $data_row = array(); foreach ($row as $key => $val) { if (array_key_exists($key, $_SESSION['import_data']['map'])) { $mapped_key = $_SESSION['import_data']['map'][$key]; if ($action == IMPORT_DATETIME && !empty($val) && array_key_exists('time_fields', $param) && array_key_exists($mapped_key, $param['time_fields'])) { $val = $this->mapDate($val, $param['time_fields'][$mapped_key], $delimiter[$key], $format[$key]); } $data_row[$_SESSION['import_data']['map'][$key]] = $val; } } $data[] = $data_row; } return $data; } } /** * Cleans the session data up and removes any uploaded and moved * files. If a function called "_cleanup()" exists, this gets * called too. * * @return mixed If _cleanup() was called, the return value of this call. * This should be the value of the first import step. */ function cleanup() { if (array_key_exists('file_name', $_SESSION['import_data'])) { @unlink($_SESSION['import_data']['file_name']); } $_SESSION['import_data'] = array(); if (function_exists('_cleanup')) { return _cleanup(); } } } --- NEW FILE: package.xml --- Horde_Data Horde Data API This package provides a data import and export API, with backends for: * CSV * TSV * iCalendar * vCard * vNote * vTodo LGPL jan lead Jan Schneider jan@horde.org chuck developer Chuck Hagenbuch chuck@horde.org 0.0.2 beta 2004-04-21 Bugfixes, much better vCard support gettext Horde_iCalendar Horde_MIME Horde_Util 0.0.2 2004-04-21 beta Bugfixes, much better vCard support 0.0.1 2003-07-03 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:06 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Data/tests csv_importFile_01.phpt, NONE, 1.1 simple_dos.csv, NONE, 1.1 simple_unix.csv, NONE, 1.1 Message-ID: <20051014143306.474DF102C10@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Data/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Data/tests Added Files: csv_importFile_01.phpt simple_dos.csv simple_unix.csv Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: csv_importFile_01.phpt --- --TEST-- Simple CSV files --FILE-- importFile(dirname(__FILE__) . '/simple_dos.csv', false, '', '', 4)); var_dump($vcs->importFile(dirname(__FILE__) . '/simple_unix.csv', false, '', '', 4)); var_dump($vcs->importFile(dirname(__FILE__) . '/simple_dos.csv', true, '', '', 4)); var_dump($vcs->importFile(dirname(__FILE__) . '/simple_unix.csv', true, '', '', 4)); ?> --EXPECT-- array(2) { [0]=> array(4) { [0]=> string(3) "one" [1]=> string(3) "two" [2]=> string(10) "three four" [3]=> string(6) "five " } [1]=> array(4) { [0]=> string(3) "six" [1]=> string(5) "seven" [2]=> string(10) "eight nine" [3]=> string(6) " ten " } } array(2) { [0]=> array(4) { [0]=> string(3) "one" [1]=> string(3) "two" [2]=> string(10) "three four" [3]=> string(5) "five " } [1]=> array(4) { [0]=> string(3) "six" [1]=> string(5) "seven" [2]=> string(10) "eight nine" [3]=> string(5) " ten " } } array(1) { [0]=> array(4) { ["one"]=> string(3) "six" ["two"]=> string(5) "seven" ["three four"]=> string(10) "eight nine" ["five "]=> string(6) " ten " } } array(1) { [0]=> array(4) { ["one"]=> string(3) "six" ["two"]=> string(5) "seven" ["three four"]=> string(10) "eight nine" ["five "]=> string(5) " ten " } } --- NEW FILE: simple_dos.csv --- one,two,three four,five six,seven,eight nine, ten --- NEW FILE: simple_unix.csv --- one,two,three four,five six,seven,eight nine, ten From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:07 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Crypt/Crypt pgp.php, NONE, 1.1 smime.php, NONE, 1.1 Message-ID: <20051014143306.49992102C13@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Crypt/Crypt In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Crypt/Crypt Added Files: pgp.php smime.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: pgp.php --- output = @fread($fp, filesize($output_file)); @fclose($fp); unlink($output_file); if ($stderr) { $fp = @fopen($stderr_file, 'r'); $data->stderr = @fread($fp, filesize($stderr_file)); @fclose($fp); unlink($stderr_file); } } return $data; } } --- NEW FILE: smime.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Crypt [...1188 lines suppressed...] { return PEAR::raiseError('_decryptSignature() ' . _("not yet implemented")); } /** * Check for the presence of the OpenSSL extension to PHP. * * @access public * * @return boolean Returns true if the openssl extension is available. * Returns a PEAR_Error if not. */ function checkForOpenSSL() { if (!Util::extensionExists('openssl')) { return PEAR::raiseError(_("The openssl module is required for the Horde_Crypt_smime:: class.")); } } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:09 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/DataTree DataTree.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.51281102C16@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/DataTree In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/DataTree Added Files: DataTree.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: DataTree.php --- data[$attribute]) ? $this->data[$attribute] : null; } /** * Set one of the attributes of the object. * * @param string $attribute The attribute to set. * @param mixed $value The value for $attribute. */ function set($attribute, $value) { $this->data[$attribute] = $value; } } --- NEW FILE: package.xml --- Horde_DataTree DataTree API TODO LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-02-11 Initial packaging. gettext Horde_Framework Horde_Serialize Horde_SQL Horde_Util From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/DataTree/DataTree null.php, NONE, 1.1 sql.php, NONE, 1.1 Message-ID: <20051014143306.5F606102C25@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/DataTree/DataTree In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/DataTree/DataTree Added Files: null.php sql.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: null.php --- * Copyright 2001, 2002 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_DataTree */ class DataTree_null extends DataTree { /** * Cache of attributes for any objects created during this page * request. * @var array $_attributeCache */ var $_attributeCache = array(); /** * Cache of data for any objects created during this page * request. * @var array $_dataCache */ var $_dataCache = array(); /** * Load (a subset of) the datatree into the $_data * array. Part of the DataTree API that must be overridden by * subclasses. * * @param optional string $root Which portion of the * tree to load. Defaults to all of it. * @param optional boolean $reload Re-load already loaded values? * * @return mixed True on success or a PEAR_Error on failure. * * @access private */ function _load($root = null, $reload = false) { } /** * Load a specific object identified by its unique ID ($id), and * its parents, into the $_data array. * * @param integer $cid The unique ID of the object to load. * * @return mixed True on success or a PEAR_Error on failure. * * @access private */ function _loadById($cid) { } /** * Add an object. Part of the DataTree API that must be * overridden by subclasses. * * @param mixed $fullname The object to add (string or DataTreeObject). */ function add($object) { if (is_a($object, 'DataTreeObject')) { $fullname = $object->getName(); $order = $object->order; } else { $fullname = $object; $order = null; } $id = md5(mt_rand()); if (strstr($fullname, ':')) { $parts = explode(':', $fullname); $name = array_pop($parts); $parent = implode(':', $parts); $pid = $this->getId($parent); if (is_a($pid, 'PEAR_Error')) { $this->add($parent); } } else { $pid = '-1'; } if (parent::exists($fullname)) { return PEAR::raiseError('Already exists'); } $added = parent::_add($fullname, $id, $pid, $order); if (is_a($added, 'PEAR_Error')) { return $added; } return $this->updateData($object); } function getData($cid) { return isset($this->_dataCache[$cid]) ? $this->_dataCache[$cid] : array(); } /** * Retrieve data for an object. * * @param integer $cid The object id to fetch. */ function getAttributes($cid) { if (is_array($cid)) { $data = array(); foreach ($cid as $id) { if (isset($this->_attributeCache[$id])) { $data[$id] = $this->_attributeCache[$id]; } } return $data; } else { return isset($this->_attributeCache[$cid]) ? $this->_attributeCache[$cid] : array(); } } /** * Return a set of object ids based on a set of attribute * criteria. * * @param array $criteria The array of criteria. */ function getByAttributes($criteria) { if (!count($criteria)) { return array(); } return array_keys($this->_attributeCache); } /** * Update the data in an object. Does not change the object's * parent or name, just serialized data. * * @param string $object The object. */ function updateData($object) { if (!is_a($object, 'DataTreeObject')) { return true; } $cid = $this->getId($object->getName()); if (is_a($cid, 'PEAR_Error')) { return $cid; } // We handle data differently if we can map it to // attributes. if (method_exists($object, '_toAttributes')) { $this->_attributeCache[$cid] = $object->_toAttributes(); } else { $this->_dataCache[$cid] = $object->getData(); } return true; } /** * Change order of the children of an object. * * @param string $parents The parent id string path. * @param mixed $order A specific new order position or an * array containing the new positions * for the given $parents object. * @param int $cid If provided indicates insertion of * a new child to the object, and * will be used to avoid incrementing * it when shifting up all other * children's order. If not provided * indicates deletion, hence shift all * other positions down one. */ function reorder($parents, $order = null, $cid = null) { if (is_array($order) && !empty($order)) { // Multi update. $this->_reorder($pid, $order); } } } --- NEW FILE: sql.php --- _db = &DB::connect($this->_params, array('persistent' => !empty($this->_params['persistent']))); if (is_a($this->_db, 'PEAR_Error')) { Horde::fatal($this->_db, __FILE__, __LINE__); } /* Enable the "portability" option. */ $this->_db->setOption('optimize', 'portability'); $this->_connected = true; } return true; } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:12 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Editor/Editor htmlarea.php, NONE, 1.1 Message-ID: <20051014143306.8AE7F102C2B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Editor/Editor In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Editor/Editor Added Files: htmlarea.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: htmlarea.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Nuno Loureiro * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Editor */ class Horde_Editor_htmlarea extends Horde_Editor { /** * Constructor. * Include the necessary javascript files. */ function Horde_Editor_htmlarea($params = array()) { global $registry, $notification; Horde::addScriptFile('htmlarea.js', 'horde'); Horde::addScriptFile('/services/editor/htmlarea/htmlarea.js', 'horde', true); Horde::addScriptFile('htmlarea_lang.js', 'horde'); if (isset($params['id'])) { $js = 'HTMLArea.replace("' . $params['id'] . '");'; } else { $js = 'HTMLArea.replaceAll();'; } $notification->push($js, 'javascript'); } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:14 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/File_PDF PDF.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.8CB79102C2D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/File_PDF Added Files: PDF.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: PDF.php --- * Copyright 2003-2004 Marko Djukic * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/File_PDF/PDF.php,v 1.17 2004/05/20 07:43:42 mdjukic Exp $ * * @author Olivier Plathey * @author Marko Djukic [...2785 lines suppressed...] } function _putStream($s) { $this->_out('stream'); $this->_out($s); $this->_out('endstream'); } function _out($s) { /* Add a line to the document. */ if ($this->_state == 2) { $this->_pages[$this->_page] .= $s . "\n"; } else { $this->_buffer .= $s . "\n"; } } } --- NEW FILE: package.xml --- File_PDF PDF generation using only PHP. This package provides PDF generation using only PHP, without requiring any external libraries. LGPL mdjukic lead Marko Djukic mdjukic@horde.org 0.0.1 beta 2003-11-01 Initial release as a PEAR package HTTP_Download 0.0.1 beta 2003-11-01 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:17 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Form/Form Action.php, NONE, 1.1 Renderer.php, NONE, 1.1 Message-ID: <20051014143306.9993C102C38@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form/Form In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Form/Form Added Files: Action.php Renderer.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Action.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @package Horde_Form */ class Horde_Form_Action { var $_id; var $_params; var $_trigger = null; function Horde_Form_Action($params = null) { $this->_params = $params; $this->_id = md5(mt_rand()); } function getTrigger() { return $this->_trigger; } function id() { return $this->_id; } function getActionScript($form, $renderer, $varname) { return ''; } function printJavaScript() { } function _printJavaScriptStart() { echo ''; } function getTarget() { return isset($this->_params['target']) ? $this->_params['target'] : null; } function setValues(&$vars, $sourceVal, $index = null, $arrayVal = false) { } /** * Attempts to return a concrete Horde_Form_Action instance * based on $form. * * @param mixed $form The type of concrete Horde_Form_Action subclass to return. * The code is dynamically included. If $form is an array, * then we will look in $form[0]/lib/Form/Action/ for * the subclass implementation named $form[1].php. * @param array $params (optional) A hash containing any additional * configuration a form might need. * * @return object Horde_Form_Action The concrete Horde_Form_Action reference, * or false on an error. */ function &factory($action, $params = null) { if (is_array($action)) { $app = $action[0]; $action = $action[1]; } $action = basename($action); if (empty($action) || (strcmp($action, 'none') == 0)) { return PEAR::raiseError('Cannot instantiate abstract class Horde_Form_Action.'); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Form/Action/' . $action . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Action/' . $action . '.php')) { require_once dirname(__FILE__) . '/Action/' . $action . '.php'; } else { @require_once 'Horde/Form/Action/' . $action . '.php'; } $class = 'Horde_Form_Action_' . $action; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete * Horde_Form_Action instance based on $action. It will only * create a new instance if no Horde_Form_Action instance with * the same parameters currently exists. * * This should be used if multiple types of form renderers (and, * thus, multiple Horde_Form_Action instances) are required. * * This method must be invoked as: $var = * &Horde_Form_Action::singleton() * * @param mixed $action The type of concrete Horde_Form_Action subclass to return. * The code is dynamically included. If $action is an array, * then we will look in $action[0]/lib/Form/Action/ for * the subclass implementation named $action[1].php. * @param array $params (optional) A hash containing any additional * configuration a form might need. * * @return object Horde_Form_Action The concrete Horde_Form_Action reference, * or false on an error. */ function &singleton($action, $params = null) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($action, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Horde_Form_Action::factory($action, $params); } return $instances[$signature]; } } --- NEW FILE: Renderer.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Robert E. Coyle * @version $Revision: 1.1 $ * @package Horde_Form */ class Horde_Form_Renderer { var $_name; var $_requiredLegend = false; var $_requiredMarker = '*'; var $_onLoadJS = array(); var $_showHeader = true; var $_cols = 2; var $_varRenderer = null; /** * Width of the attributes column. * * @access private * @var string $_attrColumnWidth */ var $_attrColumnWidth = '15%'; /** * Construct a new Horde_Form_Renderer::. * * @param optional array $params This is a hash of renderer-specific * parameters. We currently only accept * the 'varrenderer_driver' key, which * specifies the driver parameter to * Horde_UI_VarRenderer::factory(). */ function Horde_Form_Renderer($params = array()) { $this->_requiredMarker = Horde::img('required.gif', '*', '', $GLOBALS['registry']->getParam('graphics', 'horde')); $driver = 'html'; if (isset($params['varrenderer_driver'])) { $driver = $params['varrenderer_driver']; } require_once 'Horde/UI/VarRenderer.php'; $this->_varRenderer = &Horde_UI_VarRenderer::factory($driver, $params); } function showHeader($bool) { $this->_showHeader = $bool; } /** * Specify the width of the attribute column in the rendered form. * * @param string $width The width of the attribute column. * * @return void */ function setAttrColumnWidth($width) { $this->_attrColumnWidth = $width; } function open($action, $method, $name, $enctype = null) { $this->_name = $name; echo "
\n"; Util::pformInput(); } function beginActive($name) { $this->_renderBeginActive($name); } function beginInactive($name) { $this->_renderBeginInactive($name); } function _renderSectionTabs(&$form) { /* If javascript is not available, do not render tabs. */ if (!$GLOBALS['browser']->hasFeature('javascript')) { return; } $open_section = $form->getOpenSection(); /* Add the javascript for the toggling the sections. */ Horde::addScriptFile('form_sections.js', 'horde'); $js = ''; echo $js; /* Print out the tabs for all the sections. */ printf(' ', $this->_cols); echo ''; $tabs_in_row = 0; /* Loop through the sections and print out a tab for each. */ foreach ($form->_sections as $section => $val) { $class = ($section == $open_section) ? 'tab-hi' : 'tab'; $js = sprintf('onclick="sections_%s.toggle(\'%s\'); return false;"', $form->getName(), $section); printf('', $js, $form->getSectionDesc($section)); $tabs_in_row++; if ($tabs_in_row > 5) { echo '
 %s  
'; $tabs_in_row = 0; } } echo '
 
'; } function _renderSectionBegin(&$form, $section) { static $first_section = ''; if (empty($first_section)) { /* If this is the first section being rendered, set it as * open and and render the section tabs. */ $first_section = $section; $form->setOpenSection($section); $this->_renderSectionTabs($form); } $open_section = $form->getOpenSection(); printf('
', '_section_' . $section, ($open_section == $section ? 'block' : 'none')); } function _renderSectionEnd() { echo '
'; } function end() { $this->_renderEnd(); } function close() { echo "\n"; } function listFormVars(&$form) { $variables = &$form->getVariables(true, true); $vars = array(); if ($variables) { foreach ($variables as $var) { if (is_object($var)) { $vars[$var->getVarName()] = 1; } else { $vars[$var] = 1; } } } echo ''; } function renderFormActive(&$form, &$vars) { $this->_renderForm($form, $vars, true); } function renderFormInactive(&$form, &$vars) { $this->_renderForm($form, $vars, false); } function _renderForm(&$form, &$vars, $active) { /* If help is present 3 columns are needed. */ $this->_cols = $form->hasHelp() ? 3 : 2; $variables = &$form->getVariables(false); /* Check for a form token error. */ if (($tokenError = $form->getError('__formToken')) !== null) { ?> $section) { if ($section_id != '__base') { $this->_renderSectionBegin($form, $section_id); } foreach ($section as $var) { $type = $var->getTypeName(); switch ($type) { case 'header': $this->_renderHeader($var->getHumanName(), $form->getError($var->getVarName())); break; case 'description': $this->_renderDescription($var->getHumanName()); break; case 'spacer': $this->_renderSpacer(); break; default: $isInput = ($active && !$var->isReadonly()); $format = $isInput ? 'Input' : 'Display'; $begin = "_renderVar${format}Begin"; $end = "_renderVar${format}End"; $this->$begin($form, $var, $vars); echo $this->_varRenderer->render($form, $var, $vars, $isInput); $this->$end($form, $var, $vars); /* Print any javascript if actions present. */ if ($var->hasAction()) { $var->_action->printJavaScript(); } } } if ($section_id != '__base') { $this->_renderSectionEnd(); } } } function submit($submit = null, $reset = false) { if (is_null($submit) || empty($submit)) { $submit = _("Submit"); } if ($reset === true) { $reset = _("Reset"); } $this->_renderSubmit($submit, $reset); } /* Implementation specifics -- begin / end functions. */ function _renderBeginActive($name) { if ($this->_showHeader) { $this->_sectionHeader($name); } ?>
_requiredLegend): ?>_showHeader) { $this->_sectionHeader($name); } ?>
_requiredMarker ?> = Required Field
_varRenderer->renderEnd(); } function _renderHeader($header, $error = '') { ?>
  getError($var); $isvalid = empty($message); $class = $this->getRowClass(); echo ''; printf(' %s%s%s%s', empty($this->_attrColumnWidth) ? '' : ' width="' . $this->_attrColumnWidth . '"', $class, $isvalid ? '' : '', $var->isRequired() ? '' . $this->_requiredMarker . ' ' : '', $var->getHumanName(), $isvalid ? '' : '
' . $message . '
'); printf(' ', ((!$var->hasHelp() && $form->hasHelp()) ? ' colspan="2"' : ''), $class); } function _renderVarInputEnd(&$form, &$var, &$vars) { /* Display any description for the field. */ if ($var->hasDescription()) { echo '
' . $var->getDescription(); } /* Display any help for the field. */ if ($var->hasHelp()) { $class = $this->getRowClass(false); echo '' . Help::link($GLOBALS['registry']->getApp(), $var->getHelp()) . ' '; } ?> getRowClass(); ?> _attrColumnWidth)) echo ' width="' . $this->_attrColumnWidth . '"' ?> align="right" class="">getHumanName() ?>
getParam('fileroot', $app) . '/lib/Form/Renderer/' . $renderer . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Renderer/' . $renderer . '.php')) { include_once dirname(__FILE__) . '/Renderer/' . $renderer . '.php'; } else { @include_once 'Horde/Form/Renderer/' . $renderer . '.php'; } $class = 'Horde_Form_Renderer_' . $renderer; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Horde_Form_Renderer * instance based on $renderer. It will only create a new instance if no * Horde_Form_Renderer instance with the same parameters currently exists. * * This should be used if multiple types of form renderers (and, * thus, multiple Horde_Form_Renderer instances) are required. * * This method must be invoked as: $var = &Horde_Form_Renderer::singleton() * * @param mixed $renderer The type of concrete Horde_Form_Renderer * subclass to return. The code is * dynamically included. If $renderer is an * array, then we will look in * $renderer[0]/lib/Form/Renderer/ for the * subclass implementation named * $renderer[1].php. * @param optional array $params A hash containing any additional * configuration a form might need. * * @return object Horde_Form_Renderer The concrete Horde_Form_Renderer * reference, or false on an error. */ function &singleton($renderer, $params = null) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($renderer, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Horde_Form_Renderer::factory($renderer, $params); } return $instances[$signature]; } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:19 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Form Form.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.93B63102C37@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Form Added Files: Form.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Form.php --- * Copyright 2001-2004 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Robert E. Coyle * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Form [...2925 lines suppressed...] $value = $this->getDefault(); } if ($this->_arrayVal && !is_null($index)) { if (!$wasset && !is_array($value)) { $return = $value; } else { $return = isset($value[$index]) ? $value[$index] : null; } } else { $return = $value; } if ($this->hasAction()) { $this->_action->setValues($vars, $return, $this->_arrayVal); } return $return; } } --- NEW FILE: package.xml --- Horde_Form Horde Form API The Horde_Form:: package provides form rendering, validation, and other functionality for the Horde Application Framework. LGPL chuck lead Chuck Hagenbuch chuck@horde.org robertecoyle developer Robert E. Coyle robertecoyle@hotmail.com mdjukic developer Marko Djukic marko@oblo.com 0.0.1 alpha 2003-07-03 Initial Release. gettext Horde_Framework Horde_Server Horde_Token Horde_Util 0.0.1 alpha 2003-07-03 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:20 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph Graph.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.A503A102C3B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Graph Added Files: Graph.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Graph.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph { /** * The Horde_Image instance that we are drawing the graph to. * @protected * @var object Horde_Image $img */ var $img; var $_graphs = array(); var $_height; var $_width; var $_title = ''; var $_background = 'lightgray'; var $_titleFont = 'sans-serif'; var $_labelFont = 'sans-serif'; var $_axisFont = 'monospace'; var $_paddingLeft = 60; var $_paddingBottom = 40; var $_paddingTop = 30; var $_paddingRight = 20; var $_offsetGridX = 0; var $_imgType = 'gd'; var $_data = array('x' => array(), 'y' => array()); var $_tmpdir; var $_plots = array(); var $_charts = array(); function Horde_Graph($params) { if (!empty($params['temp'])) { $this->_tmpdir = $params['temp']; } if (!empty($params['width'])) { $this->_width = $params['width']; $this->_height = $params['height']; } if (!empty($params['imgType'])) { $this->_imgType = $params['imgType']; } } function &addPlot($plotType, $plotParams) { if (count($this->_charts)) { return PEAR::raiseError('Mixing of Charts and Plots is not allowed.'); } $plotType = basename($plotType); @include_once dirname(__FILE__) . '/Graph/Plot/' . $plotType . '.php'; $class = 'Horde_Graph_Plot_' . $plotType; if (class_exists($class)) { $plot = &new $class($this, $plotParams); $this->_plots[] = &$plot; return $plot; } else { return PEAR::raiseError('Plot type not found'); } } function &addChart($chartType, $chartParams) { if (count($this->_plots)) { return PEAR::raiseError('Mixing of Charts and Plots is not allowed.'); } $chartType = basename($chartType); @include_once dirname(__FILE__) . '/Graph/Chart/' . $chartType . '.php'; $class = 'Horde_Graph_Chart_' . $chartType; if (class_exists($class)) { $chart = &new $class($this, $chartParams); $this->_charts[] = &$chart; return $chart; } else { return PEAR::raiseError('Chart type not found'); } } function addXData($data) { $this->_data['x'] = $data; } function addYData($data, $name = '') { if (empty($name)) { $name = md5(serialize($data)); } $this->_data['y'][$name] = $data; return $name; } function set($param, $value) { $key = '_' . $param; $this->$key = $value; } /** * Cache the image and return a link to view it out of the cache. */ function display() { global $conf, $registry; require_once 'Horde/Cache.php'; $cache = &Horde_Cache::singleton($conf['cache']['driver'], Horde::getDriverConfig('cache', $conf['cache']['driver'])); $this->initialize(); $cid = md5(serialize($this)); Horde_Cache::setCacheObject($this, 'getCacheable'); $cache->getData($cid, 'Horde_Cache::getCacheObject()', $conf['cache']['default_lifetime']); $url = Horde::url($registry->getParam('webroot', 'horde') . '/services/cacheview.php'); $url = Util::addParameter($url, 'cid', $cid); return $this->img->getLink($url, $this->_title); } /** * Return an array containing all information necessary to * retrieve the image, including the data and content-type. * * @return array */ function getCacheable() { return serialize(array('data' => $this->draw(false), 'ctype' => $this->img->getContentType())); } /** * Process all of the data sets and set graph properties. */ function initialize() { // Load a Horde_Image to draw on. require_once 'Horde/Image.php'; $this->img = &Horde_Image::factory($this->_imgType, array('height' => $this->_height, 'width' => $this->_width, 'temp' => $this->_tmpdir)); // Total image and graph area dimensions. $width = $this->_width - 1; $height = $this->_height - 1; $this->_graphTop = $this->_paddingTop; $this->_graphBottom = $this->_height - 1 - ($this->_paddingTop + $this->_paddingBottom); $this->_graphLeft = $this->_paddingLeft; $this->_graphRight = $this->_width - $this->_paddingRight - 1; $this->_graphHeight = $this->_graphBottom - $this->_graphTop; $this->_graphWidth = $this->_graphRight - $this->_graphLeft; $this->_gridX = min(count($this->_data['x']), round($this->_graphWidth / 40)); if (!$this->_gridX) { require_once 'PEAR.php'; return PEAR::raiseError('No data.'); } // Find the range of all y values. $ydata = array(); $this->_gridY = 0; foreach ($this->_data['y'] as $data) { $this->_gridY = max($this->_gridY, count($data)); $ydata = array_merge($ydata, $data); } // Calculate the number of Y gridlines (and thus, labels) to // show. Try to make sure we don't end up with too dense a // grid, but also make sure that we have a few grid lines to // break up small datasets. $this->_gridY = max(min($this->_gridY, floor($this->_graphHeight / 30)), floor($this->_graphHeight / 60)); $this->_maxX = count($this->_data['x']); list($this->_minY, $this->_maxY) = $this->_findRange($ydata); $this->_diffY = $this->_maxY - $this->_minY; if (($this->_maxY - $this->_minY) == 0) { require_once 'PEAR.php'; return PEAR::raiseError('No range to graph. Check data.'); } // Format text for labeling the Y axis. $deltaLabelsY = ($this->_maxY - $this->_minY) / ($this->_gridY); for ($i = 0; $i <= $this->_gridY; $i++) { $text = $this->_minY + ($deltaLabelsY * $i); $this->_labelsY[$i] = number_format($text, 2); } if (empty($this->_labelsY)) { require_once 'PEAR.php'; return PEAR::raiseError('No Y axis data.'); } // Calculate the spacing for ticks and grid lines. $denominator = $this->_maxX - 1 + (2 * $this->_offsetGridX); if ($denominator == 0) { $denominator = 1; } $this->_factorX = $this->_graphWidth / $denominator; $this->_factorY = $this->_graphHeight / $this->_maxY; $denominator = $this->_gridX - 1 + 2 * $this->_offsetGridX; if ($denominator == 0) { $denominator = 1; } $this->_deltaTicksX = ($this->_graphWidth / $denominator) / $this->_factorX; $this->_deltaTicksY = ($this->_graphHeight / $this->_gridY) / $this->_factorY; return true; } function draw($display = true) { $result = $this->initialize(); if (is_a($result, 'PEAR_Error')) { return $result; } $plots = count($this->_plots); $charts = count($this->_charts); if ($plots) { $this->drawBackground(); $this->drawTitle(); $this->drawGridX(); $this->drawGridY(); $this->drawPlotBox(); $this->drawLabelsX(); $this->drawLabelsY(); for ($i = 0; $i < $plots; $i++) { $this->_plots[$i]->draw(); } } elseif ($charts) { $this->drawTitle(); for ($i = 0; $i < $charts; $i++) { $this->_charts[$i]->draw(); } } return $display ? $this->img->display() : $this->img->raw(); } function drawBackground() { $this->img->rectangle(0, 0, $this->_width - 1, $this->_height - 1, 'black', $this->_background); $this->img->rectangle($this->_graphLeft, $this->_graphTop, $this->_graphWidth, $this->_graphHeight, 'black', 'white'); } /** * Draw a box around the plot area. */ function drawPlotBox() { $this->img->rectangle($this->_graphLeft, $this->_graphTop, $this->_graphWidth, $this->_graphHeight, 'black'); } /** * Draws grid lines from top to bottom on the image. */ function drawGridX() { for ($i = 0; $i < $this->_gridX; $i++) { $x = $this->translateX($this->_deltaTicksX * $i); $this->img->dashedLine($x, $this->_graphTop, $x, $this->_graphBottom, 'gray'); } } /** * Draws grid lines from left to right on the image. */ function drawGridY() { for ($i = 0; $i < $this->_gridY; $i++) { $y = $this->translateY($this->_deltaTicksY * $i); $this->img->dashedLine($this->_graphLeft, $y, $this->_graphRight, $y, 'gray'); } } /** * Draw the title. */ function drawTitle() { if (!empty($this->_title)) { $this->img->text($this->_title, $this->_graphLeft + ($this->_graphWidth / 2) - ((strlen($this->_title) / 2) * 7), $this->_graphTop - 20, $this->_titleFont); } } /** * Draws the axis tag text outside the plotting area on the x * axis. */ function drawLabelsX() { // Draw X axis label. if (!empty($this->_xlabel)) { $x = $this->_graphLeft + ($this->_graphWidth / 2) - (strlen($this->_xlabel) * 3); $y = $this->_graphBottom + 50; $this->img->text($this->_xlabel, $x, $y, $this->_labelFont); } $lastX = 0; $minDiff = 20; foreach ($this->_data['x'] as $i => $text) { $x = $this->translateX($i); if ($x - $lastX >= $minDiff) { $lastX = $x; $this->img->text($text, $x - 5, $this->_graphBottom + (strlen($text) * 7), $this->_axisFont, 'black', -90); $this->img->line($x, $this->_graphBottom + 2, $x, $this->_graphBottom - 2); } } } /** * Draws the axis tag text outside the plotting area on the y * axis. */ function drawLabelsY() { // Draw Y axis label. if (!empty($this->_ylabel)) { $y = $this->_graphTop + ($this->_graphHeight / 2) + ((strlen($this->_ylabel) / 2) * 5); $this->img->text($this->_ylabel, 5, $y, $this->_labelFont, 'black', -90); } foreach ($this->_labelsY as $i => $label) { $y = $this->translateY($i * $this->_deltaTicksY); $this->img->text($label, $this->_graphLeft - (strlen($label) * 7), $y - 5, $this->_axisFont); $this->img->line($this->_graphLeft - 2, $y, $this->_graphLeft + 2, $y); } } /** * Take a pair of (x,y) graph coordinates and return the * screen-pixel coordinates for them. * * @param float &$x The x position in world coordinates. * @param float &$y The y position in world coordinates. */ function translate(&$x, &$y) { $x = $this->translateX($x); $y = $this->translateY($y); } /** * Translate the x coordinate of a point on the plot to screen * coordinates. * * @param float $x The x world (plot) coordinate. */ function translateX($x) { return (($x + $this->_offsetGridX) * $this->_factorX) + $this->_graphLeft; } /** * Translate the y coordinate of a point on the plot to screen * coordinates. * * @param float $y The y world (plot) coordinate. */ function translateY($y) { if ($y) { return $this->_graphBottom - ($y * $this->_factorY); } else { return $this->_graphBottom; } } /** * Find the minimum and maximum values for a set of data. * * The $resolution variable is used for rounding maximum and * minimum values. If maximum value is 8645 then: * * If $resolution is 0, then maximum value becomes 9000. * If $resolution is 1, then maximum value becomes 8700. * If $resolution is 2, then maximum value becomes 8650. * If $resolution is 3, then maximum value becomes 8645. * * @param array $data The Dataset to find the range for. * @param integer $min (optional) Minimum value to start at. The lowest number * in the dataset is used if it's lower. * @param integer $max (optional) Maximum value to start at. The highest number * in the dataset is used if it's higher. * @param integer $resolution (optional) The resolution to use for the range. * * @return array The minimum and maximum values for the range. * @private */ function _findRange($data, $min = 0, $max = 0, $resolution = 0) { if (!count($data)) { return array('min' => 0, 'max' => 0); } $data[] = $max; $data[] = $min; $max = max($data); $min = min($data); if ($max == 0) { $factor = 1; } else { if ($max < 0) { $factor = -pow(10, (floor(log10(abs($max))) + $resolution)); } else { $factor = pow(10, (floor(log10(abs($max))) - $resolution)); } } $max = $factor * @ceil($max / $factor); $min = $factor * @floor($min / $factor); return array($min, $max); } } --- NEW FILE: package.xml --- Horde_Graph Horde graphing suite Provides a set of graph backends and methods for creating all kinds of graphs using the Horde_Image abstraction package. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-05 Initial Release. Horde_Cache Horde_Framework Horde_Image Horde_Util 0.0.1 alpha 2003-07-05 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:21 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Form/Form/Action conditional_enable.php, NONE, 1.1 conditional_setvalue.php, NONE, 1.1 reload.php, NONE, 1.1 submit.php, NONE, 1.1 sum_fields.php, NONE, 1.1 updatefield.php, NONE, 1.1 Message-ID: <20051014143306.A9962102C3D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Form/Form/Action In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Form/Form/Action Added Files: conditional_enable.php conditional_setvalue.php reload.php submit.php sum_fields.php updatefield.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: conditional_enable.php --- * $params = array( * 'target' => '[name of element this is conditional on]', * 'enabled' => 'true' | 'false', * 'values' => array([target values to check]) * ); * * * So $params = array('foo', 'true', array(1, 2)) will enable the field this * action is attached to if the value of 'foo' is 1 or 2, and disable it * otherwise. * * Copyright 2002-2004 Matt Kynaston * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Matt Kynaston * @package Horde_Form */ class Horde_Form_Action_conditional_enable extends Horde_Form_Action { var $_trigger = array('onload'); function getActionScript(&$form, $renderer, $varname) { Horde::addScriptFile('form_helpers.js', 'horde'); $form_name = $form->getName(); $target = $this->_params['target']; $enabled = $this->_params['enabled']; if (!is_string($enabled)) { $enabled = ($enabled) ? 'true' : 'false'; } $vals = $this->_params['values']; $vals = (is_array($vals)) ? $vals : array($vals); $args = "'$varname', $enabled, '" . join("','", $vals) . "'"; return "if (addEvent(document.$form_name.$target, 'onchange', \"checkEnabled(this, $args);\")) { " ." checkEnabled(document.$form_name.$varname, $args); " ."};"; } } --- NEW FILE: conditional_setvalue.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @package Horde_Form */ class Horde_Form_Action_conditional_setvalue extends Horde_Form_Action { /** * Which JS events should trigger this action? * @var array $_trigger */ var $_trigger = array('onchange', 'onload'); function getActionScript($form, $renderer, $varname) { return 'map(\'' . $renderer->_genID($varname, false) . "', '" . $renderer->_genID($this->getTarget(), false) . '\');'; } function setValues(&$vars, $sourceVal, $arrayVal = false) { $map = $this->_params['map']; $target = $this->getTarget(); if ($arrayVal) { $i = 0; if (is_array($sourceVal)) { foreach ($sourceVal as $val) { if (!empty($map[$val])) { $vars->set($target, $map[$val], $i); } $i++; } } } else { if (!empty($map[$sourceVal])) { $vars->set($target, $map[$sourceVal]); } } } function printJavaScript() { $this->_printJavaScriptStart(); $map = $this->_params['map']; ?> _map = new Array( 0) { echo ', '; } echo '"' . $val . '"'; $i++; }?>); function map(sourceId, targetId) { var newval; var source = document.getElementById(sourceId); var element = document.getElementById(targetId); if (element && _map) { if (_map[source.selectedIndex]) { newval = _map[source.selectedIndex]; replace = true; } else { newval = ''; replace = false; for (i = 0; i < _map.length; i++) { if (element.value == _map[i]) { replace = true; break; } } } if (replace) { element.value = newval; } } }_printJavaScriptEnd(); } } --- NEW FILE: reload.php --- * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @author Jan Schneider * @version $Revision: 1.1 $ * @package Horde_Form */ class Horde_Form_Action_reload extends Horde_Form_Action { var $_trigger = array('onchange'); function getActionScript($form, $renderer, $varname) { return 'if (this.value) { document.' . $form->getName() . '.formname.value=\'\';' . 'document.' . $form->getName() . '.submit() }'; } } --- NEW FILE: submit.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @package Horde_Form */ class Horde_Form_Action_submit extends Horde_Form_Action { var $_trigger = array('onchange'); function getActionScript($form, $renderer, $varname) { return 'document.' . $form->getName() . '.submit()'; } } --- NEW FILE: sum_fields.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Matt Kynaston * @package Horde_Form */ class Horde_Form_Action_sum_fields extends Horde_Form_Action { var $_trigger = array('onload'); function getActionScript(&$form, $renderer, $varname) { Horde::addScriptFile('form_helpers.js', 'horde'); $form_name = $form->getName(); $fields = "'" . join("','", $this->_params) . "'"; $js = array(); $js[] = sprintf('document.%s.%s.disabled = true;', $form_name, $varname); foreach($this->_params as $field) { $js[] = sprintf("addEvent(document.%s.%s, 'onchange', \"sumFields(this.form, '%s', %s);\");", $form_name, $field, $varname, $fields); } return join("\n", $js); } } --- NEW FILE: updatefield.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @package Horde_Form */ class Horde_Form_Action_updatefield extends Horde_Form_Action { var $_trigger = array('onchange', 'onload', 'onkeyup'); function getActionScript(&$form, &$renderer, $varname) { return 'updateField' . $this->id() . '();'; } function setValues(&$vars, $sourceVal, $arrayVal = false) { } function printJavaScript() { $this->_printJavaScriptStart(); $pieces = explode('%s', $this->_params['format']); $fields = $this->_params['fields']; $val_first = (substr($this->_params['format'], 0, 2) == '%s'); if ($val_first) { array_shift($pieces); } if (substr($this->_params['format'], -2) == '%s') { array_pop($pieces); } $args = array(); if ($val_first) { $args[] = "document.getElementById('" . array_shift($fields) . "').value"; } while (count($pieces)) { $args[] = "'" . array_shift($pieces) . "'"; $args[] = "document.getElementById('" . array_shift($fields) . "').value"; } ?> // Updater for getTarget() ?>. function updateFieldid() ?>() { var target = document.getElementById('getTarget() ?>'); if (target) { target.value = ; } }_printJavaScriptEnd(); } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:23 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Group Group.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.CD15F102C45@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Group In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Group Added Files: Group.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Group.php --- * Copyright 2001-2004 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Stephane Huther * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Group */ class Group { /** * Pointer to a DataTree instance to manage the different groups. * @var object DataTree $_datatree */ var $_datatree; /** * Constructor */ function Group() { global $conf; if (!isset($conf['datatree']['driver'])) { Horde::fatal('You must configure a DataTree backend to use Groups.'); } $driver = $conf['datatree']['driver']; $this->_datatree = &DataTree::singleton($driver, array_merge(Horde::getDriverConfig('datatree', $driver), array('group' => 'horde.groups'))); } /** * Return a new group object. * * @param string $name The group's name. * * @return object DataTreeObject_Group A new group object. */ function &newGroup($name) { if (empty($name)) { return PEAR::raiseError(_("Group names must be non-empty")); } $group = &new DataTreeObject_Group($name); $group->setGroupOb($this); return $group; } /** * Return a DataTreeObject_Group object corresponding to the named * group, with the users and other data retrieved appropriately. * * @param string $name The name of the group to retrieve. */ function &getGroup($name) { /* cache of previous retrieved groups */ static $groupCache; if (!is_array($groupCache)) { $groupCache = array(); } if (!isset($groupCache[$name])) { $groupCache[$name] = $this->_datatree->getObject($name, 'DataTreeObject_Group'); if (!is_a($groupCache[$name], 'PEAR_Error')) { $groupCache[$name]->setGroupOb($this); } } return $groupCache[$name]; } /** * Return a DataTreeObject_Group object corresponding to the given * unique ID, with the users and other data retrieved * appropriately. * * @param string $cid The unique ID of the group to retrieve. */ function &getGroupById($cid) { $group = $this->_datatree->getObjectById($cid, 'DataTreeObject_Group'); if (!is_a($group, 'PEAR_Error')) { $group->setGroupOb($this); } return $group; } /** * Get a globally unique ID for a group. * * @param object DataTreeObject_Group $group The group. * * @return string A GUID referring to $group. */ function getGUID($group) { return 'horde:group:' . $this->getGroupId($group); } /** * Add a group to the groups system. The group must first be * created with Group::newGroup(), and have any initial users * added to it, before this function is called. * * @param object DataTreeObject_Group $group The new group object. */ function addGroup($group) { if (!is_a($group, 'DataTreeObject_Group')) { return PEAR::raiseError('Groups must be DataTreeObject_Group objects or extend that class.'); } $result = $this->_datatree->add($group); if (is_a($result, 'PEAR_Error')) { return $result; } /* Log the addition of the group in the history log. */ $history = &Horde_History::singleton(); $history->log($this->getGUID($group), array('action' => 'add'), true); return $result; } /** * Store updated data - users, etc. - of a group to the backend * system. * * @param object DataTreeObject_Group $group The group to update. */ function updateGroup($group) { if (!is_a($group, 'DataTreeObject_Group')) { return PEAR::raiseError('Groups must be DataTreeObject_Group objects or extend that class.'); } $result = $this->_datatree->updateData($group); if (is_a($result, 'PEAR_Error')) { return $result; } /* Log the update of the group users on the history log. */ $history = &Horde_History::singleton(); $guid = $this->getGUID($group); foreach ($group->getAuditLog() as $userId => $action) { $history->log($guid, array('action' => $action, 'user' => $userId), true); } $group->clearAuditLog(); /* Log the group modification. */ $history->log($guid, array('action' => 'modify'), true); return $result; } /** * Change the name of a group without changing its contents or * where it is in the groups hierarchy. * * @param object DataTreeObject_Group $group The group to rename. * @param string $newName The group's new name. */ function renameGroup($group, $newName) { if (!is_a($group, 'DataTreeObject_Group')) { return PEAR::raiseError('Groups must be DataTreeObject_Group objects or extend that class.'); } $result = $this->_datatree->rename($group, $newName); if (is_a($result, 'PEAR_Error')) { return $result; } /* History Log the name change of the group. */ $history = &Horde_History::singleton(); $history->log($this->getGUID($group), array('action' => 'rename'), true); return $result; } /** * Remove a group from the groups system permanently. * * @param object DataTreeObject_Group $group The group to remove. * * @param optional boolean force [default = false] Force to remove * every child */ function removeGroup($group, $force = false) { if (!is_a($group, 'DataTreeObject_Group')) { return PEAR::raiseError('Groups must be DataTreeObject_Group objects or extend that class.'); } $history = &Horde_History::singleton(); $history->log($this->getGUID($group), array('action' => 'delete'), true); return $this->_datatree->remove($group, $force); } /** * Retrieve the name of a group. * * @param integer $groupId The id of the group to retrieve the name for.. * * @return string The group's name. */ function getGroupName($groupId) { if (is_a($groupId, 'DataTreeObject_Group')) { return $this->_datatree->getName($groupId->getId()); } else { return $this->_datatree->getName($groupId); } } /** * Retrieve the ID of a group. * * @param string $group The group to retrieve the ID for.. * * @return integer The group's ID. */ function getGroupId($group) { if (is_a($group, 'DataTreeObject_Group')) { return $this->_datatree->getId($group->getName()); } else { return $this->_datatree->getId($group); } } /** * Check if a group exists in the system. * * @param string $group The group to check. * * @return boolean true if the group exists, false otherwise. */ function exists($group) { return $this->_datatree->exists($group); } /** * Get a list of the parents of a child group. * * @param string $group The name of the child group. * * @return array */ function getGroupParents($group) { return $this->_datatree->getParents($group); } /** * Get a list of every group, in the format cid => groupname. * * @return array CID => groupname hash. */ function listGroups() { static $groups; if (is_null($groups)) { $groups = $this->_datatree->get(DATATREE_FORMAT_FLAT, '-1', true); unset($groups['-1']); } return $groups; } /** * Get a list of every user that is a part of this group ONLY. * * @param string $group The name of the group. * * @return array The user list. * @access public */ function listUsers($group) { $groupOb = &$this->getGroup($group); if (is_a($groupOb, 'PEAR_Error')) { return $groupOb; } if (!isset($groupOb->data['users']) || !is_array($groupOb->data['users'])) { return array(); } return array_keys($groupOb->data['users']); } /** * Get a list of every user that is part of the specified group * and any of its subgroups. * * @access public * * @param string $group The name of the parent group. * * @return array The complete user list. */ function listAllUsers($group) { // Get a list of every group that is a sub-group of $group. $groups = $this->_datatree->get(DATATREE_FORMAT_FLAT, $group, true); if (is_a($groups, 'PEAR_Error')) { return $groups; } $groups = array($group) + $groups; $users = array(); foreach ($groups as $group) { $users = array_merge($users, $this->listUsers($group)); } return array_values(array_flip(array_flip($users))); } /** * Get a list of every group that $user is in. * * @param string $user The user to get groups for. * @param boolean $parentGroups Also return the parents of any groups? * * @return array An array of all groups the user is in. */ function getGroupMemberships($user, $parentGroups = false) { static $cache; if (empty($cache[$user])) { $criteria = array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'user'), array('field' => 'key', 'op' => '=', 'test' => $user))); $groups = $this->_datatree->getByAttributes($criteria); if (is_a($groups, 'PEAR_Error')) { return $groups; } if ($parentGroups) { foreach ($groups as $id => $g) { $parents = $this->_datatree->getParentList($id); if (is_a($parents, 'PEAR_Error')) { return $parents; } $groups += $parents; } } $cache[$user] = $groups; } return $cache[$user]; } /** * Say if a user is a member of a group or not. * * @param string $user The name of the user. * @param string $group The name of the group. * @param optional boolean $subgroups Return true if the user is in any subgroups * of $group, also. * * @return boolean * @access public */ function userIsInGroup($user, $group, $subgroups = true) { if (!$this->exists($group)) { return false; } elseif ($subgroups) { $groups = $this->getGroupMemberships($user, true); if (is_a($groups, 'PEAR_Error')) { return $groups; } return !empty($groups[$this->getGroupId($group)]); } else { $users = $this->listUsers($group); if (is_a($users, 'PEAR_Error')) { return $users; } return in_array($user, $users); } } /** * Attempts to return a concrete Group instance based on $driver. * * @access public * * @param mixed $driver The type of concrete Group subclass to * return. The code is dynamically * included. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Group The newly created concrete Group instance, or a * PEAR_Error object on an error. */ function &factory($driver = '', $params = null) { $driver = basename($driver); if (@file_exists(dirname(__FILE__) . '/Group/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Group/' . $driver . '.php'; } else { @include_once 'Horde/Group/' . $driver . '.php'; } $class = 'Group_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Group instance. * It will only create a new instance if no Group instance * currently exists. * * This method must be invoked as: $var = &Group::singleton() * * @return object Group The concrete Group reference, or false on an * error. */ function &singleton() { static $group; if (!isset($group)) { global $conf; require_once 'Horde/Auth.php'; $auth = &Auth::singleton($conf['auth']['driver']); if ($auth->hasCapability('groups')) { $group = &Group::factory($auth->getDriver(), $auth); } elseif (!empty($conf['group']['driver']) && $conf['group']['driver'] != 'datatree') { $group = &Group::factory($conf['group']['driver']); } else { $group = new Group(); } } return $group; } } /** * Extension of the DataTreeObject class for storing Group information * in the Categories driver. If you want to store specialized Group * information, you should extend this class instead of extending * DataTreeObject directly. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Group */ class DataTreeObject_Group extends DataTreeObject { /** * The Group object which this group is associated with - needed * for updating data in the backend to make changes stick, etc. * * @var object Group $_groupOb */ var $_groupOb; /** * This variable caches the users added or removed from the group * for History logging of user-groups relationship. * * @var array $_auditLog */ var $_auditLog = array(); /** * The DataTreeObject_Group constructor. Just makes sure to call * the parent constructor so that the group's name is set * properly. * * @param string $name The name of the group. */ function DataTreeObject_Group($name) { parent::DataTreeObject($name); } /** * Associates a Group object with this group. * * @param object Group $groupOb The Group object. */ function setGroupOb(&$groupOb) { $this->_groupOb = &$groupOb; } /** * Fetch the ID of this group * * @return string The group's ID */ function getId() { return $this->_groupOb->getGroupId($this); } /** * Save any changes to this object to the backend permanently. */ function save() { $this->_groupOb->updateGroup($this); } /** * Adds a user to this group, and makes sure that the backend is * updated as well. * * @param string $username The user to add. */ function addUser($username, $update = true) { $this->data['users'][$username] = 1; $this->_auditLog[$username] = 'addUser'; if ($update && $this->_groupOb->_datatree->exists($this->getName())) { $this->save(); } } /** * Removes a user from this group, and makes sure that the backend * is updated as well. * * @param string $username The user to remove. */ function removeUser($username, $update = true) { unset($this->data['users'][$username]); $this->_auditLog[$username] = 'deleteUser'; if ($update) { $this->save(); } } /** * Get a list of every user that is a part of this group * (and only this group) * * @return array The user list * @access public */ function listUsers() { return $this->_groupOb->listUsers($this->name); } /** * Get a list of every user that is a part of this group and * any of it's subgroups * * @return array The complete user list * @access public */ function listAllUsers() { return $this->_groupOb->listAllUsers($this->name); } /** * Get all the users recently added or removed from the group. */ function getAuditLog() { return $this->_auditLog; } /** * Clears the audit log. To be called after group update. */ function clearAuditLog() { $this->_auditLog = array(); } /** * Map this object's attributes from the data array into a format * that we can store in the attributes storage backend. * * @return array The attributes array. */ function _toAttributes() { // Default to no attributes. $attributes = array(); // Loop through all users, if any. if (isset($this->data['users']) && is_array($this->data['users']) && count($this->data['users'])) { foreach ($this->data['users'] as $user => $active) { $attributes[] = array('name' => 'user', 'key' => $user, 'value' => $active); } } $attributes[] = array('name' => 'email', 'key' => '', 'value' => $this->get('email')); return $attributes; } /** * Take in a list of attributes from the backend and map it to our * internal data array. * * @param array $attributes The list of attributes from the * backend (attribute name, key, and value). */ function _fromAttributes($attributes) { // Initialize data array. $this->data['users'] = array(); foreach ($attributes as $attr) { if ($attr['name'] == 'user') { $this->data['users'][$attr['key']] = $attr['value']; } else { $this->data[$attr['name']] = $attr['value']; } } } } --- NEW FILE: package.xml --- Horde_Group Horde User Groups System The Group:: class provides the Horde groups system. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-05 Initial packaging. gettext Horde_Framework Horde_DataTree Horde_Auth 0.0.1 alpha 2003-07-05 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:24 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Chart pie.php, NONE, 1.1 pie3d.php, NONE, 1.1 Message-ID: <20051014143306.AE209102C40@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Chart In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Chart Added Files: pie.php pie3d.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: pie.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Chart_pie { var $graph; var $_dataset; var $_padding = 20; var $_outline = true; var $_colors = array('tan', 'palegoldenrod', 'olivedrab', 'blue', 'red', 'green', 'yellow', 'orange', 'gray', 'purple'); /** "255,153,0", "0,204,153", "204,255,102", "255,102,102", "102,204,255", "204,153,255", "255,0,0", "51,0,255", "255,51,153", "204,0,255", "255,255,51", "51,255,51", "255,102,0"); */ function Horde_Graph_Chart_pie(&$graph, $params) { $this->graph = &$graph; foreach ($params as $param => $value) { $key = '_' . $param; $this->$key = $value; } } function draw() { $data = $this->graph->_data['y'][$this->_dataset]; // Initialize some variables. $diameter = min($this->graph->_graphWidth, $this->graph->_graphHeight) - ($this->_padding * 2); $radius = $diameter / 2; $count = count($data); $xcenter = $this->graph->_graphLeft + $this->_padding + ($this->graph->_graphWidth / 2); $ycenter = $this->graph->_graphTop + $this->_padding + ($this->graph->_graphHeight / 2); // Calculate the sum of all slices. $sum = 0; foreach ($data as $x) { $sum += $x; } // Convert each slice into the corresponding percentage of a // 360-degree circle. $degCount = 0; $slices = array(); $degrees = array(); foreach ($data as $i => $y) { if ((($y / $sum) * 360) > 0) { $degrees[$degCount] = ($y / $sum) * 360; $slices[$degCount] = $y; $names[$degCount] = isset($this->graph->_data['x'][$i]) ? $this->graph->_data['x'][$i] : ''; $degCount++; } } // Draw the baseline. if ($count > 1) { $last_angle = 0; $count = count($degrees); for ($z = 0; $z < $count; $z++) { // Calculate and draw arcs corresponding to each // slice. $cz = $z % count($this->_colors); $this->graph->img->arc($xcenter, $ycenter, $radius, $last_angle, ($last_angle + $degrees[$z]), $this->_outline ? 'black' : $this->_colors[$cz], $this->_colors[$cz]); $last_angle = $last_angle + $degrees[$z]; } } else { $this->graph->img->circle($xcenter, $ycenter, $radius, 'black', $this->_colors[0]); } // Create the color key and slice labels. $yBase = $this->graph->_graphTop; $xBase = 5; $max = strlen((string)max($data)); for ($z = 0; $z < $degCount; $z++) { $cz = $z % count($this->_colors); $percent = ($degrees[$z] / 360) * 100; $percent = round($percent, 2); $yBase += 15; $this->graph->img->rectangle($xBase, $yBase, 12, 12, 'black', $this->_colors[$cz]); if ($slices[$z] >= 1000 && $slices[$z] < 1000000) { $slices[$z] = $slices[$z] / 1000; $slices[$z] = $slices[$z] . 'k'; } $repeat = $max - strlen($slices[$z]); if ($repeat < 0) { $repeat = 0; } $slices[$z] = str_repeat(' ', $repeat) . $slices[$z]; $this->graph->img->text($slices[$z], $xBase + 20, ($yBase + 1)); $label = $names[$z] . ' (' . $percent . '%)'; if (strlen($label) > 20) { $labels = explode("\n", wordwrap($label, 20)); foreach ($labels as $i => $label) { if ($i > 0) { $yBase += 15; } $this->graph->img->text($label, $xBase + 35 + ($max * 4), ($yBase + 1)); } } else { $this->graph->img->text($label, $xBase + 35 + ($max * 4), ($yBase + 1)); } } } } --- NEW FILE: pie3d.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Chart_pie3d { var $graph; var $_dataset; var $_padding = 20; var $_outline = true; var $_colors = array('tan', 'palegoldenrod', 'olivedrab', 'blue', 'red', 'green', 'yellow', 'orange', 'gray', 'purple'); /** "255,153,0", "0,204,153", "204,255,102", "255,102,102", "102,204,255", "204,153,255", "255,0,0", "51,0,255", "255,51,153", "204,0,255", "255,255,51", "51,255,51", "255,102,0"); */ function Horde_Graph_Chart_pie3d(&$graph, $params) { $this->graph = &$graph; foreach ($params as $param => $value) { $key = '_' . $param; $this->$key = $value; } } function draw() { } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:25 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/tests .htaccess, NONE, 1.1 test01.php, NONE, 1.1 test02.php, NONE, 1.1 test03.php, NONE, 1.1 test04.php, NONE, 1.1 test05.php, NONE, 1.1 test06.php, NONE, 1.1 test_bargrouped.php, NONE, 1.1 test_pie3d.php, NONE, 1.1 test_pie3d_gd.php, NONE, 1.1 Message-ID: <20051014143306.CA672102C42@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Graph/tests Added Files: .htaccess test01.php test02.php test03.php test04.php test05.php test06.php test_bargrouped.php test_pie3d.php test_pie3d_gd.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: .htaccess --- Allow from all --- NEW FILE: test01.php --- 400, 'width' => 400)); $graph->set('title', '3 lines'); $graph->set('ylabel', 'Some Parameters'); $graph->set('xlabel', 'Day of the Week'); $graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri')); $data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650)); $data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678)); $data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678)); $graph->addPlot('line', array('dataset' => $data1, 'color' => 'red')); $graph->addPlot('line', array('dataset' => $data2, 'color' => 'green')); $graph->addPlot('line', array('dataset' => $data3, 'color' => 'blue')); $graph->draw(); --- NEW FILE: test02.php --- 400, 'width' => 400)); $graph->set('title', '3 bars'); $graph->set('ylabel', 'Some Parameters'); $graph->set('xlabel', 'Day of the Week'); $graph->set('offsetGridX', .5); $graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri')); $data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650)); $data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678)); $data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678)); $graph->addPlot('bar', array('dataset' => $data3, 'offset' => .5, 'color' => 'blue')); $graph->addPlot('bar', array('dataset' => $data2, 'offset' => 0, 'color' => 'green')); $graph->addPlot('bar', array('dataset' => $data1, 'offset' => -.5, 'color' => 'red')); $graph->draw(); --- NEW FILE: test03.php --- 400, 'width' => 400)); $graph->set('title', '3 scatters'); $graph->set('ylabel', 'Some Parameters'); $graph->set('xlabel', 'Day of the Week'); $graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri')); $data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650)); $data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678)); $data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678)); $graph->addPlot('scatter', array('dataset' => $data3, 'shape' => 'rectangle', 'color' => 'blue')); $graph->addPlot('scatter', array('dataset' => $data2, 'shape' => 'triangle', 'color' => 'green')); $graph->addPlot('scatter', array('dataset' => $data1, 'shape' => 'circle', 'color' => 'red')); $graph->draw(); --- NEW FILE: test04.php --- 400, 'width' => 400)); $graph->set('title', 'Scatter & Lines'); $graph->set('ylabel', 'Some Parameters'); $graph->set('xlabel', 'Day of the Week'); $graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri')); $data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650)); $data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678)); $data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678)); $graph->addPlot('line', array('dataset' => $data1, 'color' => 'red')); $graph->addPlot('line', array('dataset' => $data2, 'color' => 'green')); $graph->addPlot('line', array('dataset' => $data3, 'color' => 'blue')); $graph->addPlot('scatter', array('dataset' => $data3, 'shape' => 'rectangle', 'color' => 'blue')); $graph->addPlot('scatter', array('dataset' => $data2, 'shape' => 'triangle', 'color' => 'green')); $graph->addPlot('scatter', array('dataset' => $data1, 'shape' => 'diamond', 'color' => 'red')); $graph->draw(); --- NEW FILE: test05.php --- 400, 'width' => 400)); $graph->set('title', 'One datapoint, two axis labels'); $graph->set('ylabel', 'Some Parameters'); $graph->set('xlabel', 'Day of the Week'); $graph->set('offsetGridX', .5); $graph->addXData(array('Fri', 'Mon')); $data1 = $graph->addYData(array(8.610)); $graph->addPlot('bar', array('dataset' => $data1, 'color' => 'red')); $graph->addPlot('scatter', array('dataset' => $data1, 'color' => 'green')); $graph->addPlot('line', array('dataset' => $data1, 'color' => 'blue')); $graph->draw(); --- NEW FILE: test06.php --- 400, 'width' => 400)); $graph->set('title', 'Pie chart'); $graph->set('imgType', 'svg'); $graph->addXData(array('Fri', 'Mon')); $data1 = $graph->addYData(array(8, 5, 4, 10, 3, 9)); $graph->addChart('pie', array('dataset' => $data1, 'outline' => false)); $graph->draw(); --- NEW FILE: test_bargrouped.php --- 400, 'width' => 400)); $graph->set('title', 'Grouped Bars'); $graph->set('ylabel', 'Value'); $graph->set('xlabel', 'Day of the Week'); $graph->set('offsetGridX', .5); $graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri')); $data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650)); $data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678)); $data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678)); $graph->addPlot('bargrouped', array('datasets' => array($data1, $data2, $data3), 'colors' => array('red', 'green', 'blue'))); $graph->draw(); --- NEW FILE: test_pie3d.php --- 400, 'width' => 400)); $graph->set('title', '3D Pie chart'); $graph->set('imgType', 'svg'); $graph->addXData(array('Fri', 'Mon')); $data1 = $graph->addYData(array(8, 5, 4, 10, 3, 9)); $graph->addChart('pie3d', array('dataset' => $data1)); $graph->draw(); --- NEW FILE: test_pie3d_gd.php --- $angle; $i--) { imagefilledarc($image, 50, $i, 100, $angle, 0, 45, $darknavy, IMG_ARC_PIE); imagefilledarc($image, 50, $i, 100, $angle, 45, 75 , $darkgray, IMG_ARC_PIE); imagefilledarc($image, 50, $i, 100, $angle, 75, 360 , $darkred, IMG_ARC_PIE); } imagefilledarc($image, 50, 50, 100, $angle, 0, 45, $navy, IMG_ARC_PIE); imagefilledarc($image, 50, 50, 100, $angle, 45, 75 , $gray, IMG_ARC_PIE); imagefilledarc($image, 50, 50, 100, $angle, 75, 360 , $red, IMG_ARC_PIE); header('Content-type: image/png'); imagepng($image); From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:27 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot bar.php, NONE, 1.1 bargrouped.php, NONE, 1.1 barstacked.php, NONE, 1.1 line.php, NONE, 1.1 scatter.php, NONE, 1.1 Message-ID: <20051014143306.C5229102BFC@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot Added Files: bar.php bargrouped.php barstacked.php line.php scatter.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: bar.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Plot_bar { var $graph; var $_color = 'blue'; var $_outline = 'black'; var $_width = 10; var $_offset = 0; var $_dataset; function Horde_Graph_Plot_bar(&$graph, $params) { $this->graph = &$graph; foreach ($params as $param => $value) { $key = '_' . $param; $this->$key = $value; } } function draw() { $data = $this->graph->_data['y'][$this->_dataset]; $barWidth = $this->_width; $barOffset = $this->_offset * $barWidth; $u = 0; $v = 0; $count = count($data); for ($i = 0; $i < $count; $i++) { $x = $i; $y = $data[$i]; $this->graph->translate($x, $y); $x = $x - ($barWidth / 2) + $barOffset; $height = $this->graph->_graphBottom - $y; $this->graph->img->rectangle($x, $y, $barWidth, $height, $this->_outline, $this->_color); } } } --- NEW FILE: bargrouped.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Plot_bargrouped extends Horde_Graph_Plot_bar { var $_step = .5; var $_colors = array(); var $_datasets = array(); function draw() { // Calculate the starting offset for each bar, from which we // move it over by $this->_step. $datasets = count($this->_datasets); $globalOffset = $this->_offset - (($this->_step * ($datasets - 1)) / 2); for ($i = 0; $i < $datasets; $i++) { // Calculate the offset of this set of bars. $this->_offset = $globalOffset + ($this->_step * $i); // Set bar parameters that change per-group. if (isset($this->_colors[$i])) { $this->_color = $this->_colors[$i]; } $this->_dataset = $this->_datasets[$i]; // Draw this dataset. parent::draw(); } } } --- NEW FILE: barstacked.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Plot_barstacked { var $graph; var $_color = 'blue'; var $_outline = 'black'; var $_width = 10; var $_offset = 0; var $_dataset; function Horde_Graph_Plot_barstacked(&$graph, $params) { $this->graph = &$graph; foreach ($params as $param => $value) { $key = '_' . $param; $this->$key = $value; } } function draw() { } } --- NEW FILE: line.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Plot_line { var $_graph; var $_color = 'blue'; var $_width = 1; var $_dataset; function Horde_Graph_Plot_line(&$graph, $params) { $this->_graph = &$graph; foreach ($params as $param => $value) { $key = '_' . $param; $this->$key = $value; } } function draw() { $data = $this->_graph->_data['y'][$this->_dataset]; $count = count($data); $verts = array(); for ($i = 0; $i < $count; $i++) { $x = $i; $y = $data[$i]; $this->_graph->translate($x, $y); $verts[] = array('x' => $x, 'y' => $y); } $this->_graph->img->polyline($verts, $this->_color, $this->_width); } } --- NEW FILE: scatter.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Graph */ class Horde_Graph_Plot_scatter { var $_graph; var $_color = 'blue'; var $_shape = 'square'; var $_dataset; function Horde_Graph_Plot_scatter(&$graph, $params) { $this->_graph = &$graph; foreach ($params as $param => $value) { $key = '_' . $param; $this->$key = $value; } } function draw() { $data = $this->_graph->_data['y'][$this->_dataset]; $count = count($data); $verts = array(); for ($i = 0; $i < $count; $i++) { $x = $i; $y = $data[$i]; $this->_graph->translate($x, $y); $this->_graph->img->brush($x, $y, $this->_color, $this->_shape); } } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:29 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Group/Group hooks.php, NONE, 1.1 Message-ID: <20051014143306.DB538102C06@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Group/Group In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Group/Group Added Files: hooks.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: hooks.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jason Rust * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Group */ class Group_hooks extends Group { /** * Constructor. */ function Group_hooks() { parent::Group(); require $GLOBALS['registry']->getParam('fileroot', 'horde') . '/config/hooks.php'; } /** * Get a list of every group that $user is in. * * @param string $user The user to get groups for. * * @return array An array of all groups the user is in. */ function getGroupMemberships($user) { $memberships = parent::getGroupMemberships($user); $funcs = get_defined_functions(); foreach ($funcs['user'] as $funcName) { if (strpos($funcName, '_group_hook_') === 0) { $groupName = substr($funcName, 12); if (!in_array($groupName, $memberships) && $this->exists($groupName) && call_user_func($funcName, $user)) { $memberships[] = $groupName; } } } return $memberships; } /** * Say if a user is a member of a group or not. * * @param string $user The name of the user. * @param string $group The name of the group. * @param optional boolean $subgroups Return true if the user is in any subgroups * of $group, also. * * @access public * @return boolean */ function userIsInGroup($user, $group, $subgroups = false) { if ($this->hasHook($group)) { if (call_user_func($this->_getGroupHookName($group), $user)) { $inGroup = true; } else { $inGroup = false; } } else { $inGroup = false; } if ($inGroup || parent::userIsInGroup($user, $group, $subgroups)) { return true; } else { return false; } } /** * Determines if a group has a hook associated with it. * * @param string $name The group name. * * @access public * @return boolean True if the group has a hook, false otherwise */ function hasHook($name) { return function_exists($this->_getGroupHookName($name)); } /** * Returns the name of the hook function. * * @param string $name The group name. * * @access public * @return string The function name for the hook for this group */ function _getGroupHookName($name) { return '_group_hook_' . str_replace(':', '__', $name); } } From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:31 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/History History.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.DE467102C4A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/History In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/History Added Files: History.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: History.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_History */ class Horde_History { /** * Pointer to a DataTree instance to manage the history. * @var object DataTree $_datatree */ var $_datatree; /** * Constructor. */ function Horde_History() { global $conf; if (!isset($conf['datatree']['driver'])) { Horde::fatal('You must configure a DataTree backend to use History.'); } $driver = $conf['datatree']['driver']; $this->_datatree = &DataTree::singleton($driver, array_merge(Horde::getDriverConfig('datatree', $driver), array('group' => 'horde.history'))); } /** * Log an event to an item's history log. The item must be * uniquely identified by $itemGuid. Any other details about the * event are passed in $attributes. Standard suggested attributes * are: * * 'who' => The id of the user that performed the action (will * be added automatically if not present). * * 'ts' => Timestamp of the action (this will be added * automatically if it is not present). * * 'desc' => Text description of the action (this may contain a * %s to represent the date of the action). * * @access public. * * @param string $guid The unique identifier of the entry to add to. * @param array $attributes (optional) The hash of name => value entries that describe this event. * @param boolean $replaceAction (optional) If $attributes['action'] is already present in the * item's history log, update that entry instead of creating * a new one. * * @return boolean|object PEAR_Error True on success, or a PEAR_Error object on failure. */ function log($guid, $attributes = array(), $replaceAction = false) { $history = &$this->getHistory($guid, true); if (is_a($history, 'PEAR_Error')) { return $history; } $history->log($attributes, $replaceAction); return $this->_updateHistory($history); } /** * Return a DataTreeObject_History object corresponding to the * named history entry, with the data retrieved appropriately. If * $autocreate is true, and $guid does not already exist, create, * save, and return a new History object with this $id. * * @param optional boolean $autocreate Automatically create the history entry? * * @param string $guid The name of the history entry to retrieve. */ function &getHistory($guid, $autocreate = false) { // If the $guid doesn't already contain a specified parent id, // then use the current application name as the parent // object. if (!strstr($guid, ':')) { global $registry; $guid = $registry->getApp() . ':' . $guid; } if ($this->_datatree->exists($guid)) { $history = &$this->_getHistory($guid); } elseif ($autocreate) { $history = &$this->_newHistory($guid); $result = $this->_addHistory($history); if (is_a($result, 'PEAR_Error')) { return $result; } } else { // Return an empty history object for ease of use. $history = &new DataTreeObject_History($guid); $history->setHistoryOb($this); } return $history; } /** * Find history objects by timestamp, and optionally filter on * other fields as well. * * @param string $cmp The comparison operator (<, >, <=, >=, or =) to * check the timestamps with. * @param integer $ts The timestamp to compare against. * @param array $filters (optional) An array of additional (ANDed) criteria. * each array value should be an array with 3 entries: * 'op' - the operator to compare this field with. * 'field' - the history field being compared (i.e., 'action'). * 'value' - the value to check for (i.e., 'add'). * @param string $parent (optional) The parent history to start searching at. * * @return array An array of history object ids, or an empty array * if none matched the criteria. */ function &getByTimestamp($cmp, $ts, $filters = array(), $parent = '-1') { // Build the timestamp test. $criteria = array( array('field' => 'key', 'op' => '=', 'test' => 'ts'), array('field' => 'value', 'op' => $cmp, 'test' => $ts)); // Add additional filters, if there are any. if (count($filters)) { foreach ($filters as $filter) { $criteria[] = array('JOIN' => array( array('field' => 'key', 'op' => '=', 'test' => $filter['field']), array('field' => 'value', 'op' => $filter['op'], 'test' => $filter['value']))); } } // Everything is ANDed together. $criteria = array('AND' => $criteria); $histories = $this->_datatree->getByAttributes($criteria, $parent); if (is_a($histories, 'PEAR_Error') || !count($histories)) { // If we got back an error or an empty array, just return // it. return $histories; } return $this->_getHistories(array_keys($histories)); } /** * Return a DataTreeObject_History object corresponding to the * named history entry, with the data retrieved appropriately. * * @param string $guid The name of the history entry to retrieve. */ function &_getHistory($guid) { /* Cache of previous retrieved history entries. */ static $historyCache; if (!is_array($historyCache)) { $historyCache = array(); } if (!isset($historyCache[$guid])) { $historyCache[$guid] = $this->_datatree->getObject($guid, 'DataTreeObject_History'); if (!is_a($historyCache[$guid], 'PEAR_Error')) { $historyCache[$guid]->setHistoryOb($this); } } return $historyCache[$guid]; } /** * Return an array of DataTreeObject_History objects corresponding * to the given set of unique IDs, with the details retrieved * appropriately. * * @param array $guids The array of ids to retrieve. */ function &_getHistories($guids) { $histories = &$this->_datatree->getObjects($guids, 'DataTreeObject_History'); if (is_a($histories, 'PEAR_Error')) { return $histories; } $keys = array_keys($histories); foreach ($keys as $key) { if (!is_a($histories[$key], 'PEAR_Error')) { $histories[$key]->setHistoryOb($this); } } return $histories; } /** * Change the name of a history entry without changing its * contents. * * @param object DataTreeObject_History $history The history entry to rename. * @param string $newName The entry's new name. */ function rename($history, $newName) { if (!is_a($history, 'DataTreeObject_History')) { return PEAR::raiseError('History entries must be DataTreeObject_History objects or extend that class.'); } return $this->_datatree->rename($history, $newName); } /** * Copy a history entry's data to a new name, keeping the old * entry as well. * * @param object DataTreeObject_History $history The history entry to rename. * @param string $newName The entry's new name. */ function copy($history, $newName) { if (!is_a($history, 'DataTreeObject_History')) { return PEAR::raiseError('History entries must be DataTreeObject_History objects or extend that class.'); } $new = &$this->_newHistory($newName); $new->data = $history->data; return $this->_addHistory($new); } /** * Remove a history entry from the history system permanently. * * @param object DataTreeObject_History $history The history entry to remove. */ function removeHistory($history) { if (!is_a($history, 'DataTreeObject_History')) { return PEAR::raiseError('History entries must be DataTreeObject_History objects or extend that class.'); } return $this->_datatree->remove($history, false); } /** * Get a list of every history entry, in the format cid => * historyname. * * @return array CID => historyname hash. */ function listHistories() { static $entries; if (is_null($entries)) { $entries = $this->_datatree->get(DATATREE_FORMAT_FLAT, '-1', true); unset($entries['-1']); } return $entries; } /** * Return a new history entry object. * * @access private * * @param string $guid The entry's name. * * @return object DataTreeObject_History A new history entry object. */ function &_newHistory($guid) { if (empty($guid)) { return PEAR::raiseError(_("History entry names must be non-empty")); } $history = &new DataTreeObject_History($guid); $history->setHistoryOb($this); return $history; } /** * Add an entry to the history system. The entry must first be * created with &History::_newHistory() before this function is * called. * * @access private * * @param object DataTreeObject_History $history The new history entry object. */ function _addHistory($history) { if (!is_a($history, 'DataTreeObject_History')) { return PEAR::raiseError('History entries must be DataTreeObject_History objects or extend that class.'); } return $this->_datatree->add($history); } /** * Store updated data of a history to the backend system. * * @access private * * @param object DataTreeObject_History $history The history entry to update. */ function _updateHistory($history) { if (!is_a($history, 'DataTreeObject_History')) { return PEAR::raiseError('History entries must be DataTreeObject_History objects or extend that class.'); } return $this->_datatree->updateData($history); } /** * Attempts to return a reference to a concrete History instance. * It will only create a new instance if no History instance * currently exists. * * This method must be invoked as: $var = &History::singleton() * * @return object Horde_History The concrete History reference, or false on an * error. */ function &singleton() { static $history; if (!isset($history)) { $history = new Horde_History(); } return $history; } } /** * Extension of the DataTreeObject class for storing History information * in the DataTree backend. If you want to store specialized History * information, you should extend this class instead of extending * DataTreeObject directly. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_History */ class DataTreeObject_History extends DataTreeObject { /** * The History object which this history came from - needed for * updating data in the backend to make changes stick, etc. * * @var object History $historyOb */ var $_historyOb; /** * Associates a History object with this history. * * @param object History $historyOb The History object. */ function setHistoryOb(&$historyOb) { $this->_historyOb = &$historyOb; } /** * Log an event to this item's history log. Details about the * event are passed in $attributes. Standard suggested attributes * are: * * 'who' => The id of the user that performed the action (will * be added automatically if not present). * * 'ts' => Timestamp of the action (this will be added * automatically if it is not present). * * 'desc' => Text description of the action (this may contain a * %s to represent the date of the action). * * @access public. * * @param array $attributes The hash of name => value entries that describe this event. * @param boolean $replaceAction (optional) If $attributes['action'] is already present in the * item's history log, update that entry instead of creating * a new one. * * @return boolean|object PEAR_Error True on success, or a PEAR_Error object on failure. */ function log($attributes = array(), $replaceAction = false) { if (empty($attributes['who'])) { $attributes['who'] = Auth::getAuth(); } if (empty($attributes['ts'])) { $attributes['ts'] = time(); } // If we want to replace an entry with the same action, try // and find one. Track whether or not we succeed in $done, so // we know whether or not to add the entry later. $done = false; if ($replaceAction && !empty($attributes['action'])) { $count = count($this->data); for ($i = 0; $i < $count; $i++) { if (!empty($this->data[$i]['action']) && $this->data[$i]['action'] == $attributes['action']) { $this->data[$i] = $attributes; $done = true; break; } } } // If we're not replacing by action, or if we didn't find an // entry to replace, tack $attributes onto the end of the // $data array. if (!$done) { $this->data[] = $attributes; } } /** * Format the description from a history entry using the default * timestamp format or a specified one. * * @param array $entry The history entry. * @param optional string $format The format string to use for the timestamp. * * @return string The formatted description. */ function getDescription($entry, $format = '%x %X') { return @sprintf($entry['desc'], strftime($format, $entry['ts'])); } /** * Save any changes to this object to the backend permanently. */ function save() { $this->_historyOb->_updateHistory($this); } /** * Map this object's attributes from the data array into a format * that we can store in the attributes storage backend. * * @return array The attributes array. */ function _toAttributes() { // Default to no attributes. $attributes = array(); // Loop through all users, if any. foreach ($this->data as $index => $entry) { foreach ($entry as $key => $value) { $attributes[] = array('name' => (string)$index, 'key' => (string)$key, 'value' => (string)$value); } } return $attributes; } /** * Take in a list of attributes from the backend and map it to our * internal data array. * * @param array $attributes The list of attributes from the * backend (attribute name, key, and value). */ function _fromAttributes($attributes) { // Initialize data array. $this->data = array(); foreach ($attributes as $attr) { if (!isset($this->data[$attr['name']])) { $this->data[$attr['name']] = array(); } $this->data[$attr['name']][$attr['key']] = $attr['value']; } } } --- NEW FILE: package.xml --- Horde_History API for tracking the history of an object. This API provides a way to track changes on arbitrary pieces of data in Horde applications. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2004-01-25 Initial Release 0.0.1 alpha 2004-01-25 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:33 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Horde Horde.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.E5EF2102C4B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Horde In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Horde Added Files: Horde.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Horde.php --- * Copyright 1999-2004 Jon Parise * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Jon Parise [...1152 lines suppressed...] function getHordeMenu() { global $registry; $menu = array(); $menu[] = array('url' => Horde::applicationUrl('services/portal/'), 'text' => _("Home"), 'icon' => 'horde.gif', 'icon_path' => $registry->getParam('graphics')); if (Auth::isAdmin()) { $menu[] = array('url' => Horde::applicationUrl('admin/'), 'text' => _("Administration"), 'icon' => 'administration.gif', 'icon_path' => $registry->getParam('graphics')); } return $menu; } } --- NEW FILE: package.xml --- Horde_Framework Horde core Framework libraries These classes provide the core functionality of the Horde Application Framework. LGPL chuck lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org jan lead Jan Schneider jan@horde.org 0.0.1 beta 2004-02-13 Initial packaging Horde_Browser Horde_Form 0.0.1 beta 2004-02-13 Initial packaging From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:36 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Horde/Horde Config.php, NONE, 1.1 Help.php, NONE, 1.1 Registry.php, NONE, 1.1 Message-ID: <20051014143307.11AE2102C4F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Horde/Horde In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Horde/Horde Added Files: Config.php Help.php Registry.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Config.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Framework */ class Horde_Config { /** * The name of the configured application. * * @var string $_app */ var $_app; /** * The XML tree of the configuration file traversed to an * associative array. * * @var array $_xmlConfigTree */ var $_xmlConfigTree = null; /** * The content of the generated configuration file. * * @var string $_phpConfig */ var $_phpConfig; /** * The content of the old configuration file. * * @var string $_oldConfig */ var $_oldConfig; /** * The manual configuration in front of the generated * configuration. * * @var string $_preConfig */ var $_preConfig; /** * The manual configuration after the generated configuration. * * @var string $_preConfig */ var $_postConfig; /** * The current $conf array of the configured application. * * @var array $_currentConfig */ var $_currentConfig = array(); /** * The CVS version tag of the conf.xml file which will be copied * into the conf.php file. * * @var string $_versionTag */ var $_versionTag = ''; /** * The line marking the begin of the generated configuration. * * @var string $_configBegin */ var $_configBegin = "/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */\n"; /** * The line marking the end of the generated configuration. * * @var string $_configEnd */ var $_configEnd = "/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */\n"; /** * Constructor. * * @param string $app The name of the application to be configured. */ function Horde_Config($app) { $this->_app = $app; } /** * Reads the application's conf.xml file and builds an associative * array from its XML tree. * * @return array An associative array representing the configuration tree. */ function readXMLConfig() { if (is_null($this->_xmlConfigTree)) { require_once 'Horde/Text.php'; global $registry; $path = $registry->getParam('fileroot', $this->_app) . '/config'; /* Fetch the current conf.php contents. */ @eval($this->getPHPConfig()); if (isset($conf)) { $this->_currentConfig = $conf; } /* Set up the domxml document. */ $this->_xmlConfigTree = array(); $doc = domxml_open_file($path . '/conf.xml'); /* Check if there is a CVS version tag and store it. */ $node = $doc->first_child(); while (!empty($node)) { if ($node->node_type() == XML_COMMENT_NODE) { if (preg_match('/\$.*?conf\.xml,v .*? .*\$/', $node->node_value(), $match)) { $this->_versionTag = $match[0] . "\n"; break; } } $node = $node->next_sibling(); } /* Parse remaining config file. */ $root = $doc->root(); if ($root->has_child_nodes()) { $this->_parseLevel($this->_xmlConfigTree, $root->child_nodes(), ''); } } return $this->_xmlConfigTree; } /** * Returns the file content of the current configuration file. * * @return string The unparsed configuration file content. */ function getPHPConfig() { if (is_null($this->_oldConfig)) { global $registry; $path = $registry->getParam('fileroot', $this->_app) . '/config'; $size = @filesize($path . '/conf.php'); if ($size && is_resource($fp = @fopen($path . '/conf.php', 'r'))) { $this->_oldConfig = @fread($fp, $size); $this->_oldConfig = preg_replace('/<\?php\n?/', '', $this->_oldConfig); $pos = strpos($this->_oldConfig, $this->_configBegin); if ($pos !== false) { $this->_preConfig = substr($this->_oldConfig, 0, $pos); $this->_oldConfig = substr($this->_oldConfig, $pos); } $pos = strpos($this->_oldConfig, $this->_configEnd); if ($pos !== false) { $this->_postConfig = substr($this->_oldConfig, $pos + strlen($this->_configEnd)); $this->_oldConfig = substr($this->_oldConfig, 0, $pos); } } else { $this->_oldConfig = ''; } } return $this->_oldConfig; } /** * Generates the content of the application's configuration file. * * @param Variables $formvars The processed configuration form data. * * @return string The content of the generated configuration file. */ function generatePHPConfig($formvars) { $this->readXMLConfig(); $this->getPHPConfig(); $this->_phpConfig = "_phpConfig .= $this->_preConfig; $this->_phpConfig .= $this->_configBegin; if (!empty($this->_versionTag)) { $this->_phpConfig .= '// ' . $this->_versionTag; } $this->_generatePHPConfig($this->_xmlConfigTree, '', $formvars); $this->_phpConfig .= $this->_configEnd; $this->_phpConfig .= $this->_postConfig; return $this->_phpConfig; } /** * Generates the configuration file items for a part of the configuration * tree. * * @access private * * @param array $section An associative array containing the part of the * traversed XML configuration tree that should be * processed. * @param string $prefix A configuration prefix determining the current * position inside the configuration file. This * prefix will be translated to keys of the $conf * array in the generated configuration file. * @param Variables $formvars The processed configuration form data. */ function _generatePHPConfig($section, $prefix, $formvars) { foreach ($section as $name => $configitem) { $prefixedname = empty($prefix) ? $name : $prefix . '|' . $name; $configname = $prefixedname; $quote = !isset($configitem['quote']) || $configitem['quote'] !== false; if ($configitem == 'placeholder') { $this->_phpConfig .= '$conf[\'' . str_replace('|', '\'][\'', $prefix) . "'] = array();\n"; } elseif (isset($configitem['switch'])) { $val = $formvars->getExists($configname, $wasset); if (!$wasset) { $val = isset($configitem['default']) ? $configitem['default'] : null; } if (isset($configitem['switch'][$val])) { $value = $val; if ($quote && $value != 'true' && $value != 'false') { $value = "'" . $value . "'"; } $this->_generatePHPConfig($configitem['switch'][$val]['fields'], $prefix, $formvars); } } elseif (isset($configitem['_type'])) { $val = $formvars->getExists($configname, $wasset); if (!$wasset) { $val = isset($configitem['default']) ? $configitem['default'] : null; } $type = $configitem['_type']; switch ($type) { case 'multienum': if (is_array($val)) { $encvals = array(); foreach ($val as $v) { $encvals[] = $this->_quote($v); } $arrayval = "'" . implode('\', \'', $encvals) . "'"; if ($arrayval == "''") { $arrayval = ''; } } else { $arrayval = ''; } $value = 'array(' . $arrayval . ')'; break; case 'boolean': if (is_bool($val)) { $value = $val ? 'true' : 'false'; } else { $value = ($val == 'on') ? 'true' : 'false'; } break; case 'stringlist': $values = explode(',', $val); if (!is_array($values)) { $value = "array('" . $this->_quote(trim($values)) . "')"; } else { $encvals = array(); foreach ($values as $v) { $encvals[] = $this->_quote(trim($v)); } $arrayval = "'" . implode('\', \'', $encvals) . "'"; if ($arrayval == "''") { $arrayval = ''; } $value = 'array(' . $arrayval . ')'; } break; case 'int': if ($val != '') { $value = (int)$val; } break; case 'octal': $value = sprintf('0%o', octdec($val)); break; case 'header': case 'description': break; default: if ($val != '') { $value = $val; if ($quote && $value != 'true' && $value != 'false') { $value = "'" . $this->_quote($value) . "'"; } } break; } } else { $this->_generatePHPConfig($configitem, $prefixedname, $formvars); } if (isset($value)) { $this->_phpConfig .= '$conf[\'' . str_replace('|', '\'][\'', $configname) . '\'] = ' . $value . ";\n"; } unset($value); } } /** * Parses one level of the configuration XML tree into the associative * array containing the traversed configuration tree. * * @access private * * @param array &$conf The already existing array where the processed * XML tree portion should be appended to. * @param array $children An array containing the XML nodes of the level * that should be parsed. * @param string $ctx A string representing the current position * (context prefix) inside the configuration XML * file. */ function _parseLevel(&$conf, $children, $ctx) { foreach ($children as $node) { if ($node->type != XML_ELEMENT_NODE) { continue; } $name = $node->get_attribute('name'); $desc = Text::linkUrls($node->get_attribute('desc')); $required = !($node->get_attribute('required') == 'false'); $quote = !($node->get_attribute('quote') == 'false'); if (!empty($ctx)) { $curctx = $ctx . '|' . $name; } else { $curctx = $name; } switch ($node->tagname) { case 'configdescription': if (empty($name)) { $name = md5(microtime()); } $conf[$name] = array('_type' => 'description', 'desc' => Text::linkUrls($this->_default($curctx, $this->_getNodeOnlyText($node)))); break; case 'configheader': if (empty($name)) { $name = md5(microtime()); } $conf[$name] = array('_type' => 'header', 'desc' => $this->_default($curctx, $this->_getNodeOnlyText($node))); break; case 'configswitch': if ($quote) { $default = $this->_default($curctx, $this->_getNodeOnlyText($node)); } else { $default = $this->_defaultRaw($curctx, $this->_getNodeOnlyText($node)); } $conf[$name] = array('desc' => $desc, 'switch' => $this->_getSwitchValues($node, $ctx), 'default' => $default); break; case 'configenum': $values = $this->_getEnumValues($node); if ($quote) { $default = $this->_default($curctx, $this->_getNodeOnlyText($node)); } else { $default = $this->_defaultRaw($curctx, $this->_getNodeOnlyText($node)); } $conf[$name] = array('_type' => 'enum', 'required' => $required, 'quote' => $quote, 'values' => $values, 'desc' => $desc, 'default' => $default); break; case 'configlist': $default = $this->_default($curctx, null); if ($default === null) { $default = $this->_getNodeOnlyText($node); } else { $default = implode(', ', $default); } $conf[$name] = array('_type' => 'stringlist', 'required' => $required, 'desc' => $desc, 'default' => $default); break; case 'configmultienum': $values = $this->_getEnumValues($node); require_once 'Horde/Array.php'; $conf[$name] = array('_type' => 'multienum', 'required' => $required, 'values' => $values, 'desc' => $desc, 'default' => Horde_Array::valuesToKeys($this->_default($curctx, explode(',', $this->_getNodeOnlyText($node))))); break; case 'configpassword': $conf[$name] = array('_type' => 'password', 'required' => $required, 'desc' => $desc, 'default' => $this->_default($curctx, $this->_getNodeOnlyText($node))); break; case 'configstring': $conf[$name] = array('_type' => 'text', 'required' => $required, 'desc' => $desc, 'default' => $this->_default($curctx, $this->_getNodeOnlyText($node))); if ($conf[$name]['default'] === false) { $conf[$name]['default'] = 'false'; } else if ($conf[$name]['default'] === true) { $conf[$name]['default'] = 'true'; } break; case 'configboolean': $default = $this->_getNodeOnlyText($node); if (empty($default) || $default === 'false') { $default = false; } else { $default = true; } $conf[$name] = array('_type' => 'boolean', 'required' => $required, 'desc' => $desc, 'default' => $this->_default($curctx, $default)); break; case 'configinteger': $values = $this->_getEnumValues($node); $conf[$name] = array('_type' => 'int', 'required' => $required, 'values' => $values, 'desc' => $desc, 'default' => $this->_default($curctx, $this->_getNodeOnlyText($node))); if ($node->get_attribute('octal') == 'true' && $conf[$name]['default'] != '') { $conf[$name]['_type'] = 'octal'; $conf[$name]['default'] = sprintf('0%o', $this->_default($curctx, octdec($this->_getNodeOnlyText($node)))); } break; case 'configphp': $conf[$name] = array('_type' => 'php', 'required' => $required, 'quote' => false, 'desc' => $desc, 'default' => $this->_defaultRaw($curctx, $this->_getNodeOnlyText($node))); break; case 'configsection': $conf[$name] = array(); $cur = &$conf[$name]; if ($node->has_child_nodes()) { $this->_parseLevel($cur, $node->child_nodes(), $curctx); } break; case 'configtab': $key = md5(microtime()); $conf[$key] = array('tab' => $name, 'desc' => $desc); if ($node->has_child_nodes()) { $this->_parseLevel($conf, $node->child_nodes(), $ctx); } break; case 'configplaceholder': $conf[md5(microtime())] = 'placeholder'; break; default: $conf[$name] = array(); $cur = &$conf[$name]; if ($node->has_child_nodes()) { $this->_parseLevel($cur, $node->child_nodes(), $curctx); } break; } } } /** * Returns a certain value from the current configuration array or * a default value, if not found. * * @access private * * @param string $ctx A string representing the key of the * configuration array to return. * @param mixed $default The default value to return if the key wasn't * found. * * @return mixed Either the value of the configuration array's requested * key or the default value if the key wasn't found. */ function _default($ctx, $default) { $ctx = explode('|', $ctx); $ptr = $this->_currentConfig; for ($i = 0; $i < count($ctx); $i++) { if (!isset($ptr[$ctx[$i]])) { return $default; } else { $ptr = $ptr[$ctx[$i]]; } } if (is_string($ptr)) { return String::convertCharset($ptr, 'iso-8859-1'); } else { return $ptr; } } /** * Returns a certain value from the current configuration file or * a default value, if not found. * It does NOT return the actual value, but the PHP expression as used * in the configuration file. * * @access private * * @param string $ctx A string representing the key of the * configuration array to return. * @param mixed $default The default value to return if the key wasn't * found. * * @return mixed Either the value of the configuration file's requested * key or the default value if the key wasn't found. */ function _defaultRaw($ctx, $default) { $ctx = explode('|', $ctx); $pattern = '/^\$conf\[\'' . implode("'\]\['", $ctx) . '\'\] = (.*);$/m'; if (preg_match($pattern, $this->getPHPConfig(), $matches)) { return $matches[1]; } return $default; } /** * Returns the content of all text node children of the specified node. * * @access private * * @param DomNode $node A DomNode object whose text node children to return. * * @return string The concatenated values of all text nodes. */ function _getNodeOnlyText($node) { $text = ''; if (!$node->has_child_nodes()) { return $node->get_content(); } foreach ($node->children() as $tnode) { if ($tnode->type == XML_TEXT_NODE) { $text .= $tnode->content; } } return trim($text); } /** * Returns an associative array containing all possible values of the * specified tag. * The keys contain the actual enum values while the values contain their * corresponding descriptions. * * @access private * * @param DomNode $node The DomNode representation of the tag * whose values should be returned. * * @return array An associative array with all possible enum values. */ function _getEnumValues($node) { $values = array(); if (!$node->has_child_nodes()) { return array(); } foreach ($node->children() as $vnode) { if ($vnode->type == XML_ELEMENT_NODE && $vnode->tagname == 'values') { if (!$vnode->has_child_nodes()) { return array(); } foreach ($vnode->children() as $value) { if ($value->type == XML_ELEMENT_NODE) { if ($value->tagname == 'configspecial') { return $this->_handleSpecials($value); } elseif ($value->tagname == 'value') { $text = $value->get_content(); $desc = $value->get_attribute('desc'); if (!empty($desc)) { $values[$text] = $desc; } else { $values[$text] = $text; } } } } } } return $values; } /** * Returns a multidimensional associative array representing the specified * tag. * * @access private * * @param DomNode &$node The DomNode representation of the * tag to process. * * @return array An associative array representing the node. */ function _getSwitchValues(&$node, $curctx) { if (!$node->has_child_nodes()) { return array(); } $values = array(); foreach ($node->children() as $case) { if ($case->type == XML_ELEMENT_NODE) { $name = $case->get_attribute('name'); $values[$name] = array(); $values[$name]['desc'] = $case->get_attribute('desc'); $values[$name]['fields'] = array(); if ($case->has_child_nodes()) { $this->_parseLevel($values[$name]['fields'], $case->child_nodes(), $curctx); } } } return $values; } /** * Returns an associative array containing the possible values of a * tag as used inside of enum configurations. * * @access private * * @param DomNode $node The DomNode representation of the * tag. * * @return array An associative array with the possible values. */ function _handleSpecials($node) { switch ($node->get_attribute('name')) { case 'list-horde-apps': global $registry; require_once 'Horde/Array.php'; $apps = Horde_Array::valuesToKeys($registry->listApps(array('hidden', 'notoolbar', 'active'))); asort($apps); return $apps; break; case 'list-horde-languages': global $nls; return $nls['languages']; break; case 'list-client-fields': global $registry; $f = array(); if ($registry->hasMethod('clients/getClientSource')) { $addressbook = $registry->call('clients/getClientSource'); $fields = $registry->call('clients/fields', array($addressbook)); if (!is_a($fields, 'PEAR_Error')) { foreach ($fields as $field) { $f[$field['name']] = $field['label']; } } } return $f; break; } return array(); } /** * Returns the specified string with escaped single quotes * * @access private * * @param string $string A string to escape. * * @return string The specified string with single quotes being escaped. */ function _quote($string) { return str_replace("'", "\'", $string); } } /** * A Horde_Form:: form that implements a user interface for the config * system. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Framework */ class ConfigForm extends Horde_Form { /** * Contains the Horde_Config object that this form represents. * * @var Horde_Config $_xmlConfig */ var $_xmlConfig; /** * Contains the Variables object of this form. * * @var Variables $_vars */ var $_vars; /** * Constructor. * * @param Variables &$vars The Variables object of this form. * @param string $app The name of the application that this * configuration form is for. */ function ConfigForm(&$vars, $app) { parent::Horde_Form($vars); $this->_xmlConfig = &new Horde_Config($app); $this->_vars = &$vars; $config = $this->_xmlConfig->readXMLConfig(); $this->addHidden('', 'app', 'text', true); $this->_buildVariables($config); } /** * Builds the form based on the specified level of the configuration tree. * * @access private * * @param array $config The portion of the configuration tree for that * the form fields should be created. * @param string $prefix A string representing the current position * inside the configuration tree. */ function _buildVariables($config, $prefix = '') { if (!is_array($config)) { return; } foreach ($config as $name => $configitem) { $prefixedname = empty($prefix) ? $name : $prefix . '|' . $name; $varname = $prefixedname; $description = null; if ($configitem == 'placeholder') { continue; } elseif (isset($configitem['tab'])) { $this->setSection($configitem['tab'], $configitem['desc']); } elseif (isset($configitem['switch'])) { $selected = $this->_vars->getExists($varname, $wasset); $var_params = array(); $select_option = true; foreach ($configitem['switch'] as $option => $case) { $var_params[$option] = $case['desc']; if ($option == $configitem['default']) { $select_option = false; if (!$wasset) { $selected = $option; } } } $v = &$this->addVariable($configitem['desc'], $varname, 'enum', true, false, null, array($var_params, $select_option)); if (array_key_exists('default', $configitem)) { $v->setDefault($configitem['default']); } $v_action = &Horde_Form_Action::factory('reload'); $v->setAction($v_action); if (isset($selected) && isset($configitem['switch'][$selected])) { $this->_buildVariables($configitem['switch'][$selected]['fields'], $prefix); } } elseif (isset($configitem['_type'])) { $required = (isset($configitem['required'])) ? $configitem['required'] : true; $type = $configitem['_type']; if ($type == 'multienum' || $type == 'header' || $type == 'description') { $required = false; } if ($type == 'multienum' || $type == 'enum') { $var_params = array($configitem['values']); } else { $var_params = array(); } if ($type == 'php') { $type = 'text'; $description = 'Enter a valid PHP expression.'; } $v = &$this->addVariable($configitem['desc'], $varname, $type, $required, false, $description, $var_params); if (isset($configitem['default'])) { $v->setDefault($configitem['default']); } } else { $this->_buildVariables($configitem, $prefixedname); } } } } --- NEW FILE: Help.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Framework */ class Help { /** * Handle for the XML parser object. * * @var object $_parser */ var $_parser = 0; /** * String buffer to hold the XML help source. * * @var string $_buffer */ var $_buffer = ''; /** * String containing the ID of the requested help entry. * * @var string $_reqEntry */ var $_reqEntry = ''; /** * String containing the ID of the current help entry. * * @var string $_curEntry */ var $_curEntry = ''; /** * String containing the formatted output. * * @var string $_output */ var $_output = ''; /** * Boolean indicating whether we're inside a block. * * @var boolean $_inHelp */ var $_inHelp = false; /** * Boolean indicating whether we're inside the requested block. * * @var boolean $_inBlock */ var $_inBlock = false; /** * Boolean indicating whether we're inside a block. * * @var boolean $_inTitle */ var $_inTitle = false; /** * Hash containing an index of all of the help entries. * * @var array $_entries */ var $_entries = array(); /** * String containing the charset of the XML data source. * * @var string $_charset */ var $_charset = 'iso-8859-1'; /** * Hash of user-defined function handlers for the XML elements. * * @var array $_handlers */ var $_handlers = array( 'help' => '_helpHandler', 'entry' => '_entryHandler', 'title' => '_titleHandler', 'heading' => '_headingHandler', 'para' => '_paraHandler', 'ref' => '_refHandler', 'eref' => '_erefHandler', 'href' => '_hrefHandler', 'b' => '_bHandler', 'i' => '_iHandler', ); /** * Constructor * * @access public * * @param integer $source The source of the XML help data, based * on the HELP_SOURCE_* constants. * @param optional string $arg Source-dependent argument for this Help * instance. */ function Help($source, $arg = null) { global $language, $nls; if (!Util::extensionExists('xml')) { Horde::fatal(PEAR::raiseError('The XML functions are not available. Rebuild PHP with --with-xml.'), __FILE__, __LINE__, false); } $this->_charset = array_key_exists($language, $nls['charsets']) ? $nls['charsets'][$language] : $nls['defaults']['charset']; /* Populate $this->_buffer based on $source. */ switch ($source) { case HELP_SOURCE_RAW: $this->_buffer = $arg; break; case HELP_SOURCE_FILE: if (!(@file_exists($arg[0]) && ($fp = @fopen($arg[0], 'r')) && ($fs = @filesize($arg[0])) || @file_exists($arg[1]) && ($fp = @fopen($arg[1], 'r')) && ($fs = @filesize($arg[1])))) { $this->_buffer = ''; } else { $this->_buffer = fread($fp, $fs); fclose($fp); } break; default: $this->_buffer = ''; break; } } /** * Initialzes the XML parser. * * @access private * * @return boolean Returns true on success, false on failure. */ function _init() { /* Create a new parser and set its default properties. */ $this->_parser = xml_parser_create(); xml_set_object($this->_parser, $this); xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler($this->_parser, '_startElement', '_endElement'); xml_set_character_data_handler($this->_parser, '_defaultHandler'); return ($this->_parser != 0); } /** * Cleans up the Help class resources. * * @access public * * @return boolean Returns true on success, false on failure. */ function cleanup() { $this->_buffer = ''; return xml_parser_free($this->_parser); } /** * Looks up the requested entry in the XML help buffer. * * @access public * * @param string $entry String containing the entry ID. */ function lookup($entry) { $this->_output = ''; $this->_reqEntry = String::upper($entry); if (!$this->_parser) { $this->_init(); } xml_parse($this->_parser, $this->_buffer, true); } /** * Returns a hash of all of the topics in this help buffer. * * @access public * * @return array Hash of all of the topics in this buffer. */ function topics() { if (!$this->_parser) { $this->_init(); } xml_parse($this->_parser, $this->_buffer, true); return $this->_entries; } /** * Display the contents of the formatted output buffer. * * @access public */ function display() { echo $this->_output; } /** * User-defined function callback for start elements. * * @access private * * @param object $parser Handle to the parser instance. * @param string $name The name of this XML element. * @param array $attrs List of this element's attributes. */ function _startElement($parser, $name, $attrs) { /* Call the assigned handler for this element, if one is * available. */ if (in_array($name, array_keys($this->_handlers))) { call_user_func(array(&$this, $this->_handlers[$name]), true, $attrs); } } /** * User-defined function callback for end elements. * * @access private * * @param object $parser Handle to the parser instance. * @param string $name The name of this XML element. */ function _endElement($parser, $name) { /* Call the assigned handler for this element, if one is available. */ if (in_array($name, array_keys($this->_handlers))) { call_user_func(array(&$this, $this->_handlers[$name]), false); } } /** * User-defined function callback for character data. * * @access private * * @param object $parser Handle to the parser instance. * @param string $data String of character data. */ function _defaultHandler($parser, $data) { $data = String::convertCharset($data, $this->_charset); if ($this->_inTitle) { $this->_entries[$this->_curEntry] .= $data; } if ($this->_inHelp && $this->_inBlock) { $this->_output .= htmlspecialchars($data); } } /** * XML element handler for the <help> tag. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes (Not used). */ function _helpHandler($startTag, $attrs = array()) { $this->_inHelp = ($startTag) ? true : false; } /** * XML element handler for the <entry> tag. * Attributes: id * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes. */ function _entryHandler($startTag, $attrs = array()) { if (!$startTag) { $this->_inBlock = false; } else { $id = String::upper($attrs['id']); $this->_curEntry = $id; $this->_entries[$id] = ''; $this->_inBlock = ($id == $this->_reqEntry); } } /** * XML element handler for the <title> tag. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes (Not used). */ function _titleHandler($startTag, $attrs = array()) { $this->_inTitle = $startTag; if ($this->_inHelp && $this->_inBlock) { $this->_output .= ($startTag) ? '<h3>' : '</h3>'; } } /** * XML element handler for the <heading> tag. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes (Not used). */ function _headingHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { $this->_output .= ($startTag) ? '<h4>' : '</h4>'; } } /** * XML element handler for the <para> tag. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes (Not used). */ function _paraHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { $this->_output .= ($startTag) ? '<p>' : '</p>'; } } /** * XML element handler for the <ref> tag. * Required attributes: ENTRY, MODULE * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes. */ function _refHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { if ($startTag) { $url = Util::addParameter(Horde::selfURL(), 'show', 'entry'); $url = Util::addParameter($url, 'module', $attrs['MODULE']); $url = Util::addParameter($url, 'topic', $attrs['ENTRY']); $this->_output .= Horde::link($url, null, 'helplink'); } else { $this->_output .= '</a>'; } } } /** * XML element handler for the <eref> tag. * Required elements: URL * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes. */ function _erefHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { if ($startTag) { $this->_output .= Horde::link($attrs['URL'], null, 'helplink', '_blank'); } else { $this->_output .= '</a>'; } } } /** * XML element handler for the <href> tag. * Required elements: url, app. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes. */ function _hrefHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { if ($startTag) { global $registry; $url = Horde::url($registry->getParam('webroot', $attrs['app']) . '/' . $attrs['url']); $this->_output .= Horde::link($url, null, 'helplink', '_blank'); } else { $this->_output .= '</a>'; } } } /** * XML element handler for the <b> tag. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes (Not used). */ function _bHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { $this->_output .= ($startTag) ? '<b>' : '</b>'; } } /** * XML element handler for the <i> tag. * * @access private * * @param boolean $startTag Boolean indicating whether this instance * is a start tag. * @param optional array $attrs Additional element attributes (Not used). */ function _iHandler($startTag, $attrs = array()) { if ($this->_inHelp && $this->_inBlock) { $this->_output .= ($startTag) ? '<i>' : '</i>'; } } /** * Includes the JavaScript necessary to create a new pop-up help * window. * * @access public */ function javascript() { global $conf, $registry; if ($conf['user']['online_help'] && Help::_useJS()) { Horde::addScriptFile('open_help_win.js', 'horde'); } } /** * Generates the HTML link that will pop up a help window for the * requested topic. * * @access public * * @param string $module The name of the current Horde module. * @param string $topic The help topic to be displayed. * * @return string The HTML to create the help link. */ function link($module, $topic) { global $conf, $registry; if (!$conf['user']['online_help']) { return ' '; } if (Help::_useJS()) { $html = Horde::link('', _("Help"), '', '', "open_help_win('$module', '$topic'); return false;"); } else { $url = Horde::url($registry->getParam('webroot', 'horde') . '/services/help/', true); $url = Util::addParameter($url, 'module', $module); $url = Util::addParameter($url, 'topic', $topic); $html = Horde::link($url, '', '', '_hordehelpwin'); } $html .= Horde::img('help.gif', _("Help"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '</a>'; return $html; } /** * Should we use javascript for the popup help windows? * * @access private * * @return boolean True if javascript can be used for the help windows. */ function _useJS() { static $use_js; if (!isset($use_js)) { require_once 'Horde/Browser.php'; $browser = &Browser::singleton(); $use_js = $browser->hasFeature('javascript'); } return $use_js; } /** * Generates the URL that will pop up a help window for the list * of topics. * * @access public * * @param string $module The name of the current Horde module. * * @return string The HTML to create the help link. */ function listLink($module) { global $conf; if (!$conf['user']['online_help']) { return false; } elseif (Help::_useJS()) { return "javascript:open_help_win('$module');"; } else { global $registry; $url = Horde::url($registry->getParam('webroot', 'horde') . '/services/help/', true); $url = Util::addParameter($url, 'module', $module); $url = Util::addParameter($url, 'show', 'topics'); return $url; } } } --- NEW FILE: Registry.php --- <?php require_once 'PEAR.php'; require_once 'Horde.php'; /** @constant HORDE_SESSION_NONE Do not start a session. */ define('HORDE_SESSION_NONE', 1); /** @constant HORDE_SESSION_READONLY Do not write changes to session. */ define('HORDE_SESSION_READONLY', 2); /** * The Registry:: class provides a set of methods for communication * between Horde applications and keeping track of application * configuration information. * * $Horde: framework/Horde/Horde/Registry.php,v 1.207 2004/05/24 16:08:32 jwm Exp $ * * Copyright 1999-2004 Chuck Hagenbuch <chuck@horde.org> * Copyright 1999-2004 Jon Parise <jon@horde.org> * Copyright 1999-2004 Anil Madhavapeddy <anil@recoil.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @author Jon Parise <jon@horde.org> * @author Anil Madhavapeddy <anil@recoil.org> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Framework */ class Registry { /** * Hash storing all of the known services and callbacks. * * @var array $_apiCache */ var $_apiCache = array(); /** * Hash storing all known data types. * * @var array $_typeCache */ var $_typeCache = array(); /** * Hash storing all of the registered interfaces that applications * provide. * * @var array $_interfaces */ var $_interfaces = array(); /** * Hash storing information on each registry-aware application. * * @var array $applications */ var $applications = array(); /** * Stack of in-use applications. * * @var array $_appStack */ var $_appStack = array(); /** * Quick pointer to the current application. * * @var $_currentApp */ var $_currentApp = null; /** * Cache of $prefs objects * * @var array $_prefsCache */ var $_prefsCache = array(); /** * Cache of application configurations. * * @var array $_confCache */ var $_confCache = array(); /** * Returns a reference to the global Registry object, only * creating it if it doesn't already exist. * * This method must be invoked as: $registry = &Registry::singleton() * * @param optional integer $session_flags Any session flags. * * @return object Registry The Horde Registry instance. */ function &singleton($session_flags = 0) { static $registry; if (!isset($registry)) { $registry = new Registry($session_flags); } return $registry; } /** * Create a new registry instance. Should never be called except * by &Registry::singleton(). * * @param optional integer $session_flags Any session flags. * * @access private */ function Registry($session_flags = 0) { /* Import and global Horde's configuration values. */ $this->importConfig('horde'); /* Start a session. */ if ($session_flags & HORDE_SESSION_NONE) { /* Never start a session if the session flags include HORDE_SESSION_NONE. */ $_SESSION = array(); } else { Horde::setupSessionHandler(); @session_start(); if ($session_flags & HORDE_SESSION_READONLY) { /* Close the session immediately so no changes can be made but values are still available. */ @session_write_close(); } } /* Read the registry configuration file. */ require_once HORDE_BASE . '/config/registry.php'; /* Initialize the localization routines and variables. */ require_once 'Horde/NLS.php'; NLS::setLang(); NLS::setTextdomain('horde', HORDE_BASE . '/locale', NLS::getCharset()); String::setDefaultCharset(NLS::getCharset()); /* Stop system if Horde is inactive. */ if ($this->applications['horde']['status'] == 'inactive') { Horde::fatal(_("This system is currently deactivated."), __FILE__, __LINE__); } /* Scan for all APIs provided by each app, and set other * common defaults like templates and graphics. */ foreach (array_keys($this->applications) as $appName) { $app = &$this->applications[$appName]; if (($app['status'] == 'heading') || ($app['status'] == 'inactive') || ($app['status'] == 'admin' && !Auth::isAdmin())) { continue; } if (isset($app['provides'])) { if (is_array($app['provides'])) { foreach ($app['provides'] as $interface) { $this->_interfaces[$interface] = $appName; } } else { $this->_interfaces[$app['provides']] = $appName; } } if (!isset($app['templates']) && isset($app['fileroot'])) { $app['templates'] = $app['fileroot'] . '/templates'; } if (!isset($app['graphics']) && isset($app['webroot'])) { $app['graphics'] = $app['webroot'] . '/graphics'; } } /* Create the global Perms object. */ if (isset($GLOBALS['conf']['datatree']['driver'])) { $GLOBALS['perms'] = &Perms::singleton(); } /* Attach javascript notification listener. */ $notification = &Notification::singleton(); $notification->attach('javascript'); /* Register access key logger for translators. */ if (@$GLOBALS['conf']['log_accesskeys']) { register_shutdown_function(create_function('', 'Horde::getAccessKey(null, null, true);')); } } /** * Return a list of the installed and registered applications. * * @since Horde 2.2 * * @access public * * @param optional array $filter An array of the statuses that should be * returned. Defaults to non-hidden. * @param optional boolean $assoc Associative array with app names as keys. * @param optional integer $perm The permission level to check for in the list. * Defaults to PERMS_SHOW. * * @return array List of apps registered with Horde. If no * applications are defined returns an empty array. */ function listApps($filter = null, $assoc = false, $perm = PERMS_SHOW) { $apps = array(); if (is_null($filter)) { $filter = array('notoolbar', 'active'); } foreach ($this->applications as $app => $params) { if (in_array($params['status'], $filter) && (defined('AUTH_HANDLER') || Auth::isAdmin() || ($GLOBALS['perms']->exists($app) ? $GLOBALS['perms']->hasPermission($app, Auth::getAuth(), $perm) : Auth::getAuth()))) { $assoc ? $apps[$app] = $app : $apps[] = $app; } } return $apps; } /** * Returns all available registry APIs. * * @access public * * @return array The API list. */ function listAPIs() { $apis = array(); foreach (array_keys($this->_interfaces) as $interface) { @list($api, ) = explode('/', $interface); $apis[] = $api; } return array_unique($apis); } /** * Fills the registry's API cache with the available services. * * @access private */ function _fillAPICache() { if (!empty($this->_apiCache)) { return; } $status = array('active', 'notoolbar', 'hidden'); if (Auth::isAdmin()) { $status[] = 'admin'; } $apps = $this->listApps($status); foreach ($apps as $app) { if (!isset($this->_apiCache[$app])) { $_services = $_types = null; @include_once $this->getParam('fileroot', $app) . '/lib/api.php'; if (!isset($_services)) { $this->_apiCache[$app] = array(); } else { $this->_apiCache[$app] = $_services; } if (isset($_types)) { $this->_typeCache = array_merge($_types, $this->_typeCache); } } } } /** * Returns all of the available registry methods, or alternately * only those for a specified API. * * @access public * * @param optional string $api Defines the API for which the methods * shall be returned. * * @return array The method list. */ function listMethods($api = null) { $methods = array(); $this->_fillAPICache(); foreach (array_keys($this->applications) as $app) { if (isset($this->applications[$app]['provides'])) { $provides = $this->applications[$app]['provides']; if (!is_array($provides)) { $provides = array($provides); } } else { $provides = array(); } foreach ($provides as $method) { if (strstr($method, '/')) { if (is_null($api) || (substr($method, 0, strlen($api)) == $api)) { $methods[] = $method; } } elseif (is_null($api) || ($method == $api)) { if (isset($this->_apiCache[$app])) { foreach (array_keys($this->_apiCache[$app]) as $service) { $methods[] = $method . '/' . $service; } } } } } return array_unique($methods); } /** * Returns all of the available registry data types. * * @access public * * @return array The data type list. */ function listTypes() { $this->_fillAPICache(); return $this->_typeCache; } /** * Returns a method's signature. * * @access public * * @param string $method The full name of the method to check for. * * @return array A two dimensional array. The first element contains an * array with the parameter names, the second one the return * type. */ function getSignature($method) { if (!($app = $this->hasMethod($method))) { return; } $this->_fillAPICache(); @list(, $function) = explode('/', $method); if (isset($this->_apiCache[$app][$function]['type']) && isset($this->_apiCache[$app][$function]['args'])) { return array($this->_apiCache[$app][$function]['args'], $this->_apiCache[$app][$function]['type']); } } /** * Determine if a method has been registered with the registry. * * @access public * * @param string $method The full name of the method to check for. * @param optional string $app Only check this application. * * @return mixed The application implementing $method if we have it, * false if the method doesn't exist. */ function hasMethod($method, $app = null) { if (is_null($app)) { @list($interface, $call) = explode('/', $method); if (!empty($this->_interfaces[$method])) { $app = $this->_interfaces[$method]; } elseif (!empty($this->_interfaces[$interface])) { $app = $this->_interfaces[$interface]; } else { return false; } } else { $call = $method; } $this->_fillAPICache(); return !empty($this->_apiCache[$app][$call]) ? $app : false; } /** * Return the hook corresponding to the default package that * provides the functionality requested by the $method * parameter. $method is a string consisting of * "packagetype/methodname". * * @access public * * @param string $method The method to call. * @param optional array $args Arguments to the method. * * @return TODO * Returns PEAR_Error on error. */ function call($method, $args = array()) { @list($interface, $call) = explode('/', $method); if (!empty($this->_interfaces[$method])) { $app = $this->_interfaces[$method]; } elseif (!empty($this->_interfaces[$interface])) { $app = $this->_interfaces[$interface]; } else { return PEAR::raiseError('The method "' . $method . '" is not defined in the Horde Registry.'); } return $this->callByPackage($app, $call, $args); } /** * Output the hook corresponding to the specific package named. * * @access public * * @param string $app The application being called. * @param string $call The method to call. * @param optional array $args Arguments to the method. * * @return TODO * Returns PEAR_Error on error. */ function callByPackage($app, $call, $args = array()) { /* Note: calling hasMethod() makes sure that we've cached * $app's services and included the API file, so we don't try * to do it again explicitly in this method. */ if (!$this->hasMethod($call, $app)) { return PEAR::raiseError(sprintf(_("The method %s is not defined in the API for %s."), $call, $app)); } /* Make sure that the function actually exists. */ $function = '_' . $app . '_' . $call; if (!function_exists($function)) { return PEAR::raiseError('The function implementing ' . $call . ' (' . $function . ') is not defined in ' . $app . '\'s API.'); } $checkPerms = isset($this->_apiCache[$app][$call]['checkperms']) ? $this->_apiCache[$app][$call]['checkperms'] : true; /* Switch application contexts now, if necessary, before * including any files which might do it for us. Return an * error immediately if pushApp() fails. */ $pushed = $this->pushApp($app, $checkPerms); if (is_a($pushed, 'PEAR_Error')) { return $pushed; } $res = call_user_func_array($function, $args); /* If we changed application context in the course of this call, * undo that change now. */ if ($pushed === true) { $this->popApp(); } return $res; } /** * Return the hook corresponding to the default package that * provides the functionality requested by the $method * parameter. $method is a string consisting of * "packagetype/methodname". * * @access public * * @param string $method The method to link to. * @param optional array $args Arguments to the method. * @param optional mixed $extra Extra, non-standard arguments to the * method. * * @return TODO * Returns PEAR_Error on error. */ function link($method, $args = array(), $extra = '') { @list($interface, $call) = explode('/', $method); if (!empty($this->_interfaces[$method])) { $app = $this->_interfaces[$method]; } elseif (!empty($this->_interfaces[$interface])) { $app = $this->_interfaces[$interface]; } else { return PEAR::raiseError('The method "' . $method . '" is not defined in the Horde Registry.'); } return $this->linkByPackage($app, $call, $args, $extra); } /** * Output the hook corresponding to the specific package named. * * @access public * * @param string $app The application being called. * @param string $call The method to link to. * @param optional array $args Arguments to the method. * @param optional mixed $extra Extra, non-standard arguments to the * method. * * @return TODO * Returns PEAR_Error on error. */ function linkByPackage($app, $call, $args = array(), $extra = '') { /* Note: calling hasMethod makes sure that we've cached $app's services and included the API file, so we don't try to do it it again explicitly in this method. */ if (!$this->hasMethod($call, $app)) { return PEAR::raiseError('The method "' . $call . '" is not defined in ' . $app . '\'s API.'); } /* Make sure the link is defined. */ if (empty($this->_apiCache[$app][$call]['link'])) { return PEAR::raiseError('The link ' . $call . ' is not defined in ' . $app . '\'s API.'); } /* Initial link value. */ $link = $this->_apiCache[$app][$call]['link']; /* Fill in html-encoded arguments. */ foreach ($args as $key => $val) { $link = str_replace('%' . $key . '%', htmlentities($val), $link); } if (isset($this->applications[$app]['webroot'])) { $link = str_replace('%application%', $this->getParam('webroot', $app), $link); } /* Replace htmlencoded arguments that haven't been specified with an empty string (this is where the default would be substituted in a stricter registry implementation). */ $link = preg_replace('|%.+%|U', '', $link); /* Fill in urlencoded arguments. */ require_once 'Horde/String.php'; foreach ($args as $key => $val) { $link = str_replace('|' . String::lower($key) . '|', urlencode($val), $link); } /* Append any extra, non-standard arguments. */ if (is_array($extra)) { $extra_args = ''; foreach ($extra as $key => $val) { $extra_args .- '&' . urlencode($key) . '=' . urlencode($val); } } else { $extra_args = $extra; } $link = str_replace('|extra|', $extra_args, $link); /* Replace html-encoded arguments that haven't been specified with an empty string (this is where the default would be substituted in a stricter registry implementation). */ $link = preg_replace('|\|.+\||U', '', $link); return $link; } /** * Replace any %application% strings with the filesystem path to * the application. * * @access public * * @param string $path The application string. * @param optional string $app The application being called. * * @return TODO * Returns PEAR_Error on error. */ function applicationFilePath($path, $app = null) { if (is_null($app)) { $app = $this->_currentApp; } if (!isset($this->applications[$app])) { return PEAR::raiseError(sprintf(_("'%s' is not configured in the Horde Registry."), $app)); } return str_replace('%application%', $this->applications[$app]['fileroot'], $path); } /** * Replace any %application% strings with the web path to the * application. * * @access public * * @param string $path The application string. * @param optional string $app The application being called. * * @return TODO * Returns PEAR_Error on error. */ function applicationWebPath($path, $app = null) { if (!isset($app)) { $app = $this->_currentApp; } return str_replace('%application%', $this->applications[$app]['webroot'], $path); } /** * Set the current application, adding it to the top of the Horde * application stack. If this is the first application to be * pushed, retrieve session information as well. * * pushApp() also reads the application's configuration file and * sets up its global $conf hash. * * @access public * * @param string $app The name of the application to push. * @param boolean $checkPerms Make sure that the current user has * permissions to the application being * loaded. Defaults to true. Should ONLY * be disabled by system scripts (cron jobs, * etc.) and scripts that handle login. * * @return boolean Whether or not the _appStack was modified. * Return PEAR_Error on error. */ function pushApp($app, $checkPerms = true) { if ($app == $this->_currentApp) { return false; } /* Bail out if application is not present or inactive. */ if (!isset($this->applications[$app]) || $this->applications[$app]['status'] == 'inactive' || ($this->applications[$app]['status'] == 'admin' && !Auth::isAdmin())) { Horde::fatal($app . ' is not activated', __FILE__, __LINE__); } /* If permissions checking is requested, return an error if * the current user does not have read perms to the * application being loaded. We allow access: * * - To all admins. * - To all authenticated users if no permission is set on $app. * - To anyone who is allowed by an explicit ACL on $app. */ if ($checkPerms && (!Auth::isAdmin() && ($GLOBALS['perms']->exists($app) ? !$GLOBALS['perms']->hasPermission($app, Auth::getAuth(), PERMS_READ) : !Auth::getAuth()))) { Horde::logMessage(sprintf('User %s does not have READ permission for %s', Auth::getAuth(), $app), __FILE__, __LINE__, PEAR_LOG_DEBUG); return PEAR::raiseError(sprintf(_("User %s is not authorised for %s."), Auth::getAuth(), $this->applications[$app]['name']), 'permission_denied'); } /* Import this application's configuration values. */ $success = $this->importConfig($app); if (is_a($success, 'PEAR_Error')) { return $success; } /* Load preferences after the configuration has been loaded to * make sure the prefs file has all the information it * needs. */ $this->loadPrefs($app); /* Reset the language in case there is a different one * selected in the preferences. */ $language = ''; if (isset($this->_prefsCache[$app]) && isset($this->_prefsCache[$app]->_prefs['language'])) { $language = $this->_prefsCache[$app]->getValue('language'); } NLS::setLang($language); NLS::setTextdomain($app, $this->applications[$app]['fileroot'] . '/locale', NLS::getCharset()); if (isset($this->_prefsCache[$app]) && isset($this->_prefsCache[$app]->_prefs['theme'])) { $theme = $this->_prefsCache[$app]->getValue('theme'); if (!empty($theme) && (@include HORDE_BASE . '/config/themes/' . $theme . '.php') && isset($theme_icons) && in_array($app, $theme_icons)) { $this->applications[$app]['graphics'] .= '/themes/' . $theme; } } /* Once we're sure this is all successful, push the new app * onto the app stack. */ array_push($this->_appStack, $app); $this->_currentApp = $app; return true; } /** * Remove the current app from the application stack, setting the * current app to whichever app was current before this one took * over. * * @access public * * @return string The name of the application that was popped. */ function popApp() { /* Pop the current application off of the stack. */ $previous = array_pop($this->_appStack); /* Import the new active application's configuration values and set the gettext domain and the preferred language. */ $this->_currentApp = count($this->_appStack) ? end($this->_appStack) : null; if ($this->_currentApp) { $this->importConfig($this->_currentApp); $this->loadPrefs($this->_currentApp); $language = $GLOBALS['prefs']->getValue('language'); if (isset($language)) { NLS::setLang($language); } NLS::setTextdomain($this->_currentApp, $this->applications[$this->_currentApp]['fileroot'] . '/locale', NLS::getCharset()); } return $previous; } /** * Return the current application - the app at the top of the * application stack. * * @access public * * @return string The current application. */ function getApp() { return $this->_currentApp; } /** * Reads the configuration values for the given application and * imports them into the global $conf variable. * * @access public * * @param string $app The name of the application. * * @return boolean True on success, PEAR_Error on error. */ function importConfig($app) { /* Don't make config files global $registry themselves. */ global $registry; /* Cache config values so that we don't re-read files on every popApp() call. */ if (!isset($this->_confCache[$app])) { if (!isset($this->_confCache['horde'])) { $conf = array(); $success = @include HORDE_BASE . '/config/conf.php'; if (!$success) { return PEAR::raiseError('Failed to import Horde configuration.'); } /* Initial Horde-wide settings. */ /* Set the error reporting level in accordance with the config settings. */ error_reporting($conf['debug_level']); /* Set the maximum execution time in accordance with the config settings. */ @set_time_limit($conf['max_exec_time']); /* Set the umask according to config settings. */ if (isset($conf['umask'])) { umask($conf['umask']); } } else { $conf = $this->_confCache['horde']; } if ($app !== 'horde') { $success = @include $this->applications[$app]['fileroot'] . '/config/conf.php'; if (!$success) { return PEAR::raiseError('Failed to import application configuration for ' . $app); } } $this->_confCache[$app] = &$conf; } $GLOBALS['conf'] = &$this->_confCache[$app]; return true; } /** * Loads the preferences for the current user for the current * application and imports them into the global $prefs variable. * * @access public * * @param string $app The name of the application. */ function loadPrefs($app = null) { require_once 'Horde/Prefs.php'; if (!isset($app)) { $app = $this->_currentApp; } /* If there is no logged in user, return an empty Prefs:: * object with just default preferences. */ if (!Auth::getAuth()) { $prefs = &Prefs::factory('none', $app, '', '', null, false); $prefs->retrieve(); $GLOBALS['prefs'] = &$prefs; return; } /* Cache prefs objects so that we don't re-load them on every * popApp() call. */ if (!isset($this->_prefsCache[$app])) { global $conf; $prefs = &Prefs::factory($conf['prefs']['driver'], $app, Auth::getAuth(), Auth::getCredential('password')); $prefs->retrieve(); $this->_prefsCache[$app] = &$prefs; } $GLOBALS['prefs'] = &$this->_prefsCache[$app]; } /** * Return the requested configuration parameter for the specified * application. If no application is specified, the value of * $this->_currentApp (the current application) is used. However, * if the parameter is not present for that application, the * Horde-wide value is used instead. If that is not present, we * return null. * * @access public * * @param string $parameter The configuration value to retrieve. * @param optional string $app The application to get the value for. * * @return string The requested parameter, or null if it is not set. */ function getParam($parameter, $app = null) { if (is_null($app)) { $app = $this->_currentApp; } if (isset($this->applications[$app][$parameter])) { $pval = $this->applications[$app][$parameter]; } else { $pval = isset($this->applications['horde'][$parameter]) ? $this->applications['horde'][$parameter] : null; } if ($parameter == 'name') { return _($pval); } else { return $pval; } } /** * Query the initial page for an application - the webroot, if * there is no initial_page set, and the initial_page, if it is * set. * * @access public * * @param optional string $app The name of the application. * * @return string URL pointing to the inital page of the application. * Returns PEAR_Error on error. */ function getInitialPage($app = null) { if (is_null($app)) { $app = $this->_currentApp; } if (!isset($this->applications[$app])) { return PEAR::raiseError(sprintf(_("'%s' is not configured in the Horde Registry."), $app)); } return $this->applications[$app]['webroot'] . '/' . (isset($this->applications[$app]['initial_page']) ? $this->applications[$app]['initial_page'] : ''); } } From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:38 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/IMAP package.xml, NONE, 1.1 Message-ID: <20051014143307.0ACE5102BD9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/IMAP Added Files: package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- $Horde: framework/IMAP/package.xml,v 1.10 2004/04/23 21:49:05 slusarz Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_IMAP</name> <summary>Horde IMAP Utility Classes</summary> <description> The IMAP_Cache:: class facilitates in caching output from the PHP imap extension in the current session. The IMAP_Search:: class performs complex searching of an IMAP mailbox. The IMAP_Sort:: class performs sorting of IMAP mailbox/folder lists. The IMAP_Tree:: builds an internal tree structure from an IMAP/POP3/NNTP server. Classes to help with complex searching of an IMAP mailbox. The built-in PHP search() function only allows IMAPv2 search queries (see RFC 1176). This library allows more complex searches to be created (e.g. OR searches, searching specific headers). </description> <license>LGPL</license> <maintainers> <maintainer> <user>slusarz</user> <name>Michael Slusarz</name> <email>slusarz@bigworm.colorado.edu</email> <role>lead</role> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-06</date> <notes>Initial release as a PEAR package</notes> <provides type="class" name="IMAP_ACL" /> <provides type="class" name="IMAP_ACL_rfc2086" /> <provides type="class" name="IMAP_Admin" /> <provides type="class" name="IMAP_Cache" /> <provides type="class" name="IMAP_Search" /> <provides type="class" name="IMAP_Search_Query" /> <provides type="class" name="IMAP_Sort" /> <provides type="class" name="IMAP_Tree" /> <filelist> <dir role="php" name="IMAP" baseinstalldir="/Horde"> <file name="ACL.php" /> <file name="Admin.php" /> <file name="Cache.php" /> <file name="Search.php" /> <file name="Sort.php" /> <file name="Tree.php" /> <dir role="php" name="ACL"> <file name="rfc2086.php" /> </dir> </dir> </filelist> <deps> <dep type="pkg" rel="has">Horde_Util</dep> <dep type="ext" rel="has" optional="yes">imap</dep> </deps> </release> <changelog> <release> <version>0.0.1</version> <date>2003-07-06</date> <state>alpha</state> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:39 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP/ACL rfc2086.php, NONE, 1.1 Message-ID: <20051014143307.40C50102BD6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP/ACL In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP/ACL Added Files: rfc2086.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: rfc2086.php --- <?php /** * Contains functions related to managing * Access Control Lists on an IMAP server using RFC 2086. * * <pre> * Required parameters: * ==================== * 'username' -- The username for the server connection * 'password' -- The password for the server connection * 'hostspec' -- The hostname or IP address of the server. * DEFAULT: 'localhost' * 'port' -- The server port to which we will connect. * IMAP is generally 143, while IMAP-SSL is generally 993. * DEFAULT: 143 * 'protocol' -- The connection protocol (e.g. 'imap', 'pop3', 'nntp'). * Protocol is one of 'imap/notls' (or only 'imap' if you * have a c-client version 2000c or older), 'imap/ssl', or * 'imap/ssl/novalidate-cert' (for a self-signed certificate). * DEFAULT: 'imap' * </pre> * * $Horde: framework/IMAP/IMAP/ACL/rfc2086.php,v 1.3 2004/04/17 14:24:13 jan Exp $ * * Copyright 2003-2004 Chris Hastie <imp@oak-wood.co.uk> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chris Hastie <imp@oak-wood.co.uk> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_ACL_rfc2086 extends IMAP_ACL { /** * IMAP resource. */ var $_imap; /** * List of server's capabilities, output of * CAPABILITY command. Formated as a hash * array( * *capability* => 1 * ) * * @var array $_caps */ var $_caps = array(); /** * Constructor. * * @access public * * @param array $params Any additional parameters this driver may need. */ function IMAP_ACL_rfc2086($params = array()) { $this->_params = array_merge(array('hostspec' => 'localhost', 'port' => 143, 'protocol' => 'imap'), $params); $this->_caps = $this->_getCapability(); if (is_a($this->_caps, 'PEAR_Error')) { $this->_error = $this->_caps; return; } if (substr($this->_params['protocol'], 0, 4) != 'imap') { /* No point in going any further if it's not an IMAP server. */ $this->_error = PEAR::raiseError(_("Only IMAP servers support shared folders.")); $this->_supported = false; } elseif (!isset($this->_caps['acl'])) { /* If we couldn't get the server's capability, we'll assume ACL is not supported for now. */ $this->_supported = false; } else { $this->_supported = true; } $this->_protected = array($this->_params['username']); $this->_rightsList = array( 'l' => _("List - user can see the folder"), 'r' => _("Read messages"), 's' => _("Mark with Seen/Unseen flags"), 'w' => _("Mark with other flags (e.g. Important/Answered)"), 'i' => _("Insert messages"), 'p' => _("Post to this folder (not enforced by IMAP)"), 'c' => _("Create sub folders"), 'd' => _("Delete and purge messages"), 'a' => _("Administer - set permissions for other users") ); } function _connect() { $this->_imap = @imap_open(sprintf('{%s:%d/%s}', $this->_params['hostspec'], $this->_params['port'], $this->_params['protocol']), $this->_params['username'], $this->_params['password'], OP_HALFOPEN); if (!$this->_imap) { $this->_imap = PEAR::raiseError(imap_last_error()); return false; } return true; } /** * Sets the ACL on an IMAP server * * @access public * * @param string $folder The folder on which to edit the ACL. * @param string $share_user The user to grant rights to. * @param array $acl An array, the keys of which are the * rights to be granted (see RFC 2086). * * @return mixed True on success, PEAR_Error on failure or if * server doesn't support ACLs. */ function createACL($folder, $share_user, $acl) { if (!$this->_connect()) { return $this->_imap; } $acl_str = ''; if (!empty($acl)) { foreach ($acl as $key => $val) { $acl_str .= $key; } } /* Can't call this as @imap_setacl() as suppressing errors leads to imap_errors() returning nothing. */ $result = imap_setacl($this->_imap, $folder, $share_user, $acl_str); if (!$result) { $errors = imap_errors(); if (is_array($errors)) { $error_string = ''; foreach ($errors as $err) { if ($err == 'ACL not available on this IMAP server') { $err .= _("This IMAP server does not support sharing folders."); } $error_string .= $err; } return PEAR::raiseError($error_string); } return PEAR::raiseError(sprintf(_("Couldn't give user '%s' the following rights for the folder '%s': %s"), $share_user, $folder, $acl_str)); } return $result; } /** * Edits an ACL on an IMAP server * * @access public * * @param string $folder The folder on which to edit the ACL. * @param string $share_user The user to grant rights to. * @param array $acl An array, the keys of which are the * rights to be granted (see RFC 2086). * * @return mixed True on success, false on failure unless * server doesn't support ACLs, returns 'no_support' */ function editACL($folder, $share_user, $acl) { return $this->createACL($folder, $share_user, $acl); } /** * Attempts to get the result of a CAPABILITY command to * the current IMAP server. If protocol is imap/ssl, will * only attempt ssl connection with PHP >= 4.3. * * @access private * * @return array An array containing the server's capabilities. */ function _getCapability() { $capabilities = null; $server = $this->_params['hostspec']; $sub_proto = null; if (($pos = strpos($this->_params['protocol'], '/'))) { $sub_proto = substr($this->_params['protocol'], $pos + 1); } if ($sub_proto == 'ssl') { if (version_compare(phpversion(), '4.3.0') >= 0) { $server = $sub_proto . '://' . $server; } else { return PEAR::raiseError(_("Could not retrieve server's capabilities. SSL connections require PHP 4.3 or better")); } } $imap = fsockopen($server, $this->_params['port'], $errno, $errstr, 30); if (!$imap) { return PEAR::raiseError(_("Could not retrieve server's capabilities") . ' - ' . _("Connection failed: ") . $errno . ' : ' . $errstr); return null; } else { $response = fgets($imap, 4096); if (preg_match('/^\*\s+OK/', $response)) { fputs($imap, "x CAPABILITY\r\n"); $response = trim(fgets($imap, 1024)); if (preg_match('/^\*\s+CAPABILITY/', $response)) { $response_array = explode(' ', $response); foreach ($response_array as $var) { if (strstr($var, '=')) { $var2 = explode('=', $var, 2); $capabilities[String::lower($var2[0])][String::lower($var2[1])] = 1; } else { $capabilities[String::lower($var)] = 1; } } } else { fclose ($imap); return PEAR::raiseError(_("Could not retrieve server's capabilities") . ' - ' . _("Unexpected response from server to: ") . '\'x CAPABILITY\' : ' . $response); } } else { fclose ($imap); return PEAR::raiseError(_("Could not retrieve server's capabilities") . ' - ' . _("Unexpected response from server on connection: ") . $response); } fclose ($imap); } return $capabilities; } /** * Attempts to retrieve the existing ACL for a folder from * the current IMAP server. * * @access public * * @param string folder The folder to get the ACL for. * * @return array A hash containing information on the ACL. * <pre> * Array ( * user => Array ( * right => 1 * ) * ) * </pre> */ function getACL($folder) { if (isset($this->_caps['auth']['digest-md5'])) { return $this->_getACL($folder, 'digest-md5'); } elseif (isset($this->_caps['auth']['cram-md5'])) { return $this->_getACL($folder, 'cram-md5'); } else { return $this->_getACL($folder, 'login'); } } /** * Attempts to retrieve the existing ACL for a folder from * the current IMAP server. If protocol is imap/ssl, will * only attempt ssl connection with PHP >= 4.3 * * NB: if Auth_SASL is not installed this function will send * the users password to the IMAP server as plain text!! * * @access private * * @param string folder The folder to get the ACL for. * @param string authMech The authorisation mechanism to use. * One of cram-md5, digest-md5 or login. * * @return array A hash containing information on the ACL * <pre> * Array ( * user => Array ( * right => 1 * ) * ) * </pre> */ function _getACL($folder, $authMech) { global $notification; $have_sasl = false; $returnACL = array(); $server = $this->_params['hostspec']; $sub_proto = null; $txid = 0; /* Silence warnings during check if Auth_SASL module is installed. */ if (@include_once 'Auth/SASL.php') { $have_sasl = true; } $pass = $this->_params['password']; if (($pos = strpos($this->_params['protocol'], '/'))) { $sub_proto = substr($this->_params['protocol'], $pos+1); } if ($sub_proto == 'ssl') { if (version_compare(phpversion(), '4.3.0') >= 0) { $server = $sub_proto . '://' . $server; } else { return PEAR::raiseError(_("Could not retrieve ACL. SSL connections require PHP 4.3 or better")); } } // Quote the folder string if it contains non alpha-numeric // characters if (preg_match('/\W/',$folder)) { $folder = '"' . $folder . '"'; } $imap = fsockopen($server, $this->_params['port'], $errno, $errstr, 30); if (!$imap) { return PEAR::raiseError(_("Could not retrieve ACL") . ' - ' . _("Connection failed: ") . $errno.' : ' . $errstr); } else { $response = fgets($imap, 4096); if (preg_match('/^\*\s+OK/', $response)) { // login using the preferred mechanism // default to login if Auth_SASL is not installed if ($have_sasl && ($authMech == 'cram-md5')) { $login = Auth_SASL::factory('crammd5'); fputs($imap, "$txid AUTHENTICATE CRAM-MD5\r\n"); $challenge = explode(' ', trim(fgets($imap, 1024))); $response = $login->getResponse($_SESSION['imp']['user'], $pass, base64_decode($challenge[1])); fputs($imap, base64_encode($response) . "\r\n"); } elseif($have_sasl && ($authMech == 'digest-md5')) { $login = Auth_SASL::factory('digestmd5'); fputs($imap, "$txid AUTHENTICATE DIGEST-MD5\r\n"); $challenge = explode(' ', trim(fgets($imap, 1024))); $response = $login->getResponse($_SESSION['imp']['user'], $pass, base64_decode($challenge[1]), $_SESSION['imp']['server'], $_SESSION['imp']['base_protocol']); fputs($imap, base64_encode($response) . "\r\n"); $response = explode(' ', trim(fgets($imap, 1024))); $response = base64_decode($response[1]); if (!strstr($response, 'rspauth=')) { fclose($imap); return PEAR::raiseError(_("Could not retrieve ACL") . ' - ' . _("Unexpected response from server to: ") . 'Digest-MD5 response', 'horde.warning'); } fputs($imap, "\r\n"); } else { if (preg_match('/\W/', $pass)) { $pass = addslashes($pass); $pass = '"' . $pass . '"'; } fputs($imap, "$txid LOGIN " . $_SESSION['imp']['user'] . ' ' . $pass . "\r\n"); } $response = trim(fgets($imap, 1024)); if (preg_match("/^$txid\sOK/", $response)) { $txid++; fputs($imap, "$txid GETACL " . $folder . "\r\n"); $response = trim(fgets($imap, 4096)); if (preg_match('/^\*\s+ACL\s+(.*)/i', $response, $matches)) { $res_arr = $this->_atomise($matches[1]); $res_folder = array_shift($res_arr); $is_key = 1; $key = null; foreach ($res_arr as $var) { if ($is_key) { $key = $var; $is_key = 0; } else { $perms = preg_split('//', $var, -1, PREG_SPLIT_NO_EMPTY); foreach ($perms as $p_key => $p_var) { $returnACL[$key][$p_var] = 1; } $is_key = 1; } } } else { fclose($imap); return PEAR::raiseError(_("Could not retrieve ACL") . ' - ' . _("Unexpected response from server to: ") . "'$txid GETACL' : " .$response); } } else { fclose($imap); return PEAR::raiseError(_("Could not retrieve ACL") . ' - ' . _("Unexpected response from server to: ") . 'login : ' . $response); } } else { fclose($imap); return PEAR::raiseError(_("Could not retrieve ACL") . ' - ' . _("Unexpected response from server on connection: ") . $response); } fclose($imap); } return $returnACL; } /** * Can a user edit the ACL for this folder? * * @access public * * @param string $folder The folder name. * @param string $user A user name. * * @return boolean True if $user has permission to edit the ACL on * $folder. */ function canEdit($folder, $user) { /* We can't establish if the user is in a group with the 'a' privilege, so just return true and leave the decision to the server */ return true; } /** * Crudely split a string into 'atoms' * * @access private * * @param string $in The string to split. * * @return array An array of 'atoms'. */ function _atomise($in) { $length = strlen($in); $qt = false; $idx = 0; $out = array(); for ($i = 0; $i < $length; $i++) { $char = substr($in, $i, 1); if (($char == '"') && !$qt) { $qt = true; $idx++; continue; } elseif (($char == ' ') && !$qt) { $idx++; } elseif (($char == '"') && $qt) { $qt = false; $idx++; } else { if (empty($out[$idx])) { $out[$idx] = $char; } else { $out[$idx] .= $char; } } } return $out; } } From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:41 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP ACL.php, NONE, 1.1 Admin.php, NONE, 1.1 Cache.php, NONE, 1.1 Search.php, NONE, 1.1 Sort.php, NONE, 1.1 Tree.php, NONE, 1.1 Message-ID: <20051014143307.4EE0A102C54@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/IMAP/IMAP Added Files: ACL.php Admin.php Cache.php Search.php Sort.php Tree.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: ACL.php --- <?php /** * Contains functions related to managing * Access Control Lists. * * $Horde: framework/IMAP/IMAP/ACL.php,v 1.2 2004/02/19 00:11:20 jan Exp $ * * Copyright 2003-2004 Chris Hastie <imp@oak-wood.co.uk> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chris Hastie <imp@oak-wood.co.uk> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_ACL { /** * Hash containing connection parameters. * * @var array $_params */ var $_params = array(); /** * Boolean indicating if the driver is supported by the server * * @var boolean $_supported */ var $_supported = false; /** * Any PEAR_Error that occured but couldn't be returned directly. * * @var object PEAR_Error $_error */ var $_error = null; /** * Hash containing the list of possible rights and a human * readable description of each * * Array ( * right-id => right-description * ) * * @var array $_rightsList */ var $_rightsList = array(); /** * Array containing user names that can not have their access * rights changed. * * @var boolean $_protected */ var $_protected; /** * Constructor. * * @access public * * @param optional array $params Hash containing connection parameters. */ function IMAP_ACL($params = array()) { $this->_params = $params; } /** * Attempts to retrieve the existing ACL for a folder from * the current IMAP server. If protocol is imap/ssl, will * only attempt ssl connection with PHP >= 4.3 * * @access public * * @param string folder The folder to get the ACL for * * @return array A hash containing information on the ACL * Array ( * user => Array ( * right => 1 * ) * ) */ function getACL($folder) { return false; } /** * Sets the ACL on an IMAP server * * @access public * * @param string $folder The folder on which to edit the ACL * * @param string $share_user The user to grant rights to * * @param array $acl An array, the keys of which are the * rights to be granted (see RFC 2086) * * @return mixed True on success, false on failure unless * server doesn't support ACLs, returns 'no_support' */ function createACL($folder, $share_user, $acl) { return false; } /** * Edits an ACL on an IMAP server * * @access public * * @param string $folder The folder on which to edit the ACL * * @param string $share_user The user to grant rights to * * @param array $acl An array, the keys of which are the * rights to be granted (see RFC 2086) * * @return mixed True on success, false on failure unless * server doesn't support ACLs, returns 'no_support' */ function editACL($folder, $share_user, $acl) { return false; } /** * Can a user edit the ACL for this folder? Returns true if $user * permission to edit the ACL on $folder * * @param string $folder The folder name * * @param string $user A user name * * @returns boolean True if $user has 'a' right */ function canEdit($folder, $user) { return true; } function getRights() { return $this->_rightsList; } function getProtected() { return $this->_protected; } function isSupported() { return $this->_supported; } function getError() { $error = $this->_error; $this->_error = null; return $error; } /** * Attempts to return an ACL instance based on $driver. * * @access public * * @param string $driver The type of concrete ACL subclass * to return. The is based on the acl * source ($driver). The code is * dynamically included. * * @param optional array $params A hash containing any additional * configuration or connection parameters * a subclass might need. * * @return mixed The newly created concrete ACL instance, or false * on error. */ function &factory($driver, $params = array()) { $driver = basename($driver); require_once dirname(__FILE__) . '/ACL/' . $driver . '.php'; $class = 'IMAP_ACL_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return false; } } /** * Attempts to return a reference to a concrete ACL instance * based on $driver. It will only create a new instance if no * ACL instance with the same parameters currently exists. * * This method must be invoked as: $var = &IMAP_ACL::singleton() * * @access public * * @param string $driver The type of concrete ACL subclass * to return. The is based on the acl * source ($driver). The code is * dynamically included. * * @param optional array $params A hash containing any additional * configuration or connection parameters * a subclass might need. * * @return mixed The created concrete ACL instance, or false on error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &IMAP_ACL::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: Admin.php --- <?php /** * The IMAP_Admin:: class allow managing of mailboxes on IMAP servers. * * <pre> * Required parameters: * ==================== * 'admin_user' -- The name of a user with admin privileges. * 'admin_password' -- The password of the adminstrator. * * Optional parameters: * ==================== * 'hostspec' -- The hostname or IP address of the server. * DEFAULT: 'localhost' * 'port' -- The server port to which we will connect. * IMAP is generally 143, while IMAP-SSL is generally 993. * DEFAULT: 143 * 'protocol' -- The connection protocol (e.g. 'imap', 'pop3', 'nntp'). * Protocol is one of 'imap/notls' (or only 'imap' if you * have a c-client version 2000c or older), 'imap/ssl', * or 'imap/ssl/novalidate-cert' (for a self-signed * certificate). * DEFAULT: 'imap' * 'userhierarchy' -- The hierarchy where user mailboxes are stored. * DEFAULT: 'user.' * 'dsn' -- The full IMAP connection string. * If not present, this is built from 'hostspec', 'port' * and 'protocol' parameters. * </pre> * * $Horde: framework/IMAP/IMAP/Admin.php,v 1.3 2004/04/17 14:24:13 jan Exp $ * * Copyright 2004 Jan Schneider <jan@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider <jan@horde.org> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_Admin { /** * Parameter hash. * * @var array $_params */ var $_params; /** * IMAP resource. * * @var resource $_imap */ var $_imap; /** * Constructor. * * @param array $params A hash with all necessary parameters */ function IMAP_Admin($params) { $default_params = array( 'hostspec' => 'localhost', 'port' => '143', 'protocol' => 'imap', 'userhierarchy' => 'user.' ); $this->_params = array_merge($default_params, $params); /* Create DSN string. */ if (!isset($this->_params['dsn'])) { $this->_params['dsn'] = sprintf('{%s:%d/%s}', $this->_params['hostspec'], $this->_params['port'], $this->_params['protocol']); $this->_ref = $this->_params['dsn']; if (!empty($this->_params['folder'])) { $this->_params['dsn'] .= $this->_params['folder']; } } else { $this->_ref = substr($this->_params['dsn'], 0, strpos($this->_params['dsn'], '}') + 1); } } /** * Connects to the IMAP server with the parameters passed to the * constructor. * * @return resource|object An IMAP resource or a PEAR_Error on failure */ function _connect() { if (!isset($this->_imap)) { $this->_imap = @imap_open($this->_ref, $this->_params['admin_user'], $this->_params['admin_password'], OP_HALFOPEN); if (!$this->_imap) { $this->_imap = PEAR::raiseError(imap_last_error(), 'horde.error'); } } return $this->_imap; } /** * Adds a mailbox. * * @param string $mailbox The mailbox name to add. * * @return mixed True on success or a PEAR_Error object on failure. */ function addMailbox($mailbox) { require_once dirname(__FILE__) . '/ACL.php'; if (is_a($imap = $this->_connect(), 'PEAR_Error')) { return $imap; } if (!@imap_createmailbox($imap, $this->_ref . $this->_params['userhierarchy'] . $mailbox)) { return PEAR::raiseError(imap_last_error(), 'horde.warning'); } $params = array('username' => $this->_params['admin_user'], 'password' => $this->_params['admin_password'], 'hostspec' => $this->_params['hostspec'], 'port' => $this->_params['port'], 'protocol' => $this->_params['protocol']); $acl = &IMAP_ACL::factory('rfc2086', $params); $result = $acl->createACL($this->_params['userhierarchy'] . $mailbox, $this->_params['admin_user'], array('l' => true, 'r' => true, 's' => true, 'w' => true, 'i' => true, 'p' => true, 'c' => true, 'd' => true, 'a' => true)); if (is_a($result, 'PEAR_Error')) { return $result; } return true; } /** * Deletes a mailbox. * * @param string $mailbox The mailbox to delete. * * @return mixed True on success or a PEAR_Error object on failure. */ function removeMailbox($mailbox) { if (is_a($imap = $this->_connect(), 'PEAR_Error')) { return $imap; } if (!@imap_deletemailbox($imap, $this->_ref . $this->_params['userhierarchy'] . $mailbox)) { return PEAR::raiseError(imap_last_error(), 'horde.warning'); } return true; } /** * List all mailboxes. * * @return mixed The array of mailboxes, or a PEAR_Error object on failure. */ function listMailboxes() { if (is_a($imap = $this->_connect(), 'PEAR_Error')) { return $imap; } $list = @imap_list($imap, $this->_ref, $this->_params['userhierarchy'] . '%'); if (!$list) { return array(); } $list = preg_replace('/.*' . $this->_params['userhierarchy'] . '(.*)/', '\\1', $list); return $list; } } --- NEW FILE: Cache.php --- <?php /** * The IMAP_Cache:: class facilitates in caching output from the PHP imap * extension in the current session. * * $Horde: framework/IMAP/IMAP/Cache.php,v 1.4 2004/01/01 15:14:17 jan Exp $ * * Copyright 2003-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_Cache { /** * Pointer to the session cache. * * @var array $_cache */ var $_cache; /** * Returns a reference to the global IMAP_Cache object, only creating * it if it doesn't already exist. * * This method must be invoked as: * $imap_cache = &IMAP_Cache::singleton(); * * @access public * * @param optional array $params Any parameters the constructor may need. * * @return object IMAP_Cache The IMAP_Cache instance. */ function &singleton($params = array()) { static $object; if (!isset($object)) { $object = &new IMAP_Cache($params); } return $object; } /** * Constructor * * @access public * * @param optional array $params Not used. */ function IMAP_Cache($params = array()) { if (!isset($_SESSION['imap_cache'])) { $_SESSION['imap_cache'] = array(); } $this->_cache = &$_SESSION['imap_cache']; } /** * Get data from the cache. * * @access public * * @param resource &$imap The IMAP resource stream. * @param string $mailbox The full ({hostname}mailbox) mailbox * name. * @param optional string $key The name of a specific entry to return. * @param optional boolean $check Check for updated mailbox? * * @return mixed The data requested, or false if not available. */ function getCache(&$imap, $mailbox, $key = null, $check = true) { if (isset($this->_cache[$mailbox])) { if (!$check || $this->checkCache($imap, $mailbox)) { $ptr = &$this->_cache[$mailbox]; if (!is_null($key)) { if (isset($ptr['d'][$key])) { return $ptr['d'][$key]; } } else { return $ptr['d']; } } } return false; } /** * Is the cache information up-to-date? * * @access public * * @param resource &$imap The IMAP resource stream. * @param string $mailbox The full ({hostname}mailbox) mailbox * name. * @param optional boolean $update Should the cache ID string be updated? * * @return boolean True if cache information up-to-date, false if not. */ function checkCache(&$imap, $mailbox, $update = false) { if (isset($this->_cache[$mailbox])) { $id = $this->_getCacheID($imap, $mailbox); if ($this->_cache[$mailbox]['k'] == $id) { return true; } elseif ($update) { $this->storeCache($imap, $mailbox); } } elseif ($update) { $this->storeCache($imap, $mailbox); } return false; } /** * Store data in the cache. * * @access public * * @param resource &$imap The IMAP resource stream. * @param string $mailbox The full ({hostname}mailbox) mailbox * name. * @param optional array $values The data to add to the cache. */ function storeCache(&$imap, $mailbox, $values = array()) { $id = $this->_getCacheID($imap, $mailbox); if (!isset($this->_cache[$mailbox])) { $this->_cache[$mailbox] = array('k' => $id, 'd' => $values); } else { $ptr = &$this->_cache[$mailbox]; $ptr['k'] = $id; $ptr['d'] = array_merge($values, $ptr['d']); } } /** * Generate the unique ID string for the mailbox. * * @access private * * @param resource &$imap The IMAP resource stream. * @param string $mailbox The full ({hostname}mailbox) mailbox name. * * @return string A unique string for the current state of the mailbox. */ function _getCacheID(&$imap, $mailbox) { $ob = @imap_status($imap, $mailbox, SA_MESSAGES | SA_RECENT | SA_UNSEEN | SA_UIDNEXT); return implode('|', array($ob->messages, $ob->recent, $ob->unseen, $ob->uidnext)); } } --- NEW FILE: Search.php --- <?php /** * The IMAP_Search:: class performs complex searching of an IMAP mailbox. * * Classes to help with complex searching of an IMAP mailbox. * The built-in PHP search() function only allows IMAPv2 search queries * (see RFC 1176). This library allows more complex searches to be * created (e.g. OR searches, searching specific headers). * * $Horde: framework/IMAP/IMAP/Search.php,v 1.26 2004/04/07 14:43:09 chuck Exp $ * * Copyright 2003-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_Search { /** * The headers cache. * * @var array $_headers */ var $_headers = array(); /** * The results cache. * * @var array $_result */ var $_result = array(); /** * Are we dealing with a POP3 connection? * * @var boolean $_pop3 */ var $_pop3 = false; /** * Internal flag used by searchMailbox(). * * @var integer $_searchflag */ var $_searchflag = 0; /** * Returns a reference to the global IMAP_Search object, * only creating it if it doesn't already exist. * * This method must be invoked as: * $imap_search = &IMAP_Search::singleton(); * * @access public * * @param optional array $params Any parameters the constructor may need. * * @return object IMAP_Search The IMAP_Search instance. */ function &singleton($params = array()) { static $object; if (!isset($object)) { $object = new IMAP_Search($params); } return $object; } /** * Constructor * * @access public * * @param optional array $params A hash containing the following entries: * 'pop3' => boolean (using POP3 * connection?) */ function IMAP_Search($params = array()) { if (isset($params['pop3'])) { $this->_pop3 = $params['pop3']; } } /** * Searches messages by ALL headers (rather than the limited set * provided by imap_search()). * * @access public * * @param object IMAP_Search_Query $query The search query. * @param resource &$imap An IMAP resource stream. * @param string $mbox The name of the mailbox to * search. For POP3, this should * be empty. * * @return array The list of indices that match the search rules in the * current mailbox. * Returns PEAR_Error on error. */ function searchMailbox($query, &$imap, $mbox) { /* Check for IMAP extension. */ if (!Util::extensionExists('imap')) { Horde::fatal(PEAR::raiseError("This function requires 'imap' to be built into PHP."), __FILE__, __LINE__, false); } /* Open to the correct mailbox. */ if (!$this->_pop3) { @imap_reopen($imap, $mbox); } /* Clear the search flag. */ $this->_searchflag = 0; return $this->_searchMailbox($query, $imap, $mbox); } /** * Search the mailbox and sort the results. * * @access public * * @param object IMAP_Search_Query $query The search query. * @param resource &$imap An IMAP resource stream. * @param string $mbox The name of the mailbox to * search. * @param integer $criteria The criteria to sort by * (see imap_sort()). * @param optional integer $dir 1 for reverse sorting. * * @return array The list of indices that match the search rules in the * current mailbox and sorted. * Returns PEAR_Error on error. */ function searchSortMailbox($query, &$imap, $mbox, $criteria, $dir = 0) { $indices = $this->searchMailbox($query, $imap, $mbox); if (is_a($indices, 'PEAR_Error')) { return $indices; } else { $indices_sort = @imap_sort($imap, $sortby, $sortdir, SE_UID); return array_values(array_intersect($indices_sort, $indices)); } } /** * Internal function to search the mailbox. * * @access private */ function _searchMailbox($query, &$imap, $mbox) { $indices = array(); /* Do the simple searches that imap_search() can handle. */ if (($ob = $query->build())) { if ($ob->not) { if (!($indices1 = @imap_search($imap, $ob->flags, SE_UID))) { $indices1 = array(); } if (!($indices2 = @imap_search($imap, $ob->query, SE_UID))) { $indices2 = array(); } $indices = array_diff($indices1, $indices2); } else { if (!($indices = @imap_search($imap, $ob->fullquery, SE_UID))) { $indices = array(); } } /* Set the search flag. */ if ($this->_searchflag == 0) { $this->_searchflag = 1; } } /* Process extended searches. */ if (($extended = $query->extendedSearch())) { $result = $this->_searchPHP($extended, $query->flags(), $imap, $mbox); /* Set the search flag. */ if ($this->_searchflag == 0) { $indices = $result; $this->_searchflag = 1; } else { $indices = array_values(array_intersect($indices, $result)); } } /* Process size searches. */ if (($sizeOb = $query->sizeSearch())) { $overview = @imap_fetch_overview($imap, implode(',', $indices), FT_UID); $func = create_function('$a', 'return ($a ' . $sizeOb->sizeop . ' ' . $sizeOb->size . ');'); $result = array(); foreach ($overview as $val) { if ($func($val->size)) { $result[] = $val->uid; } } $indices = array_values(array_intersect($indices, $result)); } /* Process AND searches now. */ $indices = $this->_doAndOrSearch($query->andSearch(), $imap, $mbox, 'and', $indices); /* Process OR searches now. */ $indices = $this->_doAndOrSearch($query->orSearch(), $imap, $mbox, 'or', $indices); return $indices; } /** * Internal function to search the mailbox. * * @access private */ function _doAndOrSearch($query, &$imap, $mbox, $mode, $indices, $base = false) { if (empty($query)) { return $indices; } foreach ($query as $val) { if (is_a($val, 'IMAP_Search_Query')) { $result = $this->_searchMailbox($val, $imap, $mbox); if ($mode == 'and') { /* If the result is empty in an AND search, we know that the entire AND search will be empty so return immediately. */ if (empty($result)) { return array(); } /* If we have reached this point, and have not performed a search yet, we must use the results as the indices list. Without this check, the indices list will always be empty if an AND search is the first search. */ if (empty($indices) && ($this->_searchflag == 1)) { $indices = $result; $this->_searchflag = 2; } else { $indices = array_values(array_intersect($indices, $result)); } } elseif (!empty($result)) { $indices = array_unique(array_merge($indices, $result)); } } else { $indices = $this->_doAndOrSearch($val, $imap, $mbox, $mode, $indices); } } return $indices; } /** * Use a PHP based functions to perform the search. * * @access private * * @param array $imap_query The search query. * @param string $flags Any additional flags. * @param resource &$imap An IMAP resource stream. * @param string $mbox The name of the search mailbox. * * @return array The list of indices that match. */ function _searchPHP($imap_query, $flags, &$imap, $mbox) { $indices = array(); if (empty($flags)) { $flags = 'ALL'; } if ($this->_pop3) { $mbox = 'POP3'; } $cache_key = $mbox . '|' . $flags; /* We have to use parseMIMEHeaders() to get each header and see if any field matches. Use imap_search() to get the list of message indices or return empty list if no search results. */ if (!isset($this->_result[$cache_key])) { $this->_result[$cache_key] = @imap_search($imap, $flags, SE_UID); } /* If empty message list, return now. */ if (empty($this->_result[$cache_key])) { return array(); } include_once 'Horde/MIME/Structure.php'; if (!isset($this->_headers[$mbox])) { $this->_headers[$mbox] = array(); } /* Get the header/query to search for. */ $query = reset($imap_query); $key = strtolower(key($imap_query)); foreach ($this->_result[$cache_key] as $index) { if (!isset($this->_headers[$mbox][$index])) { $this->_headers[$mbox][$index] = MIME_Structure::parseMIMEHeaders(@imap_fetchheader($imap, $index, FT_UID), null, true); } $h = &$this->_headers[$mbox][$index]; /* We need to do a case insensitive search on text because, for example, e-mail addresses may not be caught correctly (filtering for example@example.com will not catch exAmple@example.com). */ if (isset($h[$key]) && (stristr($h[$key], strval($query)) !== false)) { $indices[] = $index; } } return $indices; } } /** * The IMAP_Search_Object:: class is used to formulate queries to be used * with the IMAP_Search:: class. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_Search_Query { var $_and = array(); var $_extendedSearch = array(); var $_flags = array(); var $_not = false; var $_or = array(); var $_query = null; var $_size = null; var $_sizeop = null; function IMAP_Search_Query() { } /** * Return any extended searches. */ function extendedSearch() { return $this->_extendedSearch; } /** * Return the parameters for a size search. */ function sizeSearch() { if (is_null($this->_size)) { return null; } $ob = &new stdClass; $ob->size = $this->_size; $ob->sizeop = $this->_sizeop; return $ob; } /** * Return any AND searches. */ function andSearch() { return $this->_and; } /** * Return any OR searches. */ function orSearch() { return $this->_or; } /** * Return the flags. */ function flags() { return ((empty($this->_flags)) ? '' : implode(' ', $this->_flags)); } /** * Build the IMAP search query. */ function build() { $search = &new stdClass; $search->not = $this->_not; $search->flags = $this->flags(); if (empty($this->_query)) { if (empty($search->flags)) { return ''; } $search->query = 'ALL'; $search->not = false; } else { if ($search->not && empty($search->flags)) { $search->flags = 'ALL'; } $search->query = $this->_query; } $search->fullquery = $search->flags . ' ' . $search->query; return $search; } /* IMAP search modifiers. */ function _modifiers($ob, $cmd) { if (is_a($ob, 'IMAP_Search_Query')) { $ob = array($ob); } array_push($this->$cmd, $ob); } function imapAnd($ob) { $this->_modifiers($ob, '_and'); } function imapOr($ob) { $this->_modifiers($ob, '_or'); } /* IMAP Search Flags. */ /* There is no need to support the KEYWORD/UNKEYWORD query since the individual keywords have identical functionality. */ function _imapFlags($flag, $cmd) { $cmd = ($flag) ? $cmd : 'UN' . $cmd; $this->_flags[] = $cmd; } function answered($flag) { $this->_imapFlags($flag, 'ANSWERED'); } function deleted($flag) { $this->_imapFlags($flag, 'DELETED'); } function flagged($flag) { $this->_imapFlags($flag, 'FLAGGED'); } function seen($flag) { $this->_imapFlags($flag, 'SEEN'); } function recent($flag) { $this->_imapFlags(true, (($flag) ? 'RECENT' : 'OLD')); } function imapNew() { $this->_imapFlags(true, 'NEW'); } /* IMAP Header Search. */ function header($header, $query, $not = false) { $header = ucfirst(rtrim($header, ':')); $stdHdrs = array('To', 'Cc', 'From', 'Subject'); if ($query != '') { if (in_array($header, $stdHdrs)) { $this->_query = String::upper($header) . ' "' . addslashes($query) . '"'; } else { $this->_extendedSearch[$header] = $query; } $this->_not = $not; } } /* IMAP Date Search. */ function _imapDate($day, $month, $year, $cmd) { $this->_query = $cmd . ' ' . date("d-M-y", mktime(0, 0, 0, $month, $day, $year)); } function before($day, $month, $year) { $this->_imapDate($day, $month, $year, 'BEFORE'); } function since($day, $month, $year) { $this->_imapDate($day, $month, $year, 'SINCE'); } function on($day, $month, $year) { $this->_imapDate($day, $month, $year, 'ON'); } /* IMAP Text searches. */ function body($query, $not = false) { $this->_query = 'BODY "' . $query . '"'; $this->_not = $not; } function text($query, $not = false) { $this->_query = 'TEXT "' . $query . '"'; $this->_not = $not; } /* IMAP Size searches. */ function size($size, $operator) { $this->_size = $size; $this->_sizeop = $operator; } } --- NEW FILE: Sort.php --- <?php /** * IMAP_Sort provides functions for sorting lists of IMAP mailboxes/folders. * * $Horde: framework/IMAP/IMAP/Sort.php,v 1.2 2004/05/27 14:41:59 jan Exp $ * * Copyright 2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_IMAP */ class IMAP_Sort { /** * The delimiter character to use. * * @var string $_delimiter */ var $_delimiter = '/'; /** * Should we sort with 'INBOX' at the front of the list? * * @var boolean $_sortinbox */ var $_sortinbox; /** * Constructor. * * @access public * * @param string $delimiter The delimiter used to separate mailboxes. */ function IMAP_Sort($delimiter) { $this->_delimiter = $delimiter; } /** * Sort a list of mailboxes (by value). * * @access public * * @param array &$mbox The list of mailboxes to sort. * @param optional boolean $inbox When sorting, always put 'INBOX' at * the head of the list? */ function sortMailboxes(&$mbox, $inbox = true) { $this->_sortinbox = $inbox; usort($mbox, array($this, '_mbox_cmp')); } /** * Sort a list of mailboxes (by key). * * @access public * * @param array &$mbox The list of mailboxes to sort, with * the keys being the mailbox names. * @param optional boolean $inbox When sorting, always put 'INBOX' at * the head of the list? */ function sortMailboxesByKey(&$mbox, $inbox = true) { $this->_sortinbox = $inbox; uksort($mbox, array($this, '_mbox_cmp')); } /** * Hierarchical folder sorting function (used with usort()). * * @access private * * @param string $a Comparison item #1. * @param string $b Comparison item #2. * * @return integer See usort(). */ function _mbox_cmp($a, $b) { /* Always return INBOX as "smaller". */ if ($this->_sortinbox) { if (String::upper($a) == 'INBOX') { return -1; } elseif (String::upper($b) == 'INBOX') { return 1; } } $a_parts = explode($this->_delimiter, $a); $b_parts = explode($this->_delimiter, $b); $iMax = min(count($a_parts), count($b_parts)); for ($i = 0; $i < $iMax; $i++) { if ($a_parts[$i] != $b_parts[$i]) { return strnatcasecmp($a_parts[$i], $b_parts[$i]); } } return count($a_parts) - count($b_parts); } } --- NEW FILE: Tree.php --- <?php /* Constants for mailboxElt attributes. * All versions of c-client (c-client/mail.h) define these constants: * LATT_NOINFERIORS (long) 0x1 = 1 * LATT_NOSELECT (long) 0x2 = 2 * LATT_MARKED (long) 0x4 = 4 * LATT_UNMARKED (long) 0x8 = 8 * * Newer versions of c-client (imap-2002 and greater) define these constants: * LATT_REFERRAL (long) 0x10 = 16 * LATT_HASCHILDREN (long) 0x20 = 32 * LATT_HASNOCHILDREN (long) 0x40 = 64 * ...but these constant names do not appear in PHP until PHP 4.3.5 and 5.0. */ if (!defined('LATT_HASCHILDREN')) { @define('LATT_REFERRAL', 16); @define('LATT_HASCHILDREN', 32); @define('LATT_HASNOCHILDREN', 64); } [...1594 lines suppressed...] * * @param array &$mbox The list of mailboxes to sort. * @param optional boolean $key Are the list of mailbox names in the key * field of $mbox? */ function _sortList(&$mbox, $key = false) { if (is_null($this->_imap_sort)) { require_once 'Horde/IMAP/Sort.php'; $this->_imap_sort = &new IMAP_Sort($this->_delimiter); } if ($key) { $this->_imap_sort->sortMailboxesByKey($mbox, ($this->_mode == IMAPTREE_MODE_MAIL)); } else { $this->_imap_sort->sortMailboxes($mbox, ($this->_mode == IMAPTREE_MODE_MAIL)); } } } From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:42 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Identity Identity.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143307.4309D102C51@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Identity In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Identity Added Files: Identity.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Identity.php --- <?php /** * This class provides an interface to all identities a user might * have. Its methods take care of any site-specific restrictions * configured in prefs.php and conf.php. * * $Horde: framework/Identity/Identity.php,v 1.42 2004/05/08 21:07:40 jan Exp $ * * Copyright 2001-2004 Jan Schneider <jan@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider <jan@horde.org> * @version $Revision: 1.1 $ * @since Horde 1.3.5 * @package Horde_Identity */ class Identity { /** * Array containing all the user's identities. * @var array $identities */ var $_identities = array(); /** * A pointer to the user's standard identity. * This one is used by the methods returning values * if no other one is specified. * @var integer $default */ var $_default = 0; /** * The user whose identities these are. * @var string $user */ var $_user = null; /** * Array containing all of the properties in this identity. * @var array $properties */ var $_properties = array('id', 'fullname', 'from_addr'); /** * Reference to the prefs object that this Identity points to. * @var object Prefs $prefs */ var $_prefs; /** * Reads all the user's identities from the prefs object or builds * a new identity from the standard values given in prefs.php. * * @param optional string $user If specified, we read another user's * identities instead of the current user. */ function Identity($user = null) { $this->_user = $user; if (is_null($user) || $user == Auth::getAuth()) { $this->_prefs = &$GLOBALS['prefs']; } else { $this->_prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'], $GLOBALS['registry']->getApp(), $user, '', null, false); $this->_prefs->retrieve(); } $this->_default = $this->_prefs->getValue('default_identity'); $this->_identities = @unserialize($this->_prefs->getValue('identities')); if (is_array($this->_identities)) { String::convertCharset($this->_identities, $this->_prefs->getCharset()); } if (!is_array($this->_identities) || (count($this->_identities) <= 0)) { foreach ($this->_properties as $key) { $identity[$key] = $this->_prefs->getValue($key); } $identity['id'] = _("Default Identity"); $this->_identities[] = $identity; } } /** * Saves all identities in the prefs backend. */ function save() { if (is_array($this->_identities)) { String::convertCharset($this->_identities, NLS::getCharset(), $this->_prefs->getCharset()); } $this->_prefs->setValue('identities', serialize($this->_identities)); $this->_prefs->setValue('default_identity', $this->_default); } /** * Adds a new empty identity to the array of identities. * * @return integer The pointer to the created identity */ function add() { $this->_identities[] = array(); return count($this->_identities) - 1; } /** * Removes an identity from the array of identities. * * @param integer $identity The pointer to the identity to be removed * * @return array The removed identity */ function delete($identity) { $deleted = array_splice($this->_identities, $identity, 1); foreach ($this->_identities as $id => $null) { if ($this->setDefault($id)) { break; } } $this->save(); return $deleted; } /** * Returns a pointer to the current default identity. * * @return integer The pointer to the current default identity */ function getDefault() { return $this->_default; } /** * Sets the current default identity. * If the identity doesn't exist, the old default identity stays the same. * * @param integer $identity The pointer to the new default identity * * @return boolean True on success, false on failure */ function setDefault($identity) { if (isset($this->_identities[$identity])) { $this->_default = $identity; return true; } else { return false; } } /** * Returns a property from one of the identities. If this value doesn't * exist or is locked, the property is retrieved from the prefs backend. * * @param string $key The property to retrieve. * @param integer $identity (optional) The identity to retrieve the * property from. * * @return mixed The value of the property. */ function getValue($key, $identity = null) { if (!isset($identity) || !isset($this->_identities[$identity])) { $identity = $this->_default; } if (!isset($this->_identities[$identity][$key]) || $this->_prefs->isLocked($key)) { $val = $this->_prefs->getValue($key); } else { $val = $this->_identities[$identity][$key]; } return $val; } /** * Returns an array with the specified property from all existing * identities. * * @param string $key The property to retrieve. * * @return array The array with the values from all identities */ function getAll($key) { $list = array(); foreach ($this->_identities as $identity => $null) { $list[$identity] = $this->getValue($key, $identity); } return $list; } /** * Sets a property with a specified value. * * @param string $key The property to set * @param mixed $val The value to which the property should be set * @param integer $identity (optional) The identity to set the property in * * @return boolean True on success, false on failure (property was locked) */ function setValue($key, $val, $identity = null) { if (!isset($identity)) { $identity = $this->_default; } if (!$this->_prefs->isLocked($key)) { $this->_identities[$identity][$key] = $val; return true; } else { return false; } } /** * Returns true if all properties are locked and therefore nothing * in the identities can be changed. * * @return boolean True if all properties are locked, false otherwise */ function isLocked() { foreach ($this->_properties as $key) { if (!$this->_prefs->isLocked($key)) { return false; } } return true; } /** * Returns true if the given address belongs to one of the identities. * * @param string $key The identity key to search. * @param string $value The value to search for in $key. * * @return boolean True if the $value was found in $key. */ function hasValue($key, $valueA) { $list = $this->getAll($key); foreach ($list as $valueB) { if (strpos(String::lower($valueA), String::lower($valueB)) !== false) { return true; } } return false; } /** * Verifies and sanitizes all identity properties. * * @param integer $identity (optional) The identity to verify. * * @return bool|object True if the properties are valid or a PEAR_Error * with an error description otherwise. */ function verify($identity = null) { if (!isset($identity)) { $identity = $this->_default; } if (!$this->getValue('id', $identity)) { $this->setValue('id', _("Unnamed"), $identity); } /* RFC 2822 [3.2.5] does not allow the '\' character to be used in the personal portion of an e-mail string. */ if (strpos($this->getValue('fullname', $identity), '\\') !== false) { return PEAR::raiseError(_("You can not have the '\\' character in your full name.")); } return true; } /** * Attempts to return a concrete Identity instance based on $type. * * @param mixed $type The type of concrete Identity subclass to return. * This is based on the storage driver ($type). The * code is dynamically included. If $type is an array, * then we will look in $type[0]/lib/Identity/ for * the subclass implementation named $type[1].php. * @param string $user (optional) If specified, we read another user's * identities instead of the current user. * * @return object Identity The newly created concrete Identity instance, * or false on an error. */ function &factory($type = 'none', $user = null) { if (is_array($type)) { $app = $type[0]; $type = $type[1]; } /* Return a base Identity object if no driver is specified. */ $type = basename($type); if (empty($type) || (strcmp($type, 'none') == 0)) { return $ret = &new Identity($user); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Identity/' . $type . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Identity/' . $type . '.php')) { require_once dirname(__FILE__) . '/Identity/' . $type . '.php'; } else { @include_once 'Horde/Identity/' . $type . '.php'; } $class = 'Identity_' . $type; if (class_exists($class)) { return $ret = &new $class($user); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Identity instance * based on $type. It will only create a new instance if no * Identity instance with the same parameters currently exists. * * This should be used if multiple types of identities (and, thus, * multiple Identity instances) are required. * * This method must be invoked as: $var = &Identity::singleton() * * @param mixed $type The type of concrete Identity subclass to return. * This is based on the storage driver ($type). The * code is dynamically included. If $type is an array, * then we will look in $type[0]/lib/Identity/ for * the subclass implementation named $type[1].php. * @param string $user (optional) If specified, we read another user's * identities instead of the current user. * * @return object Identity The concrete Identity reference, or false on an * error. */ function &singleton($type = 'none', $user = null) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($type, $user)); if (!isset($instances[$signature])) { $instances[$signature] = &Identity::factory($type, $user); } return $instances[$signature]; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/Identity/package.xml,v 1.7 2004/01/16 01:12:27 jan Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_Identity</name> <summary>Horde Identity API</summary> <description> The Identity:: class provides an interface to all identities a user might have. </description> <license>LGPL</license> <maintainers> <maintainer> <user>yunosh</user> <role>lead</role> <name>Jan Schneider</name> <email>jan@horde.org</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-05</date> <notes>Initial Release.</notes> <filelist> <file baseinstalldir="/Horde" role="php" name="Identity.php" /> </filelist> <provides type="class" name="Identity" /> <deps> <dep type="ext" rel="has" optional="yes">gettext</dep> <dep type="pkg" rel="has">Horde_Auth</dep> <dep type="pkg" rel="has">Horde_Framework</dep> <dep type="pkg" rel="has">Horde_Prefs</dep> <dep type="pkg" rel="has">Horde_Util</dep> </deps> </release> <changelog> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-05</date> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:43 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image Image.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143307.761B9102C55@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Image Added Files: Image.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Image.php --- <?php require_once 'Horde/Util.php'; /** * This class defines the Horde_Image:: API, and also provides some * utility functions, such as generating highlights of a color. * * $Horde: framework/Image/Image.php,v 1.37 2004/05/18 14:53:56 mdjukic Exp $ * * Copyright 2002-2004 Chuck Hagenbuch <chuck@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Image */ class Horde_Image { /** * Current color. * * @var string $_rgb */ var $_rgb = 'ff0000'; /** * Background color. * * @var string $_background */ var $_background = 'white'; /** * Observers. * * @var array $_observers */ var $_observers = array(); /** * Capabilites of this driver. * * @var array $_capabilities */ var $_capabilities = array(); /** * The current image data. * * @var string $_data */ var $_data = ''; /** * The current image id. * * @var string $_id */ var $_id = ''; /** * The current height/width of the image data. * * @var integer $_height * @var integer $_width */ var $_width = 0; var $_height = 0; /** * A directory for temporary files. * * @var string $_tmpdir */ var $_tmpdir; /** * Constructor. * * @access public * * @param string $rgb The base color for generated pixels/images. */ function Horde_Image($params) { $this->_tmpdir = $params['temp']; if (isset($params['width'])) { $this->_width = $params['width']; } if (isset($params['height'])) { $this->_height = $params['height']; } if (!empty($params['rgb'])) { $this->_rgb = $params['rgb']; } $this->_background = isset($params['background']) ? $params['background'] : 'white'; } function getCapabilites() { return $this->_capabilities; } function hasCapability($capability) { return in_array($capability, $this->_capabilities); } function getLink($url, $title = '') { return Horde::img($url, $title, '', ''); } /** * Generate image headers. */ function headers() { header('Content-type: ' . $this->getContentType()); } /** * Calculate a lighter (or darker) version of a color. * * @static * * @access public * * @param string $color An HTML color, e.g.: #ffffcc. * @param optional string $factor TODO * * @return string A modified HTML color. */ function modifyColor($color, $factor = 0x11) { $r = hexdec(substr($color, 1, 2)) + $factor; $g = hexdec(substr($color, 3, 2)) + $factor; $b = hexdec(substr($color, 5, 2)) + $factor; $r = min(max($r, 0), 255); $g = min(max($g, 0), 255); $b = min(max($b, 0), 255); return '#' . str_pad(dechex($r), 2, '0', STR_PAD_LEFT) . str_pad(dechex($g), 2, '0', STR_PAD_LEFT) . str_pad(dechex($b), 2, '0', STR_PAD_LEFT); } /** * Calculate a more intense version of a color. * * @static * * @param string $color An HTML color, e.g.: #ffffcc. * @param optional string $factor TODO * * @return string A more intense HTML color. */ function moreIntenseColor($color, $factor = 0x11) { $r = hexdec(substr($color, 1, 2)); $g = hexdec(substr($color, 3, 2)); $b = hexdec(substr($color, 5, 2)); if ($r >= $g && $r >= $b) { $g = $g / $r; $b = $b / $r; $r += $factor; $g = floor($g * $r); $b = floor($b * $r); } elseif ($g >= $r && $g >= $b) { $r = $r / $g; $b = $b / $g; $g += $factor; $r = floor($r * $g); $b = floor($b * $g); } else { $r = $r / $b; $g = $g / $b; $b += $factor; $r = floor($r * $b); $g = floor($g * $b); } $r = min(max($r, 0), 255); $g = min(max($g, 0), 255); $b = min(max($b, 0), 255); return '#' . str_pad(dechex($r), 2, '0', STR_PAD_LEFT) . str_pad(dechex($g), 2, '0', STR_PAD_LEFT) . str_pad(dechex($b), 2, '0', STR_PAD_LEFT); } function getRGB($colorname) { require_once dirname(__FILE__) . '/Image/rgb.php'; return isset($GLOBALS['horde_image_rgb_colors'][$colorname]) ? $GLOBALS['horde_image_rgb_colors'][$colorname] : array(0, 0, 0); } function getHexColor($colorname) { require_once dirname(__FILE__) . '/Image/rgb.php'; if (isset($GLOBALS['horde_image_rgb_colors'][$colorname])) { list($r, $g, $b) = $GLOBALS['horde_image_rgb_colors'][$colorname]; return '#' . str_pad(dechex(min($r, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(min($g, 255)), 2, '0', STR_PAD_LEFT) . str_pad(dechex(min($b, 255)), 2, '0', STR_PAD_LEFT); } else { return 'black'; } } /** * Draw a shaped point at the specified (x,y) point. Useful for * scatter diagrams, debug points, etc. Draws squares, circles, * diamonds, and triangles. * * @param integer $x The x coordinate of the point to brush. * @param integer $y The y coordinate of the point to brush. * @param optional string $color The color to brush the point with. * @param optional string $shape What brush to use? Defaults to a square. */ function brush($x, $y, $color = 'black', $shape = 'square') { switch ($shape) { case 'triangle': $verts[0] = array('x' => $x + 3, 'y' => $y + 3); $verts[1] = array('x' => $x, 'y' => $y - 3); $verts[2] = array('x' => $x - 3, 'y' => $y + 3); $this->polygon($verts, $color, $color); break; case 'circle': $this->circle($x, $y, 3, $color, $color); break; case 'diamond': $verts[0] = array('x' => $x - 3, 'y' => $y); $verts[1] = array('x' => $x, 'y' => $y + 3); $verts[2] = array('x' => $x + 3, 'y' => $y); $verts[3] = array('x' => $x, 'y' => $y - 3); $this->polygon($verts, $color, $color); break; case 'square': default: $this->rectangle($x - 2, $y - 2, 4, 4, $color, $color); break; } } /** * Add an observer to this image. The observer will be notified * when the image's changes. */ function addObserver($method, &$object) { $this->_observers[] = array($method, &$object); } /** * Let observers know that something happened worth acting on. */ function notifyObservers() { for ($i = 0; $i < count($this->_observers); ++$i) { $obj = &$this->_observers[$i][1]; $method = $this->_observers[$i][0]; $obj->$method($this); } } /** * Reset the image data. */ function reset() { $this->_data = ''; $this->_id = ''; $this->_width = null; $this->_height = null; $this->_background = 'white'; } /** * Get the height and width of the current image data. * * @return array An hash with 'width' containing the width, * 'height' containing the height of the image. */ function getDimensions() { $tmp = $this->toFile(); $details = @getimagesize($tmp); unlink($tmp); return array('width' => $details[0], 'height' => $details[1]); } /** * Load the image data from a string. * * @access public * * @params string $id An arbitrary id for the image. * @params string $image_data The data to use for the image. */ function loadString($id, $image_data) { if ($id != $this->_id) { $this->reset(); $this->_data = $image_data; $this->_id = $id; } } /** * Load the image data from a file. * * @access public * * @params string $filename The full path and filename to the file to load * the image data from. The filename will also be * used for the image id. * * @return mixed PEAR Error if file does not exist or could not be loaded * otherwise NULL if successful or already loaded. */ function loadFile($filename) { if ($filename != $this->_id) { $this->reset(); if (!file_exists($filename)) { return PEAR::raiseError('The image file ' . $image . ' does not exist.'); } if ($this->_data = file_get_contents($filename)) { $this->_id = $filename; } else { return PEAR::raiseError('Could not load the image file ' . $image); } } } function toFile($data = false) { $tmp = Util::getTempFile('img', false, $this->_tmpdir); $fp = @fopen($tmp, 'wb'); fwrite($fp, $data ? $data : $this->raw()); fclose($fp); return $tmp; } /** * Display the current image. */ function display() { $this->headers(); echo $this->raw(); } /** * Return the raw data for this image. * * @return string The raw image data. */ function raw() { return $this->_data; } /** * Get an x,y pair on circle, assuming center is 0,0. * * @access private * * @param double $degrees The degrees of arc to get the point for. * @param int $diameter The diameter of the circle. * * @return array (x coordinate, y coordinate) of the point. */ function _circlePoint($degrees, $diameter) { // Avoid problems with doubles. $degrees += 0.0001; return array(cos(deg2rad($degrees)) * ($diameter / 2), sin(deg2rad($degrees)) * ($diameter / 2)); } /** * Get point coordinates at the limits of an arc. Only valid for * angles ($end - $start) <= 45 degrees. * * @access private * * @param integer $r The radius of the arc. * @param integer $start The starting angle. * @param integer $end The ending angle. * * @return array The start point, end point, and anchor point. */ function _arcPoints($r, $start, $end) { // Start point. $pts['x1'] = $r * cos(deg2rad($start)); $pts['y1'] = $r * sin(deg2rad($start)); // End point. $pts['x2'] = $r * cos(deg2rad($end)); $pts['y2'] = $r * sin(deg2rad($end)); // Anchor point. $a3 = ($start + $end) / 2; $r3 = $r / cos(deg2rad(($end - $start) / 2)); $pts['x3'] = $r3 * cos(deg2rad($a3)); $pts['y3'] = $r3 * sin(deg2rad($a3)); return $pts; } /** * Attempts to return a concrete Horde_Image instance based on * $driver. * * @param mixed $driver The type of concrete Horde_Image subclass to return. * This is based on the storage driver ($driver). The * code is dynamically included. If $driver is an array, * then we will look in $driver[0]/lib/Image/ for * the subclass implementation named $driver[1].php. * @param array $params (optional) A hash containing any additional * configuration or connection parameters a subclass * might need. * * @return object Horde_Image The newly created concrete Horde_Image instance, * or false on an error. */ function &factory($driver, $params = array()) { if (is_array($driver)) { list($app, $driver) = $driver; } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Image/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Image/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Image/' . $driver . '.php'; } else { @include_once 'Horde/Image/' . $driver . '.php'; } $class = 'Horde_Image_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Horde_Image * instance based on $driver. It will only create a new instance * if no Horde_Image instance with the same parameters currently * exists. * * This should be used if multiple types of image renderers (and, * thus, multiple Horde_Image instances) are required. * * This method must be invoked as: $var = &Horde_Image::singleton() * * @param mixed $driver The type of concrete Horde_Image subclass to return. * This is based on the storage driver ($driver). The * code is dynamically included. If $driver is an array, * then we will look in $driver[0]/lib/Image/ for * the subclass implementation named $driver[1].php. * @param array $params (optional) A hash containing any additional * configuration or connection parameters a subclass * might need. * * @return object Horde_Image The concrete Horde_Image reference, or false * on an error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Horde_Image::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/Image/package.xml,v 1.9 2004/05/06 21:43:05 chuck Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_Image</name> <summary>Horde Image API</summary> <description>This package provides an Image utility API, with backends for: * GD * GIF * PNG * SVG * SWF * ImageMagick convert command line tool </description> <license>LGPL</license> <maintainers> <maintainer> <user>chuck</user> <role>lead</role> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> </maintainer> <maintainer> <user>mac</user> <role>developer</role> <name>Mike Cochrane</name> <email>mike@graftonhall.co.nz</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2002-09-24</date> <notes>Initial release as a PEAR package</notes> <filelist> <file role="php" baseinstalldir="/Horde" name="Image.php" /> <dir name="Image" baseinstalldir="/Horde" role="php"> <file name="gd.php" /> <file name="im.php" /> <file name="png.php" /> <file name="rgb.php" /> <file name="svg.php" /> <file name="swf.php" /> </dir> <dir role="test" name="tests"> <file name="gd.php" /> <file name="im.php" /> <file name="svg.php" /> <file name="swf.php" /> </dir> </filelist> </release> <deps> <dep type="php" rel="ge" version="4.2.0+" /> <dep type="pkg" rel="has">Horde_Util</dep> <dep type="pkg" rel="has" optional="yes">XML_SVG</dep> </deps> </package> From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:46 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image/Image/Decorator border.php, NONE, 1.1 watermark.php, NONE, 1.1 Message-ID: <20051014143307.A71E2102BE0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/Image/Decorator In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Image/Image/Decorator Added Files: border.php watermark.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: border.php --- <?php /** * Image border decorator for the Horde_Image package. * * $Horde: framework/Image/Image/Decorator/border.php,v 1.1 2004/05/04 21:36:10 chuck Exp $ * * @author Chuck Hagenbuch <chuck@horde.org> * @package Horde_Image */ class Horde_Image_Decorator_border { /** * Valid parameters for border decorators: * * padding - Pixels from the image edge that the border will start. * borderColor - Border color. Defaults to black. * fillColor - Color to fill the border with. Defaults to white. * lineWidth - Border thickness, defaults to 1 pixel. * roundWidth - Width of the corner rounding. Defaults to none. * * @var array $_params */ var $_params = array('padding' => 0, 'borderColor' => 'black', 'fillColor' => 'white', 'lineWidth' => 1, 'roundWidth' => 0); /** * Draw the border. * * This draws the configured border to the provided image. Beware, * that every pixel inside the border clipping will be overwritten * with the background color. * * @access public */ function draw(&$image) { $o = $this->_params; $d = $image->getDimensions(); $x = $o['padding']; $y = $o['padding']; $width = $d['width'] - (2 * $o['padding']); $height = $d['height'] - (2 * $o['padding']); if ($o['roundWidth'] > 0) { $image->roundedRectangle($x, $y, $width, $height, $o['roundWidth'], $o['borderColor'], $o['fillColor']); } else { $image->rectangle($x, $y, $width, $height, $o['borderColor'], $o['fillColor']); } } } --- NEW FILE: watermark.php --- <?php /** * Watermark decorator for the Horde_Image package. * * $Horde: framework/Image/Image/Decorator/watermark.php,v 1.3 2004/05/04 21:35:38 chuck Exp $ * * @author Chuck Hagenbuch <chuck@horde.org> * @package Horde_Image */ class Horde_Image_Decorator_watermark { /** * Draw the watermark. * * @access public */ function draw(&$image) { } } From cvs at intevation.de Fri Oct 14 16:33:08 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:48 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image/tests .htaccess, NONE, 1.1 gd.php, NONE, 1.1 im.php, NONE, 1.1 svg.php, NONE, 1.1 swf.php, NONE, 1.1 Message-ID: <20051014143308.0373E102BDD@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Image/tests Added Files: .htaccess gd.php im.php svg.php swf.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: .htaccess --- Allow from all --- NEW FILE: gd.php --- <?php /** * @package Horde_Image */ require_once dirname(__FILE__) . '/../Image/gd.php'; $image = &new Horde_Image_gd(array('height' => 400, 'width' => 400)); $image->rectangle(30, 30, 100, 60, 'black', 'yellow'); $image->roundedRectangle(30, 30, 100, 60, 15, 'black', 'red'); $image->circle(30, 30, 30, 'black', 'blue'); $image->polygon(array(array('x' => 30, 'y' => 50), array('x' => 40, 'y' => 60), array('x' => 50, 'y' => 40)), 'green', 'green'); $image->arc(100, 100, 100, 0, 70, 'black', 'green'); $image->brush(100, 300, 'red', 'circle'); $image->line(0, 200, 500, 200, 'darkblue', 2); $image->line(200, 200, 200, 500, 'darkblue', 2); $image->polyline(array(array('x' => 130, 'y' => 150), array('x' => 140, 'y' => 160), array('x' => 150, 'y' => 140)), 'black', 5); $image->text('Hello World', 100, 100, 'arial', 'purple'); $image->display(); --- NEW FILE: im.php --- <?php /** * @package Horde_Image */ require_once dirname(__FILE__) . '/../Image/im.php'; $GLOBALS['conf']['image']['convert'] = trim(`which convert`); $image = &new Horde_Image_im(array('height' => 400, 'width' => 400)); $image->rectangle(30, 30, 100, 60, 'black', 'yellow'); $image->roundedRectangle(30, 30, 100, 60, 15, 'black', 'red'); $image->circle(30, 30, 30, 'black', 'blue'); $image->polygon(array(array('x' => 30, 'y' => 50), array('x' => 40, 'y' => 60), array('x' => 50, 'y' => 40)), 'green', 'green'); $image->arc(100, 100, 100, 0, 70, 'black', 'green'); $image->brush(100, 300, 'red', 'circle'); $image->line(0, 200, 500, 200, 'darkblue', 2); $image->line(200, 200, 200, 500, 'darkblue', 2); $image->polyline(array(array('x' => 130, 'y' => 150), array('x' => 140, 'y' => 160), array('x' => 150, 'y' => 140)), 'black', 5); $image->text('Hello World', 100, 100, 'arial', 'purple'); $image->display(); --- NEW FILE: svg.php --- <?php /** * @package Horde_Image */ require_once dirname(__FILE__) . '/../Image/svg.php'; $image = &new Horde_Image_svg(array('height' => 400, 'width' => 400)); $image->rectangle(30, 30, 100, 60, 'black', 'yellow'); $image->roundedRectangle(30, 30, 100, 60, 15, 'black', 'red'); $image->circle(30, 30, 30, 'black', 'blue'); $image->polygon(array(array('x' => 30, 'y' => 50), array('x' => 40, 'y' => 60), array('x' => 50, 'y' => 40)), 'green', 'green'); $image->arc(100, 100, 100, 0, 70, 'black', 'green'); $image->brush(100, 300, 'red', 'circle'); $image->line(0, 200, 500, 200, 'darkblue', 2); $image->line(200, 200, 200, 500, 'darkblue', 2); $image->polyline(array(array('x' => 130, 'y' => 150), array('x' => 140, 'y' => 160), array('x' => 150, 'y' => 140)), 'black', 5); $image->text('Hello World', 100, 100, 'arial', 'purple'); $image->display(); --- NEW FILE: swf.php --- <?php /** * @package Horde_Image */ require_once dirname(__FILE__) . '/../Image/swf.php'; $image = &new Horde_Image_swf(array('height' => 400, 'width' => 400)); $image->rectangle(30, 30, 100, 60, 'black', 'yellow'); $image->roundedRectangle(30, 30, 100, 60, 15, 'black', 'red'); $image->circle(30, 30, 30, 'black', 'blue'); $image->polygon(array(array('x' => 30, 'y' => 50), array('x' => 40, 'y' => 60), array('x' => 50, 'y' => 40)), 'green', 'green'); $image->arc(100, 100, 100, 0, 70, 'black', 'green'); $image->brush(100, 300, 'red', 'circle'); $image->line(0, 200, 500, 200, 'darkblue', 2); $image->line(200, 200, 200, 500, 'darkblue', 2); $image->polyline(array(array('x' => 130, 'y' => 150), array('x' => 140, 'y' => 160), array('x' => 150, 'y' => 140)), 'black', 5); $image->text('Hello World', 100, 100, 'arial', 'purple'); $image->display(); From cvs at intevation.de Fri Oct 14 16:33:08 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:49 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Kolab Kolab.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143308.4AC1F102BE4@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Kolab In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Kolab Added Files: Kolab.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Kolab.php --- <?php #require_once 'HTTP/WebDAV/Client.php'; require_once 'HTTP/Request.php'; require_once 'Horde.php'; require_once 'Horde/iCalendar.php'; require_once 'Horde/String.php'; require_once 'Horde/MIME.php'; require_once 'Horde/MIME/Message.php'; require_once 'Horde/MIME/Headers.php'; require_once 'Horde/MIME/Structure.php'; require_once 'Horde/NLS.php'; /** * The 'newline' character sequence used by Cyrus IMAP. */ define('CYRUS_NL', "\r\n"); /** * The Does Not Exist error message returned by the imap_last_error() * function if a specified mailbox does not exist on the IMAP server. */ define('ERR_MBOX_DNE', 'Mailbox does not exist'); /** * The name of an X-Header used in various messages to provide category * information for the relevant object (note, task, etc). */ define('X_HEAD_CAT', 'X-Horde-Category'); /** * The name of an X-Header used by the Kolab KDE Client to specify a * notes' UID. */ define('X_HEAD_K_NOTEID', 'X-KOrg-Note-Id'); /** * The name of an X-Property used in various iCalendar objects to * provide support for storing Horde category information. */ define('X_ICAL_CAT', 'X-HORDE-CATEGORY'); /** * The Kolab:: and Kolab_Cyrus:: utility libraries provide various * functions for dealing with a Kolab server (i.e. functions that * relate to Cyrus IMAP, WebDAV, etc.). * * $Horde: framework/Kolab/Kolab.php,v 1.11 2004/05/24 13:45:04 stuart Exp $ * * Copyright 2003, 2004 Code Fusion, cc. * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Stuart Binge <s.binge@codefusion.co.za> * @package Horde_Kolab */ class Kolab { /* ---------- GENERAL FUNCTIONS ---------- */ /** * Convertes any newlines in the specified text to unix format. * * @access public * * @param string $text The text to convert. * * @return string $text with all newlines replaced by NL. */ function unixNewlines($text) { return preg_replace("/\r\n|\n|\r/s", "\n", $text); } /** * Returns the unfolded representation of the given text. * * @access public * * @param string $text The text to unfold. * * @return string The unfolded representation of $text. */ function unfoldText($text) { return preg_replace("/\r\n[ \t]+/", "", $text); } /* ---------- GENERAL KOLAB FUNCTIONS ---------- */ /** * Strips any superfluos domain suffix from an email address. This was * done as Kolab uses 'name@maildomain' user names, whereas horde was * returning 'name@maildomain@hostname' addresses for the username. * * @access public * * @param string $address The address to strip the domain from, of the * form 'a@b@c' where any/all of '@b' and '@c' * may be missing. * * @return string A string of the form 'a@b'. */ function stripKolabUsername($address) { return preg_replace('/^([^@]*(@[^@]*)?).*$/', "\$1", $address); } /** * Strips any superfluos domain suffix from an email address. * * @access public * * @param string $address The address to strip the domain from, of the * form 'a@b@c' where any/all of '@b' and '@c' * may be missing. * * @return string A string of the form 'a'. */ function stripBaseUsername($address) { return preg_replace('/^([^@]*).*$/', "\$1", $address); } /** * Returns the username of the currently logged on Horde user, suitable * for use in other Kolab authentication procedures (assuming Horde is * using LDAP authentication against the Kolab server). * * @access public * * @return string The current users login name. */ function getUser() { return Kolab::stripKolabUsername(Auth::getAuth()); } /** * Returns the password of the currently logged on Horde user, suitable * for use in other Kolab authentication procedures (assuming Horde is * using LDAP authentication against the Kolab server). * * @access public * * @return string The current users login password. */ function getPassword() { return Auth::getCredential('password'); } /** * Returns the username and password of the currently logged on Horde user, * suitable for use in other Kolab authentication procedures (assuming * Horde is using LDAP authentication against the Kolab server). * * @access public * * @return array An array of the form (username, password). */ function getAuthentication() { return array(Kolab::getUser(), Kolab::getPassword()); } /* ---------- WEBDAV FUNCTIONS ---------- */ /** * Retrieves the contents of a specified users VFB file, stored on a * specified WebDAV server. * * @access public * * @param string $server The address of the WebDAV server, of the * form host:port. * @param string $folder The folder on $server where the VFB file is * stored. * @param optional string $user The name of the user whose VFB file is to * be retrieved. Defaults to the current user. * * @return mixed (string) The contents of the users VFB file, suitable for * parsing by a Horde_iCalendar object. * (object) PEAR_Error on failure. */ function retrieveFreeBusy($server, $folder, $user = '') { list($uname, $pass) = Kolab::getAuthentication(); if (empty($user)) $user = $uname; $url = "http://$server/$folder/$user.vfb"; $http = &new HTTP_Request( $url, array( 'user' => $uname, 'pass' => $pass ) ); $result = $http->sendRequest(); if (is_a($result, 'PEAR_Error')) { return $result; } $status = $http->getResponseCode(); if ($status != 200) { // Try `user' instead of `user@domain', for backward compatibility $url = "http://$server/$folder/" . Kolab::stripBaseUsername($user) . ".vfb"; $http->setURL($url); $result = $http->sendRequest(); if (is_a($result, 'PEAR_Error')) { return $result; } $status = $http->getResponseCode(); if ($status != 200) { return PEAR::raiseError(sprintf( _('%s %d (GET %s)'), $http->_response->_protocol, $status, $url ), $status); } } return $http->getResponseBody(); } /** * Stores the specified VFB data in the current users VFB file on the * specified WebDAV server. * * @access public * * @param string $server The address of the WebDAV server, of the form * host:port. * @param string $folder The folder on $server where the VFB file is stored. * @param string $vfb The new VFB data to store. * * @return mixed (boolean) True on success. * (object) PEAR_Error on failure. */ function storeFreeBusy($server, $folder, $vfb) { list($user, $pass) = Kolab::getAuthentication(); $path = 'webdav://' . urlencode($user) . ':' . urlencode($pass) . "@$server/$folder/$user.vfb"; if (!$fh = fopen($path, 'w')) return PEAR::raiseError(sprintf( _('Unable to store free/busy information for user %s on server %s'), $user, $server )); if (!fwrite($fh, $vfb)) { fclose($fh); return PEAR::raiseError(sprintf( _('Unable to store free/busy information for user %s on server %s'), $user, $server )); } fclose($fh); return true; } } class Kolab_Cyrus { /** * The IMAP connection handle. * * @var resource $_imap */ var $_imap = NULL; /** * The address of our Cyrus server. * * @var string $_server */ var $_server = ""; /** * The mailbox which we currently have opened. * * @var string $_mailbox */ var $_mailbox = ""; /* ---------- UTILITY FUNCTIONS ---------- */ /** * Returns an IMAP server address formatted for use in the PHP IMAP * functions. * * @param string $server The address of the IMAP server. * * @return string An address string suitable for use in functions such as * imap_open(). */ function serverURI($server) { return "{" . "$server/imap/notls/norsh}"; } /** * Returns an address of a Cyrus mailbox, formatted for use in the PHP IMAP * functions. * * @param string $server The address of the Cyrus server. * @param optional string $mailbox The name of the mailbox (defaults to * the current users' inbox). * * @return string A mailbox address string suitable for use in functions * such as imap_open(). */ function mailboxURI($server, $mailbox = "INBOX") { $mailbox = imap_utf7_encode($mailbox); if (strncmp($mailbox, "user", 4) && strncmp($mailbox, "INBOX", 5)) { $mailbox = "INBOX/$mailbox"; } return Kolab_Cyrus::serverURI($server) . $mailbox; } /** * Converts newlines of any format in the specified text to a * Cyrus-compatible format. * * @param string $text The text to convert. * * @return string $text with all newlines replaced by CRLF. */ function convertNewlines($text) { return preg_replace("/\r\n|\n|\r/s", "\r\n", $text); } /** * Tests if $error was the last IMAP error that was generated. * * @param string $error The error to test against. * * @return boolean True if $error was the last IMAP error. */ function testError($error) { return strcasecmp(imap_last_error(), $error) == 0; } /** * Returns the IMAP folder corresponding to the specified share. * * @param string $sharesname The name of the shares object to query * @param string $shareobject The name of the share * @param string $defaultfolder What folder to use as the default. This * is also used if the name of the share is * the name of the user (i.e. the default * share), and as the root under which to * store the non-default subfolders (shares). * @param string $folder A reference to the variable which will * store the folder name. * @param boolean $create A reference to the variable which will * store the folder creation flag. * * @return mixed (string) The name of the share if successful, PEAR_Error on failure */ function shareToFolder($sharesname, $shareobject, $defaultfolder, &$folder, &$create) { $user = Auth::getAuth(); $shares = $GLOBALS[$sharesname]->listShares($user, PERMS_EDIT, true); if (is_a($shares, 'PEAR_Error')) { return $shares; } if (empty($shareobject)) { // No share specified; use the first one $shareobject = array_keys($shares); $shareobject = $shareobject[0]->getName(); } $shares = $GLOBALS[$sharesname]->listShares($user, PERMS_SHOW, false); if (!array_key_exists($shareobject, $shares)) { // Can't access the share; bork return PEAR::raiseError("Unable to access share $shareobject"); } $owner = $shares[$shareobject]->get("owner"); $name = $shares[$shareobject]->get("name"); $name = ($owner == $shares[$shareobject]->getName() ? $defaultfolder : $name); if ($owner != $user) { // Shared Cyrus folder if ($GLOBALS['conf']['kolab']['virtual_domains']) { $owner = Kolab::stripBaseUsername($owner); } if ($defaultfolder == $name) { $folder = "user/$owner/$name"; } else { $folder = "user/$owner/$defaultfolder/$name"; } $create = false; } else { // Local Cyrus folder if ($defaultfolder == $name) { $folder = "$name"; } else { $folder = "$defaultfolder/$name"; } $create = true; } return $shareobject; } /* ---------- CONNECTION FUNCTIONS ---------- */ /** * Constructor - opens a connection to the specified Cyrus server. * * @param string $server The address of the Kolab Cyrus server. */ function Kolab_Cyrus($server) { $this->reconnect($server); } /** * Reconnects to a (possibly different) Cyrus server. * * @param optional string $server If specified, connect to this server * instead of the default. * * @return mixed True on success; PEAR_Error on failure. */ function reconnect($server = "") { $this->disconnect(); $this->_server = (empty($server) ? $this->_server : $server); $this->_imap = @imap_open( Kolab_Cyrus::serverURI($this->_server), Kolab::getUser(), Kolab::getPassword(), OP_HALFOPEN ); if ($this->_imap === false) { $this->_imap = NULL; return PEAR::raiseError(sprintf(_("Unable to connect to the Cyrus server %s: " . imap_last_error()), $this->_server)); } return true; } /** * Disconnects from the currently open Cyrus server, * * @param optional boolean $expunge True to expunge the mailbox before * closing. */ function disconnect($expunge = true) { if (isset($this->_imap)) { @imap_close($this->_imap, ($expunge ? CL_EXPUNGE : 0)); $this->_imap = NULL; } $this->_mailbox = ""; } /** * Ensures that the connection to the Cyrus server is still active. */ function ping() { if (!isset($this->_imap) || !imap_ping($this->_imap)) $this->reconnect(); } /* ---------- MAILBOX FUNCTIONS ---------- */ /** * Opens a mailbox on the active IMAP connection, optionally creating it * if it doesn't already exist. * * @param optional string $mailbox Which mailbox to open. Defaults to * the inbox. * @param optional boolean $create True to create $mailbox if it doesn't * already exist. * * @return mixed True on success; PEAR_Error on failure. */ function openMailbox($mailbox = "INBOX", $create = true) { if (@imap_reopen($this->_imap, Kolab_Cyrus::mailboxURI($this->_server, $mailbox))) { if (Kolab_Cyrus::testError(ERR_MBOX_DNE) && $create) { $result = $this->createMailbox($mailbox); if (is_a("PEAR_Error", $result)) return $result; if (!@imap_reopen($this->_imap, Kolab_Cyrus::mailboxURI($this->_server, $mailbox))) return PEAR::raiseError(sprintf(_("Unable to open mailbox %s: " . imap_last_error()), $mailbox)); } } else { return PEAR::raiseError(sprintf(_("Unable to open mailbox %s: " . imap_last_error()), $mailbox)); } $this->_mailbox = $mailbox; return true; } /** * Closes the currently open mailbox. * * @return mixed True on success; PEAR_Error on failure. */ function closeMailbox() { /* return if we don't currently have a mailbox open */ if ($this->_mailbox == "") return true; if (!@imap_reopen($this->_imap, Kolab_Cyrus::serverURI($this->_server), OP_HALFOPEN)) return PEAR::raiseError(sprintf(_("Unable to close mailbox %s: " . imap_last_error()), $this->_mailbox)); $this->_mailbox = ""; return true; } /** * Creates a new mailbox. * * @param $mailbox The name of the mailbox to create. * * @return mixed True on success; PEAR_Error on failure. */ function createMailbox($mailbox) { $result = $this->closeMailbox(); if (is_a("PEAR_Error", $result)) return $result; if (!@imap_createmailbox($this->_imap, Kolab_Cyrus::mailboxURI($this->_server, $mailbox))) return PEAR::raiseError(sprintf(_("Unable to create mailbox %s: " . imap_last_error()), $mailbox)); return true; } /** * Removes an existing mailbox, including all messages in the mailbox. * * @param $mailbox The name of the mailbox to remove. * * @return mixed True on success; PEAR_Error on failure. */ function deleteMailbox($mailbox) { $result = $this->closeMailbox(); if (is_a("PEAR_Error", $result)) return $result; if (!@imap_deletemailbox($this->_imap, Kolab_Cyrus::mailboxURI($this->_server, $mailbox))) return PEAR::raiseError(sprintf(_("Unable to delete mailbox %s: " . imap_last_error()), $mailbox)); return true; } /** * Renames a mailbox. * * @param $old The current name of the mailbox. * @param $new The new name of the mailbox. * * @return mixed True on success; PEAR_Error on failure. */ function renameMailbox($old, $new) { $result = $this->closeMailbox(); if (is_a("PEAR_Error", $result)) return $result; if (!@imap_renamemailbox( $this->_imap, Kolab_Cyrus::mailboxURI($this->_server, $old), Kolab_Cyrus::mailboxURI($this->_server, $new) )) return PEAR::raiseError(sprintf(_("Unable to rename mailbox %s: " . imap_last_error()), $old)); return true; } /** * Retrieves a list of all the current user's mailboxes. * * @return array An array of mailbox names. */ function listMailBoxes() { $result = $this->closeMailbox(); if (is_a("PEAR_Error", $result)) return $result; $mailboxes = @imap_list($this->_imap, Kolab_Cyrus::serverURI($this->_server), "*"); if (!is_array($mailboxes)) return PEAR::raiseError(_("Unable to retrieve mailbox list: " . imap_last_error())); return $mailboxes; } /* ---------- MESSAGE FUNCTIONS ---------- */ /** * Returns a list of messages in the opened mailbox, sorted by the * specified criteria, optinally matching specific search criteria. * * @access public * * @param (optional) integer $sortcriteria Specifies how to sort the * returned message list. Defaults to * sorting by date. * @param (optional) bool $reverse If TRUE, sorts the message list * in reverse order. * @param (optional) string $searchcriteria Specifies the IMAP search * string which returned messages should * match. By default all messages are * returned. See "imap_sort" for the format * of this field. * * @return array The list of messages in the mailbox that match the * specified criteria; an empty list is returned on * failure. */ function getMessageList($sortcriteria = SORTDATE, $reverse = false, $searchcriteria = "") { $messages = @imap_sort($this->_imap, $sortcriteria, ($reverse ? 1 : 0), SE_UID, $searchcriteria); if (!is_array($messages)) { $messages = array(); } return $messages; } /** * Returns the entire unaltered RFC822 message text from the specified * message store. * * @access public * * @param integer $messageid The message of interest. * * @return string The message data. */ function getMessage($messageid) { if (is_array($messageid)) { $messageid = array_values($messageid); $messageid = $messageid[0]; } $message = @imap_fetchheader($this->_imap, $messageid, FT_UID | FT_PREFETCHTEXT); $message .= @imap_body($this->_imap, $messageid, FT_UID); return $message; } /** * Returns the raw, unfolded RFC822 headers of a specified message. * * @access public * * @param integer $messageid The message from which to read the headers. * * @return string The raw RFC822 message headers. */ function getMessageHeaders($messageid) { if (is_array($messageid)) { $messageid = array_values($messageid); $messageid = $messageid[0]; } return Kolab::unfoldText(@imap_fetchheader($this->_imap, $messageid, FT_UID)); } /** * Returns the body of the specified message. * * @access public * * @param integer $messageid The message of interest. * * @return string The message body. */ function getMessageBody($messageid) { if (is_array($messageid)) { $messageid = array_values($messageid); $messageid = $messageid[0]; } return @imap_body($this->_imap, $messageid, FT_UID); } /** * Deletes the specified message(s) from the relevant message store. * * @access public * * @param integer $messageid The message to delete. This can also be * an array of message IDs if multiple messages * are to be deleted. * @param optional boolean $expunge True to expunge the mailbox after * deletion. */ function deleteMessages($messageid, $expunge = false) { if (!is_array($messageid)) { $messageid = array($messageid); } foreach ($messageid as $mid) { @imap_delete($this->_imap, $mid, FT_UID); } if ($expunge) @imap_expunge($this->_imap); } /** * Returns a hash of the message headers of a specified message. * * @access public * * @param integer $messageid The message from which to read the headers. * If this is an array, the first element is * used as the message. * * @return array A hash of the headers, where each 'key => value' pair in * the hash corresponds to a 'Name: Value' header line. This * array is empty if an error occurs. */ function getHeaderHash($messageid) { if (is_array($messageid)) { $messageid = array_values($messageid); $messageid = $messageid[0]; } $headers = array(); $headerlines = $this->getMessageHeaders($messageid); $headerlines = explode(CYRUS_NL, $headerlines); foreach ($headerlines as $headerline) { if (empty($headerline)) continue; list($hname, $hval) = explode(':', MIME::decode($headerline), 2); $headers[trim($hname)] = trim($hval); } return $headers; } /** * Returns the value of a header attribute in a hash returned by * Kolab::getHeaderHash(), or a specified default value if the header * attribute does not exist. * * @access public * * @param array $headers The message header hash. * @param string $name The attribute to search for. * @param optional mixed $default The value to return if $name does not * exist in $headers. * * @return mixed The value of $default. */ function headerValue(&$headers, $name, $default = '') { return array_key_exists($name, $headers) ? $headers[$name] : $default; } /* ---------- GROUPWARE OBJECT FUNCTIONS ---------- */ /** * Returns the body of the first MIME part within the specified message * that matches the specified content type (if such a part exists). * * @access public * * @param integer $messageid The message to read. * @param string $conttype The content type of the desired object. * The first MIME part in the specified * message with this content type is the * object that is returned. * * @return mixed (string) The first mime part matching $conttype * (boolean) False if such a mime part does not exist. */ function getObject($messageid, $conttype) { $message_text = $this->getMessage($messageid); $message = &MIME_Structure::parseTextMIMEMessage($message_text); $parts = $message->contentTypeMap(); foreach ($parts as $mimeid => $ct) { if ($ct == $conttype) { $part = $message->getPart($mimeid); return $part->toString(); } } return false; } /** * Inserts an object as a MIME part into a message, and adds the resulting * message to the specified mail store. * * @access public * * @param string $subject What text to use for the message subject. * @param string $data The data to use as the MIME part body * @param string $conttype The MIME content type of the message. * @param optional string $filename The MIME attachment name that $body should * have. * @param optional string $ua The user agent which is adding the message. * @param optional array $extraheaders A hash containing any extra headers to * append. Each 'key => value' pair is written * as 'key: value' in the message header. * * @return mixed (boolean) True on success. * (object) PEAR_Error on failure. */ function addObject($subject, $data, $conttype, $filename = '', $ua = '', $extraheaders = array()) { $current_user = Kolab::getUser(); $message = &new MIME_Message(); $part = &new MIME_Part($conttype, $data); $part->setName($filename); $part->setDisposition("attachment"); $message->addPart($part); $headers = &new MIME_Headers(); foreach ($extraheaders as $key => $value) { $headers->addHeader($key, $value); } $headers->addHeader("From", $current_user); $headers->addHeader("To", $current_user); $headers->addHeader("Subject", $subject); $headers->addHeader("User-Agent", "Horde/$ua/Kolab"); $headers->addHeader("Reply-To", ""); $headers->addHeader("Date", date("r")); $headers->addMIMEHeaders($message); $message = Kolab_Cyrus::convertNewlines($headers->toString() . $part->toString(false)); if (!@imap_append($this->_imap, Kolab_Cyrus::mailboxURI($this->_server, $this->_mailbox), $message)) { return PEAR::raiseError( sprintf( _('Unable to add object from %s to mailbox %s: ' . imap_last_error()), $current_user, $this->_mailbox ) ); } return true; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/Kolab/package.xml,v 1.4 2004/04/21 19:05:01 chuck Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Kolab</name> <summary>Glue package for accessing a Kolab server from Horde</summary> <description> This package contains a number of helper functions that make communication between a Horde client and a Kolab server smoother. </description> <license>LGPL</license> <maintainers> <maintainer> <user>stuart</user> <role>lead</role> <name>Stuart Binge</name> <email>s.binge@codefusion.co.za</email> </maintainer> </maintainers> <release> <version>0.0.4</version> <state>alpha</state> <date>2004-04-21</date> <notes> Pretty much a total reorganisation of the library; added a new Kolab_Cyrus object to better encapsulate communication with the Cyrus server. Moved and in most cases renamed existing functions to fit into the Kolab_Cyrus object, and added several new functions. </notes> <filelist> <file baseinstalldir="/Horde" role="php" name="Kolab.php" /> </filelist> <provides type="class" name="Kolab" /> </release> <changelog> <release> <version>0.0.4</version> <state>alpha</state> <date>2004-04-21</date> <notes> Pretty much a total reorganisation of the library; added a new Kolab_Cyrus object to better encapsulate communication with the Cyrus server. Moved and in most cases renamed existing functions to fit into the Kolab_Cyrus object, and added several new functions. </notes> </release> <release> <version>0.0.3</version> <state>alpha</state> <date>2004-03-09</date> <notes> - Modified the cyrusMailboxURI() function to properly handle shared Cyrus folders. - Small change in the openCyrusConnection() function to disable creating the specified folder if it is a shared folder, even if the user requests otherwise. - Removed the compileFreeBusy() functions, as Kronolith:: already provides a more robust version. </notes> </release> <release> <version>0.0.2</version> <state>alpha</state> <date>2004-01-30</date> <notes> - Replaced the various iconv() functions with Horde counterparts from the MIME:: and String:: libraries. - Replaced the Net_HTTP_Client code with its equivalent that uses HTTP_Request for GETs, and PHP streams with the WebDAV_Client wrapper for WebDAV PUTs. - Fixed a small bug in openCyrusConnection() when false was being returned (instead of raising Horde::fatal) on a certain error condition. </notes> </release> <release> <version>0.0.1</version> <state>alpha</state> <date>2004-01-28</date> <notes>Initial contribution to Horde</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:08 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:51 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/LDAP LDAP.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143308.B6DC0102BE8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/LDAP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/LDAP Added Files: LDAP.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: LDAP.php --- <?php /** * This is a utility class, every method is static. * * $Horde: framework/LDAP/LDAP.php,v 1.5 2004/01/01 15:15:52 jan Exp $ * * Copyright 1999-2004 Chuck Hagenbuch <chuck@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_LDAP */ class Horde_LDAP { /** * Return a boolean expression using the specified operator. * * @access public * * @param string $lhs The attribute to test. * @param string $op The operator. * @param string $rhs The comparison value. * * @returns string The LDAP search fragment. */ function buildClause($lhs, $op, $rhs) { switch ($op) { case 'LIKE': return empty($rhs) ? sprintf('(%s=*)', $lhs) : sprintf('(%s=*%s*)', $lhs, $rhs); default: return sprintf('(%s%s%s)', $lhs, $op, $rhs); } } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/LDAP/package.xml,v 1.1 2004/01/13 05:00:27 chuck Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> <package version="1.0"> <name>Horde_LDAP</name> <summary>LDAP Utility Class</summary> <description> Horde_LDAP:: contains some utility functions for dealing with LDA. </description> <license>LGPL</license> <maintainers> <maintainer> <user>chuck</user> <role>lead</role> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2004-01-12</date> <notes>Initial Release.</notes> <provides type="class" name="Horde_LDAP" /> <filelist> <file role="php" name="LDAP.php" baseinstalldir="/Horde"/> </filelist> </release> <changelog> <release> <version>0.0.1</version> <date>2004-01-12</date> <state>alpha</state> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:08 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:52 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Links Links.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143308.C8F69102BED@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Links In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Links Added Files: Links.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Links.php --- <?php require_once 'Horde/DataTree.php'; /** * Horde_Links API. * * We refer to type if we mean the (string) link types name or * identifier. We refer to definition if we mean the (hash) with link * properties. In the _definitions hash the definitions are identified * by the types. * * Copyright 2003-2004, Jeroen Huinink <j.huinink@wanadoo.nl> * Copyright 2003-2004, Chuck Hagenbuch <chuck@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Links/Links.php,v 1.37 2004/04/07 14:43:09 chuck Exp $ * * @author Jeroen Huinink <j.huinink@wanadoo.nl> * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Links */ class Horde_Links { /** * Name of the application from which the links are created. * * @access private * * @var string $_from_application */ var $_from_application; /** * Pointer to a datatree instance to manage the links. * * @var object DataTree $_datatree */ var $_datatree; /** * The subclass of DataTreeObject to instantiate links as. * * @var string $_linkObject */ var $_linkObject = 'DataTreeObject_Link'; /** * Hash with available link definitions * * @access private * * @var string $_definitions; */ var $_definitions = array(); /** * Array to hold retrieved links * * @access private * * @var string $_links; * */ var $_links = array(); /** * Unique name for the link * * @var string $name */ var $_name; /** * Constructor. * * @access public * * @param string $from_application The 'provides' value for the links. */ function Horde_Links($from_application = false) { global $conf; if (!isset($conf['datatree']['driver'])) { Horde::fatal('You must configure a DataTree backend to use Links.'); } $driver = $conf['datatree']['driver']; $this->_datatree = &DataTree::singleton($driver, array_merge(Horde::getDriverConfig('datatree', $driver), array('group' => 'horde.links'))); global $registry; if ($from_application) { $this->_from_application = $from_application; $definitions = $registry->getParam('links'); if (is_array($definitions) && count($definitions)) { foreach ($definitions as $type => $definition) { $description = $definition['description']; $this->_definitions[$this->_from_application . '/' . $type]['provider'] = $definition['provider']; $this->_definitions[$this->_from_application . '/' . $type]['description'] = gettext($description); $this->_definitions[$this->_from_application . '/' . $type]['readonly'] = (isset($definition['readonly']) && $definition['readonly']); $this->_definitions[$this->_from_application . '/' . $type]['show'] = (isset($definition['show'])) ? $definition['show'] : true; } } else { $this->_definitions = array(); } $provides = $registry->getParam('provides'); foreach ($registry->listApps() as $app) { $definitions = $registry->getParam('links', $app); if (is_array($definitions) && count($definitions)) { foreach ($definitions as $type => $definition) { if ($definition['provider'] == $provides) { if (!empty($definition['reverse'])) { $reverse_provider = $registry->getParam('provides', $app); if (isset($definition['reverse']['description'])) { $reverse_description = $definition['reverse']['description']; } else { $reverse_description = $definition['description']; } $this->_definitions[$reverse_provider . '/' . $type . '/reverse'] = array( 'provider' => $reverse_provider, 'description' => $reverse_description, 'type' => $type, 'readonly' => (isset($definition['reverse']['readonly']) && $definition['reverse']['readonly']), 'show' => (isset($definition['reverse']['show']) ? $definition['reverse']['show'] : true), ); } } } } } } } /** * This function returns the list of link definitions. * * @access public * * @return array The list of link definitions. */ function listLinkTypes() { return $this->_definitions; } /** * This function returns a list of links for the specified * type and the specified from_parameters. * * @access public * * @param array $link_criteria Hash with the following structure: * $link_criteria[$name][$key] = $value * where $key is one of: 'link_param', * 'link_to_param' or 'link_from_param' * and $key and $value are an arbitrary * link properties pair. * * @return array The list of links. */ function listLinks($link_criteria) { // Get links from the DataTree driver. $links = $this->_datatree->getByAttributes($this->_buildCriteria($link_criteria), '-1', true, false); $attributes = array(); if (count($links)) { // Get all available data for these links. $cids = array(); foreach ($links as $id => $name) { $cids[] = $id; $attributes[$id]['name'] = $name; } $link_results = $this->_datatree->getAttributes($cids); foreach ($link_results as $id => $attr) { foreach ($attr as $key => $vals) { $attribute_key = $vals['key']; $attribute_value = $vals['value']; $attribute_name = $vals['name']; $attributes[$id][$attribute_name][$attribute_key] = $attribute_value; } } } return $attributes; } /** * This function provides the general (shared) user interface for * links. * * @access public * * @param array $link_data * * @return array The list of links. */ function viewLinks($link_data) { global $registry; if (!isset($link_data['link_params']['from_application'])) { $link_data['link_params']['from_application'] = $this->_from_application; } foreach ($this->_definitions as $type => $definition) { $link_data['link_params']['link_type'] = $type; $app = $this->_definitions[$type]['provider']; if ($this->_definitions[$type]['show'] && ($registry->hasMethod($app . '/addLink') || $registry->hasMethod($app . '/getLinkDescription'))) { $reverse = (substr($type, -8) == '/reverse') ? '/reverse' : ''; include $registry->getParam('templates', 'horde') . '/links/links.inc'; } } } /** * This function provides (part of) the general (shared) user * interface for links. * * @access public * * @param string $type * @param array $link */ function display($type, $link) { global $registry; $app = $this->_definitions[$type]['provider']; if ($registry->hasMethod($app . '/getLinkDescription')) { $description = $registry->call($app . '/getLinkDescription', array($link)); if (is_a($description, 'PEAR_Error')) { Horde::logMessage($description, __FILE__, __LINE__, PEAR_LOG_ERR); printf(_("An error occurred following this link: %s"), $description->getMessage()); } else { $url = $registry->link($app . '/followLink', $link['to_params']); if (!is_a($url, 'PEAR_Error')) { $description = '<a href="' . Horde::url($url) . '">' . $description . '</a>'; } echo $description; } } else { echo _("No description found"); } if ($registry->hasMethod('deleteLink', 'horde') && !$this->_definitions[$type]['readonly']) { $url = $registry->linkByPackage('horde', 'deleteLink', array('link_data' => serialize($link), 'url' => Horde::selfURL(true, false, true))); echo ' ' . Horde::link(Horde::url($url), _("Delete this link")) . Horde::img('delete.gif', _("Delete"), '', $registry->getParam('graphics', 'horde')) . '</a>'; } } /** * Add a link. * * @access public * * @param array $link_data Contains the link's parameters */ function addLink($link_data) { if (!isset($link_data['link_params']['from_application'])) { return PEAR::raiseError('No from_application specified.'); } if (!isset($link_data['link_params']['to_application'])) { return PEAR::raiseError('No to_application specified.'); } if (!isset($link_data['link_params']['link_type'])) { return PEAR::raiseError('No link_type specified.'); } if (!isset($link_data['from_params'])) { return PEAR::raiseError('No from_params specified.'); } if (!isset($link_data['to_params'])) { return PEAR::raiseError('No to_params specified.'); } $this->_name = md5(uniqid(mt_rand(), true)); $link = &new $this->_linkObject($this->_name); if (is_a($link, 'PEAR_Error')) { return PEAR::raiseError('Could not create link.'); } if (!empty($link_data['link_params']['link_type']) && !empty($link_data['link_params']['from_application']) && !strstr($link_data['link_params']['link_type'], '/')) { $link_data['link_params']['link_type'] = $link_data['link_params']['from_application'] . '/' . $link_data['link_params']['link_type']; } $link->addAttributes($link_data); return $this->_datatree->add($link); } /** * Delete a link. * * @access public * * @param array $link_data Contains the link's parameters */ function deleteLink($link_data) { if (!empty($link_data['link_params']['link_type']) && !empty($link_data['link_params']['from_application']) && !strstr($link_data['link_params']['link_type'], '/')) { $link_data['link_params']['link_type'] = $link_data['link_params']['from_application'] . '/' . $link_data['link_params']['link_type']; } // First get all links meeting the supplied criteria. $links = $this->listLinks($link_data); // Now delete all these links from the DataTree driver. // // TODO: It would be better to do this in one batch (ie. pass // an array of names to be removed instead of looping over // them). foreach ($links as $link_id => $attributes) { $this->_datatree->remove($attributes['name']); } return false; } /** * Build DataTree criteria structure. * * @access private * * @param array $link_criteria Contains the link's parameters */ function _buildCriteria($link_criteria) { $term = 'AND'; $criteria = array(); foreach ($link_criteria as $name => $attributes) { if (is_array($attributes)) { foreach ($attributes as $key => $value) { $c = array(array('field' => 'name', 'op' => '=', 'test' => $name), array('field' => 'key', 'op' => '=', 'test' => $key)); if (!is_array($value)) { $c[] = array('field' => 'value', 'op' => '=', 'test' => $value); } else { // Multiple values were specified. Return all // links with any of the specified values // (ie. use 'OR' for these values). $valuelist = array(); foreach ($value as $val) { $valuelist[] = array('field' => 'value', 'op' => '=', 'test' => $val); } $c[] = array('OR' => $valuelist); } $criteria[] = array($term => $c); // Any further criteria should be JOINed. $term = 'JOIN'; } } } return array('AND' => $criteria); } /** * Attempts to return a reference to a concrete Horde_Links * instance. It will only create a new instance if no Horde_Links * instance with the same parameters currently exists. * * This method must be invoked as: $var = &Horde_Links::singleton() * * @param string $from_application The 'provides' value for the * application requesting the links * or an application name. * * @return object Horde_Links The concrete Horde_Links * reference or false on an error. * * @access public */ function &singleton($from_application) { global $conf, $registry; static $instances = array(); if ($registry->getParam('provides', $from_application) != '') { $from_application = $registry->getParam('provides', $from_application); } if (is_array($from_application)) { $from_application = $from_application[0]; } if (empty($instances[$from_application])) { $instances[$from_application] = new Horde_Links($from_application); } return $instances[$from_application]; } } /** * Extension of the DataTreeObject class for storing Link information * in the DataTree driver. If you want to store specialized Links * information, you should extend this class instead of extending * DataTreeObject directly. * * @package Horde_Links */ class DataTreeObject_Link extends DataTreeObject { /** * The Link object which this link came from - needed for * updating data in the backend to make changes stick, etc. * * @var object Horde_Links $_linkOb */ var $_linkOb; function addAttributes($attributes = array()) { $this->data[] = $attributes; } function _toAttributes() { $attributes = array(); // Loop through all data elements, if any. foreach ($this->data as $index => $entry) { foreach ($entry as $name => $values) { foreach ($values as $key => $value) { if (is_array($value)) { $value = serialize($value); } $attributes[] = array('name' => (string)$name, 'key' => (string)$key, 'value' => $value); } } } return $attributes; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/Links/package.xml,v 1.1 2004/01/25 19:21:30 chuck Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_Links</name> <summary>API for linking objects between Horde applications</summary> <description> This API provides a way to create either one-way or two-way links between arbitrary pieces of data in different Horde applications. </description> <license>LGPL</license> <maintainers> <maintainer> <user>chuck</user> <role>lead</role> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2004-01-25</date> <notes>Initial Release</notes> <filelist> <file baseinstalldir="/Horde" role="php" name="Links.php" /> </filelist> <provides type="class" name="Horde_Links" /> </release> <changelog> <release> <version>0.0.1</version> <state>alpha</state> <date>2004-01-25</date> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:08 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:54 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/MIME MIME.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143308.EA66E102BF0@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/MIME Added Files: MIME.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: MIME.php --- <?php /* We need to (unfortunately) hard code these constants because they reside in the imap module, which is not required for Horde. These constants are found in the UW-imap c-client distribution: ftp://ftp.cac.washington.edu/imap/ The constants appear in the file include/mail.h */ require_once 'Horde/Util.php'; if (!Util::extensionExists('imap')) { /* Primary body types */ define('TYPETEXT', 0); define('TYPEMULTIPART', 1); define('TYPEMESSAGE', 2); define('TYPEAPPLICATION', 3); define('TYPEAUDIO', 4); define('TYPEIMAGE', 5); define('TYPEVIDEO', 6); define('TYPEOTHER', 8); /* Body encodings */ define('ENC7BIT', 0); define('ENC8BIT', 1); define('ENCBINARY', 2); define('ENCBASE64', 3); define('ENCQUOTEDPRINTABLE', 4); define('ENCOTHER', 5); } /* Older versions of PHP's imap extension don't define TYPEMODEL. */ if (!defined('TYPEMODEL')) { define('TYPEMODEL', 7); } /** @constant MIME_CODE Return a code for type()/encoding(). */ define('MIME_CODE', 1); /** @constant MIME_STRING Return a string for type()/encoding(). */ define('MIME_STRING', 2); /** * The MIME:: class provides methods for dealing with MIME standards. * * $Horde: framework/MIME/MIME.php,v 1.130 2004/05/24 20:23:09 chuck Exp $ * * Copyright 1999-2004 Chuck Hagenbuch <chuck@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_MIME */ class MIME { /** * A listing of the allowed MIME types. * * @var array $mime_types */ var $mime_types = array( TYPETEXT => 'text', TYPEMULTIPART => 'multipart', TYPEMESSAGE => 'message', TYPEAPPLICATION => 'application', TYPEAUDIO => 'audio', TYPEIMAGE => 'image', TYPEVIDEO => 'video', TYPEMODEL => 'model', TYPEOTHER => 'other' ); /** * A listing of the allowed MIME encodings. * * @var array $mime_encodings */ var $mime_encodings = array( ENC7BIT => '7bit', ENC8BIT => '8bit', ENCBINARY => 'binary', ENCBASE64 => 'base64', ENCQUOTEDPRINTABLE => 'quoted-printable', ENCOTHER => 'unknown' ); /** * Filter for RFC822. * * @var array $rfc822_filter */ var $rfc822_filter = "()<>@,;:\\\"[]\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177"; /** * Determine if a string contains 8-bit characters. * * @access public * * @param string $string The string to check. * * @return boolean True if it does, false if it doesn't. */ function is8bit($string) { return (is_string($string) && preg_match('/[\x80-\xff]+/', $string)); } /** * Encode a string containing non-ASCII characters according to RFC 2047. * * @access public * * @param string $text The text to encode. * @param optional string $charset The character set of the text. * * @return string The text, encoded only if it contains non-ASCII * characters. */ function encode($text, $charset = null) { /* Return if nothing needs to be encoded. */ if (!MIME::is8bit($text)) { return $text; } if (is_null($charset)) { $charset = NLS::getCharset(); } $charset = String::lower($charset); $line = ''; /* Get the list of elements in the string. */ $size = preg_match_all("/([^\s]+)([\s]*)/", $text, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { if (MIME::is8bit($val[1])) { if ((($key + 1) < $size) && MIME::is8bit($matches[$key + 1][1])) { $line .= MIME::_encode($val[1] . $val[2], $charset) . ' '; } else { $line .= MIME::_encode($val[1], $charset) . $val[2]; } } else { $line .= $val[1] . $val[2]; } } return rtrim($line); } /** * Internal recursive function to RFC 2047 encode a string. * * @access private * * @param string $text The text to encode. * @param string $charset The character set of the text. * * @return string The text, encoded only if it contains non-ASCII * characters. */ function _encode($text, $charset) { $char_len = strlen($charset); $txt_len = strlen($text) * 2; /* RFC 2047 [2] states that no encoded word can be more than 75 characters long. If longer, you must split the word. */ if (($txt_len + $char_len + 7) > 75) { $pos = intval((68 - $char_len) / 2); return MIME::_encode(substr($text, 0, $pos), $charset) . ' ' . MIME::_encode(substr($text, $pos), $charset); } else { return '=?' . $charset . '?b?' . trim(base64_encode($text)) . '?='; } } /** * Encode a line via quoted-printable encoding. * Wraps lines at 76 characters. * * @access public * * @param string $text The text to encode. * @param string $eol The EOL sequence to use. * * @return string The quoted-printable encoded string. */ function quotedPrintableEncode($text, $eol) { $output = ''; if (Util::extensionExists('imap')) { foreach (preg_split("/\r?\n/", $text) as $line) { $output .= imap_8bit($line) . $eol; } } else { foreach (preg_split("/\r?\n/", $text) as $line) { /* We need to go character by character through the line. */ $length = strlen($line); $current_line = ''; $current_length = 0; for ($i = 0; $i < $length; $i++) { $char = substr($line, $i, 1); $ascii = ord($char); /* Spaces or tabs at the end of the line are NOT allowed. * Also, Characters in ASCII below 32 or above 126 AND 61 * must be encoded. */ if (((($ascii === 9) || ($ascii === 32)) && ($i == ($length - 1))) || (($ascii < 32) || ($ascii > 126) || ($ascii === 61))) { $char = '=' . String::upper(sprintf('%02s', dechex($ascii))); } /* Lines must be 76 characters or less. */ $char_length = strlen($char); $current_length += $char_length; if ($current_length > 76) { $output .= $current_line . '=' . $eol; $current_line = ''; $current_length = $char_length; } $current_line .= $char; } $output .= $current_line . $eol; } } return $output; } /** * Encode a string containing email addresses according to RFC 2047. * * @access public * * This differs from MIME::encode() because it keeps email * addresses legal, only encoding the personal information. * * @param string $text The email addresses to encode. * @param optional string $charset The character set of the text. * @param optional string $defserver The default domain to append to * mailboxes. * * @return string The text, encoded only if it contains non-ascii * characters. */ function encodeAddress($text, $charset = null, $defserver = null) { /* parseAddressList() does not process the null entry * 'undisclosed-recipients:;' correctly. */ if (preg_match("/undisclosed-recipients:\s*;/i", trim($text))) { return $text; } require_once 'Mail/RFC822.php'; $parser = &new Mail_RFC822(); $addr_arr = $parser->parseAddressList($text, $defserver, false, false); $text = ''; if (is_array($addr_arr)) { foreach ($addr_arr as $addr) { if (empty($addr->personal)) { $personal = ''; } else { if ((substr($addr->personal, 0, 1) == '"') && (substr($addr->personal, -1) == '"')) { $addr->personal = substr($addr->personal, 1, -1); } $personal = MIME::encode($addr->personal, $charset); } if (strlen($text) != 0) { $text .= ', '; } $text .= MIME::trimEmailAddress(MIME::rfc822WriteAddress($addr->mailbox, $addr->host, $personal)); } } return $text; } /** * Decode an RFC 2047-encoded string. * * @access public * * @param string $string The text to decode. * @param optional string $to_charset The charset that the text should * be decoded to. * * @return string The decoded text, or the original string if it was not * encoded. */ function decode($string, $to_charset = null) { if (($pos = strpos($string, '=?')) === false) { return $string; } /* Take out any spaces between multiple encoded words. */ $string = preg_replace('|\?=\s=\?|', '?==?', $string); /* Save any preceding text. */ $preceding = substr($string, 0, $pos); $search = substr($string, $pos + 2); $d1 = strpos($search, '?'); if (!is_int($d1)) { return $string; } $charset = substr($string, $pos + 2, $d1); $search = substr($search, $d1 + 1); $d2 = strpos($search, '?'); if (!is_int($d2)) { return $string; } $encoding = substr($search, 0, $d2); $search = substr($search, $d2+1); $end = strpos($search, '?='); if (!is_int($end)) { $end = strlen($search); } $encoded_text = substr($search, 0, $end); $rest = substr($string, (strlen($preceding . $charset . $encoding . $encoded_text) + 6)); if (!isset($to_charset)) { $to_charset = NLS::getCharset(); } switch ($encoding) { case 'Q': case 'q': $encoded_text = str_replace('_', '%20', $encoded_text); $encoded_text = str_replace('=', '%', $encoded_text); $decoded = urldecode($encoded_text); $decoded = String::convertCharset($decoded, $charset, $to_charset); break; case 'B': case 'b': $decoded = urldecode(base64_decode($encoded_text)); $decoded = String::convertCharset($decoded, $charset, $to_charset); break; default: $decoded = '=?' . $charset . '?' . $encoding . '?' . $encoded_text . '?='; break; } return $preceding . $decoded . MIME::decode($rest, $to_charset); } /** * Decode an RFC 2231-encoded string. * * @access public * * @param string $string The entire string to decode, * including the parameter name. * @param optional string $charset The charset that the text should be * decoded to. * * @return array The decoded text, or the original string if it was not * encoded. */ function decodeRFC2231($string, $to_charset = null) { if (($pos = strpos($string, '*')) === false) { return false; } if (!isset($to_charset)) { $to_charset = NLS::getCharset(); } $attribute = substr($string, 0, $pos); $charset = $lang = null; $output = ''; /* Get the characer set and language used in the encoding, if * any. */ if (preg_match("/^[^=]+\*\=([^']*)'([^']*)'/", $string, $matches)) { $charset = $matches[1]; $lang = $matches[2]; $string = str_replace($charset . "'" . $lang . "'", '', $string); } $lines = preg_split('/' . preg_quote($attribute) . '(?:\*\d)*/', $string); foreach ($lines as $line) { $pos = strpos($line, '*='); if ($pos === 0) { $line = substr($line, 2); $line = str_replace('_', '%20', $line); $line = str_replace('=', '%', $line); $output .= urldecode($line); } else { $line = substr($line, 1); $output .= $line; } } /* RFC 2231 uses quoted printable encoding. */ if (!is_null($charset)) { $output = String::convertCharset($output, $charset, $to_charset); } return array( 'attribute' => $attribute, 'value' => $output ); } /** * If an email address has no personal information, get rid of any * angle brackets (<>) around it. * * @access public * * @param string $address The address to trim. * * @return string The trimmed address. */ function trimEmailAddress($address) { $address = trim($address); if ((substr($address, 0, 1) == '<') && (substr($address, -1) == '>')) { $address = substr($address, 1, -1); } return $address; } /** * Builds an RFC 822 compliant email address. * * @access public * * @param string $mailbox Mailbox name. * @param optional string $host Domain name of mailbox's host. * @param optional string $personal Personal name phrase. * * @return string The correctly escaped and quoted * "$personal <$mailbox@$host>" string. */ function rfc822WriteAddress($mailbox, $host = null, $personal = '') { $address = ''; if (!empty($personal)) { $vars = get_class_vars('MIME'); $address .= MIME::_rfc822Encode($personal, $vars['rfc822_filter'] . '.'); $address .= ' <'; } if (!is_null($host)) { $address .= MIME::_rfc822Encode($mailbox); if (substr($host, 0, 1) != '@') { $address .= '@' . $host; } } if (!empty($personal)) { $address .= '>'; } return $address; } /** * Explodes a RFC 822 string, ignoring a delimiter if preceded by * a "\" character, or if delimiter is inside single or double * quotes. * * @access public * * @param string $str The RFC 822 string. * @param string $delimiter The delimter. * * @return array The exploded string in an array. */ function rfc822Explode($str, $delimiter) { $arr = array(); $match = 0; $quotes = array('"', "'"); $in_quote = null; $prev = null; if (in_array($str[0], $quotes)) { $in_quote = $str[0]; } elseif ($str[0] == $delimiter) { $arr[] = ''; $match = 1; } for ($i = 1; $i < strlen($str); $i++) { $char = $str[$i]; if (in_array($char, $quotes)) { if ($prev !== "\\") { if ($in_quote === $char) { $in_quote = null; } elseif (is_null($in_quote)) { $in_quote = $char; } } } elseif (($char == $delimiter) && ($prev !== "\\") && is_null($in_quote)) { $arr[] = substr($str, $match, $i - $match); $match = $i + 1; } $prev = $char; } if ($match != $i) { /* The string ended without a $delimiter. */ $arr[] = substr($str, $match, $i - $match); } return $arr; } /** * Takes an address object, as returned by imap_header() for example, * and formats it as a string. * * Object Format * For the address: John Doe <john_doe@example.com> * The object fields are: * <pre> * $object->personal = Personal name ("John Doe") * $object->mailbox = The user's mailbox ("john_doe") * $object->host = The host the mailbox is on ("example.com") * </pre> * * @access public * * @param object stdClass $ob The address object to be turned into a * string. * @param optional mixed $filter A user@example.com style bare address * to ignore. Either single string or an * array of strings. If the address matches * $filter, an empty string will be returned. * * @return string The formatted address (Example: John Doe * <john_doe@example.com>). */ function addrObject2String($ob, $filter = '') { /* If the personal name is set, decode it. */ $ob->personal = isset($ob->personal) ? MIME::decode($ob->personal) : ''; /* If both the mailbox and the host are empty, return an empty string. If we just let this case fall through, the call to MIME::rfc822WriteAddress() will end up return just a '@', which is undesirable. */ if (empty($ob->mailbox) && empty($ob->host)) { return ''; } /* Make sure these two variables have some sort of value. */ if (!isset($ob->mailbox)) { $ob->mailbox = ''; } elseif ($ob->mailbox == 'undisclosed-recipients') { return ''; } if (!isset($ob->host)) { $ob->host = ''; } /* Filter out unwanted addresses based on the $filter string. */ if ($filter) { if (!is_array($filter)) { $filter = array($filter); } foreach ($filter as $f) { if (strcasecmp($f, $ob->mailbox . '@' . $ob->host) == 0) { return ''; } } } /* Return the trimmed, formatted email address. */ return MIME::trimEmailAddress(MIME::rfc822WriteAddress($ob->mailbox, $ob->host, $ob->personal)); } /** * Takes an array of address objects, as returned by imap_headerinfo(), * for example, and passes each of them through MIME::addrObject2String(). * * @access public * * @param array $addresses The array of address objects. * @param optional mixed $filter A user@example.com style bare address * to ignore. If any address matches * $filter, it will not be included in the * final string. * * @return string All of the addresses in a comma-delimited string. * Returns the empty string on error/no addresses found. */ function addrArray2String($addresses, $filter = '') { $addrList = array(); if (!is_array($addresses)) { return ''; } foreach ($addresses as $addr) { $val = MIME::addrObject2String($addr, $filter); if (!empty($val)) { $bareAddr = String::lower(MIME::bareAddress($val)); if (!array_key_exists($bareAddr, $addrList)) { $addrList[$bareAddr] = $val; } } } if (empty($addrList)) { return ''; } else { return implode(', ', $addrList); } } /** * Returns the bare address. * * @access public * * @param string $address The address string. * @param optional string $defserver The default domain to append to * mailboxes. * @param optional boolean $multiple Should we return multiple results? * * @return mixed If $multiple is false, returns the mailbox@host e-mail * address. If $multiple is true, returns an array of * these addresses. */ function bareAddress($address, $defserver = null, $multiple = false) { $addressList = array(); /* Use built-in IMAP function if available (for speed). */ if (Util::extensionExists('imap')) { $from = imap_rfc822_parse_adrlist($address, $defserver); } else { require_once 'Mail/RFC822.php'; $from = Mail_RFC822::parseAddressList($address, $defserver, false, false); } foreach ($from as $entry) { if (isset($entry->mailbox) && isset($entry->host)) { $addressList[] = $entry->mailbox . '@' . $entry->host; } elseif (isset($entry->mailbox)) { $addressList[] = $entry->mailbox; } } if ($multiple) { return $addressList; } else { return array_pop($addressList); } } /** * Quotes and escapes the given string if necessary. * * @access private * * @param string $str The string to be quoted and escaped. * @param optional string $filter A list of characters that make it * necessary to quote the string if they * occur. * * @return string The correctly quoted and escaped string. */ function _rfc822Encode($str, $filter = '') { if (empty($filter)) { $vars = get_class_vars('MIME'); $filter = $vars['rfc822_filter'] . ' '; } if (strcspn($str, $filter) != strlen($str)) { return '"' . str_replace('"', '\\"', str_replace('\\', '\\\\', $str)) . '"'; } else { return $str; } } /** * Get the MIME type for the given input. * * @access public * * @param mixed $input Either the MIME code or type string. * @param optional integer $format If MIME_CODE, return code. * If MIME_STRING, returns lowercase * string. * * @return mixed See above. */ function type($input, $format = null) { return MIME::_getCode($input, $format, 'mime_types'); } /** * Get the MIME encoding for the given input. * * @access public * * @param mixed $input Either the MIME code or encoding * string. * @param optional integer $format If MIME_CODE, return code. If * MIME_STRING, returns lowercase * string. If not set, returns the * opposite value. * * @return mixed See above. */ function encoding($input, $format = null) { return MIME::_getCode($input, $format, 'mime_encodings'); } /** * Retrieves MIME encoding/type data from the internal arrays. * * @access private * * @param mixed $input Either the MIME code or encoding string. * @param string $format If 'code', returns code. * If 'string', returns lowercase string. * If empty set, return the oppposite value. * @param string $type The name of the internal array. * * @return mixed See above. */ function _getCode($input, $format, $type) { $numeric = is_numeric($input); switch ($format) { case MIME_CODE: if ($numeric) return $input; break; case MIME_STRING: if (!$numeric) return String::lower($input); break; } $vars = get_class_vars('MIME'); if ($numeric) { if (array_key_exists($input, $vars[$type])) { return String::lower($vars[$type][$input]); } } else { if (($search = array_search($input, $vars[$type]))) { return $search; } } return null; } /** * Generate a Message-ID string conforming to RFC 2822 [3.6.4] and the * standards outlined in 'draft-ietf-usefor-message-id-01.txt'. * * @access public * * @param string A message ID string. */ function generateMessageID() { return '<' . date('YmdHis') . '.' . substr(base_convert(microtime() . session_id(), 10, 36), -16) . '@' . $_SERVER['SERVER_NAME'] . '>'; } /** * Add proper linebreaks to a header string. * RFC 2822 [2.2.3] says that headers SHOULD be wrapped at 78 characters. * * @access public * * @param string $header The header name. * @param string $text The text of the header field. * @param optional string $eol The EOL string to use. * * @return string The header text, with linebreaks inserted. */ function wrapHeaders($header, $text, $eol = "\r\n") { /* Remove any existing linebreaks. */ $text = preg_replace("/\r?\n\s?/", ' ', $text); /* Wrap the line. */ $line = wordwrap(rtrim($header) . ': ' . rtrim($text), 75, $eol . "\t"); /* Make sure there are no empty lines. */ $line = preg_replace("/" . $eol . "\t\s*" . $eol . "\t/", "/" . $eol . "\t/", $line); return substr($line, strlen($header) + 2); } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/MIME/package.xml,v 1.17 2004/04/29 22:58:59 slusarz Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_MIME</name> <summary>Horde Mime Library</summary> <description> The Horde_MIME:: class provides methods for dealing with MIME standards. </description> <license>LGPL</license> <maintainers> <maintainer> <user>chuck</user> <role>lead</role> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> </maintainer> <maintainer> <user>slusarz</user> <role>lead</role> <name>Michael Slusarz</name> <email>slusarz@bigworm.colorado.edu</email> </maintainer> <maintainer> <user>avsm</user> <role>lead</role> <name>Anil Madhavapeddy</name> <email>anil@recoil.org</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-05</date> <notes>Initial Release.</notes> <filelist> <file role="php" baseinstalldir="/Horde" name="MIME.php" /> <dir name="MIME" baseinstalldir="/Horde" role="php"> <file name="Contents.php" /> <file name="Headers.php" /> <file name="Magic.php" /> <file name="Message.php" /> <file name="mime.magic.php" /> <file name="mime.mapping.php" /> <file name="Part.php" /> <file name="Structure.php" /> <file name="Viewer.php" /> <dir name="Viewer" baseinstalldir="/Horde" role="php"> <file name="deb.php" /> <file name="default.php" /> <file name="enriched.php" /> <file name="enscript.php" /> <file name="html.php" /> <file name="icalendar.php" /> <file name="images.php" /> <file name="msexcel.php" /> <file name="mspowerpoint.php" /> <file name="msword.php" /> <file name="ooo.php" /> <file name="pdf.php" /> <file name="php.php" /> <file name="plain.php" /> <file name="rar.php" /> <file name="report.php" /> <file name="rfc822.php" /> <file name="richtext.php" /> <file name="rpm.php" /> <file name="security.php" /> <file name="source.php" /> <file name="srchighlite.php" /> <file name="tgz.php" /> <file name="tnef.php" /> <file name="vcard.php" /> <file name="webcpp.php" /> <file name="zip.php" /> <dir name="ooo" baseinstalldir="/Horde" role="php"> <file name="common.xsl" /> <file name="global_document.xsl" /> <file name="main_html.xsl" /> <file name="palm.xsl" /> <file name="style_header.xsl" /> <file name="style_inlined.xsl" /> <file name="style_mapping.xsl" /> <file name="table.xsl" /> <file name="table_cells.xsl" /> <file name="table_columns.xsl" /> <file name="table_rows.xsl" /> </dir> </dir> </dir> </filelist> <provides type="class" name="MIME" /> <provides type="class" name="MIME_Contents" /> <provides type="class" name="MIME_Headers" /> <provides type="class" name="MIME_Magic" /> <provides type="class" name="MIME_Message" /> <provides type="class" name="MIME_Part" /> <provides type="class" name="MIME_Structure" /> <provides type="class" name="MIME_Viewer" /> <provides type="class" name="MIME_Viewer_deb" /> <provides type="class" name="MIME_Viewer_default" /> <provides type="class" name="MIME_Viewer_enriched" /> <provides type="class" name="MIME_Viewer_enscript" /> <provides type="class" name="MIME_Viewer_html" /> <provides type="class" name="MIME_Viewer_icalendar" /> <provides type="class" name="MIME_Viewer_images" /> <provides type="class" name="MIME_Viewer_msexcel" /> <provides type="class" name="MIME_Viewer_mspowerpoint" /> <provides type="class" name="MIME_Viewer_msword" /> <provides type="class" name="MIME_Viewer_ooo" /> <provides type="class" name="MIME_Viewer_pdf" /> <provides type="class" name="MIME_Viewer_php" /> <provides type="class" name="MIME_Viewer_plain" /> <provides type="class" name="MIME_Viewer_rar" /> <provides type="class" name="MIME_Viewer_report" /> <provides type="class" name="MIME_Viewer_rpm" /> <provides type="class" name="MIME_Viewer_security" /> <provides type="class" name="MIME_Viewer_srchighlite" /> <provides type="class" name="MIME_Viewer_tgz" /> <provides type="class" name="MIME_Viewer_tnef" /> <provides type="class" name="MIME_Viewer_vcard" /> <provides type="class" name="MIME_Viewer_webcpp" /> <provides type="class" name="MIME_Viewer_zip" /> <deps> <dep type="ext" rel="has" optional="yes">gettext</dep> <dep type="ext" rel="has" optional="yes">imap</dep> <dep type="pkg" rel="has">Horde_Auth</dep> <dep type="pkg" rel="has">Horde_Compress</dep> <dep type="pkg" rel="has">Horde_iCalendar</dep> <dep type="pkg" rel="has">Horde_Identity</dep> <dep type="pkg" rel="has">Horde_SessionObjects</dep> <dep type="pkg" rel="has">Horde_Text</dep> <dep type="pkg" rel="has">Horde_Util</dep> </deps> </release> <changelog> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-05</date> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:09 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:34:57 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/MIME/MIME Contents.php, NONE, 1.1 Headers.php, NONE, 1.1 Magic.php, NONE, 1.1 Message.php, NONE, 1.1 Part.php, NONE, 1.1 Structure.php, NONE, 1.1 Viewer.php, NONE, 1.1 mime.magic.php, NONE, 1.1 mime.mapping.php, NONE, 1.1 Message-ID: <20051014143309.768DC102BF3@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/MIME/MIME In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/MIME/MIME Added Files: Contents.php Headers.php Magic.php Message.php Part.php Structure.php Viewer.php mime.magic.php mime.mapping.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Contents.php --- <?php require_once dirname(__FILE__) . '/Message.php'; require_once dirname(__FILE__) . '/Part.php'; require_once HORDE_BASE . '/config/mime_drivers.php'; /* @constant MIME_CONTENTS_CACHE The name of the URL parameter that holds the MIME_Contents cache identifier. */ define('MIME_CONTENTS_CACHE', 'mimecache'); /** * The MIME_Contents:: class contains functions related to handling * the output of MIME content. * * $Horde: framework/MIME/MIME/Contents.php,v 1.111 2004/05/28 08:57:21 jan Exp $ * * Copyright 2002-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. [...1109 lines suppressed...] require_once 'Horde/SessionObjects.php'; $cache = &Horde_SessionObjects::singleton(); return $ret = &$cache->query($cacheid); } /** * Add the current object to the cache, and return the cache identifier * to be used in URLs. * * @access public * * @return array The parameter key/value set to use in URLs. */ function cacheIDURLParam() { return array(MIME_CONTENTS_CACHE => $this->_addCache()); } } --- NEW FILE: Headers.php --- <?php require_once HORDE_BASE . '/lib/version.php'; /** @constant HORDE_AGENT_HEADER The description of Horde to use in the 'User-Agent:' header. */ define('HORDE_AGENT_HEADER', 'Horde Application Framework ' . HORDE_VERSION); /** * The MIME_Headers:: class contains generic functions related to * handling the headers of mail messages. * * $Horde: framework/MIME/MIME/Headers.php,v 1.20 2004/04/14 16:59:33 slusarz Exp $ * * Copyright 2002-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_MIME */ class MIME_Headers { /** * The internal headers array. * * @var array $_headers */ var $_headers = array(); /** * Cached output of the MIME_Structure::parseMIMEHeaders() command. * * @var array $_allHeaders */ var $_allHeaders; /** * Cached output of the imap_fetchheader() command. * * @var string $_headerText */ var $_headerText; /** * The header object returned from imap_headerinfo(). * * @var stdClass $_headerObject */ var $_headerObject; /** * The internal flags array. * * @var array $_flags */ var $_flags = array(); /** * The User-Agent string to use. * THIS VALUE SHOULD BE OVERRIDEN BY ALL SUBCLASSES. * * @var string $_agent */ var $_agent = HORDE_AGENT_HEADER; /** * The sequence to use as EOL for the headers. * The default is currently to output the EOL sequence internally as * just "\n" instead of the canonical "\r\n" required in RFC 822 & 2045. * To be RFC complaint, the full <CR><LF> EOL combination should be used * when sending a message. * * @var string $_eol */ var $_eol = "\n"; /** * The index of the message. * * @var integer $_index */ var $_index; /** * Constructor. * * @access public * * @param optional integer $index The message index to parse headers. */ function MIME_Headers($index = null) { $this->_index = $index; } /** * Returns a reference to a currently open IMAP stream. * THIS VALUE SHOULD BE OVERRIDEN BY ALL SUBCLASSES. * * @return resource An IMAP resource stream. */ function &_getStream() { return false; } /** * Return the full list of headers from the imap_fetchheader() function. * * @access public * * @return string See imap_fetchheader(). */ function getHeaderText() { if (!is_null($this->_index) && empty($this->_headerText)) { $this->_headerText = @imap_fetchheader($this->_getStream(), $this->_index, FT_UID); } return $this->_headerText; } /** * Return the full list of headers. * * @access public * * @param optional boolean $decode Decode the headers? * * @return array See MIME_Structure::parseMIMEHeaders(). */ function getAllHeaders($decode = true) { require_once 'Horde/MIME/Structure.php'; if (!is_null($this->_index) && empty($this->_allHeaders)) { $this->_allHeaders = MIME_Structure::parseMIMEHeaders($this->getHeaderText(), $decode); } return $this->_allHeaders; } /** * Return the header object from imap_headerinfo(). * * @access public * * @return object stdClass See imap_headerinfo(). */ function getHeaderObject() { if (!is_null($this->_index) && empty($this->_headerObject)) { $stream = &$this->_getStream(); $this->_headerObject = @imap_headerinfo($stream, @imap_msgno($stream, $this->_index)); } return $this->_headerObject; } /** * Build the header array. The headers are MIME decoded. * * @access public */ function buildHeaders() { if (!empty($this->_headers)) { return; } /* Parse through the list of all headers. */ foreach ($this->getAllHeaders() as $key => $val) { $this->addHeader($key, $val); } } /** * Build the flags array. * * @access public */ function buildFlags() { if (!empty($this->_flags)) { return; } /* Get the IMAP header object. */ $ob = $this->getHeaderObject(); if (!isset($ob)) { return; } /* Unseen flag */ if (($ob->Unseen == 'U') || ($ob->Recent == 'N')) { $this->_flags['unseen'] = true; } /* Recent flag */ if (($ob->Recent == 'N') || ($ob->Recent == 'R')) { $this->_flags['recent'] = true; } /* Answered flag */ if ($ob->Answered == 'A') { $this->_flags['answered'] = true; } /* Draft flag */ if (isset($ob->Draft) && ($ob->Draft == 'X')) { $this->_flags['draft'] = true; } /* Important flag */ if ($ob->Flagged == 'F') { $this->_flags['important'] = true; } /* Deleted flag */ if ($ob->Deleted == 'D') { $this->_flags['deleted'] = true; } } /** * Returns the internal header array in array format. * * @access public * * @return array The headers in array format. */ function toArray() { $return_array = array(); foreach ($this->_headers as $ob) { $eol = $this->getEOL(); $header = $ob['header']; if (is_array($ob['value'])) { require_once dirname(__FILE__) . '/../MIME.php'; $return_array[$header] = MIME::wrapHeaders($header, reset($ob['value'])); next($ob['value']); while (list(,$val) = each($ob['value'])) { $return_array[$header] .= $eol . $header . ': ' . MIME::wrapHeaders($header, $val, $eol); } } else { $return_array[$header] = $ob['value']; } } return $return_array; } /** * Returns the internal header array in string format. * * @access public * * @return string The headers in string format. */ function toString() { $eol = $this->getEOL(); $text = ''; foreach ($this->_headers as $ob) { if (!is_array($ob['value'])) { $ob['value'] = array($ob['value']); } foreach ($ob['value'] as $entry) { $text .= $ob['header'] . ': ' . $entry . $eol; } } return $text . $eol; } /** * Generate the 'Received' header for the Web browser->Horde hop * (attempts to conform to guidelines in RFC 2821). * * @access public */ function addReceivedHeader() { if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { /* This indicates the user is connecting through a proxy. */ $remote_path = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); $remote_addr = $remote_path[0]; $remote = gethostbyaddr($remote_addr); } else { $remote_addr = $_SERVER['REMOTE_ADDR']; if (empty($_SERVER['REMOTE_HOST'])) { $remote = gethostbyaddr($remote_addr); } else { $remote = $_SERVER['REMOTE_HOST']; } } $received = 'from ' . $remote . ' ('; if (!empty($_SERVER['REMOTE_IDENT'])) { $received .= $_SERVER['REMOTE_IDENT'] . '@' . $remote . ' '; } elseif ($remote != $_SERVER['REMOTE_ADDR']) { $received .= $remote . ' '; } $received .= '[' . $remote_addr . ']) '; $received .= 'by ' . $GLOBALS['conf']['server']['name'] . ' (Horde) with HTTP '; $user = Auth::getAuth(); if (strpos($user, '@') === false) { $user .= '@' . $GLOBALS['conf']['server']['name']; } $received .= 'for <' . $user . '>; ' . date('r'); $this->addHeader('Received', $received); } /** * Generate the 'Message-ID' header. * * @access public */ function addMessageIdHeader() { require_once dirname(__FILE__) . '/../MIME.php'; $this->addHeader('Message-ID', MIME::generateMessageID()); } /** * Generate the 'Resent' headers (conforms to guidelines in * RFC 2822 [3.6.6]). * * @access public * * @param string $from The address to use for 'Resent-From'. * @param string $to The address to use for 'Resent-To'. */ function addResentHeaders($from, $to) { require_once dirname(__FILE__) . '/../MIME.php'; /* We don't set Resent-Sender, Resent-Cc, or Resent-Bcc. */ $this->addHeader('Resent-Date', date('r')); $this->addHeader('Resent-From', $from); $this->addHeader('Resent-To', $to); $this->addHeader('Resent-Message-ID', MIME::generateMessageID()); } /** * Generate read receipt headers. * * @access public * * @param string $to The address the receipt should be mailed to. */ function addReadReceiptHeaders($to) { /* This is the RFC 2298 way of requesting a receipt. */ $this->addHeader('Disposition-Notification-To', $to); /* For certain Pegasus mail installations. */ $this->addHeader('X-Confirm-Reading-To', $to); $this->addHeader('X-PMRQC', 1); } /** * Generate delivery receipt headers. * * @access public * * @param string $to The address the receipt should be mailed to. */ function addDeliveryReceiptHeaders($to) { /* This is old sendmail (pre-8.7) behavior. */ $this->addHeader('Return-Receipt-To', $to); } /** * Generate the user agent description header. * * @access public */ function addAgentHeader() { $this->addHeader('User-Agent', $this->_agent); } /** * Add a header to the header array. * * @access public * * @param string $header The header name. * @param string $value The header value. */ function addHeader($header, $value) { $header = trim($header); $lcHeader = String::lower($header); if (!isset($this->_headers[$lcHeader])) { $this->_headers[$lcHeader] = array(); } $this->_headers[$lcHeader]['header'] = $header; $this->_headers[$lcHeader]['value'] = $value; $this->_headers[$lcHeader]['_alter'] = false; } /** * Remove a header from the header array. * * @access public * * @param string $header The header name. */ function removeHeader($header) { $header = trim($header); $lcHeader = String::lower($header); unset($this->_headers[$lcHeader]); } /** * Set a value for a particular header ONLY if that header is set. * * @access public * * @param string $header The header name. * @param string $value The original header value. * * @return boolean True if string was set, false if not. */ function setString($header, $value) { $header = trim($header); $lcHeader = String::lower($header); if (isset($this->_headers[$lcHeader])) { $this->_headers[$lcHeader]['header'] = $value; $this->_headers[$lcHeader]['_alter'] = true; return true; } else { return false; } } /** * Set a value for a particular header ONLY if that header is set. * * @access public * * @param string $header The header name. * @param string $value The header value. * * @return boolean True if value was set, false if not. */ function setValue($header, $value) { $lcHeader = String::lower($header); if (isset($this->_headers[$lcHeader])) { $this->_headers[$lcHeader]['value'] = $value; $this->_headers[$lcHeader]['_alter'] = true; return true; } else { return false; } } /** * Attempts to return the header in the correct case. * * @access public * * @param string $header The header to search for. * * @return string The value for the given header. * If the header is not found, returns null. */ function getString($header) { $lcHeader = String::lower($header); return (isset($this->_headers[$lcHeader])) ? $this->_headers[$lcHeader]['header'] : null; } /** * Attempt to return the value for a given header. * The following header fields can only have 1 entry, so if duplicate * entries exist, the first value will be used (RFC 2822 [3.6]): * To, From, Cc, Bcc, Date, Sender, Reply-to, Message-ID, In-Reply-To, * References, Subject * * @access public * * @param string $header The header to search for. * * @return mixed The value for the given header. * If the header is not found, returns null. */ function getValue($header) { $header = String::lower($header); if (isset($this->_headers[$header])) { $single = array('to', 'from', 'cc', 'bcc', 'date', 'sender', 'reply-to', 'message-id', 'in-reply-to', 'references', 'subject', 'x-priority'); if (is_array($this->_headers[$header]['value']) && in_array($header, $single)) { return $this->_headers[$header]['value'][0]; } else { return $this->_headers[$header]['value']; } } else { return null; } } /** * Has the header been altered from the original? * * @access public * * @param string $header The header to analyze. * * @return boolean True if the header has been altered. */ function alteredHeader($header) { $lcHeader = String::lower($header); return (isset($this->_headers[$lcHeader])) ? $this->_headers[$lcHeader]['_alter'] : false; } /** * Transforms a Header value using the list of functions provided. * * @access public * * @param string $header The header to alter. * @param mixed $funcs A function, or an array of functions. * The functions will be performed from right to * left. */ function setValueByFunction($header, $funcs) { $header = String::lower($header); if (is_array($funcs)) { $funcs = array_reverse($funcs); } else { $funcs = array($funcs); } if (isset($this->_headers[$header])) { $val = $this->getValue($header); if (is_array($val)) { $val = implode("\n", $val); } foreach ($funcs as $func) { $val = call_user_func($func, $val); } $this->setValue($header, $val); } } /** * Add any MIME headers required for the MIME_Part. * * @access public * * @param object MIME_Part &$mime_part The MIME_Part object. */ function addMIMEHeaders(&$mime_part) { foreach ($mime_part->header(array()) as $head => $val) { $this->addHeader($head, $val); } } /** * Return the list of addresses for a header object. * * @access public * * @param array $obs An array of header objects (See imap_headerinfo() * for the object structure). * * @return array An array of objects. * <pre> * Object elements: * 'address' - Full address * 'host' - Host name * 'inner' - Trimmed, bare address * 'personal' - Personal string * </pre> */ function getAddressesFromObject($obs) { $retArray = array(); if (!is_array($obs) || empty($obs)) { return $retArray; } foreach ($obs as $ob) { /* Ensure we're working with initialized values. */ $ob->personal = isset($ob->personal) ? trim(MIME::decode($ob->personal), '"') : ''; if (isset($ob->mailbox)) { /* Don't process invalid addresses. */ if (strstr($ob->mailbox, 'UNEXPECTED_DATA_AFTER_ADDRESS') || strstr($ob->mailbox, 'INVALID_ADDRESS')) { continue; } } else { $ob->mailbox = ''; } if (!isset($ob->host)) { $ob->host = ''; } /* Generate the new object. */ $newOb = &new stdClass; $newOb->address = MIME::addrObject2String($ob, array('undisclosed-recipients@', 'Undisclosed recipients@')); $newOb->host = $ob->host; $newOb->inner = MIME::trimEmailAddress(MIME::rfc822WriteAddress($ob->mailbox, $ob->host, '')); $newOb->personal = $ob->personal; $retArray[] = &$newOb; } return $retArray; } /** * Returns the list of valid mailing list headers. * * @access public * * @return array The list of valid mailing list headers. */ function listHeaders() { return array( /* RFC 2369 */ 'list-help' => _("List-Help"), 'list-unsubscribe' => _("List-Unsubscribe"), 'list-subscribe' => _("List-Subscribe"), 'list-owner' => _("List-Owner"), 'list-post' => _("List-Post"), 'list-archive' => _("List-Archive"), /* RFC 2919 */ 'list-id' => _("List-Id") ); } /** * Do any mailing list headers exist? * * @access public * * @return boolean True if any mailing list headers exist. */ function listHeadersExist() { foreach ($this->listHeaders() as $val => $str) { if (isset($this->_headers[$val])) { return true; } } return false; } /** * Sets a new string to use for EOLs. * * @access public * * @param string $eol The string to use for EOLs. */ function setEOL($eol) { $this->_eol = $eol; } /** * Get the string to use for EOLs. * * @access public * * @return string The string to use for EOLs. */ function getEOL() { return $this->_eol; } /** * Returns the flag status. * * @access public * * @param string $flag Is this flag set? * Flags: recent, unseen, answered, draft, important, * deleted * * @return boolean True if the flag has been set, false if not. */ function getFlag($flag) { if (!empty($this->_flags[String::lower($flag)])) { return true; } else { return false; } } /** * Get the primary from address (first address in the From: header). * * @access public * * @return string The from address (user@host). */ function getFromAddress() { if (!($ob = $this->getOb('from'))) { return null; } require_once 'Horde/MIME.php'; return trim(MIME::trimEmailAddress(MIME::rfc822WriteAddress($ob[0]->mailbox, (isset($ob[0]->host)) ? $ob[0]->host : '', ''))); } /** * Get a header from the header object. * * @access public * * @param string $field The object field to retrieve (see * imap_headerinfo() for the list of fields). * @param boolean $decode Should the return value be MIME decoded? * It will only be decoded if it is not an object * itself. * * @return mixed The field requested. */ function getOb($field, $decode = false) { $data = array(); $ob = $this->getHeaderObject(); if (!is_object($ob)) { return $data; } if (isset($ob->$field)) { $data = $ob->$field; if (!empty($decode) && !is_object($data) && !is_array($data)) { include_once 'Horde/MIME.php'; $data = MIME::decode($data); } } return (is_string($data)) ? strtr($data, "\t", " ") : $data; } } --- NEW FILE: Magic.php --- <?php /** * The MIME_Magic:: class provides an interface to determine a * MIME type for various content, if it provided with different * levels of information. * * $Horde: framework/MIME/MIME/Magic.php,v 1.49 2004/05/24 22:38:25 jan Exp $ * * Copyright 1999-2004 Anil Madhavapeddy <anil@recoil.org> * Copyright 2002-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anil Madhavapeddy <anil@recoil.org> * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_MIME */ class MIME_Magic { /** * Returns a copy of the MIME extension map. * * @access private * * @return array The MIME extension map. */ function &_getMimeExtensionMap() { static $mime_extension_map; if (!isset($mime_extension_map)) { require dirname(__FILE__) . '/mime.mapping.php'; } return $mime_extension_map; } /** * Returns a copy of the MIME magic file. * * @access private * * @return array The MIME magic file. */ function &_getMimeMagicFile() { static $mime_magic; if (!isset($mime_magic)) { require dirname(__FILE__) . '/mime.magic.php'; } return $mime_magic; } /** * Attempt to convert a file extension to a MIME type, based * on the global Horde and application specific config files. * * If we cannot map the file extension to a specific type, then * we fall back to a custom MIME handler 'x-extension/$ext', which * can be used as a normal MIME type internally throughout Horde. * * @access public * * @param string $ext The file extension to be mapped to a MIME type. * * @return string The MIME type of the file extension. */ function extToMIME($ext) { if (empty($ext)) { return 'text/plain'; } else { $ext = String::lower($ext); $map = &MIME_Magic::_getMimeExtensionMap(); $pos = 0; while (!isset($map[$ext]) && $pos !== false) { $pos = strpos($ext, '.'); if ($pos !== false) { $ext = substr($ext, $pos + 1); } } if (isset($map[$ext])) { return $map[$ext]; } else { return 'x-extension/' . $ext; } } } /** * Attempt to convert a filename to a MIME type, based on the * global Horde and application specific config files. * * @access public * * @param string $filename The filename to be mapped to a MIME * type. * @param optional boolean $unknown How should unknown extensions be * handled? If true, will return * 'x-extension/*' types. If false, * will return * 'application/octet-stream'. * * @return string The MIME type of the filename. */ function filenameToMIME($filename, $unknown = true) { $pos = strlen($filename) + 1; $type = ''; $map = &MIME_Magic::_getMimeExtensionMap(); for ($i = 0; $i <= $map['__MAXPERIOD__'] && strrpos(substr($filename, 0, $pos - 1), '.') !== false; $i++) { $pos = strrpos(substr($filename, 0, $pos - 1), '.') + 1; } $type = MIME_Magic::extToMIME(substr($filename, $pos)); if (empty($type) || (!$unknown && (strpos($type, 'x-extension') !== false))) { return 'application/octet-stream'; } else { return $type; } } /** * Attempt to convert a MIME type to a file extension, based * on the global Horde and application specific config files. * * If we cannot map the type to a file extension, we return false. * * @access public * * @param string $type The MIME type to be mapped to a file extension. * * @return string The file extension of the MIME type. */ function MIMEToExt($type) { $key = array_search($type, MIME_Magic::_getMimeExtensionMap()); if (empty($type) || ($key === false)) { list($major, $minor) = explode('/', $type); if ($major == 'x-extension') { return $minor; } if (strpos($minor, 'x-') === 0) { return substr($minor, 2); } return false; } else { return $key; } } /** * Uses variants of the UNIX "file" command to attempt to determine the * MIME type of an unknown file. * * @access public * * @param string $path The path to the file to analyze. * * @return string The MIME type of the file. Returns false if either * the file type isn't recognized or the file command is * not available. */ function analyzeFile($path) { /* If the PHP Mimetype extension is available, use that. */ if (Util::extensionExists('fileinfo')) { $res = finfo_open(FILEINFO_MIME); $type = finfo_file($res, $path); finfo_close($res); return $type; } else { /* Use a built-in magic file. */ $mime_magic = &MIME_Magic::_getMimeMagicFile(); if (!($fp = @fopen($path, 'rb'))) { return false; } foreach ($mime_magic as $offset => $odata) { foreach ($odata as $length => $ldata) { @fseek($fp, $offset, SEEK_SET); $lookup = @fread($fp, $length); if (!empty($ldata[$lookup])) { fclose($fp); return $ldata[$lookup]; } } } fclose($fp); } return false; } /** * Uses variants of the UNIX "file" command to attempt to determine the * MIME type of an unknown byte stream. * * @access public * * @param string $data The file data to analyze. * * @return string The MIME type of the file. Returns false if either * the file type isn't recognized or the file command is * not available. */ function analyzeData($data) { /* Use a built-in magic file. */ $mime_magic = &MIME_Magic::_getMimeMagicFile(); foreach ($mime_magic as $offset => $odata) { foreach ($odata as $length => $ldata) { $lookup = substr($data, $offset, $length); if (!empty($ldata[$lookup])) { return $ldata[$lookup]; } } } return false; } } --- NEW FILE: Message.php --- <?php require_once dirname(__FILE__) . '/Part.php'; /** * The MIME_Message:: class provides methods for creating and manipulating * MIME email messages. * * $Horde: framework/MIME/MIME/Message.php,v 1.76 2004/04/16 21:00:42 jan Exp $ * * Copyright 1999-2004 Chuck Hagenbuch <chuck@horde.org> * Copyright 2002-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_MIME */ class MIME_Message extends MIME_Part { /** * Has the message been parsed via buildMessage()? * * @var boolean $_build */ var $_build = false; /** * The server to default unqualified addresses to. * * @var string $_defaultServer */ var $_defaultServer = null; /** * Constructor - creates a new MIME email message. * * @access public * * @param optional string $defaultServer The server to default * unqualified addresses to. */ function MIME_Message($defaultServer = null) { if (is_null($defaultServer)) { $this->_defaultServer = $_SERVER['SERVER_NAME']; } else { $this->_defaultServer = $defaultServer; } } /** * Create a MIME_Message object from a MIME_Part object. * This function can be called statically via: * MIME_Message::convertMIMEPart(); * * @access public * * @param object MIME_Part &$mime_part The MIME_Part object. * @param optional string $server The server to default unqualified * addresses to. * * @return object MIME_Message The new MIME_Message object. */ function &convertMIMEPart(&$mime_part, $server = null) { if (!$mime_part->getMIMEId()) { $mime_part->setMIMEId(1); } $mime_message = &new MIME_Message($server); $mime_message->addPart($mime_part); $mime_message->buildMessage(); return $mime_message; } /** * Send a message. * * @access public * * @param string $email The address list to send to. * @param mixed &$headers The MIME_Headers object holding * this message's headers, *or* a hash * with header->value mappings. * * @return mixed True on success, PEAR_Error object on error. */ function send($email, &$headers) { global $conf; static $mailer; if (!isset($mailer)) { require_once 'Mail.php'; $mailer = &Mail::factory($conf['mailer']['type'], $conf['mailer']['params']); } $msg = $this->toString(); if (is_object($headers)) { $headerArray = $this->encode($headers->toArray(), $this->getCharset()); } else { $headerArray = $this->encode($headers, $this->getCharset()); } /* Make sure the message has a trailing newline. */ if (substr($msg, -1) != "\n") { $msg .= "\n"; } return $mailer->send(MIME::encodeAddress($email), $headerArray, $msg); } /** * Take a set of headers and make sure they are encoded properly. * * @access public * * @param array $headers The headers to encode. * @param string $charset The character set to use. * * @return array The array of encoded headers. */ function encode($headers, $charset) { require_once 'Horde/MIME.php'; $addressKeys = array('To', 'Cc', 'Bcc', 'From'); foreach ($headers as $key => $val) { if (in_array($key, $addressKeys)) { $text = MIME::encodeAddress($val, $charset, $this->_defaultServer); } else { $text = MIME::encode($val, $charset); } $headers[$key] = MIME::wrapHeaders($key, $text, $this->getEOL()); } return $headers; } /** * Add the proper set of MIME headers for this message to an array. * * @access public * * @param optional array $headers The headers to add the MIME headers to. * * @return array The full set of headers including MIME headers. */ function header($headers = array()) { /* Per RFC 2045 [4], this MUST appear in the message headers. */ $headers['MIME-Version'] = '1.0'; if ($this->_build) { return parent::header($headers); } else { $this->buildMessage(); return $this->encode($this->header($headers), $this->getCharset()); } } /** * Return the entire message contents, including headers, as a string. * * @access public * * @return string The encoded, generated message. */ function toString() { if ($this->_build) { return parent::toString(false); } else { $this->buildMessage(); return $this->toString(); } } /** * Build message from current contents. * * @access public */ function buildMessage() { if ($this->_build) { return; } if (empty($this->_flags['setType'])) { if (count($this->_parts) > 1) { $this->setType('multipart/mixed'); } else { /* Copy the information from the single part to the current base part. */ if (($obVars = get_object_vars(reset($this->_parts)))) { foreach ($obVars as $key => $val) { $this->$key = $val; } } } } /* Set the build flag now. */ $this->_build = true; } /** * Get a list of all MIME subparts. * * @access public * * @return array An array of the MIME_Part subparts. */ function getParts() { if ($this->_build) { return parent::getParts(); } else { $this->buildMessage(); return $this->getParts(); } } /** * Return the base part of the message. This function does NOT * return a reference to make sure that the whole MIME_Message * object isn't accidentally modified. * * @access public * * @return object MIME_Message The base MIME_Part of the message. */ function getBasePart() { $this->buildMessage(); return $this; } /** * Retrieve a specific MIME part. * * @access public * * @param string $id The MIME_Part ID string. * * @return object MIME_Part The MIME_Part requested. Returns false if * the part doesn't exist. */ function getPart($id) { if ($this->_build) { return parent::getPart($id); } else { $this->buildMessage(); return $this->getPart($id); } } } --- NEW FILE: Part.php --- <?php require_once 'Horde/String.php'; require_once dirname(__FILE__) . '/../MIME.php'; /** @constant MIME_PART_EOL The character(s) used internally for EOLs. */ define('MIME_PART_EOL', "\n"); /** @constant MIME_PART_RFC_EOL The character string designated by RFCs 822/2045 to designate EOLs in MIME messages. */ define('MIME_PART_RFC_EOL', "\r\n"); /* Default MIME parameters. */ /** @constant MIME_DEFAULT_CHARSET The default MIME character set. */ define('MIME_DEFAULT_CHARSET', 'us-ascii'); /** @constant MIME_DEFAULT_DESCRIPTION The default MIME description. */ define('MIME_DEFAULT_DESCRIPTION', _("unnamed")); /** @constant MIME_DEFAULT_DISPOSITION The default MIME disposition. */ [...1467 lines suppressed...] } return $map; } /** * Generate the unique boundary string (if not already done). * * @access private * * @return string The boundary string. */ function _generateBoundary() { if (is_null($this->_boundary)) { $this->_boundary = '=_' . base_convert(microtime(), 10, 36); } return $this->_boundary; } } --- NEW FILE: Structure.php --- <?php require_once dirname(__FILE__) . '/Message.php'; require_once dirname(__FILE__) . '/Part.php'; require_once dirname(__FILE__) . '/../MIME.php'; /** * $Horde: framework/MIME/MIME/Structure.php,v 1.87 2004/05/18 09:17:18 jan Exp $ * * The MIME_Structure:: class provides methods for dealing with MIME mail. * * Copyright 1999-2004 Chuck Hagenbuch <chuck@horde.org> * Copyright 2002-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_MIME */ class MIME_Structure { /** * Given the results of imap_fetchstructure(), parse the structure * of the message, figuring out correct bodypart numbers, etc. * * @access public * * @param object stdClass $body The result of imap_fetchstructure(). * * @return object &MIME_Message The message parsed into a MIME_Message * object. */ function &parse($body) { $msgOb = &new MIME_Message(); $msgOb->addPart(MIME_Structure::_parse($body)); $msgOb->buildMessage(); $ptr = array(&$msgOb); MIME_Structure::_addMultipartInfo($ptr); return $msgOb; } /** * Given the results of imap_fetchstructure(), parse the structure * of the message, figuring out correct bodypart numbers, etc. * * @access private * * @param object stdClass $body The result of imap_fetchstructure(). * @param optional string $ref The current bodypart. * * @return object MIME_Part A MIME_Part object. */ function &_parse($body, $ref = null) { static $message, $multipart; if (!isset($message)) { $message = MIME::type('message'); $multipart = MIME::type('multipart'); } $mime_part = &new MIME_Part(); /* Top multiparts don't get their own line. */ if (is_null($ref) && (!isset($body->type) || ($body->type != $multipart))) { $ref = 1; } MIME_Structure::_setInfo($body, $mime_part, $ref); /* Deal with multipart headers. */ if (is_null($ref)) { $mime_part->setMIMEId(0); } elseif ($body->subtype == 'RFC822') { $mime_part->setMIMEId($ref . '.0'); } elseif ((($body->subtype != 'MIXED') && ($body->subtype != 'ALTERNATIVE')) || ($body->type == $multipart)) { $mime_part->setMIMEId($ref); } /* Deal with multipart data. */ if (isset($body->parts)) { $sub_id = 1; foreach ($body->parts as $sub_part) { /* Are we dealing with a multipart message? */ if (isset($body->type) && ($body->type == $message) && isset($sub_part->type) && ($sub_part->type == $multipart)) { $sub_ref = $ref; } else { $sub_ref = (is_null($ref)) ? $sub_id : $ref . '.' . $sub_id; } $mime_part->addPart(MIME_Structure::_parse($sub_part, $sub_ref), $sub_id++); } } return $mime_part; } /** * Given a mime part from imap_fetchstructure(), munge it into a * useful form and make sure that any parameters which are missing * are given default values. * * @access private * * @param object stdClass $part The original part info. * @param object MIME_Part &$ob A MIME_Part object. * @param string $ref The ID of this part. */ function _setInfo($part, &$ob, $ref) { /* Store Content-type information. */ $primary_type = (isset($part->type)) ? $part->type : MIME::type('text'); $sec_type = ($part->ifsubtype && $part->subtype) ? String::lower($part->subtype) : 'x-unknown'; $ob->setType($primary_type . '/' . $sec_type); /* Set transfer encoding. */ if (isset($part->encoding)) { $encoding = $part->encoding; $ob->setTransferEncoding($encoding); } else { $encoding = null; } /* Set transfer disposition. */ $ob->setDisposition(($part->ifdisposition) ? String::lower($part->disposition) : MIME_DEFAULT_DISPOSITION); /* If 'body' is set, set as the contents of the part. */ if (isset($part->body)) { $ob->setContents($part->body, $encoding); } /* If 'bytes' is set, store as information variable. */ if (isset($part->bytes)) { $ob->setBytes($part->bytes); } /* Set the part's identification string, if available. */ if (!is_null($ref) && $part->ifid) { $ob->setInformation('id', $part->id); } else { $ob->setInformation('id', false); } /* Set the default character set. */ $ob->setCharset(MIME_DEFAULT_CHARSET); /* Go through the content-type parameters, if any. */ foreach (MIME_Structure::_getParameters($part, 1) as $key => $val) { if ($key == 'charset') { $ob->setCharset($val); } else { $ob->setContentTypeParameter($key, $val); } } /* Go through the disposition parameters, if any. */ foreach (MIME_Structure::_getParameters($part, 2) as $key => $val) { $ob->setDispositionParameter($key, $val); } /* Set the name. */ if ($ob->getContentTypeParameter('filename')) { $ob->setName($ob->getContentTypeParameter('filename')); } elseif ($ob->getDispositionParameter('filename')) { $ob->setName($ob->getDispositionParameter('filename')); } /* Set the description. */ if (isset($part->description)) { $ob->setDescription($part->description); } } /** * Get all parameters for a given portion of a message. * * @access private * * @param object stdClass $part The original part info. * @param integer $type The parameter type to retrieve. * 1 = content * 2 = disposition * * @return array An array of parameter key/value pairs. */ function _getParameters($part, $type) { $param_list = array(); if ($type == 1) { $ptype = 'parameters'; } elseif ($type == 2) { $ptype = 'dparameters'; } $pexists = 'if' . $ptype; if ($part->$pexists) { foreach ($part->$ptype as $param) { $param->value = str_replace("\t", ' ', $param->value); $res = MIME::decodeRFC2231($param->attribute . '=' . $param->value); if ($res) { $param->attribute = $res['attribute']; $param->value = $res['value']; } $field = String::lower($param->attribute); if ($field == 'type') { if (($type = MIME::type($param->value))) { $param_list['type'] = $type; } } else { $param_list[$field] = $param->value; } } } return $param_list; } /** * Set the special information for certain MIME types. * * @access private * * @param array &$parts TODO * @param optional array $info TODO */ function _addMultipartInfo(&$parts, $info = array()) { if (empty($parts)) { return; } foreach (array_keys($parts) as $key) { $ptr = &$parts[$key]; $new_info = $info; if (isset($info['alt'])) { $ptr->setInformation('alternative', (is_null($info['alt'])) ? '-' : $info['alt']); } if (isset($info['related'])) { $ptr->setInformation('related_part', $info['related']->getMIMEId()); if (($id = $ptr->getInformation('id'))) { $info['related']->addCID(array($ptr->getMIMEId() => $id)); } } if (isset($info['rfc822'])) { $ptr->setInformation('rfc822_part', $info['rfc822']); } switch ($ptr->getType()) { case 'multipart/alternative': $new_info['alt'] = $ptr->getMIMEId(); break; case 'multipart/related': $new_info['related'] = &$ptr; break; case 'message/rfc822': $new_info['rfc822'] = $ptr->getMIMEId(); $ptr->setInformation('header', true); break; } MIME_Structure::_addMultipartInfo($ptr->_parts, $new_info); } } /** * Attempts to build a MIME_Message object from a text message. * * @access public * * @param string $text The text of the MIME message. * * @return object MIME_Message A MIME_Message object if successful. * Returns false on error. */ function &parseTextMIMEMessage($text) { require_once 'Mail/mimeDecode.php'; /* Set up the options for the mimeDecode class. */ $decode_args = array(); $decode_args['include_bodies'] = true; $decode_args['decode_bodies'] = false; $decode_args['decode_headers'] = false; $mimeDecode = &new Mail_mimeDecode($text, MIME_PART_EOL); if (!($structure = $mimeDecode->decode($decode_args))) { return false; } /* Put the object into imap_parsestructure() form. */ MIME_Structure::_convertMimeDecodeData($structure); return $ret = &MIME_Structure::parse($structure); } /** * Convert the output from mimeDecode::decode() into a structure that * matches imap_fetchstructure() output. * * @access private * * @param object stdClass &$ob The output from mimeDecode::decode(). */ function _convertMimeDecodeData(&$ob) { /* Primary content-type. */ $ob->type = intval(MIME::type($ob->ctype_primary)); /* Secondary content-type. */ if (isset($ob->ctype_secondary)) { $ob->subtype = String::upper($ob->ctype_secondary); $ob->ifsubtype = 1; } else { $ob->ifsubtype = 0; } /* Content transfer encoding. */ if (isset($ob->headers['content-transfer-encoding'])) { $ob->encoding = MIME::encoding($ob->headers['content-transfer-encoding']); } /* Content-type and Disposition parameters. */ $param_types = array ('ctype_parameters' => 'parameters', 'd_parameters' => 'dparameters'); foreach ($param_types as $param_key => $param_value) { $if_var = 'if' . $param_value; if (isset($ob->$param_key)) { $ob->$if_var = 1; $ob->$param_value = array(); foreach ($ob->$param_key as $key => $val) { $newOb = &new stdClass; $newOb->attribute = $key; $newOb->value = $val; array_push($ob->$param_value, $newOb); } } else { $ob->$if_var = 0; } } /* Content-Disposition. */ if (isset($ob->headers['content-disposition'])) { $ob->ifdisposition = 1; $hdr = $ob->headers['content-disposition']; $pos = strpos($hdr, ';'); if ($pos !== false) { $hdr = substr($hdr, 0, $pos); } $ob->disposition = $hdr; } else { $ob->ifdisposition = 0; } /* Content-ID. */ if (isset($ob->headers['content-id'])) { $ob->ifid = 1; $ob->id = $ob->headers['content-id']; } else { $ob->ifid = 0; } /* Get file size (if 'body' text is set). */ if (isset($ob->body)) { $ob->bytes = strlen($ob->body); } /* Process parts also. */ if (isset($ob->parts)) { foreach (array_keys($ob->parts) as $key) { MIME_Structure::_convertMimeDecodeData($ob->parts[$key]); } } } /** * Builds an object consisting of MIME header/value pairs. * * @access public * * @param string $headers A text string containing the headers * (e.g. output from * imap_fetchheader()). * @param optional boolean $decode Should the headers be decoded? * @param optional boolean $lowercase Should the keys be in lowercase? * * @return array An array consisting of the header name as the key and * the header value as the value. * A header with multiple entries will be stored in * 'value' as an array. */ function parseMIMEHeaders($headers, $decode = true, $lowercase = false) { $header = ''; $ob = array(); foreach (explode("\n", $headers) as $val) { if ($decode) { $val = MIME::decode($val); } if (preg_match("/^([^\s]+)\:(.*)/", $val, $matches)) { $val = trim($matches[2]); $header = $matches[1]; if (isset($ob[$header])) { if (!is_array($ob[$header])) { $temp = $ob[$header]; $ob[$header] = array(); $ob[$header][] = $temp; } $ob[$header][] = $val; continue; } } else { $val = ' ' . trim($val); } if (!empty($header)) { if (isset($ob[$header])) { if (is_array($ob[$header])) { end($ob[$header]); $ob[$header][key($ob[$header])] .= $val; } else { $ob[$header] .= $val; } } else { $ob[$header] = $val; } } } return ($lowercase) ? array_change_key_case($ob, CASE_LOWER) : $ob; } } --- NEW FILE: Viewer.php --- <?php /** * The MIME_Viewer:: class provides an abstracted interface to * render out MIME types into HTML format. It depends on a * set of MIME_Viewer_* drivers which handle the actual rendering, * and also a configuration file to map MIME types to drivers. * * $Horde: framework/MIME/MIME/Viewer.php,v 1.60 2004/04/13 18:03:51 slusarz Exp $ * * Copyright 1999-2004 Anil Madhavapeddy <anil@recoil.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anil Madhavapeddy <anil@recoil.org> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_MIME_Viewer */ class MIME_Viewer { /** * The MIME_Part object to render. * * @var object MIME_Part $mime_part */ var $mime_part; /** * Configuration parameters. * * @var array $_conf */ var $_conf = array(); /** * getDriver cache. * * @var array $_driverCache */ var $_driverCache = array(); /** * Attempts to return a concert MIME_Viewer_* object based on the * type of MIME_Part passed onto it. * * @param object MIME_Part &$mime_part Reference to a MIME_Part object * with the information to be * rendered. * @param optional string $mime_type Use this MIME type instead of the * type stored in the $mime_part. * * @return object MIME_Viewer The MIME_Viewer object. * Returns false on error. */ function &factory(&$mime_part, $mime_type = null) { /* Check that we have a valid MIME_Part object */ if (!is_a($mime_part, 'MIME_Part')) { return false; } /* Determine driver type from the MIME type */ if (empty($mime_type)) { $mime_type = $mime_part->getType(); if (empty($mime_type)) { return false; } } /* Spawn the relevant driver, and return it (or false on failure) */ if (($ob = MIME_Viewer::includeDriver($mime_type))) { $class = (($ob->module == 'horde') ? '' : $ob->module . '_') . 'MIME_Viewer_' . $ob->driver; if (class_exists($class)) { return $ret = &new $class($mime_part, $GLOBALS['mime_drivers'][$ob->module][$ob->driver]); } } return false; } /** * Include the code for the relevant driver. * * @access public * * @param string $mime_type The Content-type of the part to be rendered. * * @return object stdClass See MIME_Driver::getDriver(). */ function includeDriver($mime_type) { global $registry; /* Figure the correct driver for this MIME type. If there is no application-specific module, a general Horde one will attempt to be used. */ if (($ob = MIME_Viewer::getDriver($mime_type, $registry->getApp()))) { /* Include the class. */ require_once MIME_Viewer::resolveDriver($ob->driver, $ob->module); } return $ob; } /** * Constructor for MIME_Viewer * * @access public * * @param object MIME_Part &$mime_part Reference to a MIME_Part object * with the information to be rendered */ function MIME_Viewer(&$mime_part, $conf = array()) { $this->mime_part = &$mime_part; $this->_conf = $conf; } /** * Sets the MIME_Part object for the class. * * @access public * * @param object MIME_Part &$mime_part Reference to a MIME_Part object * with the information to be rendered */ function setMIMEPart(&$mime_part) { $this->mime_part = &$mime_part; } /** * Return the MIME type of the rendered content. This can be * overridden by the individual drivers, depending on what format * they output in. By default, it passes through the MIME type of * the object, or replaces custom extension types with * 'text/plain' to let the browser do a best-guess render. * * @access public * * @return string MIME-type of the output content. */ function getType() { if ($this->mime_part->getPrimaryType() == 'x-extension') { return 'text/plain'; } else { return $this->mime_part->getType(); } } /** * Return the rendered version of the object. * Should be overridden by individual drivers to perform custom tasks. * The $mime_part class variable has the information to render, * encapsulated in a MIME_Part object. * * @access public * * @param mixed $params Any optional parameters this driver needs at * runtime. * * @return string Rendered version of the object. */ function render($params = null) { return $this->mime_part->getContents(); } /** * Return text/html output used as alternative output when the fully * rendered object can not (or should not) be displayed. For example, * this function should be used for MIME attachments that can not be * viewed inline, where the user may be given options on how to view * the attachment. * Should be overridden by individual drivers to perform custom tasks. * The $mime_part class variable has the information to render, * encapsulated in a MIME_Part object. * * @access public * * @param mixed $params Any optional parameters this driver needs at * runtime. * * @return string Text/html rendered information. */ function renderAttachmentInfo() { } /** * Can this driver render the the data inline? * * @access public * * @return boolean True if the driver can display inline. */ function canDisplayInline() { if ($this->getConfigParam('inline')) { return true; } else { return false; } } /** * Given a driver and an application, this returns the fully * qualified filesystem path to the driver source file. * * @access public * * @param optional string $driver Driver name. * @param optional string $app Application name. * * @return string Filesystem path of the driver/application queried. */ function resolveDriver($driver = 'default', $app = 'horde') { if ($app == 'horde') { return dirname(__FILE__) . '/Viewer/' . $driver . '.php'; } else { return $GLOBALS['registry']->applications[$app]['fileroot'] . '/lib/MIME/Viewer/' . $driver . '.php'; } } /** * Given an input MIME type and a module name, this function * resolves it into a specific output driver which can handle it. * * @param string $mimeType MIME type to resolve. * @param string $module Module in which to search for the driver. * * @return object stdClass Object with the following items: * <pre> * 'driver' -- Name of driver (e.g. 'enscript') * 'exact' -- Was the driver and exact match? (true/false) * 'module' -- The module containing driver (e.g. 'horde') * </pre> * Returns false if driver could not be found. */ function getDriver($mimeType, $module = 'horde') { global $mime_drivers, $mime_drivers_map; $cacheName = $mimeType . '|' . $module; if (isset($this) && isset($this->_driverCache[$cacheName])) { return $this->_driverCache[$cacheName]; } $driver = ''; $exactDriver = false; list($primary_type, ) = explode('/', $mimeType, 2); $allSub = $primary_type . '/*'; /* If the module doesn't exist in $mime_drivers_map, check for Horde viewers. */ if (!isset($mime_drivers_map[$module]) && $module != 'horde') { return MIME_Viewer::getDriver($mimeType, 'horde'); } $dr = &$mime_drivers[$module]; $map = &$mime_drivers_map[$module]; /* If an override exists for this MIME type, then use that */ if (isset($map['overrides'][$mimeType])) { $driver = $map['overrides'][$mimeType]; $exactDriver = true; } elseif (isset($map['overrides'][$allSub])) { $driver = $map['overrides'][$allSub]; $exactDriver = true; } elseif (isset($map['registered'])) { /* Iterate through the list of registered drivers, and see if this MIME type exists in the MIME types that they claim to handle. If the driver handles it, then assign it as the rendering driver. If we find a generic handler, keep iterating to see if we can find a specific handler. */ foreach ($map['registered'] as $val) { if (in_array($mimeType, $dr[$val]['handles'])) { $driver = $val; $exactDriver = true; break; } elseif (in_array($allSub, $dr[$val]['handles'])) { $driver = $val; } } } /* If this is an application specific module, and an exact match was not found, search for a Horde-wide specific driver. Only use the Horde-specific driver if it is NOT the 'default' driver AND the Horde driver is an exact match. */ if (!$exactDriver && $module != 'horde') { $ob = MIME_Viewer::getDriver($mimeType, 'horde'); if (empty($driver) || (($ob->driver != 'default') && $ob->exact)) { $driver = $ob->driver; $module = 'horde'; } } /* If the 'default' driver exists in this module, fall back to that. */ if (empty($driver) && @is_file(MIME_Viewer::resolveDriver('default', $module))) { $driver = 'default'; } if (empty($driver)) { $this->_driverCache[$cacheName] = false; return false; } else { $ob = new stdClass; $ob->driver = $driver; $ob->exact = $exactDriver; $ob->module = $module; if (isset($this)) { $this->_driverCache[$cacheName] = $ob; } return $ob; } } /** * Given a MIME type, this function will return an appropriate * icon. * * @access public * * @param string $mimeType The MIME type that we need an icon for. * * @return string The URL to the appropriate icon. */ function getIcon($mimeType) { $app = $GLOBALS['registry']->getApp(); $ob = MIME_Viewer::_getIcon($mimeType, $app); if (!isset($ob) && ($app != 'horde')) { $obHorde = MIME_Viewer::_getIcon($mimeType, 'horde'); $icon = $obHorde->url; } elseif (!isset($ob)) { return null; } elseif (($ob->match !== 0) && ($app != 'horde')) { $obHorde = MIME_Viewer::_getIcon($mimeType, 'horde'); if (!is_null($ob->match) && ($ob->match <= $obHorde->match)) { $icon = $ob->url; } else { $icon = $obHorde->url; } } else { $icon = $ob->url; } return $icon; } /** * Given an input MIME type and module, this function returns the * URL of an icon that can be associated with it * * @access private * * @param string $mimeType MIME type to get the icon for. * * @return object stdClass url: URL to an icon, or null if none * could be found. * exact: How exact the match is. * 0 => 'exact', 1 => 'primary', * 2 => 'driver', 3 => 'default' * or null. */ function _getIcon($mimeType, $module = 'horde') { global $mime_drivers; $ob = MIME_Viewer::getDriver($mimeType, $module); if (!is_object($ob)) { return array(false, null); } $driver = $ob->driver; list($primary_type,) = explode('/', $mimeType, 2); $allSub = $primary_type . '/*'; $retOb = &new stdClass(); $retOb->match = null; $retOb->url = null; /* If the module doesn't exist in $mime_drivers, return now. */ if (!isset($mime_drivers[$module])) { return null; } $dr = &$mime_drivers[$module]; /* If a specific icon for this driver and mimetype is defined, then use that. */ if (isset($dr[$driver]['icons'])) { $icondr = &$mime_drivers[$module][$driver]['icons']; $iconList = array($mimeType => 0, $allSub => 1, 'default' => 2); foreach ($iconList as $key => $val) { if (isset($icondr[$key])) { $retOb->url = $icondr[$key]; $retOb->match = $val; break; } } } /* Try to use a default icon if none already obtained. */ if (is_null($retOb->url) && isset($dr['default'])) { $dr = &$mime_drivers[$module]['default']; if (isset($dr['icons']['default'])) { $retOb->url = $dr['default']['icons']['default']; $retOb->match = 3; } } if (!is_null($retOb->url)) { $retOb->url = $GLOBALS['registry']->applicationWebPath("%application%/graphics/mime/" . $retOb->url, $module); } return $retOb; } /** * Returns the character set used for the Viewer. * Should be overridden by individual drivers to perform custom tasks. * * @access public * * @return string The character set used by this Viewer. */ function getCharset() { return $this->mime_part->getCharset(); } /** * Return a configuration parameter for the current viewer. * * @access public * * @param string $param The parameter name. * * @return mixed The value of the parameter; returns null if the parameter * doesn't exist. */ function getConfigParam($param) { return (isset($this->_conf[$param])) ? $this->_conf[$param] : null; } } --- NEW FILE: mime.magic.php --- <?php /** * Data file used by MIME_Magic::. * * $Horde: framework/MIME/MIME/mime.magic.php,v 1.5 2004/03/20 22:45:37 jan Exp $ * * @package Horde_MIME */ $mime_magic[0][30]["\145\166\141\154\40\42\145\170\145\143\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][24]["\145\166\141\154\40\42\145\170\145\143\40\57\165\163\162\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][23]["\103\157\155\155\157\156\40\163\165\142\144\151\162\145\143\164\157\162\151\145\163\72\40"] = 'text/x-patch'; $mime_magic[0][23]["\75\74\154\151\163\164\76\156\74\160\162\157\164\157\143\157\154\40\142\142\156\55\155"] = 'application/data'; $mime_magic[0][22]["\101\115\101\116\104\101\72\40\124\101\120\105\123\124\101\122\124\40\104\101\124\105"] = 'application/x-amanda-header'; $mime_magic[0][22]["\107\106\61\120\101\124\103\110\61\60\60\60\111\104\43\60\60\60\60\60\62\60"] = 'audio/x-gus-patch'; $mime_magic[0][22]["\107\106\61\120\101\124\103\110\61\61\60\60\111\104\43\60\60\60\60\60\62\60"] = 'audio/x-gus-patch'; $mime_magic[0][22]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\142\141\163\150"] = 'application/x-sh'; $mime_magic[0][22]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][22]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][22]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][22]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][22]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\142\141\163\150"] = 'application/x-sh'; $mime_magic[0][22]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][22]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][22]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][22]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][21]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\141\163\150"] = 'application/x-zsh'; $mime_magic[0][21]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\172\163\150"] = 'application/x-zsh'; $mime_magic[0][21]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\141\163\150"] = 'application/x-zsh'; $mime_magic[0][21]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\172\163\150"] = 'application/x-zsh'; $mime_magic[0][21]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\142\141\163\150"] = 'application/x-sh'; $mime_magic[0][21]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][21]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][21]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][21]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][20]["\145\166\141\154\40\42\145\170\145\143\40\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][20]["\43\41\11\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\141\145"] = 'text/script'; $mime_magic[0][20]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\141\145"] = 'text/script'; $mime_magic[0][20]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\141\163\150"] = 'application/x-sh'; $mime_magic[0][20]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\172\163\150"] = 'application/x-zsh'; $mime_magic[0][19]["\103\162\145\141\164\151\166\145\40\126\157\151\143\145\40\106\151\154\145"] = 'audio/x-voc'; $mime_magic[0][19]["\41\74\141\162\143\150\76\156\137\137\137\137\137\137\137\137\137\137\105"] = 'application/x-ar'; $mime_magic[0][19]["\41\74\141\162\143\150\76\156\137\137\137\137\137\137\137\137\66\64\105"] = 'application/data'; $mime_magic[0][19]["\43\41\57\165\163\162\57\154\157\143\141\154\57\142\151\156\57\141\145"] = 'text/script'; $mime_magic[0][18]["\106\151\114\145\123\164\101\162\124\146\111\154\105\163\124\141\122\164"] = 'text/x-apple-binscii'; $mime_magic[0][18]["\43\41\40\57\165\163\162\57\154\157\143\141\154\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][18]["\45\41\120\123\55\101\144\157\142\145\106\157\156\164\55\61\56\60"] = 'font/type1'; $mime_magic[0][17]["\43\41\57\165\163\162\57\154\157\143\141\154\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][16]["\105\170\164\145\156\144\145\144\40\115\157\144\165\154\145\72"] = 'audio/x-ft2-mod'; $mime_magic[0][16]["\123\164\141\162\164\106\157\156\164\115\145\164\162\151\143\163"] = 'font/x-sunos-news'; $mime_magic[0][16]["\43\41\11\57\165\163\162\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][16]["\43\41\11\57\165\163\162\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][16]["\43\41\11\57\165\163\162\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][16]["\43\41\40\57\165\163\162\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][16]["\43\41\40\57\165\163\162\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][16]["\43\41\40\57\165\163\162\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][16]["\74\115\141\153\145\162\104\151\143\164\151\157\156\141\162\171"] = 'application/x-framemaker'; $mime_magic[0][16]["\74\115\141\153\145\162\123\143\162\145\145\156\106\157\156\164"] = 'font/x-framemaker'; $mime_magic[0][15]["\43\41\11\57\165\163\162\57\142\151\156\57\141\167\153"] = 'application/x-awk'; $mime_magic[0][15]["\43\41\40\57\165\163\162\57\142\151\156\57\141\167\153"] = 'application/x-awk'; $mime_magic[0][15]["\43\41\57\165\163\162\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][15]["\43\41\57\165\163\162\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][15]["\43\41\57\165\163\162\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][14]["\41\74\141\162\143\150\76\156\144\145\142\151\141\156"] = 'application/x-dpkg'; $mime_magic[0][14]["\43\41\57\165\163\162\57\142\151\156\57\141\167\153"] = 'application/x-awk'; $mime_magic[0][14]["\74\41\104\117\103\124\131\120\105\40\110\124\115\114"] = 'text/html'; $mime_magic[0][14]["\74\41\144\157\143\164\171\160\145\40\150\164\155\154"] = 'text/html'; $mime_magic[0][13]["\107\111\115\120\40\107\162\141\144\151\145\156\164"] = 'application/x-gimp-gradient'; $mime_magic[0][12]["\122\145\164\165\162\156\55\120\141\164\150\72"] = 'message/rfc822'; $mime_magic[0][12]["\43\41\11\57\142\151\156\57\142\141\163\150"] = 'application/x-sh'; $mime_magic[0][12]["\43\41\11\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][12]["\43\41\11\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][12]["\43\41\11\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][12]["\43\41\11\57\142\151\156\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][12]["\43\41\40\57\142\151\156\57\142\141\163\150"] = 'application/x-sh'; $mime_magic[0][12]["\43\41\40\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][12]["\43\41\40\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][12]["\43\41\40\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][12]["\43\41\40\57\142\151\156\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][11]["\43\41\11\57\142\151\156\57\141\167\153"] = 'application/x-awk'; $mime_magic[0][11]["\43\41\11\57\142\151\156\57\143\163\150"] = 'application/x-csh'; $mime_magic[0][11]["\43\41\11\57\142\151\156\57\153\163\150"] = 'application/x-ksh'; $mime_magic[0][11]["\43\41\40\57\142\151\156\57\141\167\153"] = 'application/x-awk'; $mime_magic[0][11]["\43\41\40\57\142\151\156\57\143\163\150"] = 'application/x-csh'; $mime_magic[0][11]["\43\41\40\57\142\151\156\57\153\163\150"] = 'application/x-ksh'; $mime_magic[0][11]["\43\41\57\142\151\156\57\142\141\163\150"] = 'application/x-sh'; $mime_magic[0][11]["\43\41\57\142\151\156\57\147\141\167\153"] = 'application/x-awk'; $mime_magic[0][11]["\43\41\57\142\151\156\57\156\141\167\153"] = 'application/x-awk'; $mime_magic[0][11]["\43\41\57\142\151\156\57\160\145\162\154"] = 'application/x-perl'; $mime_magic[0][11]["\43\41\57\142\151\156\57\164\143\163\150"] = 'application/x-csh'; $mime_magic[0][10]["\102\151\164\155\141\160\146\151\154\145"] = 'image/unknown'; $mime_magic[0][10]["\123\124\101\122\124\106\117\116\124\40"] = 'font/x-bdf'; $mime_magic[0][10]["\43\41\11\57\142\151\156\57\162\143"] = 'text/script'; $mime_magic[0][10]["\43\41\11\57\142\151\156\57\163\150"] = 'application/x-sh'; $mime_magic[0][10]["\43\41\40\57\142\151\156\57\162\143"] = 'text/script'; $mime_magic[0][10]["\43\41\40\57\142\151\156\57\163\150"] = 'application/x-sh'; $mime_magic[0][10]["\43\41\57\142\151\156\57\141\167\153"] = 'application/x-awk'; $mime_magic[0][10]["\43\41\57\142\151\156\57\143\163\150"] = 'application/x-csh'; $mime_magic[0][10]["\43\41\57\142\151\156\57\153\163\150"] = 'application/x-ksh'; $mime_magic[0][10]["\74\115\141\153\145\162\106\151\154\145"] = 'application/x-framemaker'; $mime_magic[0][9]["\122\145\143\145\151\166\145\144\72"] = 'message/rfc822'; $mime_magic[0][9]["\123\164\141\162\164\106\157\156\164"] = 'font/x-sunos-news'; $mime_magic[0][9]["\211\114\132\117\0\15\12\32\12"] = 'application/data'; $mime_magic[0][9]["\43\41\57\142\151\156\57\162\143"] = 'text/script'; $mime_magic[0][9]["\43\41\57\142\151\156\57\163\150"] = 'application/x-sh'; $mime_magic[0][9]["\55\162\157\155\61\146\163\55\60"] = 'application/x-filesystem'; $mime_magic[0][9]["\74\102\157\157\153\106\151\154\145"] = 'application/x-framemaker'; $mime_magic[0][8]["\117\156\154\171\40\151\156\40"] = 'text/x-patch'; $mime_magic[0][8]["\147\151\155\160\40\170\143\146"] = 'application/x-gimp-image'; $mime_magic[0][8]["\155\163\147\143\141\164\60\61"] = 'application/x-locale'; $mime_magic[0][8]["\32\141\162\143\150\151\166\145"] = 'application/data'; $mime_magic[0][8]["\41\74\120\104\106\76\41\156"] = 'application/x-prof'; $mime_magic[0][8]["\74\115\111\106\106\151\154\145"] = 'application/x-framemaker'; $mime_magic[0][7]["\101\162\164\151\143\154\145"] = 'message/news'; $mime_magic[0][7]["\120\103\104\137\117\120\101"] = 'x/x-photo-cd-overfiew-file'; $mime_magic[0][7]["\351\54\1\112\101\115\11"] = 'application/data'; $mime_magic[0][7]["\41\74\141\162\143\150\76"] = 'application/x-ar'; $mime_magic[0][7]["\72\40\163\150\145\154\154"] = 'application/data'; $mime_magic[0][6]["\116\165\106\151\154\145"] = 'application/data'; $mime_magic[0][6]["\116\365\106\351\154\345"] = 'application/data'; $mime_magic[0][6]["\60\67\60\67\60\61"] = 'application/x-cpio'; $mime_magic[0][6]["\60\67\60\67\60\62"] = 'application/x-cpio'; $mime_magic[0][6]["\60\67\60\67\60\67"] = 'application/x-cpio'; $mime_magic[0][6]["\74\115\141\153\145\162"] = 'application/x-framemaker'; $mime_magic[0][6]["\74\124\111\124\114\105"] = 'text/html'; $mime_magic[0][6]["\74\164\151\164\154\145"] = 'text/html'; $mime_magic[0][5]["\0\1\0\0\0"] = 'font/ttf'; $mime_magic[0][5]["\0\4\36\212\200"] = 'application/core'; $mime_magic[0][5]["\102\101\102\131\114"] = 'message/x-gnu-rmail'; $mime_magic[0][5]["\102\105\107\111\116"] = 'application/x-awk'; $mime_magic[0][5]["\103\157\162\145\1"] = 'application/x-executable-file'; $mime_magic[0][5]["\104\61\56\60\15"] = 'font/x-speedo'; $mime_magic[0][5]["\106\162\157\155\72"] = 'message/rfc822'; $mime_magic[0][5]["\115\101\123\137\125"] = 'audio/x-multimate-mod'; $mime_magic[0][5]["\120\117\136\121\140"] = 'text/vnd.ms-word'; $mime_magic[0][5]["\120\141\164\150\72"] = 'message/news'; $mime_magic[0][5]["\130\162\145\146\72"] = 'message/news'; $mime_magic[0][5]["\144\151\146\146\40"] = 'text/x-patch'; $mime_magic[0][5]["\225\64\62\62\336"] = 'application/x-locale'; $mime_magic[0][5]["\336\62\62\64\225"] = 'application/x-locale'; $mime_magic[0][5]["\74\110\105\101\104"] = 'text/html'; $mime_magic[0][5]["\74\110\124\115\114"] = 'text/html'; $mime_magic[0][5]["\74\150\145\141\144"] = 'text/html'; $mime_magic[0][5]["\74\150\164\155\154"] = 'text/html'; $mime_magic[0][5]["\75\74\141\162\76"] = 'application/x-ar'; $mime_magic[0][4]["\0\0\0\314"] = 'application/x-executable-file'; $mime_magic[0][4]["\0\0\0\4"] = 'font/x-snf'; $mime_magic[0][4]["\0\0\1\107"] = 'application/x-object-file'; $mime_magic[0][4]["\0\0\1\113"] = 'application/x-executable-file'; $mime_magic[0][4]["\0\0\1\115"] = 'application/x-executable-file'; $mime_magic[0][4]["\0\0\1\117"] = 'application/x-executable-file'; $mime_magic[0][4]["\0\0\1\201"] = 'application/x-object-file'; $mime_magic[0][4]["\0\0\1\207"] = 'application/data'; $mime_magic[0][4]["\0\0\1\263"] = 'video/mpeg'; $mime_magic[0][4]["\0\0\1\272"] = 'video/mpeg'; $mime_magic[0][4]["\0\0\1\6"] = 'application/x-executable-file'; $mime_magic[0][4]["\0\0\201\154"] = 'application/x-apl-workspace'; $mime_magic[0][4]["\0\0\377\145"] = 'application/x-library-file'; $mime_magic[0][4]["\0\0\377\155"] = 'application/data'; $mime_magic[0][4]["\0\0\3\347"] = 'application/x-library-file'; $mime_magic[0][4]["\0\0\3\363"] = 'application/x-executable-file'; $mime_magic[0][4]["\0\144\163\56"] = 'audio/basic'; $mime_magic[0][4]["\0\1\22\127"] = 'application/core'; $mime_magic[0][4]["\0\22\326\207"] = 'image/x11'; $mime_magic[0][4]["\0\3\233\355"] = 'application/data'; $mime_magic[0][4]["\0\3\233\356"] = 'application/data'; $mime_magic[0][4]["\0\5\26\0"] = 'application/data'; $mime_magic[0][4]["\0\5\26\7"] = 'application/data'; $mime_magic[0][4]["\0\5\61\142"] = 'application/x-db'; $mime_magic[0][4]["\0\6\25\141"] = 'application/x-db'; $mime_magic[0][4]["\103\124\115\106"] = 'audio/x-cmf'; $mime_magic[0][4]["\105\115\117\104"] = 'audio/x-emod'; $mime_magic[0][4]["\106\106\111\114"] = 'font/ttf'; $mime_magic[0][4]["\106\117\116\124"] = 'font/x-vfont'; $mime_magic[0][4]["\107\104\102\115"] = 'application/x-gdbm'; $mime_magic[0][4]["\107\111\106\70"] = 'image/gif'; $mime_magic[0][4]["\10\16\12\17"] = 'application/data'; $mime_magic[0][4]["\110\120\101\113"] = 'application/data'; $mime_magic[0][4]["\111\111\116\61"] = 'image/tiff'; $mime_magic[0][4]["\111\111\52\0"] = 'image/tiff'; $mime_magic[0][4]["\114\104\110\151"] = 'application/data'; $mime_magic[0][4]["\114\127\106\116"] = 'font/type1'; $mime_magic[0][4]["\115\115\0\52"] = 'image/tiff'; $mime_magic[0][4]["\115\117\126\111"] = 'video/x-sgi-movie'; $mime_magic[0][4]["\115\124\150\144"] = 'audio/midi'; $mime_magic[0][4]["\115\247\356\350"] = 'font/x-hp-windows'; $mime_magic[0][4]["\116\124\122\113"] = 'audio/x-multitrack'; $mime_magic[0][4]["\120\113\3\4"] = 'application/zip'; $mime_magic[0][4]["\122\111\106\106"] = 'audio/x-wav'; $mime_magic[0][4]["\122\141\162\41"] = 'application/x-rar'; $mime_magic[0][4]["\123\121\123\110"] = 'application/data'; $mime_magic[0][4]["\124\101\104\123"] = 'application/x-tads-game'; $mime_magic[0][4]["\125\103\62\32"] = 'application/data'; $mime_magic[0][4]["\125\116\60\65"] = 'audio/x-mikmod-uni'; $mime_magic[0][4]["\12\17\10\16"] = 'application/data'; $mime_magic[0][4]["\131\246\152\225"] = 'x/x-image-sun-raster'; $mime_magic[0][4]["\145\377\0\0"] = 'application/x-ar'; $mime_magic[0][4]["\150\163\151\61"] = 'image/x-jpeg-proprietary'; $mime_magic[0][4]["\16\10\17\12"] = 'application/data'; $mime_magic[0][4]["\177\105\114\106"] = 'application/x-executable-file'; $mime_magic[0][4]["\17\12\16\10"] = 'application/data'; $mime_magic[0][4]["\1\130\41\246"] = 'application/core'; $mime_magic[0][4]["\1\146\143\160"] = 'font/x-pcf'; $mime_magic[0][4]["\211\120\116\107"] = 'image/x-png'; $mime_magic[0][4]["\23\127\232\316"] = 'application/x-gdbm'; $mime_magic[0][4]["\23\172\51\104"] = 'font/x-sunos-news'; $mime_magic[0][4]["\23\172\51\107"] = 'font/x-sunos-news'; $mime_magic[0][4]["\23\172\51\120"] = 'font/x-sunos-news'; $mime_magic[0][4]["\23\172\51\121"] = 'font/x-sunos-news'; $mime_magic[0][4]["\24\2\131\31"] = 'font/x-libgrx'; $mime_magic[0][4]["\260\61\63\140"] = 'application/x-bootable'; $mime_magic[0][4]["\2\10\1\10"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\10\1\6"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\10\1\7"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\10\377\145"] = 'application/x-library-file'; $mime_magic[0][4]["\2\12\1\10"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\12\1\7"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\12\377\145"] = 'application/x-library-file'; $mime_magic[0][4]["\2\13\1\10"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\13\1\13"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\13\1\15"] = 'application/x-library-file'; $mime_magic[0][4]["\2\13\1\16"] = 'application/x-library-file'; $mime_magic[0][4]["\2\13\1\6"] = 'application/x-object-file'; $mime_magic[0][4]["\2\13\1\7"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\14\1\10"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\14\1\13"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\14\1\14"] = 'application/x-lisp'; $mime_magic[0][4]["\2\14\1\15"] = 'application/x-library-file'; $mime_magic[0][4]["\2\14\1\16"] = 'application/x-library-file'; $mime_magic[0][4]["\2\14\1\6"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\14\1\7"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\14\377\145"] = 'application/x-library-file'; $mime_magic[0][4]["\2\20\1\10"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\20\1\13"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\20\1\15"] = 'application/x-library-file'; $mime_magic[0][4]["\2\20\1\16"] = 'application/x-library-file'; $mime_magic[0][4]["\2\20\1\6"] = 'application/x-object-file'; $mime_magic[0][4]["\2\20\1\7"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\24\1\10"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\24\1\13"] = 'application/x-executable-file'; $mime_magic[0][4]["\2\24\1\15"] = 'application/x-object-file'; $mime_magic[0][4]["\2\24\1\16"] = 'application/x-library-file'; $mime_magic[0][4]["\2\24\1\6"] = 'application/x-object-file'; $mime_magic[0][4]["\2\24\1\7"] = 'application/x-executable-file'; $mime_magic[0][4]["\361\60\100\273"] = 'image/x-cmu-raster'; $mime_magic[0][4]["\366\366\366\366"] = 'application/x-pc-floppy'; $mime_magic[0][4]["\377\106\117\116"] = 'font/x-dos'; $mime_magic[0][4]["\41\74\141\162"] = 'application/x-ar'; $mime_magic[0][4]["\43\41\11\57"] = 'text/script'; $mime_magic[0][4]["\43\41\40\57"] = 'text/script'; $mime_magic[0][4]["\52\123\124\101"] = 'application/data'; $mime_magic[0][4]["\52\52\52\40"] = 'text/x-patch'; $mime_magic[0][4]["\56\162\141\375"] = 'audio/x-pn-realaudio'; $mime_magic[0][4]["\56\163\156\144"] = 'audio/basic'; $mime_magic[0][4]["\61\143\167\40"] = 'application/data'; $mime_magic[0][4]["\61\276\0\0"] = 'text/vnd.ms-word'; $mime_magic[0][4]["\62\62\67\70"] = 'application/data'; $mime_magic[0][4]["\74\115\115\114"] = 'application/x-framemaker'; $mime_magic[0][4]["\74\141\162\76"] = 'application/x-ar'; $mime_magic[0][3]["\102\132\150"] = 'application/x-bzip2'; $mime_magic[0][3]["\106\101\122"] = 'audio/mod'; $mime_magic[0][3]["\115\124\115"] = 'audio/x-multitrack'; $mime_magic[0][3]["\123\102\111"] = 'audio/x-sbi'; $mime_magic[0][3]["\124\117\103"] = 'audio/x-toc'; $mime_magic[0][3]["\12\107\114"] = 'application/data'; $mime_magic[0][3]["\146\154\143"] = 'application/x-font'; $mime_magic[0][3]["\146\154\146"] = 'font/x-figlet'; $mime_magic[0][3]["\33\105\33"] = 'image/x-pcl-hp'; $mime_magic[0][3]["\33\143\33"] = 'application/data'; $mime_magic[0][3]["\377\377\174"] = 'application/data'; $mime_magic[0][3]["\377\377\176"] = 'application/data'; $mime_magic[0][3]["\377\377\177"] = 'application/data'; $mime_magic[0][3]["\43\41\40"] = 'text/script'; $mime_magic[0][3]["\43\41\57"] = 'text/script'; $mime_magic[0][3]["\4\45\41"] = 'application/postscript'; $mime_magic[0][3]["\55\150\55"] = 'application/data'; $mime_magic[0][3]["\61\143\167"] = 'application/data'; $mime_magic[0][2]["\0\0"] = 'application/x-executable-file'; $mime_magic[0][2]["\102\115"] = 'image/x-bmp'; $mime_magic[0][2]["\102\132"] = 'application/x-bzip'; $mime_magic[0][2]["\111\103"] = 'image/x-ico'; $mime_magic[0][2]["\112\116"] = 'audio/x-669-mod'; $mime_magic[0][2]["\115\132"] = 'application/x-ms-dos-executable'; $mime_magic[0][2]["\120\61"] = 'image/x-portable-bitmap'; $mime_magic[0][2]["\120\62"] = 'image/x-portable-graymap'; $mime_magic[0][2]["\120\63"] = 'image/x-portable-pixmap'; $mime_magic[0][2]["\120\64"] = 'image/x-portable-bitmap'; $mime_magic[0][2]["\120\65"] = 'image/x-portable-graymap'; $mime_magic[0][2]["\120\66"] = 'image/x-portable-pixmap'; $mime_magic[0][2]["\151\146"] = 'audio/x-669-mod'; $mime_magic[0][2]["\161\307"] = 'application/x-cpio'; $mime_magic[0][2]["\166\377"] = 'application/data'; $mime_magic[0][2]["\1\110"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\111"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\124"] = 'application/data'; $mime_magic[0][2]["\1\125"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\160"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\161"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\175"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\177"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\20"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\203"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\21"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\210"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\217"] = 'application/x-object-file'; $mime_magic[0][2]["\1\224"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\227"] = 'application/x-executable-file'; $mime_magic[0][2]["\1\332"] = 'x/x-image-sgi'; $mime_magic[0][2]["\1\36"] = 'font/x-vfont'; $mime_magic[0][2]["\1\6"] = 'application/x-executable-file'; $mime_magic[0][2]["\307\161"] = 'application/x-bcpio'; $mime_magic[0][2]["\313\5"] = 'application/data'; $mime_magic[0][2]["\352\140"] = 'application/x-arj'; $mime_magic[0][2]["\367\131"] = 'font/x-tex'; $mime_magic[0][2]["\367\203"] = 'font/x-tex'; $mime_magic[0][2]["\367\312"] = 'font/x-tex'; $mime_magic[0][2]["\36\1"] = 'font/x-vfont'; $mime_magic[0][2]["\375\166"] = 'application/x-lzh'; $mime_magic[0][2]["\376\166"] = 'application/data'; $mime_magic[0][2]["\377\145"] = 'application/data'; $mime_magic[0][2]["\377\155"] = 'application/data'; $mime_magic[0][2]["\377\166"] = 'application/data'; $mime_magic[0][2]["\377\330"] = 'image/jpeg'; $mime_magic[0][2]["\377\37"] = 'application/data'; $mime_magic[0][2]["\37\213"] = 'application/x-gzip'; $mime_magic[0][2]["\37\235"] = 'application/compress'; $mime_magic[0][2]["\37\236"] = 'application/data'; $mime_magic[0][2]["\37\237"] = 'application/data'; $mime_magic[0][2]["\37\240"] = 'application/data'; $mime_magic[0][2]["\37\36"] = 'application/data'; $mime_magic[0][2]["\37\37"] = 'application/data'; $mime_magic[0][2]["\37\377"] = 'application/data'; $mime_magic[0][2]["\45\41"] = 'application/postscript'; $mime_magic[0][2]["\4\66"] = 'font/linux-psf'; $mime_magic[0][2]["\57\57"] = 'text/cpp'; $mime_magic[0][2]["\5\1"] = 'application/x-locale'; $mime_magic[0][2]["\6\1"] = 'application/x-executable-file'; $mime_magic[0][2]["\6\2"] = 'application/x-alan-adventure-game'; $mime_magic[0][2]["\7\1"] = 'application/x-executable-file'; $mime_magic[1][3]["\120\116\107"] = 'image/x-png'; $mime_magic[1][3]["\127\120\103"] = 'application/vnd.wordperfect'; $mime_magic[2][6]["\55\154\150\64\60\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\144\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\60\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\61\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\62\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\63\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\64\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\150\65\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\172\163\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\172\64\55"] = 'application/x-lha'; $mime_magic[2][5]["\55\154\172\65\55"] = 'application/x-lha'; $mime_magic[2][2]["\0\21"] = 'font/x-tex-tfm'; $mime_magic[2][2]["\0\22"] = 'font/x-tex-tfm'; $mime_magic[4][4]["\155\144\141\164"] = 'video/quicktime'; $mime_magic[4][4]["\155\157\157\166"] = 'video/quicktime'; $mime_magic[4][4]["\160\151\160\145"] = 'application/data'; $mime_magic[4][4]["\160\162\157\146"] = 'application/data'; $mime_magic[4][2]["\257\21"] = 'video/fli'; $mime_magic[4][2]["\257\22"] = 'video/flc'; $mime_magic[6][18]["\45\41\120\123\55\101\144\157\142\145\106\157\156\164\55\61\56\60"] = 'font/type1'; $mime_magic[7][22]["\357\20\60\60\60\60\60\60\60\60\60\60\60\60\60\60\60\60\60\60\60\60"] = 'application/core'; $mime_magic[7][4]["\0\105\107\101"] = 'font/x-dos'; $mime_magic[7][4]["\0\126\111\104"] = 'font/x-dos'; $mime_magic[8][4]["\23\172\53\105"] = 'font/x-sunos-news'; $mime_magic[8][4]["\23\172\53\110"] = 'font/x-sunos-news'; $mime_magic[10][25]["\43\40\124\150\151\163\40\151\163\40\141\40\163\150\145\154\154\40\141\162\143\150\151\166\145"] = 'application/x-shar'; $mime_magic[20][4]["\107\111\115\120"] = 'application/x-gimp-brush'; $mime_magic[20][4]["\107\120\101\124"] = 'application/x-gimp-pattern'; $mime_magic[20][4]["\375\304\247\334"] = 'application/x-zoo'; $mime_magic[21][8]["\41\123\103\122\105\101\115\41"] = 'audio/x-st2-mod'; $mime_magic[24][4]["\0\0\352\153"] = 'application/x-dump'; $mime_magic[24][4]["\0\0\352\154"] = 'application/x-dump'; $mime_magic[24][4]["\0\0\352\155"] = 'application/data'; $mime_magic[24][4]["\0\0\352\156"] = 'application/data'; $mime_magic[65][4]["\106\106\111\114"] = 'font/ttf'; $mime_magic[65][4]["\114\127\106\116"] = 'font/type1'; $mime_magic[257][8]["\165\163\164\141\162\40\40\60"] = 'application/x-gtar'; $mime_magic[257][6]["\165\163\164\141\162\60"] = 'application/x-tar'; $mime_magic[0774][2]["\332\276"] = 'application/data'; $mime_magic[1080][4]["\103\104\70\61"] = 'audio/x-oktalyzer-mod'; $mime_magic[1080][4]["\106\114\124\64"] = 'audio/x-startracker-mod'; $mime_magic[1080][4]["\115\41\113\41"] = 'audio/x-protracker-mod'; $mime_magic[1080][4]["\115\56\113\56"] = 'audio/x-protracker-mod'; $mime_magic[1080][4]["\117\113\124\101"] = 'audio/x-oktalyzer-mod'; $mime_magic[1080][4]["\61\66\103\116"] = 'audio/x-taketracker-mod'; $mime_magic[1080][4]["\63\62\103\116"] = 'audio/x-taketracker-mod'; $mime_magic[1080][4]["\64\103\110\116"] = 'audio/x-fasttracker-mod'; $mime_magic[1080][4]["\66\103\110\116"] = 'audio/x-fasttracker-mod'; $mime_magic[1080][4]["\70\103\110\116"] = 'audio/x-fasttracker-mod'; $mime_magic[2048][7]["\120\103\104\137\111\120\111"] = 'x/x-photo-cd-pack-file'; $mime_magic[2080][29]["\115\151\143\162\157\163\157\146\164\40\105\170\143\145\154\40\65\56\60\40\127\157\162\153\163\150\145\145\164"] = 'application/vnd.ms-excel'; $mime_magic[2080][27]["\115\151\143\162\157\163\157\146\164\40\127\157\162\144\40\66\56\60\40\104\157\143\165\155\145\156\164"] = 'text/vnd.ms-word'; $mime_magic[2080][26]["\104\157\143\165\155\145\156\164\157\40\115\151\143\162\157\163\157\146\164\40\127\157\162\144\40\66"] = 'text/vnd.ms-word'; $mime_magic[2112][9]["\115\123\127\157\162\144\104\157\143"] = 'text/vnd.ms-word'; $mime_magic[2114][5]["\102\151\146\146\65"] = 'application/vnd.ms-excel'; $mime_magic[4098][7]["\104\117\123\106\117\116\124"] = 'font/x-dos'; $mime_magic[68158480][2]["\23\177"] = 'application/x-filesystem'; $mime_magic[68158480][2]["\23\217"] = 'application/x-filesystem'; $mime_magic[68158480][2]["\44\150"] = 'application/x-filesystem'; $mime_magic[68158480][2]["\44\170"] = 'application/x-filesystem'; $mime_magic[70779960][2]["\357\123"] = 'application/x-linux-ext2fs'; --- NEW FILE: mime.mapping.php --- <?php /** * This file contains a mapping of common file extensions to * MIME types. It has been automatically generated from the * horde/scripts/mime_mapping directory. * * ALL changes should be made to horde/scripts/mime_mapping/mime.types.horde * or else they will be lost when this file is regenerated. * * Any unknown file extensions will automatically be mapped to * 'x-extension/<ext>' where <ext> is the unknown file extension. * * @package Horde_MIME * * $Horde: framework/MIME/MIME/mime.mapping.php,v 1.5 2004/03/24 22:39:28 jan Exp $ * * Generated: 03/24/04 23:40:21 by jan on neo */ $mime_extension_map = array( '__MAXPERIOD__' => '1', '3ds' => 'image/x-3ds', 'BLEND' => 'application/x-blender', 'C' => 'text/x-c++src', 'CSSL' => 'text/css', 'NSV' => 'video/x-nsv', 'XM' => 'audio/x-mod', 'Z' => 'application/x-compress', 'a' => 'application/x-archive', 'abw' => 'application/x-abiword', 'abw.gz' => 'application/x-abiword', 'ac3' => 'audio/ac3', 'adb' => 'text/x-adasrc', 'ads' => 'text/x-adasrc', 'afm' => 'application/x-font-afm', 'ag' => 'image/x-applix-graphics', 'ai' => 'application/illustrator', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'al' => 'application/x-perl', 'arj' => 'application/x-arj', 'as' => 'application/x-applix-spreadsheet', 'asc' => 'text/plain', 'asf' => 'video/x-ms-asf', 'asp' => 'application/x-asp', 'asx' => 'video/x-ms-asf', 'au' => 'audio/basic', 'avi' => 'video/x-msvideo', 'aw' => 'application/x-applix-word', 'bak' => 'application/x-trash', 'bcpio' => 'application/x-bcpio', 'bdf' => 'application/x-font-bdf', 'bib' => 'text/x-bibtex', 'bin' => 'application/octet-stream', 'blend' => 'application/x-blender', 'blender' => 'application/x-blender', 'bmp' => 'image/bmp', 'bz' => 'application/x-bzip', 'bz2' => 'application/x-bzip', 'c' => 'text/x-csrc', 'c++' => 'text/x-c++src', 'cc' => 'text/x-c++src', 'cdf' => 'application/x-netcdf', 'cdr' => 'application/vnd.corel-draw', 'cer' => 'application/x-x509-ca-cert', 'cert' => 'application/x-x509-ca-cert', 'cgi' => 'application/x-cgi', 'cgm' => 'image/cgm', 'chrt' => 'application/x-kchart', 'class' => 'application/x-java', 'cls' => 'text/x-tex', 'cpio' => 'application/x-cpio', 'cpio.gz' => 'application/x-cpio-compressed', 'cpp' => 'text/x-c++src', 'cpt' => 'application/mac-compactpro', 'crt' => 'application/x-x509-ca-cert', 'cs' => 'text/x-csharp', 'csh' => 'application/x-shellscript', 'css' => 'text/css', 'csv' => 'text/x-comma-separated-values', 'cur' => 'image/x-win-bitmap', 'cxx' => 'text/x-c++src', 'dat' => 'video/mpeg', 'dbf' => 'application/x-dbase', 'dc' => 'application/x-dc-rom', 'dcl' => 'text/x-dcl', 'dcm' => 'image/x-dcm', 'dcr' => 'application/x-director', 'deb' => 'application/x-deb', 'der' => 'application/x-x509-ca-cert', 'desktop' => 'application/x-desktop', 'dia' => 'application/x-dia-diagram', 'diff' => 'text/x-patch', 'dir' => 'application/x-director', 'djv' => 'image/vnd.djvu', 'djvu' => 'image/vnd.djvu', 'dll' => 'application/octet-stream', 'dms' => 'application/octet-stream', 'doc' => 'application/msword', 'dsl' => 'text/x-dsl', 'dtd' => 'text/x-dtd', 'dvi' => 'application/x-dvi', 'dwg' => 'image/vnd.dwg', 'dxf' => 'image/vnd.dxf', 'dxr' => 'application/x-director', 'egon' => 'application/x-egon', 'el' => 'text/x-emacs-lisp', 'eps' => 'image/x-eps', 'epsf' => 'image/x-eps', 'epsi' => 'image/x-eps', 'etheme' => 'application/x-e-theme', 'etx' => 'text/x-setext', 'exe' => 'application/x-executable', 'ez' => 'application/andrew-inset', 'f' => 'text/x-fortran', 'fig' => 'image/x-xfig', 'fits' => 'image/x-fits', 'flac' => 'audio/x-flac', 'flc' => 'video/x-flic', 'fli' => 'video/x-flic', 'flw' => 'application/x-kivio', 'fo' => 'text/x-xslfo', 'g3' => 'image/fax-g3', 'gb' => 'application/x-gameboy-rom', 'gcrd' => 'text/x-vcard', 'gen' => 'application/x-genesis-rom', 'gg' => 'application/x-sms-rom', 'gif' => 'image/gif', 'glade' => 'application/x-glade', 'gmo' => 'application/x-gettext-translation', 'gnc' => 'application/x-gnucash', 'gnucash' => 'application/x-gnucash', 'gnumeric' => 'application/x-gnumeric', 'gra' => 'application/x-graphite', 'gsf' => 'application/x-font-type1', 'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'h' => 'text/x-chdr', 'h++' => 'text/x-chdr', 'hdf' => 'application/x-hdf', 'hh' => 'text/x-c++hdr', 'hp' => 'text/x-chdr', 'hpgl' => 'application/vnd.hp-hpgl', 'hqx' => 'application/mac-binhex40', 'hs' => 'text/x-haskell', 'htm' => 'text/html', 'html' => 'text/html', 'icb' => 'image/x-icb', 'ice' => 'x-conference/x-cooltalk', 'ico' => 'image/x-ico', 'ics' => 'text/calendar', 'idl' => 'text/x-idl', 'ief' => 'image/ief', 'ifb' => 'text/calendar', 'iff' => 'image/x-iff', 'iges' => 'model/iges', 'igs' => 'model/iges', 'ilbm' => 'image/x-ilbm', 'iso' => 'application/x-cd-image', 'it' => 'audio/x-it', 'jar' => 'application/x-jar', 'java' => 'text/x-java', 'jng' => 'image/x-jng', 'jp2' => 'image/jpeg2000', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpr' => 'application/x-jbuilder-project', 'jpx' => 'application/x-jbuilder-project', 'js' => 'application/x-javascript', 'kar' => 'audio/midi', 'karbon' => 'application/x-karbon', 'kdelnk' => 'application/x-desktop', 'kfo' => 'application/x-kformula', 'kil' => 'application/x-killustrator', 'kon' => 'application/x-kontour', 'kpm' => 'application/x-kpovmodeler', 'kpr' => 'application/x-kpresenter', 'kpt' => 'application/x-kpresenter', 'kra' => 'application/x-krita', 'ksp' => 'application/x-kspread', 'kud' => 'application/x-kugar', 'kwd' => 'application/x-kword', 'kwt' => 'application/x-kword', 'la' => 'application/x-shared-library-la', 'latex' => 'application/x-latex', 'lha' => 'application/x-lha', 'lhs' => 'text/x-literate-haskell', 'lhz' => 'application/x-lhz', 'log' => 'text/x-log', 'ltx' => 'text/x-tex', 'lwo' => 'image/x-lwo', 'lwob' => 'image/x-lwo', 'lws' => 'image/x-lws', 'lyx' => 'application/x-lyx', 'lzh' => 'application/x-lha', 'lzo' => 'application/x-lzop', 'm' => 'text/x-objcsrc', 'm15' => 'audio/x-mod', 'm3u' => 'audio/x-mpegurl', 'man' => 'application/x-troff-man', 'md' => 'application/x-genesis-rom', 'me' => 'text/x-troff-me', 'mesh' => 'model/mesh', 'mgp' => 'application/x-magicpoint', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mif' => 'application/x-mif', 'mkv' => 'application/x-matroska', 'mm' => 'text/x-troff-mm', 'mml' => 'text/mathml', 'mng' => 'video/x-mng', 'moc' => 'text/x-moc', 'mod' => 'audio/x-mod', 'moov' => 'video/quicktime', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'video/mpeg', 'mp3' => 'audio/x-mp3', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpga' => 'audio/mpeg', 'ms' => 'text/x-troff-ms', 'msh' => 'model/mesh', 'msod' => 'image/x-msod', 'msx' => 'application/x-msx-rom', 'mtm' => 'audio/x-mod', 'mxu' => 'video/vnd.mpegurl', 'n64' => 'application/x-n64-rom', 'nc' => 'application/x-netcdf', 'nes' => 'application/x-nes-rom', 'nsv' => 'video/x-nsv', 'o' => 'application/x-object', 'obj' => 'application/x-tgif', 'oda' => 'application/oda', 'ogg' => 'application/ogg', 'old' => 'application/x-trash', 'oleo' => 'application/x-oleo', 'p' => 'text/x-pascal', 'p12' => 'application/x-pkcs12', 'p7s' => 'application/pkcs7-signature', 'pas' => 'text/x-pascal', 'patch' => 'text/x-patch', 'pbm' => 'image/x-portable-bitmap', 'pcd' => 'image/x-photo-cd', 'pcf' => 'application/x-font-pcf', 'pcf.Z' => 'application/x-font-type1', 'pcl' => 'application/vnd.hp-pcl', 'pdb' => 'application/vnd.palm', 'pdf' => 'application/pdf', 'pem' => 'application/x-x509-ca-cert', 'perl' => 'application/x-perl', 'pfa' => 'application/x-font-type1', 'pfb' => 'application/x-font-type1', 'pfx' => 'application/x-pkcs12', 'pgm' => 'image/x-portable-graymap', 'pgn' => 'application/x-chess-pgn', 'pgp' => 'application/pgp', 'php' => 'application/x-php', 'php3' => 'application/x-php', 'php4' => 'application/x-php', 'pict' => 'image/x-pict', 'pict1' => 'image/x-pict', 'pict2' => 'image/x-pict', 'pl' => 'application/x-perl', 'pls' => 'audio/x-scpls', 'pm' => 'application/x-perl', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'po' => 'text/x-gettext-translation', 'pot' => 'application/vnd.ms-powerpoint', 'ppm' => 'image/x-portable-pixmap', 'pps' => 'application/vnd.ms-powerpoint', 'ppt' => 'application/vnd.ms-powerpoint', 'ppz' => 'application/vnd.ms-powerpoint', 'ps' => 'application/postscript', 'ps.gz' => 'application/x-gzpostscript', 'psd' => 'image/x-psd', 'psf' => 'application/x-font-linux-psf', 'psid' => 'audio/prs.sid', 'pw' => 'application/x-pw', 'py' => 'application/x-python', 'pyc' => 'application/x-python-bytecode', 'pyo' => 'application/x-python-bytecode', 'qif' => 'application/x-qw', 'qt' => 'video/quicktime', 'qtvr' => 'video/quicktime', 'ra' => 'audio/x-pn-realaudio', 'ram' => 'audio/x-pn-realaudio', 'rar' => 'application/x-rar', 'ras' => 'image/x-cmu-raster', 'rdf' => 'text/rdf', 'rej' => 'application/x-reject', 'rgb' => 'image/x-rgb', 'rle' => 'image/rle', 'rm' => 'audio/x-pn-realaudio', 'roff' => 'application/x-troff', 'rpm' => 'application/x-rpm', 'rss' => 'text/rss', 'rtf' => 'application/rtf', 'rtx' => 'text/richtext', 's3m' => 'audio/x-s3m', 'sam' => 'application/x-amipro', 'scm' => 'text/x-scheme', 'sda' => 'application/vnd.stardivision.draw', 'sdc' => 'application/vnd.stardivision.calc', 'sdd' => 'application/vnd.stardivision.impress', 'sdp' => 'application/vnd.stardivision.impress', 'sds' => 'application/vnd.stardivision.chart', 'sdw' => 'application/vnd.stardivision.writer', 'sgi' => 'image/x-sgi', 'sgl' => 'application/vnd.stardivision.writer', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'sh' => 'application/x-shellscript', 'shar' => 'application/x-shar', 'shtml' => 'text/html', 'siag' => 'application/x-siag', 'sid' => 'audio/prs.sid', 'sik' => 'application/x-trash', 'silo' => 'model/mesh', 'sit' => 'application/x-stuffit', 'skd' => 'application/x-koan', 'skm' => 'application/x-koan', 'skp' => 'application/x-koan', 'skt' => 'application/x-koan', 'slk' => 'text/spreadsheet', 'smd' => 'application/vnd.stardivision.mail', 'smf' => 'application/vnd.stardivision.math', 'smi' => 'application/smil', 'smil' => 'application/smil', 'sml' => 'application/smil', 'sms' => 'application/x-sms-rom', 'snd' => 'audio/basic', 'so' => 'application/x-sharedlib', 'spd' => 'application/x-font-speedo', 'spl' => 'application/x-futuresplash', 'sql' => 'text/x-sql', 'src' => 'application/x-wais-source', 'stc' => 'application/vnd.sun.xml.calc.template', 'std' => 'application/vnd.sun.xml.draw.template', 'sti' => 'application/vnd.sun.xml.impress.template', 'stm' => 'audio/x-stm', 'stw' => 'application/vnd.sun.xml.writer.template', 'sty' => 'text/x-tex', 'sun' => 'image/x-sun-raster', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'svg' => 'image/svg+xml', 'swf' => 'application/x-shockwave-flash', 'sxc' => 'application/vnd.sun.xml.calc', 'sxd' => 'application/vnd.sun.xml.draw', 'sxg' => 'application/vnd.sun.xml.writer.global', 'sxi' => 'application/vnd.sun.xml.impress', 'sxm' => 'application/vnd.sun.xml.math', 'sxw' => 'application/vnd.sun.xml.writer', 'sylk' => 'text/spreadsheet', 't' => 'application/x-troff', 'tar' => 'application/x-tar', 'tar.Z' => 'application/x-tarz', 'tar.bz' => 'application/x-bzip-compressed-tar', 'tar.bz2' => 'application/x-bzip-compressed-tar', 'tar.gz' => 'application/x-compressed-tar', 'tar.lzo' => 'application/x-tzo', 'tcl' => 'text/x-tcl', 'tex' => 'text/x-tex', 'texi' => 'text/x-texinfo', 'texinfo' => 'text/x-texinfo', 'tga' => 'image/x-tga', 'tgz' => 'application/x-compressed-tar', 'theme' => 'application/x-theme', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'tk' => 'text/x-tcl', 'torrent' => 'application/x-bittorrent', 'tr' => 'application/x-troff', 'ts' => 'application/x-linguist', 'tsv' => 'text/tab-separated-values', 'ttf' => 'application/x-font-ttf', 'txt' => 'text/plain', 'tzo' => 'application/x-tzo', 'ui' => 'application/x-designer', 'uil' => 'text/x-uil', 'ult' => 'audio/x-mod', 'uni' => 'audio/x-mod', 'uri' => 'text/x-uri', 'url' => 'text/x-uri', 'ustar' => 'application/x-ustar', 'vcd' => 'application/x-cdlink', 'vcf' => 'text/x-vcalendar', 'vcs' => 'text/x-vcalendar', 'vct' => 'text/x-vcard', 'vfb' => 'text/calendar', 'vob' => 'video/mpeg', 'voc' => 'audio/x-voc', 'vor' => 'application/vnd.stardivision.writer', 'vrml' => 'model/vrml', 'vsd' => 'application/vnd.visio', 'wav' => 'audio/x-wav', 'wax' => 'audio/x-ms-wax', 'wb1' => 'application/x-quattropro', 'wb2' => 'application/x-quattropro', 'wb3' => 'application/x-quattropro', 'wbmp' => 'image/vnd.wap.wbmp', 'wbxml' => 'application/vnd.wap.wbxml', 'wk1' => 'application/vnd.lotus-1-2-3', 'wk3' => 'application/vnd.lotus-1-2-3', 'wk4' => 'application/vnd.lotus-1-2-3', 'wks' => 'application/vnd.lotus-1-2-3', 'wm' => 'video/x-ms-wm', 'wma' => 'audio/x-ms-wma', 'wmd' => 'application/x-ms-wmd', 'wmf' => 'image/x-wmf', 'wml' => 'text/vnd.wap.wml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmls' => 'text/vnd.wap.wmlscript', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wmz' => 'application/x-ms-wmz', 'wpd' => 'application/wordperfect', 'wpg' => 'application/x-wpg', 'wri' => 'application/x-mswrite', 'wrl' => 'model/vrml', 'wvx' => 'video/x-ms-wvx', 'xac' => 'application/x-gnucash', 'xbel' => 'application/x-xbel', 'xbm' => 'image/x-xbitmap', 'xcf' => 'image/x-xcf', 'xcf.bz2' => 'image/x-compressed-xcf', 'xcf.gz' => 'image/x-compressed-xcf', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xi' => 'audio/x-xi', 'xla' => 'application/vnd.ms-excel', 'xlc' => 'application/vnd.ms-excel', 'xld' => 'application/vnd.ms-excel', 'xll' => 'application/vnd.ms-excel', 'xlm' => 'application/vnd.ms-excel', 'xls' => 'application/vnd.ms-excel', 'xlt' => 'application/vnd.ms-excel', 'xlw' => 'application/vnd.ms-excel', 'xm' => 'audio/x-xm', 'xml' => 'text/xml', 'xpm' => 'image/x-xpixmap', 'xsl' => 'text/x-xslt', 'xslfo' => 'text/x-xslfo', 'xslt' => 'text/x-xslt', 'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz', 'zabw' => 'application/x-abiword', 'zip' => 'application/zip', 'zoo' => 'application/x-zoo', '123' => 'application/vnd.lotus-1-2-3', '669' => 'audio/x-mod' ); From cvs at intevation.de Fri Oct 14 16:33:09 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:00 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Maintenance Maintenance.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143309.B2509102BFA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Maintenance In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Maintenance Added Files: Maintenance.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Maintenance.php --- <?php /** @constant MAINTENANCE_YEARLY Do task yearly (First login after/on January 1). */ define('MAINTENANCE_YEARLY', 1); /** @constant MAINTENANCE_MONTHLY Do task monthly (First login after/on first of month). */ define('MAINTENANCE_MONTHLY', 2); /** @constant MAINTENANCE_WEEKLY Do task weekly (First login after/on a Sunday). */ define('MAINTENANCE_WEEKLY', 3); /** @constant MAINTENANCE_DAILY Do task daily (First login of the day). */ define('MAINTENANCE_DAILY', 4); /** @constant MAINTENANCE_EVERY Do task every login. */ define('MAINTENANCE_EVERY', 5); /** @constant MAINTENANCE_FIRST_LOGIN Do task on first login only. */ define('MAINTENANCE_FIRST_LOGIN', 6); /** @constant MAINTENANCE_OUTPUT_CONFIRM Confirmation-style output for maintenance page. */ define('MAINTENANCE_OUTPUT_CONFIRM', 7); /** @constant MAINTENANCE_OUTPUT_AGREE Agreement-style output for maintenance page. */ define('MAINTENANCE_OUTPUT_AGREE', 8); /** @constant MAINTENANCE_OUTPUT_NOTICE Notice-style output for maintenance page. */ define('MAINTENANCE_OUTPUT_NOTICE', 9); /** @constant MAINTENANCE_CACHE_PARAM The name of the URL parameter that contains the session ID of the cache object. */ define('MAINTENANCE_CACHE_PARAM', 'maintenance_cache'); /** @constant MAINTENANCE_DONE_PARAM The name of the URL parameter that indicates that the maintenance tasks are completed. */ define('MAINTENANCE_DONE_PARAM', 'maintenance_done'); /* Intervals hash - used to build select tables in preferences menu. */ $intervals = array(); $intervals[MAINTENANCE_YEARLY] = _("Yearly"); $intervals[MAINTENANCE_MONTHLY] = _("Monthly"); $intervals[MAINTENANCE_WEEKLY] = _("Weekly"); $intervals[MAINTENANCE_DAILY] = _("Daily"); $intervals[MAINTENANCE_EVERY] = _("Every Login"); $GLOBALS['intervals'] = &$intervals; /** * The Maintenance:: class provides a set of methods for dealing with * maintenance operations run upon login to Horde applications. * * $Horde: framework/Maintenance/Maintenance.php,v 1.44 2004/04/07 14:43:10 chuck Exp $ * * Copyright 2001-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 1.3.5 * @package Horde_Maintenance */ class Maintenance { /** * Hash holding maintenance preference names. * Syntax: PREFNAME => interval * Valid intervals are: MAINTENANCE_YEARLY, MAINTENANCE_MONTHLY, * MAINTENANCE_WEEKLY, MAINTENANCE_DAILY, * MAINTENANCE_EVERY, MAINTENANCE_FIRST_LOGIN * Operations will be run in the order they appear in the array - * MAKE SURE FUNCTIONS ARE IN THE CORRECT ORDER! * Operations can appear more than once - they will only be run once per * login though (the operation will run the first time it is seen in * the array). * * This array should be filled in for each Horde module that extends * the Maintenance class. * * @var array $maint_tasks */ var $maint_tasks = array(); /** * UNIX timestamp of the last login time for user. * * @var integer $_lastLogin */ var $_lastLogin = 0; /** * The Maintenance_Tasklist object for this login. * * @var object Maintenance_Tasklist $_tasklist */ var $_tasklist; /** * Array to store Maintenance_Task objects. * * @var array $_modulesCache */ var $_taskCache = array(); /** * Attempts to return a concert Maintenance_* object based on the * module name passed into it. * * @access public * * @param string $module The name of the Horde module. * @param optional array $params A hash containing additional data * needed by the constructor. * * @return object Maintenance The Maintenance object. * Returns false on error. */ function &factory($module, $params = array()) { global $registry; /* Spawn the relevant driver, and return it (or false on failure). */ include_once $registry->getParam('fileroot', $module) . '/lib/Maintenance/' . $module . '.php'; $class = 'Maintenance_' . $module; if (class_exists($class)) { return $ret = &new $class($params); } else { return false; } } /** * Constructor. * * @access public * * @param array $params A hash containing the following entries: * 'last_login' => The last login timestamp. */ function Maintenance($params = array()) { /* Set the class variable $_lastLogin. */ if (array_key_exists('last_login', $params)) { $this->_lastLogin = $params['last_login']; } /* Retrieve the Maintenance_Tasklist object from the session. */ if (($sid = Util::getFormData(MAINTENANCE_CACHE_PARAM))) { $this->_retrieveSessionData($sid); } } /** * Do maintenance operations needed for this login. * This function will generate the list of tasks to perform during * this login and will redirect to the maintenance page if necessary. * This is the function that should be called from the * application upon login. * * @access public */ function runMaintenance() { /* Check to see if we are finished with maintenance operations. */ if (!Util::getFormData(MAINTENANCE_DONE_PARAM)) { /* Generate the list of tasks. */ $this->_createTaskList(); /* Determine if we should redirect to the maintenance page. */ if ($this->_needMaintenancePage() !== null) { header('Location: ' . $this->_getMaintenanceURL(), true); exit; } } /* Finally, run any tasks that need to be executed. */ $this->_doMaintenanceTasks(); } /** * Do the necessary maintenance tasks for this loading of the * maintenance page. * This is the function that is called from the maintenance page * every time it is loaded. * * @access public * * @return integer The display required for the maintenance page. */ function runMaintenancePage() { /* Should we run any tasks? */ $this->_doMaintenanceTasks(); /* Get the list of tasks we need to display to the user. */ $task_no = $this->_needMaintenancePage(); $tasks = $this->_tasklist->getList(); /* Remove 'newflag' from first task. */ if (!$this->_tasklist->processed(true)) { reset($tasks); $this->_tasklist->unsetNewPage(key($tasks)); } if (!is_null($task_no)) { $tasks = array_slice($tasks, 0, $task_no + 1); } reset($tasks); $action = $tasks[key($tasks)]['display']; return array($action, array_keys($tasks)); } /** * Returns the informational text message on what the operation is about * to do. Also indicates whether the box should be checked by default or * not. Operations that have been locked by the admin will return null. * * @access public * * @param string $pref Name of the operation to get information for. * * @return array 1st element - Description of what the operation is about * to do during this login. * 2nd element - Whether the preference is set to on or not. */ function infoMaintenance($pref) { global $prefs; /* If the preference has been locked by the admin, do not show the user. */ if ($prefs->isLocked($pref)) { return; } $mod = &$this->_loadModule($pref); return array($mod->describeMaintenance(), $prefs->getValue($pref)); } /** * Export variable names to use for creating select tables in the * preferences menu. * * @access public * * @return array An array of variable names to be imported into the * prefs.php namespace. */ function exportIntervalPrefs() { global $prefs; $return_array = array(); foreach (array_keys($this->maint_tasks) as $val) { if (!$prefs->isLocked($val . '_interval')) { $return_array[] = $val . '_interval_options'; } } return $return_array; } /** * Output hidden for elements for the POST form to ensure the calling * script has the same POST elements as when the maintenance operations * first run. * * @access public * * @return string The form data. */ function getPostData() { $text = ''; if (($data = $this->_tasklist->getPostData())) { foreach ($data as $name => $val) { $text .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($val) . '" />' . "\n"; } } return $text; } /** * Creates the list of maintenance operations that are available for * this session (stored in Maintenance_Tasklist object). * * @access private * * @return boolean Returns true if list was created. * False if not (e.g. list already exists). */ function _createTaskList() { global $prefs; /* Create a new Maintenance_Tasklist object. */ $this->_tasklist = &new Maintenance_Tasklist(); /* Create time objects for today's date and last login date. */ $last_date = getdate($this->_lastLogin); $cur_date = getdate(); /* Go through each item in $maint_tasks and determine if we need to run it during this login. */ foreach ($this->maint_tasks as $key => $val) { /* Skip item if it already appears in the tasks list. */ if ($this->_tasklist->inList($key)) { continue; } /* Determine the correct interval for the item. */ if (($interval = $prefs->getValue($key . '_interval'))) { $val = $interval; } $addTask = false; /* FIRST LOGIN OPERATIONS */ /* If $_lastLogin is empty (= 0), this is the first time the user has logged in. Don't run any other maintenance operations on the first login. */ if (empty($this->_lastLogin)) { if ($val == MAINTENANCE_FIRST_LOGIN) { $addTask = true; } } /* YEARLY_OPERATIONS */ elseif (($val == MAINTENANCE_YEARLY) && ($cur_date['year'] > $last_date['year'])) { $addTask = true; } /* MONTHLY OPERATIONS */ elseif (($val == MAINTENANCE_MONTHLY) && (($cur_date['year'] > $last_date['year']) || ($cur_date['mon'] > $last_date['mon']))) { $addTask = true; } /* WEEKLY OPERATIONS */ elseif (($val == MAINTENANCE_WEEKLY) && (($cur_date['wday'] < $last_date['wday']) || ((time() - 604800) > $this->_lastLogin))) { $addTask = true; } /* DAILY OPERATIONS */ elseif (($val == MAINTENANCE_DAILY) && (($cur_date['year'] > $last_date['year']) || ($cur_date['yday'] > $last_date['yday']))) { $addTask = true; } /* EVERY LOGIN OPERATIONS */ elseif ($val == MAINTENANCE_EVERY) { $addTask = true; } /* Skip the task if any of the following: + This task does not need to be run in this login + This task is not set in the preferences */ if (!$addTask || !$prefs->getValue($key)) continue; /* Load the task module now. */ $mod = &$this->_loadModule($key); /* Determine if this task has already been confirmed/set via some sort of admin setting. Also, if the user/admin has set the 'confirm_maintenance' flag, use the preferences value. */ $confirmed = false; if ($prefs->isLocked($key) || !$prefs->getValue('confirm_maintenance')) { $confirmed = (boolean) $prefs->getValue($key); } /* Add the task to the tasklist. */ $this->_tasklist->addTask($key, $confirmed, $mod->getDisplayType()); } } /** * Load module (if not already loaded). * * @access private * * @param string $modname Name of the module to load. * * @return object Maintenance_Task A reference to the requested module. */ function &_loadModule($modname) { global $registry; if (!array_key_exists($modname, $this->_taskCache)) { include_once $registry->getParam('fileroot', $this->_tasklist->getModule()) . '/lib/Maintenance/Task/' . $modname . '.php'; $class = 'Maintenance_Task_' . $modname; if (class_exists($class)) { $this->_taskCache[$modname] = new $class; } else { Horde::fatal(PEAR::raiseError(sprintf(_("Could not open Maintenance_Task module %s"), $class)), __FILE__, __LINE__); } } return $this->_taskCache[$modname]; } /** * Return the URL needed for the maintenance form. * * @access public * * @return string The URL to redirect to. */ function getMaintenanceFormURL() { if ($this->_needMaintenancePage() !== null) { return $this->_getMaintenanceURL(); } else { return $this->_getInitialPageURL(); } } /** * Get the URL for the initial page. * * @access private * * @return string The URL for the initial page. */ function _getInitialPageURL() { $url = Util::addParameter($this->_tasklist->getTarget(), MAINTENANCE_CACHE_PARAM, $this->_createSessionData()); return Util::addParameter($url, MAINTENANCE_DONE_PARAM, 1); } /** * Get the URL for the maintenance page. * * @access private * * @return string The URL for the maintenance page. */ function _getMaintenanceURL() { global $registry; /* We need to pass the cache ID and 'module' parameters. */ $url = Horde::url($registry->getParam('webroot', 'horde') . '/services/maintenance.php'); $url = Util::addParameter($url, MAINTENANCE_CACHE_PARAM, $this->_createSessionData()); $url = Util::addParameter($url, 'module', $this->_tasklist->getModule()); return $url; } /** * Creates the session cache used to hold data between requests. * * @access private * * @return string Cache_session identifier string. */ function _createSessionData() { require_once 'Horde/SessionObjects.php'; $cacheSess = &Horde_SessionObjects::singleton(); return $cacheSess->storeOid($this->_tasklist, false); } /** * Retrieves session data from a previous request. * * @access private * * @param string $sid The session ID of the cache object. */ function _retrieveSessionData($sid) { require_once 'Horde/SessionObjects.php'; $cacheSess = &Horde_SessionObjects::singleton(); $this->_tasklist = $cacheSess->query($sid); $cacheSess->setPruneFlag($sid, true); } /** * Execute all confirmed tasks. * * @access private */ function _doMaintenanceTasks() { $tasks = $this->_tasklist->getList(); foreach ($tasks as $key => $val) { if ($val['newpage']) { if ($this->_tasklist->processed()) { $this->_tasklist->unsetNewPage($key); } break; } elseif ($val['confirmed'] || Util::getFormData($key . '_confirm')) { /* Perform maintenance if confirmed. */ $mod = &$this->_loadModule($key); $mod->doMaintenance(); } $this->_tasklist->removeTask($key); } } /** * Do any of the tasks require the maintenance page? * * @access private * * @return integer The key of the task that requires the maintenance * page. Returns null if the maintenance page is no * longer needed. */ function _needMaintenancePage() { $i = 0; foreach ($this->_tasklist->getList() as $val) { if ($val['newpage']) return $i; $i++; } return null; } } /** * The Maintenance_Tasklist:: class is used to store the list of maintenance * tasks that need to be run during this login. * * Copyright 2002-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Maintenance */ class Maintenance_Tasklist { /** * The Horde module running the maintenance tasks. * * @var string $_module */ var $_module; /** * The URL of the web page to load after maintenance is complete. * * @var string $_target */ var $_target; /** * POST data for the calling script. * * @var array $_postdata */ var $_postdata; /** * The list of tasks to run during this login. * * KEY: Task name * VALUE: Array => ( * 'confirmed' => boolean, * 'display' => integer, * 'newpage' => boolean * ) * * @var array $_tasks */ var $_tasks = array(); /** * Internal flag for addTask(). * * @var boolean $_addFlag */ var $_addFlag = false; /** * Has the tasklist been processed yet? * * @var boolean $_processed */ var $_processed = false; /** * Constructor. * * @access public */ function Maintenance_Tasklist() { global $registry; $this->_module = $registry->getApp(); $this->_target = Horde::selfURL(true); // $this->_postdata = $_POST; } /** * Adds a task to the tasklist. * * @access public * * @param string $key The name of the task to perform. * @param boolean $confirmed Has the task been confirmed? * @param integer $display The display type of the task. */ function addTask($key, $confirmed, $display) { $this->_tasks[$key] = array(); $this->_tasks[$key]['confirmed'] = $confirmed; $this->_tasks[$key]['display'] = $display; if (($display == MAINTENANCE_OUTPUT_AGREE) || ($display == MAINTENANCE_OUTPUT_NOTICE)) { $this->_tasks[$key]['newpage'] = true; $this->_addFlag = false; } elseif (($confirmed == false) && (!$this->_addFlag)) { $this->_tasks[$key]['newpage'] = true; $this->_addFlag = true; } else { $this->_tasks[$key]['newpage'] = false; } } /** * Unsets the newpage flag for a task. * * @access public * * @param string $task The name of the task to alter. */ function unsetNewPage($task) { if ($this->inList($task)) { $this->_tasks[$task]['newpage'] = false; } } /** * Removes the task from the tasklist. * * @access public * * @param string $task The name of the task to alter. */ function removeTask($task) { if ($this->inList($task)) { unset($this->_tasks[$task]); } } /** * Is this task already in the tasklist? * * @access public * * @param string $task The name of the task. * * @return boolean Whether the task is already in the tasklist. */ function inList($task) { return array_key_exists($task, $this->_tasks); } /** * Return the list of tasks. * * @access public * * @return array The list of tasks that still need to be done. */ function getList() { return $this->_tasks; } /** * Return the Horde module the tasks are running under. * * @access public * * @return string The Horde module name. */ function getModule() { return $this->_module; } /** * Return the POST data. * * @access public * * @return array The POST data from the initial URL. */ function getPostData() { return $this->_postdata; } /** * Return the URL of the web page to load after maintenance is complete. * * @access public * * @return string The target URL. */ function getTarget() { return $this->_target; } /** * Sets/displays the flag to show that tasklist has been processed at * least once. * * @access public * * @param optional boolean $set Set the flag? * * @return boolean Has the tasklist been processed before? */ function processed($set = false) { $retvalue = $this->_processed; if ($set) { $this->_processed = true; } return $retvalue; } } /** * Abstract class to allow for modularization of specific maintenace tasks. * * For this explanation, the specific Horde application you want to create * maintenance actions for will be labeled HORDEAPP. * * To add a new maintenance task, you need to do the following: * [1] Add preference to "HORDEAPP/config/prefs.php" file. * (The name of this preference will be referred to as PREFNAME) * This preference should be of type 'checkbox' (i.e. 1 = on; 0 = off). * [Optional:] Add a preference in prefs.php of the name * 'PREFNAME_interval' to allow the user to set the interval. * 'default' value should be set to the values of the interval * constants above. * If this preference doesn't exist, the default interval * used will be the one that appears in $maint_tasks. * [2] Create a directory named "HORDEAPP/lib/Maintenance". * [3] Create a class entitled Maintenance_HORDEAPP that extends the * Maintenance class. * This class should contain only the application specific definitions of * $maint_tasks (see above for description). * Save this file as "HORDEAPP/lib/Maintenance/HORDEAPP.php". * [4] Create a directory titled "HORDEAPP/lib/Maintenance/Task". * [5] Create modules in HORDEAPP/lib/Maintenance/Task named 'PREFNAME.php' * that extend the Maintenance_Task class. * The class should be named Maintenance_Task_PREFNAME. * The class should declare the following two methods: * 'doMaintenance' - This is the function that is run to do the * specified maintenance operation. * 'describeMaintenance' - This function sets the preference text * and text to be used on the confirmation * page. Should return a description of what * your 'doMaintenance' function is about to do. * Neither function requires any parameters passed in. * * There are 3 different types of maintenance (set via $_display_type): * [1] MAINTENANCE_OUTPUT_CONFIRM * Each output from describeMaintenance() will have a checkbox associated * with it. For each checkbox selected, doMaintenance() for that task will * be run. More than 1 confirmation message can be displayed on the * maintenance page at once. * * [2] MAINTENANCE_OUTPUT_AGREE * The output from describeMaintenance() should be text asking the user to * agree/disagree to specified terms. If 'yes' is selected, the POST * variable 'agree' will be set. If 'no' is selected, the POST variable * 'not_agree' will be set. In either case, doMaintenance() will ALWAYS be * run. * * This style will be displayed on its own, separate maintenance page. * * * [3] MAINTENANCE_OUTPUT_NOTICE * The output from describeMaintenance() should be any non-interactive text * desired. There will be a single 'Click to Continue' button below this * text. doMaintenance() will ALWAYS be run. * * This style will be displayed on its own, separate maintenance page. * * * Copyright 2001-2004 Michael Slusarz <slusarz@bigworm.colorado.edu> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz <slusarz@bigworm.colorado.edu> * @version $Revision: 1.1 $ * @since Horde 1.3.5 * @package Horde_Maintenance */ class Maintenance_Task { /** * The style of the maintenance page output. * Possible values: MAINTENANCE_OUTPUT_CONFIRM, * MAINTENANCE_OUTPUT_AGREE, * MAINTENANCE_OUTPUT_NOTICE * * @var integer $_display_type */ var $_display_type = MAINTENANCE_OUTPUT_CONFIRM; /** * Constructor * * @access public */ function Maintenance_Task() { } /** * Do maintenance operation (if it has been confirmed). * * @access public * * @return boolean Whether the maintenance operation was successful or * not. */ function doMaintenance() { return false; } /** * Return description information for the maintenance page. * * @access public * * @return string Description that will be displayed on the maintenance * confirmation page. */ function describeMaintenance() { return ''; } /** * Returns the desired output type for the maintenance page. * * @access public * * @return integer Desired output type for the maintenance confirmation * page. */ function getDisplayType() { return $this->_display_type; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/Maintenance/package.xml,v 1.7 2004/01/02 22:35:19 slusarz Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_Maintenance</name> <summary>Horde Maintenance System</summary> <description> The Maintenance:: class provides a set of methods for dealing with maintenance operations run upon login to Horde applications. </description> <license>LGPL</license> <maintainers> <maintainer> <user>slusarz</user> <name>Michael Slusarz</name> <email>slusarz@bigworm.colorado.edu</email> <role>lead</role> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-05</date> <notes>Initial packaging.</notes> <provides type="class" name="Maintenance" /> <provides type="class" name="Maintenance_Task" /> <provides type="class" name="Maintenance_Tasklist" /> <filelist> <file role="php" baseinstalldir="/Horde" name="Maintenance.php" /> </filelist> </release> <deps> <dep type="ext" rel="has" optional="yes">gettext</dep> <dep type="pkg" rel="has">Horde_SessionObjects</dep> <dep type="pkg" rel="has">Horde_Util</dep> </deps> <changelog> <release> <version>0.0.1</version> <date>2003-07-05</date> <state>alpha</state> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:09 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Menu Menu.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143309.DA171102BFB@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Menu In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Menu Added Files: Menu.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Menu.php --- <?php /** * The Menu:: class provides standardized methods for creating menus in * Horde applications. * * $Horde: framework/Menu/Menu.php,v 1.67 2004/04/17 14:06:27 jan Exp $ * * Copyright 1999-2004 Chuck Hagenbuch <chuck@horde.org> * Copyright 1999-2004 Jon Parise <jon@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @author Jon Parise <jon@horde.org> * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Framework */ class Menu { /** * Show help option? * * @var boolean $_with_help */ var $_with_help; /** * Show login option? * * @var boolean $_with_login */ var $_with_login; /** * Show preferences option? * * @var boolean $_with_prefs */ var $_with_prefs; /** * The location of the menufile. * * @var boolean $_menufile */ var $_menufile; /** * Constructor * * @access public */ function Menu($with_help = true, $with_login = null, $with_prefs = true) { /* Default to false if help turned off or no javascript support. */ if (!empty($GLOBALS['conf']['user']['online_help']) && $GLOBALS['browser']->hasFeature('javascript')) { $with_help = false; } $this->_with_help = $with_help; $this->_with_prefs = $with_prefs; /* If no setting specified for login button, default to true if no Horde frameset and false if there is a Horde frameset. */ $this->_with_login = (is_null($with_login)) ? !$GLOBALS['conf']['menu']['display'] : $with_login; /* Location of the menufile. */ $this->_menufile = $GLOBALS['registry']->getParam('fileroot') . '/config/menu.php'; } /** * Generates the HTML for an item on the menu bar. * * @param string $url String containing the value for * the hyperlink. * @param string $text String containing the label for * this menu item. * @param optional string $icon String containing the filename of * the image icon to display for this * menu item. * @param optional string $icon_path If the icon lives in a non-default * directory, where is it? * @param optional string $target If the link needs to open in * another frame or window, what is * its name? * @param optional string $onclick Onclick javascript, if desired. * @param optional string $cell_class CSS class for the table cell. * @param optional string $link_class CSS class for the item link. * * @return string String containing the HTML to display this menu item. */ function createItem($url, $text, $icon = '', $icon_path = null, $target = '', $onclick = null, $cell_class = null, $link_class = 'menuitem') { global $conf, $prefs; if (is_null($cell_class)) { /* Try to match the item's path against the current script * filename as well as other possible URLs to this script. */ if (Menu::isSelected($url)) { $cell_class = 'menuselected'; } } if ($cell_class === '__noselection') { $cell_class = null; } $accesskey = Horde::getAccessKey($text); $plaintext = preg_replace('/_([A-Za-z])/', '\\1', $text); $menu_view = $prefs->getValue('menu_view'); $html = '<td align="center" nowrap="nowrap" style="cursor:pointer;" valign="'; $html .= (($menu_view == 'icon') ? 'middle' : 'bottom') . '"'; /* Handle javascript URLs. */ if (strstr($url, 'javascript:')) { $html .= ' onclick="' . str_replace('javascript:', '', $url) . '"'; } elseif (!$url) { if ($onclick) { $html .= ' onclick="' . $onclick . '";'; } } else { $html .= ' onclick="document.location=\'' . addslashes($url) . '\';"'; } $html .= (!empty($cell_class)) ? " class=\"$cell_class\">" : '>'; if (strstr($url, 'javascript:')) { if (!strstr($onclick, 'return false;')) { $onclick .= 'return false;'; } $html .= Horde::link('', $plaintext, $link_class, $target, $onclick, '', $accesskey); } else { $html .= Horde::link($url, $plaintext, $link_class, $target, $onclick, '', $accesskey); } if (!empty($icon) && (($menu_view == 'icon') || ($menu_view == 'both'))) { $html .= Horde::img($icon, $plaintext, ($menu_view == 'icon') ? 'hspace="5" vspace="5"' : '', $icon_path); if ($menu_view == 'both') { $html .= '<br />'; } } if ($menu_view != 'icon') { $html .= Horde::highlightAccessKey($text, $accesskey); } $html .= "</a> </td>\n"; return $html; } /** * Creates a menu string from a custom menu item. Custom menu items * can either define a new menu item or a menu separate (spacer). * * A custom menu item consists of a hash with the following properties: * * 'url' The URL value for the menu item. * 'text' The text to accompany the menu item. * 'icon' The filename of an icon to use for the menu item. * 'icon_path' The path to the icon if it doesn't exist in the graphics/ * directory. * 'target' The "target" of the link (e.g. '_top', '_blank'). * 'onclick' Any onclick javascript. * * A menu separator item is simply a string set to 'separator'. * * @param mixed $item Mixed parameter containing the custom menu item. * * @return string The resulting HTML to display the menu item. */ function customItem($item) { $text = ''; if (is_array($item)) { $text = Menu::createItem($item['url'], $item['text'], @$item['icon'], @$item['icon_path'], @$item['target'], @$item['onclick']); } else { if (strcasecmp($item, 'separator') == 0) { $text = '<td> </td>'; } } return $text; } /** * Print out any site-specific links for the current application * that have been defined in application/config/menu.php. */ function siteLinks() { $menufile = $GLOBALS['registry']->getParam('fileroot') . '/config/menu.php'; if (@is_readable($menufile)) { include_once $menufile; if (isset($_menu) && is_array($_menu)) { foreach ($_menu as $item) { echo Menu::customItem($item); } } } } /** * Print out any links to other Horde applications that are * defined in $conf['menu']['apps']. */ function appLinks() { global $conf, $registry; if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) { foreach ($conf['menu']['apps'] as $app) { if ($registry->getParam('status', $app) != 'inactive') { $url = $registry->getInitialPage($app); if (!is_a($url, 'PEAR_Error')) { echo Menu::createItem(Horde::url($url), $registry->getParam('name', $app), $registry->getParam('icon', $app), ''); } } } } } /** * Used in Horde_Template situations to return an array of menu elements * for a page. * * @access public * * @return array An array of menu elements. */ function getMenu() { /* Cache the menu generation. */ static $menu = array(); /* Return the menu array if already generated. */ if (!empty($menu)) { return $menu; } global $conf, $registry, $prefs; $graphics = $registry->getParam('graphics', 'horde'); /* Get the menu array from the current app. */ $app = $registry->getApp(); $function = 'get' . $app . 'Menu'; if (is_callable(array($app, $function))) { $menu = call_user_func(array($app, $function)); } /* Add settings item. */ if ($this->_with_prefs && ($conf['prefs']['driver'] != '') && ($conf['prefs']['driver'] != 'none')) { $url = Horde::url($registry->getParam('webroot', 'horde') . '/services/prefs.php'); $url = Util::addParameter($url, 'app', $app); $menu[] = array('url' => $url, 'text' => _("Options"), 'icon' => 'prefs.gif', 'icon_path' => $graphics); } /* Add any app menu items. */ $this->addAppLinks($menu); /* Add any custom menu items. */ $this->addSiteLinks($menu); /* Add help item. */ require_once 'Horde/Help.php'; if ($help_link = Help::listLink($app)) { Help::javascript(); $menu[] = array('url' => $help_link, 'text' => _("Help"), 'icon' => 'manual.gif', 'icon_path' => $graphics); } /* Login/Logout. */ if (Auth::getAuth() && $this->_with_login) { $url = Horde::url($registry->getParam('webroot', 'horde') . '/login.php'); $url = Auth::addLogoutParameters($url, AUTH_REASON_LOGOUT); $menu[] = array('url' => $url, 'text' => _("Logout"), 'icon' => 'logout.gif', 'icon_path' => $graphics); } elseif ($this->_with_login) { $url = Auth::getLoginScreen('', Horde::selfUrl()); $menu[] = array('url' => $url, 'text' => _("Login"), 'icon' => 'login.gif', 'icon_path' => $graphics); } /* Loop through the menu and set up necessary elements. */ $menu_view = $prefs->getValue('menu_view'); foreach ($menu as $k => $item) { /* Access keys. */ $item['accesskey'] = Horde::getAccessKey($item['text']); $item['text_accesskey'] = Horde::highlightAccessKey($item['text'], $item['accesskey']); /* Cell class and selected indication. */ if (Menu::isSelected($item['url']) && (!isset($item['cell_class']) || ($item['cell_class'] != '__noselection'))) { $item['status'] = 'menuselected'; } else { $item['status'] = ''; } if (isset($item['cell_class'])) { unset($item['cell_class']); } $item['onclick'] = (isset($item['onclick'])) ? $item['onclick'] : ''; $item['target'] = (isset($item['target'])) ? $item['target'] : ''; /* The actual button of the menu. */ $item['button'] = ''; if (!empty($item['icon']) && (($menu_view == 'icon') || ($menu_view == 'both'))) { /* Icon available and requested in prefs, so set up icon. */ $item['button'] .= Horde::img($item['icon'], $item['text'], ($menu_view == 'icon') ? 'hspace="5" vspace="5"' : '', $item['icon_path']); if ($menu_view == 'both') { $item['button'] .= '<br />'; } } /* If no icon-only preference then set text. */ if ($menu_view != 'icon') { $item['button'] .= Horde::highlightAccessKey($item['text'], $item['accesskey']); } $menu[$k] = $item; } return $menu; } /** * Any links to other Horde applications defined in an application's * config file by the $conf['menu']['apps'] array are added to the menu * array for use in Horde_Template pages. * * @access public * * @param array &$menu TODO */ function addAppLinks(&$menu) { global $conf, $registry; if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) { foreach ($conf['menu']['apps'] as $app) { if ($registry->getParam('status', $app) != 'inactive') { $url = $registry->getInitialPage($app); if (!is_a($url, 'PEAR_Error')) { $menu[] = array('url' => $url, 'text' => $registry->getParam('name', $app), 'icon' => $registry->getParam('icon', $app), 'icon_path' => ''); } } } } } /** * Any other links usually found in the /config/menu.php file that need * to be included in the menu as handled by Horde_Template are done here. * * @access public * * @param array &$menu TODO */ function addSiteLinks(&$menu) { if (@is_readable($this->_menufile)) { include $this->_menufile; if (isset($_menu) && is_array($_menu)) { foreach ($_menu as $menuitem) { $menu[] = $menuitem; } } } } /** * Checks to see if the current url matches the given url. * * @access public * * @return bool True or false whether given url is the current one. */ function isSelected($url) { $server_url = parse_url($_SERVER['PHP_SELF']); $check_url = parse_url($url); /* Try to match the item's path against the current script filename as well as other possible URLs to this script. */ if (isset($check_url['path']) && (($check_url['path'] == $server_url['path']) || ($check_url['path'] . 'index.php' == $server_url['path']) || ($check_url['path'] . '/index.php' == $server_url['path']))) { return true; } return false; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!-- $Horde: framework/Menu/package.xml,v 1.1 2004/02/11 22:17:12 chuck Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Menu</name> <summary>Horde Menu package</summary> <description> Package for creating and manipulating Horde menus and menuitems. </description> <license>LGPL</license> <maintainers> <maintainer> <user>chuck</user> <role>lead</role> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2004-02-11</date> <notes>Initial packaging</notes> <filelist> <file baseinstalldir="/Horde" role="php" name="Menu.php" /> </filelist> <provides type="class" name="Menu" /> </release> <changelog> <release> <version>0.0.1</version> <state>alpha</state> <date>2004-02-11</date> <notes>Initial packaging</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:09 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:06 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Mobile Mobile.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143309.E80A3102C47@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Mobile Added Files: Mobile.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Mobile.php --- <?php /** * @package Horde_Mobile */ class Horde_Mobile_card extends Horde_Mobile_element { var $_name; var $_title; var $_form; var $_elements = array(); var $_softkeys = array(); /** * Constructor * * @param string $name (optional, default: null) * The name of this card. Can be used in anchor links. * @param string $title (optional, default: null) * If a string is provided here, it will be displayed [...1128 lines suppressed...] */ class Horde_Mobile_rule extends Horde_Mobile_element { var $_width; var $_size; /** * Constructor * * @param integer $width (optional) Percentage of screen width or absolute value in * number of pixels (e.g. "50%", 100). * @param integer $size (optional) Height of the line to be drawn in pixels. */ function Horde_Mobile_rule($width = '', $size = '') { $this->_width = $width; $this->_size = $size; } } --- NEW FILE: package.xml --- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- $Horde: framework/Mobile/package.xml,v 1.4 2004/01/15 22:21:13 jan Exp $ --> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.1"> <package version="1.0"> <name>Horde_Mobile</name> <summary>Horde Mobile API</summary> <description> Horde API for generating Mobile content. Includes numerous utility functions, generalized element classes, and renderers for markup languages including WML, HDML, and CHTML. </description> <license>LGPL</license> <maintainers> <maintainer> <user>chuck</user> <role>lead</role> <name>Chuck Hagenbuch</name> <email>chuck@horde.org</email> </maintainer> </maintainers> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-03</date> <notes>Initial release as a PEAR package</notes> <filelist> <file role="php" baseinstalldir="/Horde" name="Mobile.php" /> <dir baseinstalldir="/Horde" name="Mobile" role="php"> <file name="Renderer.php" /> <dir name="Renderer" role="php"> <file name="html.php" /> <file name="wml.php" /> </dir> </dir> </filelist> <deps> <dep type="pkg" rel="has">Horde_Framework</dep> <dep type="pkg" rel="has">Horde_Util</dep> </deps> </release> <changelog> <release> <version>0.0.1</version> <state>alpha</state> <date>2003-07-03</date> <notes>Initial release as a PEAR package</notes> </release> </changelog> </package> From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:07 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile Renderer.php, NONE, 1.1 Message-ID: <20051014143310.27AF4102C00@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile Added Files: Renderer.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Renderer.php --- <?php /** * Horde_Mobile_Renderer:: framework for mobile device markup * renderers. * * $Horde: framework/Mobile/Mobile/Renderer.php,v 1.14 2004/01/01 15:16:07 jan Exp $ * * Copyright 2002-2004 Chuck Hagenbuch <chuck@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Mobile */ class Horde_Mobile_Renderer extends Horde_Mobile { var $_browser; function Horde_Mobile_Renderer($browser = null) { if (is_null($browser)) { $this->_browser = &new Browser(); } else { $this->_browser = $browser; } } function isBrowser($agent) { return $this->_browser->isBrowser($agent); } function hasQuirk($quirk) { return $this->_browser->hasQuirk($quirk); } /** * Render any Horde_Mobile_element object. Looks for the * appropriate rendering function in the renderer; if there isn't * one, we ignore this element. * * @param object Horde_Mobile_element $element The element to render. */ function renderElement(&$element) { $func = '_render' . ucfirst(str_replace('horde_mobile_', '', get_class($element))); if (method_exists($this, $func)) { $this->$func($element); } } function _renderBlock(&$block) { if (count($block->_elements)) { echo '<p>'; foreach ($block->_elements as $blockElement) { $this->renderElement($blockElement); } echo "</p>\n"; } } function _renderForm(&$form) { foreach ($form->_elements as $formElement) { $this->renderElement($formElement); } } function _renderTable(&$table) { foreach ($table->_rows as $row) { $this->_renderRow($row); } } function _renderRow(&$row) { echo '<tr>'; foreach ($row->_columns as $column) { echo '<td>'; // Call create function for each cellelement that is a // Horde_Mobile object. if (!is_null($column)) { $this->renderElement($column); } echo '</td>'; } echo "</tr>\n"; } /** * Attempts to return a concrete Horde_Mobile_Renderer instance * based on $type. * * @access public * * @param string $type The kind of markup (html, hdml, wml) * we want to generate. * @param optional object Browser The Browser object to use. * @param optional array $params A hash containing any * options for the renderer. * * @return object Horde_Mobile_Renderer The newly created concrete * Horde_Mobile_Renderer instance, or * a PEAR_Error object on an error. */ function &factory($type, $browser = null, $params = array()) { $type = basename($type); if (@file_exists(dirname(__FILE__) . '/Renderer/' . $type . '.php')) { include_once dirname(__FILE__) . '/Renderer/' . $type . '.php'; } else { @include_once 'Horde/Mobile/Renderer/' . $type . '.php'; } $class = 'Horde_Mobile_Renderer_' . $type; if (class_exists($class)) { return $ret = &new $class($browser, $params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a concrete Horde_Mobile_Renderer instance * based on $type. It will only create a new instance if no * renderer with the same parameters currently exists. * * @access public * * @param string $type The kind of markup (html, hdml, wml) * we want to generate. * @param optional object Browser The Browser object to use. * @param optional array $params A hash containing any * options for the renderer. * * @return object Horde_Mobile_Renderer The newly created concrete * Horde_Mobile_Renderer instance, or * a PEAR_Error object on an error. */ function &singleton($type, $browser = null, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($type, $browser, $params)); if (!array_key_exists($signature, $instances)) { $instances[$signature] = &Horde_Mobile_Renderer::factory($type, $browser, $params); } return $instances[$signature]; } } From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:08 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile/Renderer html.php, NONE, 1.1 wml.php, NONE, 1.1 Message-ID: <20051014143310.369B9102C01@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile/Renderer In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Mobile/Mobile/Renderer Added Files: html.php wml.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: html.php --- <?php /** * Horde_Mobile_Renderer:: output module for simple HTML and * Imode/Avantgo/similar devices. * * $Horde: framework/Mobile/Mobile/Renderer/html.php,v 1.27 2004/01/01 15:16:08 jan Exp $ * * Copyright 2002-2004 Chuck Hagenbuch <chuck@horde.org> * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch <chuck@horde.org> * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Mobile */ class Horde_Mobile_Renderer_html extends Horde_Mobile_Renderer { /** * Properly encode characters for output to an HTML browser. * * @param string $input Characters to encode. * * @return string The encoded text. */ function escape($input) { return @htmlspecialchars($input, ENT_COMPAT, NLS::getCharset()); } /** * Creates the page in the appropriate markup. Depending on the * clients browser type pure HTML, handheldfriendly AvantGo HTML, * i-mode cHTML, or MML is created. * * @param object Horde_Mobile $deck The deck to render. */ function render(&$deck) { if ($deck->_debug) { header('Content-Type: text/plain; charset=' . NLS::getCharset()); } else { header('Content-Type: text/html; charset=' . NLS::getCharset()); } header('Vary: Accept-Language'); if (!$this->isBrowser('mml')) { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n"; } echo !empty($GLOBALS['language']) ? '<html lang="' . strtr($GLOBALS['language'], '_', '-') . '">' : '<html>'; echo '<head>'; if ($this->isBrowser('avantgo')) { echo '<meta name="HandheldFriendly" content="True">'; } printf("<title>%s\n", $this->escape($deck->get('title'))); if ($deck->_simulator) { // Use simulator (mobile theme) stylesheet. echo Horde::stylesheetLink('horde', 'mobile'); } echo ''; if ($deck->_simulator) { echo "

\n"; // Create default device simulator table layout with // central CSS layout. echo "\n"; echo "\n"; echo "\n"; echo "
 
 \n"; } $divstyle = ''; if ($this->hasQuirk('scroll_tds') && $deck->_simulator) { // Make content of table element scrollable (Horde_Mobile // simulator). $divstyle = ' class="simdev"'; } echo ''; if (($cnt = count($deck->_cards)) !== 0) { $i = 0; foreach ($deck->_cards as $card) { if ($i != 0) { echo '
'; } $this->_renderCard($card); $i++; } } else { foreach ($deck->_elements as $page_element) { $this->renderElement($page_element); } } echo ''; if ($deck->_simulator) { // Display lower part of Horde_Mobile default device // simulator. echo '
 
 
'; } echo ''; } function _renderCard(&$card) { $name = $card->get('name') ? ' name="' . $this->escape($card->get('name')) . '"' : ''; printf('%s', $name, $card->get('title')); if (count($card->_softkeys)) { foreach ($card->_softkeys as $key) { echo ' | ' . $this->escape($key['label']) . ''; } } // Render all tags. foreach ($card->_elements as $page_element) { $this->renderElement($page_element); } } function _renderLink(&$link) { if ($link->get('title') && !$this->isBrowser('avantgo') && !$this->isBrowser('imode') && !$this->isBrowser('mml')) { $title_option = sprintf(' onmouseover="self.status=\'%s\';return true;"', $this->escape($link->get('title'))); } else { $title_option = ''; } $accesskey_option = ''; if ($link->get('accesskey')) { if ($this->isBrowser('imode')) { $accesskey_option = sprintf(' accesskey="%d"', $link->get('accesskey')); } elseif ($this->isBrowser('mml')) { $accesskey_option = sprintf(' directkey="%d"', $link->get('accesskey')); } } printf('%s', $this->escape($link->get('url')), $title_option, $accesskey_option, $this->escape($link->get('label'))); } function _renderLinkset(&$linkset) { if (count($linkset->_elements)) { echo '
    '; foreach ($linkset->_elements as $val) { echo '
  1. '; $this->_renderLink($val); echo '
  2. '; } echo '
'; } } function _renderText(&$element) { foreach ($element->_attributes as $attribute) { echo '<' . $attribute . '>'; } if ($element->get('linebreaks')) { echo nl2br($this->escape($element->get('text'))); } else { echo $this->escape($element->get('text')); } $attributes = array_reverse($element->_attributes); foreach ($attributes as $attribute) { echo ''; } } function _renderForm(&$form) { printf('
', $form->get('url'), $form->get('method')); parent::_renderForm($form); echo '
'; } function _renderInput(&$input) { $type = 'type="' . $input->get('type') . '"'; $size = $input->get('size') ? sprintf('size="%d"', $input->get('size')) : ''; $maxlength = $input->get('maxlength') ? sprintf('maxlength="%d"', $input->get('maxlength')) : ''; if ($this->isBrowser('imode')) { $mode = sprintf(' istyle="%d"', $input->get('mode')); } elseif ($this->isBrowser('mml')) { $mode = $this->_getMode($input->get('mode')); } else { $mode = ''; } // Create HTML input. printf('%s ', $this->escape($input->get('label')), $type, $this->escape($input->get('name')), $this->escape($input->get('value')), $size, $maxlength, $mode); } function _renderTextarea(&$textarea) { if ($this->isBrowser('imode')) { $mode = sprintf(' istyle="%d"', $this->mode); } elseif ($this->isBrowser('mml')) { $mode = $this->_getMode($this->mode); } else { $mode = ''; } $wrap = ''; if (!$this->isBrowser('imode') && !$this->isBrowser('mml')) { $wrap = ' wrap="virtual"'; } printf('%s
', $this->escape($textarea->get('label')), $textarea->get('name'), $textarea->get('rows'), $textarea->get('cols'), $mode, $wrap, $textarea->get('value')); } function _renderSelect(&$select) { echo ''; } function _renderRadio(&$radio) { foreach ($radio->_buttons as $val) { $sel = ($val['value'] == $radio->_value) ? ' checked="checked"' : ''; printf(' %s
', $radio->get('name'), $sel, $val['value'], $this->escape($val['label'])); } } function _renderCheckbox(&$checkbox) { $state = $checkbox->isChecked() ? ' checked="checked"' : ''; printf(' %s
', $checkbox->get('name'), $state, $checkbox->get('value'), $this->escape($checkbox->get('label'))); } function _renderSubmit(&$submit) { $name = !empty($submit->_name) ? ' name="' . $submit->_name . '"' : ''; printf('
', $name, $this->escape($submit->_label)); } function _renderHidden(&$hidden) { printf('', $hidden->get('name'), $hidden->get('value')); } function _renderTable(&$table) { $border = $table->get('border'); $padding = $table->get('padding'); $spacing = $table->get('spacing'); echo ''; parent::_renderTable($table); // Terminate table. if ($this->isBrowser('mml')) { echo '
'; } else { // MML has problems with the clear attribute. echo '
'; } } function _renderPhone(&$phone) { if ($this->isBrowser('imode')) { // Create phoneto: link for i-Mode. printf('

%s

', $phone->get('number'), $phone->get('label')); } elseif ($this->isBrowser('mml')) { // Create tel: link for MML. printf('

%s

', $phone->get('number'), $phone->get('label')); } else { // Display phone number as plain text. printf('

%s

', $phone->get('label')); } } function _renderRule(&$rule) { $width = $rule->get('width'); $size = $rule->get('size'); echo '\n"; } function _getMode($mode) { switch ($mode) { case 'katakana': return ' mode="katakana"'; case 'hiragana': return ' mode="hiragana"'; case 'numeric': return ' mode="numeric"'; case 'alpha': default: return ' mode="alphabet"'; } } } --- NEW FILE: wml.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Mobile */ class Horde_Mobile_Renderer_wml extends Horde_Mobile_Renderer { /** * Properly encode characters for output to a WML device. * * @param string $input Characters to encode. * * @return string The encoded text. */ function escape($input) { // Encode entities. $output = @htmlspecialchars($input, ENT_COMPAT, NLS::getCharset()); // Escape $ character in WML. $output = str_replace('$', '$$', $output); // Generate UTF-8. $output = String::convertCharset($output, NLS::getCharset(), 'utf-8'); return $output; } /** * Creates the page in WML, allowing for different WML browser * quirks. * * @param object Horde_Mobile $deck The deck to render. */ function render(&$deck) { if ($deck->_debug) { header('Content-Type: text/plain; charset=utf-8'); } else { header('Content-Type: text/vnd.wap.wml; charset=utf-8'); } // Tricks to foil caching. header('Content-location: ' . md5(date('U'))); echo "\n"; if ($this->hasQuirk('ow_gui_1.3')) { echo ''; } else { echo ''; } echo ''; if (count($deck->_cards)) { foreach ($deck->_cards as $card) { $this->_renderCard($card); } } else { $title = $deck->get('title') ? ' title="' . $this->escape($deck->get('title')) . '"' : ''; printf('', $title); // Render all tags. foreach ($deck->_elements as $page_element) { $this->renderElement($page_element); } echo ''; } // End the WML page. echo ''; } function _renderCard(&$card) { $name = $card->get('name') ? ' id="' . $this->escape($card->get('name')) . '"' : ''; $title = $card->get('title') ? ' title="' . $this->escape($card->get('title')) . '"' : ''; printf('', $name, $title); // Initialize WML variables with their default values. if (!is_null($card->_form)) { echo ''; $defaults = $card->_form->getDefaults(); foreach ($defaults as $d) { printf('', $d['name'], $this->escape($d['value'])); } echo ''; } if (count($card->_softkeys)) { if (count($card->_softkeys) == 1) { // If there is only one softkey, make it of type // 'options' so that it always shows up on the right, // instead of having to share the left softkey with // active links, making it much harder to get to. $type = 'options'; } else { $type = 'accept'; } foreach ($card->_softkeys as $key) { echo ''; } } // Render all tags. foreach ($card->_elements as $page_element) { $this->renderElement($page_element); } echo ''; } function _renderLink(&$link) { $title_option = $link->get('title') ? sprintf(' title="%s"', $this->escape($link->get('title'))) : ''; printf('%s', $title_option, str_replace('&amp;', '&', $this->escape($link->get('url'))), $this->escape($link->get('label'))); } function _renderLinkset(&$linkset) { if (count($linkset->_elements)) { if ($this->isBrowser('up')) { echo ''; } else { foreach ($linkset->_elements as $val) { $this->_renderLink($val); echo '
'; } } } } function _renderText(&$element) { foreach ($element->_attributes as $attribute) { echo '<' . $attribute . '>'; } if ($element->get('linebreaks')) { echo nl2br($this->escape($element->get('text'))); } else { echo $this->escape($element->get('text')); } $attributes = array_reverse($element->_attributes); foreach ($attributes as $attribute) { echo ''; } } function _renderInput(&$input) { $type = ' type="' . $input->get('type') . '"'; $size = $input->get('size') ? sprintf(' size="%d"', $input->get('size')) : ''; $maxlength = $input->get('maxlength') ? sprintf(' maxlength="%d"', $input->get('maxlength')) : ''; printf('%s', $this->escape($input->get('label')), $input->get('format'), $type, $this->escape($input->get('name')), $this->escape($input->get('value')), $size, $maxlength); } function _renderTextarea(&$textarea) { printf('%s', $this->escape($textarea->get('label')), $textarea->get('name'), $textarea->get('value')); } function _renderSelect(&$select) { if ($this->hasQuirk('ow_gui_1.3')) { switch ($select->get('type')) { case 'spin': $type_option = 'type="spin"'; break; case 'popup': default: $type_option = 'type="popup"'; break; } echo ''; } foreach ($select->_options as $val) { echo ''; } echo ''; } function _renderRadio(&$radio) { if ($this->hasQuirk('ow_gui_1.3')) { // Openwave GUI extensions for WML 1.3 printf('', $radio->get('name')); } foreach ($radio->_buttons as $val) { printf('', $val['value'], $this->escape($val['label'])); } echo ''; } function _renderCheckbox(&$checkbox) { printf('', $checkbox->get('value'), $this->escape($checkbox->get('label'))); } function _renderSubmit(&$submit) { if ($this->hasQuirk('ow_gui_1.3')) { // Create sequence for Openwave GUI // extensions WML 1.3. printf('', $this->escape($submit->get('label'))); $tag = 'do'; } else { // Create sequence in normal WML. printf('%s', $this->escape($submit->get('label')), $this->escape($submit->get('label'))); $tag = 'anchor'; } if ($submit->_form->get('method') == 'post') { printf('', Horde::url($submit->_form->get('url'))); // Value for this submit element, only if non-empty name. if ($submit->get('name')) { printf('', $submit->get('name'), $this->escape($submit->get('label'))); } $defaults = $submit->_form->getDefaults(); foreach ($defaults as $d) { if (array_key_exists('hidden', $d)) { printf('', $d['name'], $this->escape($d['value'])); } else { printf('', $d['name'], $d['name']); } } } else { // Start with the value for this submit element. $query_string = $submit->get('name') . '=' . $this->escape($submit->get('label')) . '&'; $getvars = $submit->_form->getGetVars(); foreach ($getvars as $val) { $query_string .= $val . '=$(_' . $val . ')&'; } if (substr($query_string, -5) == '&') { $query_string = substr($query_string, 0, strlen($query_string) - 5); } printf('', $submit->_form->get('url'), $query_string); } echo ""; } function _renderTable(&$table) { // Count maximum number of columns in table. $max = 0; foreach ($table->_rows as $row) { $max = max($max, $row->getColumnCount()); } printf('', $max); parent::_renderTable($table); // Terminate table. echo '
'; } function _renderPhone(&$phone) { $title = $phone->get('title'); $title_option = ($title ? sprintf(' title="%s"', $this->escape($title)) : ''); printf('%s', $title_option, str_replace('+', '%2B', $phone->get('number')), $phone->get('label')); } function _renderRule(&$rule) { if ($this->hasQuirk('ow_gui_1.3')) { // WAP device accepts Openwave GUI extensions for WML 1.3 $width = $rule->get('width'); $size = $rule->get('size'); echo ''; } else { // WAP device does not understand
tags. // ==> draw some number of hyphens to create a rule echo '----------
'; } } } From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/NLS NLS.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143310.45BEF102C5D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/NLS In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/NLS Added Files: NLS.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: NLS.php --- country lookups. * * $Horde: framework/NLS/NLS.php,v 1.72 2004/05/02 21:47:09 chuck Exp $ * * Copyright 1999-2004 Jon Parise * Copyright 1999-2004 Chuck Hagenbuch * Copyright 2002-2004 Jan Schneider * Copyright 2003-2004 Michael Slusarz * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @author Chuck Hagenbuch * @author Jan Schneider * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_NLS */ class NLS { /** * Selects the most preferred language for the current client session. * * @access public * * @return string The selected language abbreviation. */ function select() { global $nls, $prefs; $lang = Util::getFormData('new_lang'); /* First, check if language pref is locked and, if so, set it to its value */ if (isset($prefs) && $prefs->isLocked('language')) { $language = $prefs->getValue('language'); /* Check if the user selected a language from the login screen */ } elseif (!empty($lang)) { $language = $lang; /* Check if we have a language set in a cookie */ } elseif (isset($_SESSION['horde_language'])) { $language = $_SESSION['horde_language']; /* Use site-wide default, if one is defined */ } elseif (!empty($nls['defaults']['language'])) { $language = $nls['defaults']['language']; /* Try browser-accepted languages. */ } elseif (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { /* The browser supplies a list, so return the first valid one. */ $browser_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); foreach ($browser_langs as $lang) { /* Strip quality value for language */ if (($pos = strpos($lang, ';')) !== false) { $lang = substr($lang, 0, $pos); } $lang = NLS::_map(trim($lang)); if (NLS::isValid($lang)) { $language = $lang; break; } /* In case no full match, save best guess based on prefix */ if (!isset($partial_lang) && NLS::isValid(NLS::_map(substr($lang, 0, 2)))) { $partial_lang = NLS::_map(substr($lang, 0, 2)); } } } if (!isset($language)) { if (isset($partial_lang)) { $language = $partial_lang; } else { /* No dice auto-detecting, default to US English. */ $language = 'en_US'; } } return basename($language); } /** * Sets the language. * * @access public * * @param optional string $lang The language abbriviation. */ function setLang($lang = null) { include_once HORDE_BASE . '/config/nls.php'; if (empty($lang) || !NLS::isValid($lang)) { $lang = NLS::select(); } $GLOBALS['language'] = $lang; /* First try language with the current charset. */ $lang_charset = $lang . '.' . NLS::getCharset(); if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { /* Next try language with its default charset. */ global $nls; $charset = !empty($nls['charsets'][$lang]) ? $nls['charsets'][$lang] : $nls['defaults']['charset']; $lang_charset = $lang . '.' . $charset; NLS::_cachedCharset(0, $charset); if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { /* At last try language solely. */ $lang_charset = $lang; setlocale(LC_ALL, $lang_charset); } } @putenv('LANG=' . $lang_charset); @putenv('LANGUAGE=' . $lang_charset); } /** * Sets the gettext domain. * * @access public * * @param string $app The application name. * @param string $directory The directory where the application's * LC_MESSAGES directory resides. * @param string $charset The charset. */ function setTextdomain($app, $directory, $charset) { bindtextdomain($app, $directory); textdomain($app); /* The existence of this function depends on the platform. */ if (function_exists('bind_textdomain_codeset')) { bind_textdomain_codeset($app, $charset); } if (!headers_sent()) { header('Content-Type: text/html; charset=' . $charset); } } /** * Determines whether the supplied language is valid. * * @access public * * @param string $language The abbreviated name of the language. * * @return boolean True if the language is valid, false if it's not * valid or unknown. */ function isValid($language) { return !empty($GLOBALS['nls']['languages'][$language]); } /** * Maps languages with common two-letter codes (such as nl) to the * full gettext code (in this case, nl_NL). Returns the language * unmodified if it isn't an alias. * * @access private * * @param string $language The language code to map. * * @return string The mapped language code. */ function _map($language) { require_once 'Horde/String.php'; $aliases = &$GLOBALS['nls']['aliases']; // Translate the $language to get broader matches. // (eg. de-DE should match de_DE) $trans_lang = str_replace('-', '_', $language); $lang_parts = explode('_', $trans_lang); $trans_lang = String::lower($lang_parts[0]); if (isset($lang_parts[1])) { $trans_lang .= '_' . String::upper($lang_parts[1]); } // See if we get a match for this if (!empty($aliases[$trans_lang])) { return $aliases[$trans_lang]; } // If we get that far down, the language cannot be found. // Return $trans_lang. return $trans_lang; } /** * Return the charset for the current language. * * @access public * * @param optional boolean $no_utf Do not use UTF-8? * * @return string The character set that should be used with the current * locale settings. */ function getCharset($no_utf = false) { global $language, $nls; /* Get cached results. */ $cacheKey = intval($no_utf); $charset = NLS::_cachedCharset($cacheKey); if (!is_null($charset)) { return $charset; } if (!$no_utf) { require_once 'Horde/Browser.php'; $browser = &Browser::singleton(); if ($browser->hasFeature('utf') && (Util::extensionExists('iconv') || Util::extensionExists('mbstring'))) { NLS::_cachedCharset($cacheKey, 'UTF-8'); return 'UTF-8'; } } $lang_charset = setlocale(LC_ALL, 0); if (!strstr($lang_charset, ';') && !strstr($lang_charset, '/')) { $lang_charset = explode('.', $lang_charset); if ((count($lang_charset) == 2) && !empty($lang_charset[1]) && (!$no_utf || ($lang_charset[1] != 'UTF-8'))) { NLS::_cachedCharset($cacheKey, $lang_charset[1]); return $lang_charset[1]; } } return (!empty($nls['charsets'][$language])) ? $nls['charsets'][$language] : $nls['defaults']['charset']; } function _cachedCharset($index, $charset = null) { static $cache; if (!isset($cache)) { $cache = array(); } if ($charset == null) { return isset($cache[$index]) ? $cache[$index] : null; } else { $cache[$index] = $charset; } } /** * Returns the charset to use for outgoing emails. * * @return string The preferred charset for outgoing mails based on * the user's preferences and the current language. */ function getEmailCharset() { global $prefs, $language, $nls; $charset = $prefs->getValue('sending_charset'); if (!empty($charset)) { return $charset; } return isset($nls['emails'][$language]) ? $nls['emails'][$language] : (isset($nls['charsets'][$language]) ? $nls['charsets'][$language] : $nls['defaults']['charset']); } /** * Check to see if character set is valid for htmlspecialchars() calls. * * @access public * * @param string $charset The character set to check. * * @return boolean Is charset valid for the current system? */ function checkCharset($charset) { static $check; if (is_null($charset) || empty($charset)) { return false; } if (isset($check[$charset])) { return $check[$charset]; } elseif (!isset($check)) { $check = array(); } $valid = true; ini_set('track_errors', 1); @htmlspecialchars('', ENT_COMPAT, $charset); if (isset($php_errormsg)) { $valid = false; } ini_restore('track_errors'); $check[$charset] = $valid; return $valid; } /** * Sets the current timezone, if available. * * @access public */ function setTimeZone() { global $prefs; $tz = $prefs->getValue('timezone'); if (!empty($tz)) { @putenv('TZ=' . $tz); } } /** * Get the locale info returned by localeconv(), but cache it, to * avoid repeated calls. * * @access public * * @return array The results of localeconv(). */ function getLocaleInfo() { static $lc_info; if (!isset($lc_info)) { $lc_info = localeconv(); } return $lc_info; } /** * Get country information from a hostname or IP address. * * @access public * * @param string $host The hostname or IP address. * * @return mixed On success, return an array with the following entries: * 'code' => Country Code * 'name' => Country Name * On failure, return false. */ function getCountryByHost($host) { global $conf; /* List of generic domains that we know is not in the country TLD list. See: http://www.iana.org/gtld/gtld.htm */ $generic = array( 'aero', 'biz', 'com', 'coop', 'edu', 'gov', 'info', 'int', 'mil', 'museum', 'name', 'net', 'org', 'pro' ); $checkHost = $host; if (preg_match('/^\d+\.\d+\.\d+\.\d+$/', $host)) { $checkHost = @gethostbyaddr($host); } /* Get the TLD of the hostname. */ $pos = strrpos($checkHost, '.'); if ($pos === false) { return false; } $domain = String::lower(substr($checkHost, $pos + 1)); /* Try lookup via TLD first. */ if (!in_array($domain, $generic)) { require 'Horde/NLS/tld.php'; if (isset($tld[$domain])) { return array('code' => $domain, 'name' => $tld[$domain]); } } /* Try GeoIP lookup next. */ if (!empty($conf['geoip']['datafile'])) { require_once 'Horde/NLS/GeoIP.php'; $geoip = &NLS_GeoIP::singleton($conf['geoip']['datafile']); $id = $geoip->countryIdByName($checkHost); if (!empty($id)) { return array('code' => String::lower($GLOBALS['GEOIP_COUNTRY_CODES'][$id]), 'name' => $GLOBALS['GEOIP_COUNTRY_NAMES'][$id]); } } return false; } /** * Returns a Horde image link to the country flag. * * @access public * * @param string $host The hostname or IP address. * * @return string The image URL, or the empty string on error. */ function generateFlagImageByHost($host) { global $registry; $data = NLS::getCountryByHost($host); if ($data !== false) { $img = $data['code'] . '.gif'; if (file_exists($registry->getParam('fileroot', 'horde') . '/graphics/flags/' . $img)) { return Horde::img($img, $data['name'], '', $registry->getParam('graphics', 'horde') . '/flags'); } else { return '[' . $data['name'] . ']'; } } return ''; } /** * Returns either a specific or all ISO-3166 country names. * * @access public * * @param optional string $code The ISO 3166 country code. * * @return mixed If a country code has been requested will return the * corresponding country name. If empty will return an * array of all the country codes and their names. */ function &getCountryISO($code = '') { static $countries = array(); if (empty($countries)) { require_once 'Horde/NLS/countries.php'; } if (empty($code)) { return $countries; } elseif (isset($countries[$code])) { return $countries[$code]; } return false; } } --- NEW FILE: package.xml --- NLS Localization package TODO LGPL chuck lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org yunosh lead Jan Schneider jan@horde.org 0.0.1 alpha 2004-02-11 Initial packaging Horde_Util 0.0.1 alpha 2004-02-11 Initial packaging From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:11 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/NLS/NLS GeoIP.php, NONE, 1.1 coordinates.php, NONE, 1.1 countries.php, NONE, 1.1 tld.php, NONE, 1.1 Message-ID: <20051014143310.4AACE102C60@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/NLS/NLS In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/NLS/NLS Added Files: GeoIP.php coordinates.php countries.php tld.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: GeoIP.php --- Country * listing. * * $Horde: framework/NLS/NLS/GeoIP.php,v 1.9 2004/03/20 14:07:46 jan Exp $ * * Based on PHP geoip.inc library by MaxMind LLC: * http://www.maxmind.com/download/geoip/api/php/ * * Originally based on php version of the geoip library written in May * 2002 by jim winstead * * Copyright (C) 2003 MaxMind LLC * Copyright 2003-2004 Michael Slusarz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. * * @author Michael Slusarz * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_NLS */ /* Country list. */ $GLOBALS['GEOIP_COUNTRY_CODES'] = array( '', 'AP', 'EU', 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'FX', 'GA', 'UK', 'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN', 'TO', 'TP', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'YU', 'ZA', 'ZM', 'ZR', 'ZW', 'A1', 'A2', 'O1' ); /* Country Names. */ $GLOBALS['GEOIP_COUNTRY_NAMES'] = array( "", _("Asia/Pacific Region"), _("Europe"), _("Andorra"), _("United Arab Emirates"), _("Afghanistan"), _("Antigua and Barbuda"), _("Anguilla"), _("Albania"), _("Armenia"), _("Netherlands Antilles"), _("Angola"), _("Antarctica"), _("Argentina"), _("American Samoa"), _("Austria"), _("Australia"), _("Aruba"), _("Azerbaijan"), _("Bosnia and Herzegovina"), _("Barbados"), _("Bangladesh"), _("Belgium"), _("Burkina Faso"), _("Bulgaria"), _("Bahrain"), _("Burundi"), _("Benin"), _("Bermuda"), _("Brunei Darussalam"), _("Bolivia"), _("Brazil"), _("Bahamas"), _("Bhutan"), _("Bouvet Island"), _("Botswana"), _("Belarus"), _("Belize"), _("Canada"), _("Cocos (Keeling) Islands"), _("Congo, The Democratic Republic of the"), _("Central African Republic"), _("Congo"), _("Switzerland"), _("Cote d'Ivoire"), _("Cook Islands"), _("Chile"), _("Cameroon"), _("China"), _("Colombia"), _("Costa Rica"), _("Cuba"), _("Cape Verde"), _("Christmas Island"), _("Cyprus"), _("Czech Republic"), _("Germany"), _("Djibouti"), _("Denmark"), _("Dominica"), _("Dominican Republic"), _("Algeria"), _("Ecuador"), _("Estonia"), _("Egypt"), _("Western Sahara"), _("Eritrea"), _("Spain"), _("Ethiopia"), _("Finland"), _("Fiji"), _("Falkland Islands (Malvinas)"), _("Micronesia, Federated States of"), _("Faroe Islands"), _("France"), _("France, Metropolitan"), _("Gabon"), _("United Kingdom"), _("Grenada"), _("Georgia"), _("French Guiana"), _("Ghana"), _("Gibraltar"), _("Greenland"), _("Gambia"), _("Guinea"), _("Guadeloupe"), _("Equatorial Guinea"), _("Greece"), _("South Georgia and the South Sandwich Islands"), _("Guatemala"), _("Guam"), _("Guinea-Bissau"), _("Guyana"), _("Hong Kong"), _("Heard Island and McDonald Islands"), _("Honduras"), _("Croatia"), _("Haiti"), _("Hungary"), _("Indonesia"), _("Ireland"), _("Israel"), _("India"), _("British Indian Ocean Territory"), _("Iraq"), _("Iran, Islamic Republic of"), _("Iceland"), _("Italy"), _("Jamaica"), _("Jordan"), _("Japan"), _("Kenya"), _("Kyrgyzstan"), _("Cambodia"), _("Kiribati"), _("Comoros"), _("Saint Kitts and Nevis"), _("Korea, Democratic People's Republic of"), _("Korea, Republic of"), _("Kuwait"), _("Cayman Islands"), _("Kazakhstan"), _("Lao People's Democratic Republic"), _("Lebanon"), _("Saint Lucia"), _("Liechtenstein"), _("Sri Lanka"), _("Liberia"), _("Lesotho"), _("Lithuania"), _("Luxembourg"), _("Latvia"), _("Libyan Arab Jamahiriya"), _("Morocco"), _("Monaco"), _("Moldova, Republic of"), _("Madagascar"), _("Marshall Islands"), _("Macedonia, The Former Yugoslav Republic of"), _("Mali"), _("Myanmar"), _("Mongolia"), _("Macao"), _("Northern Mariana Islands"), _("Martinique"), _("Mauritania"), _("Montserrat"), _("Malta"), _("Mauritius"), _("Maldives"), _("Malawi"), _("Mexico"), _("Malaysia"), _("Mozambique"), _("Namibia"), _("New Caledonia"), _("Niger"), _("Norfolk Island"), _("Nigeria"), _("Nicaragua"), _("Netherlands"), _("Norway"), _("Nepal"), _("Nauru"), _("Niue"), _("New Zealand"), _("Oman"), _("Panama"), _("Peru"), _("French Polynesia"), _("Papua New Guinea"), _("Philippines"), _("Pakistan"), _("Poland"), _("Saint Pierre and Miquelon"), _("Pitcairn"), _("Puerto Rico"), _("Palestinian Territory, Occupied"), _("Portugal"), _("Palau"), _("Paraguay"), _("Qatar"), _("Reunion"), _("Romania"), _("Russian Federation"), _("Rwanda"), _("Saudi Arabia"), _("Solomon Islands"), _("Seychelles"), _("Sudan"), _("Sweden"), _("Singapore"), _("Saint Helena"), _("Slovenia"), _("Svalbard and Jan Mayen"), _("Slovakia"), _("Sierra Leone"), _("San Marino"), _("Senegal"), _("Somalia"), _("Suriname"), _("Sao Tome and Principe"), _("El Salvador"), _("Syrian Arab Republic"), _("Swaziland"), _("Turks and Caicos Islands"), _("Chad"), _("French Southern Territories"), _("Togo"), _("Thailand"), _("Tajikistan"), _("Tokelau"), _("Turkmenistan"), _("Tunisia"), _("Tonga"), _("Timor-Leste"), _("Turkey"), _("Trinidad and Tobago"), _("Tuvalu"), _("Taiwan"), _("Tanzania, United Republic of"), _("Ukraine"), _("Uganda"), _("United States Minor Outlying Islands"), _("United States"), _("Uruguay"), _("Uzbekistan"), _("Holy See (Vatican City State)"), _("Saint Vincent and the Grenadines"), _("Venezuela"), _("Virgin Islands, British"), _("Virgin Islands, U.S."), _("Viet Nam"), _("Vanuatu"), _("Wallis and Futuna"), _("Samoa"), _("Yemen"), _("Mayotte"), _("Yugoslavia"), _("South Africa"), _("Zambia"), _("Zaire"), _("Zimbabwe"), _("Anonymous Proxy"), _("Satellite Provider"), _("Other") ); define('GEOIP_COUNTRY_BEGIN', 16776960); define('STRUCTURE_INFO_MAX_SIZE', 20); define('STANDARD_RECORD_LENGTH', 3); class NLS_GeoIP { /** * The location of the GeoIP database. * * @var string $_datafile */ var $_datafile; /** * The open filehandle to the GeoIP database. * * @var resource $_filehandle */ var $_filehandle; /** * Returns a reference to the global NLS_GeoIP object, only creating it * if it doesn't already exist. * * This method must be invoked as: * $geoip = &GeoIP::singleton($datafile); * * @access public * * @param string $datafile The location of the GeoIP database. * * @return object NLS_GeoIP The NLS_GeoIP instance. */ function &singleton($datafile) { static $instance; if (!isset($instance)) { $instance = new NLS_GeoIP($datafile); } return $instance; } /** * Create a NLS_GeoIP instance (Constructor). * * @access public * * @param string $datafile The location of the GeoIP database. */ function NLS_GeoIP($datafile) { $this->_datafile = $datafile; } /** * Open the GeoIP database. * * @access private * * @return boolean False on error. */ function _open() { /* Return if we already have an object. */ if (!empty($this->_gi)) { return true; } /* Return if no datafile specified. */ if (empty($this->_datafile)) { return false; } $this->_filehandle = fopen($this->_datafile, 'rb'); $filepos = ftell($this->_filehandle); fseek($this->_filehandle, -3, SEEK_END); for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { $delim = fread($this->_filehandle, 3); if ($delim == (chr(255) . chr(255) . chr(255))) { break; } else { fseek($this->_filehandle, -4, SEEK_CUR); } } fseek($this->_filehandle, $filepos, SEEK_SET); return true; } /** * Returns the country ID for a hostname. * * @access public * * @param string $name The hostname. * * @return integer The GeoIP country ID. */ function countryIdByName($name) { if (!$this->_open()) { return false; } $addr = gethostbyname($name); if (!$addr || $addr == $name) { return false; } return $this->countryIdByAddr($addr); } /** * Returns the country abbreviation (2-letter) for a hostname. * * @access public * * @param string $name The hostname. * * @return integer The country abbreviation. */ function countryCodeByName($name) { if ($this->_open()) { $country_id = $this->countryIdByName($name); if ($country_id !== false) { return $GLOBALS['GEOIP_COUNTRY_CODES'][$country_id]; } } return false; } /** * Returns the country name for a hostname. * * @access public * * @param string $name The hostname. * * @return integer The country name. */ function countryNameByName($name) { if ($this->_open()) { $country_id = $this->countryIdByName($name); if ($country_id !== false) { return $GLOBALS['GEOIP_COUNTRY_NAMES'][$country_id]; } } return false; } /** * Returns the country ID for an IP Address. * * @access public * * @param string $addr The IP Address. * * @return integer The GeoIP country ID. */ function countryIdByAddr($addr) { if (!$this->_open()) { return false; } $ipnum = ip2long($addr); return ($this->_seekCountry($ipnum) - GEOIP_COUNTRY_BEGIN); } /** * Returns the country abbreviation (2-letter) for an IP Address. * * @access public * * @param string $addr The IP Address. * * @return integer The country abbreviation. */ function countryCodeByAddr($addr) { if ($this->_open()) { $country_id = $this->countryIdByAddr($addr); if ($country_id !== false) { return $GLOBALS['GEOIP_COUNTRY_CODES'][$country_id]; } } return false; } /** * Returns the country name for an IP address. * * @access public * * @param string $addr The IP address. * * @return mixed The country name. */ function countryNameByAddr($addr) { if ($this->_open()) { $country_id = $this->countryIdByAddr($addr); if ($country_id !== false) { return $GLOBALS['GEOIP_COUNTRY_NAMES'][$country_id]; } } return false; } /** * Finds a country by IP Address in the GeoIP database. * * @access private * * @param string $ipnum The IP Address to search for. * * @return mixed The country ID or false if not found. * Returns PEAR_Error on error. */ function _seekCountry($ipnum) { $offset = 0; for ($depth = 31; $depth >= 0; --$depth) { if (fseek($this->_filehandle, 2 * STANDARD_RECORD_LENGTH * $offset, SEEK_SET) != 0) { return PEAR::raiseError('fseek failed'); } $buf = fread($this->_filehandle, 2 * STANDARD_RECORD_LENGTH); $x = array(0, 0); for ($i = 0; $i < 2; ++$i) { for ($j = 0; $j < STANDARD_RECORD_LENGTH; ++$j) { $x[$i] += ord($buf[STANDARD_RECORD_LENGTH * $i + $j]) << ($j * 8); } } if ($ipnum & (1 << $depth)) { if ($x[1] >= GEOIP_COUNTRY_BEGIN) { return $x[1]; } $offset = $x[1]; } else { if ($x[0] >= GEOIP_COUNTRY_BEGIN) { return $x[0]; } $offset = $x[0]; } } return false; } } --- NEW FILE: coordinates.php --- _("Afghanistan"), 'AL' => _("Albania"), 'DZ' => _("Algeria"), 'AS' => _("American Samoa"), 'AD' => _("Andorra"), 'AO' => _("Angola"), 'AI' => _("Anguilla"), 'AQ' => _("Antarctica"), 'AG' => _("Antigua and Barbuda"), 'AR' => _("Argentina"), 'AM' => _("Armenia"), 'AW' => _("Aruba"), 'AU' => _("Australia"), 'AT' => _("Austria"), 'AZ' => _("Azerbaijan"), 'BS' => _("Bahamas"), 'BH' => _("Bahrain"), 'BD' => _("Bangladesh"), 'BB' => _("Barbados"), 'BY' => _("Belarus"), 'BE' => _("Belgium"), 'BZ' => _("Belize"), 'BJ' => _("Benin"), 'BM' => _("Bermuda"), 'BT' => _("Bhutan"), 'BO' => _("Bolivia"), 'BA' => _("Bosnia and Herzegovina"), 'BW' => _("Botswana"), 'BV' => _("Bouvet Island"), 'BR' => _("Brazil"), 'IO' => _("British Indian Ocean Territory"), 'BN' => _("Brunei Darussalam"), 'BG' => _("Bulgaria"), 'BF' => _("Burkina Faso"), 'BI' => _("Burundi"), 'KH' => _("Cambodia"), 'CM' => _("Cameroon"), 'CA' => _("Canada"), 'CV' => _("Cape Verde"), 'KY' => _("Cayman Islands"), 'CF' => _("Central African Republic"), 'TD' => _("Chad"), 'CL' => _("Chile"), 'CN' => _("China"), 'CX' => _("Christmas Island"), 'CC' => _("Cocos (Keeling) Islands"), 'CO' => _("Colombia"), 'KM' => _("Comoros"), 'CG' => _("Congo"), 'CD' => _("Congo, The Democratic Republic of the"), 'CK' => _("Cook Islands"), 'CR' => _("Costa Rica"), 'CI' => _("Cote d'Ivoire"), 'HR' => _("Croatia"), 'CU' => _("Cuba"), 'CY' => _("Cyprus"), 'CZ' => _("Czech Republic"), 'DK' => _("Denmark"), 'DJ' => _("Djibouti"), 'DM' => _("Dominica"), 'DO' => _("Dominican Republic"), 'EC' => _("Ecuador"), 'EG' => _("Egypt"), 'SV' => _("El Salvador"), 'GQ' => _("Equatorial Guinea"), 'ER' => _("Eritrea"), 'EE' => _("Estonia"), 'ET' => _("Ethiopia"), 'FK' => _("Falkland Islands (Malvinas)"), 'FO' => _("Faroe Islands"), 'FJ' => _("Fiji"), 'FI' => _("Finland"), 'FR' => _("France"), 'GF' => _("French Guiana"), 'PF' => _("French Polynesia"), 'TF' => _("French Southern Territories"), 'GA' => _("Gabon"), 'GM' => _("Gambia"), 'GE' => _("Georgia"), 'DE' => _("Germany"), 'GH' => _("Ghana"), 'GI' => _("Gibraltar"), 'GR' => _("Greece"), 'GL' => _("Greenland"), 'GD' => _("Grenada"), 'GP' => _("Guadeloupe"), 'GU' => _("Guam"), 'GT' => _("Guatemala"), 'GN' => _("Guinea"), 'GW' => _("Guinea-Bissau"), 'GY' => _("Guyana"), 'HT' => _("Haiti"), 'HM' => _("Heard Island and McDonald Islands"), 'VA' => _("Holy See (Vatican City State)"), 'HN' => _("Honduras"), 'HK' => _("Hong Kong"), 'HU' => _("Hungary"), 'IS' => _("Iceland"), 'IN' => _("India"), 'ID' => _("Indonesia"), 'IR' => _("Iran, Islamic Republic of"), 'IQ' => _("Iraq"), 'IE' => _("Ireland"), 'IL' => _("Israel"), 'IT' => _("Italy"), 'JM' => _("Jamaica"), 'JP' => _("Japan"), 'JO' => _("Jordan"), 'KZ' => _("Kazakhstan"), 'KE' => _("Kenya"), 'KI' => _("Kiribati"), 'KP' => _("Korea, Democratic People's Republic of"), 'KR' => _("Korea, Republic of"), 'KW' => _("Kuwait"), 'KG' => _("Kyrgyzstan"), 'LA' => _("Lao People's Democratic Republic"), 'LV' => _("Latvia"), 'LB' => _("Lebanon"), 'LS' => _("Lesotho"), 'LR' => _("Liberia"), 'LY' => _("Libyan Arab Jamahiriya"), 'LI' => _("Liechtenstein"), 'LT' => _("Lithuania"), 'LU' => _("Luxembourg"), 'MO' => _("Macao"), 'MK' => _("Macedonia, The Former Yugoslav Republic of"), 'MG' => _("Madagascar"), 'MW' => _("Malawi"), 'MY' => _("Malaysia"), 'MV' => _("Maldives"), 'ML' => _("Mali"), 'MT' => _("Malta"), 'MH' => _("Marshall Islands"), 'MQ' => _("Martinique"), 'MR' => _("Mauritania"), 'MU' => _("Mauritius"), 'YT' => _("Mayotte"), 'MX' => _("Mexico"), 'FM' => _("Micronesia, Federated States of"), 'MD' => _("Moldova, Republic of"), 'MC' => _("Monaco"), 'MN' => _("Mongolia"), 'MS' => _("Montserrat"), 'MA' => _("Morocco"), 'MZ' => _("Mozambique"), 'MM' => _("Myanmar"), 'NA' => _("Namibia"), 'NR' => _("Nauru"), 'NP' => _("Nepal"), 'NL' => _("Netherlands"), 'AN' => _("Netherlands Antilles"), 'NC' => _("New Caledonia"), 'NZ' => _("New Zealand"), 'NI' => _("Nicaragua"), 'NE' => _("Niger"), 'NG' => _("Nigeria"), 'NU' => _("Niue"), 'NF' => _("Norfolk Island"), 'MP' => _("Northern Mariana Islands"), 'NO' => _("Norway"), 'OM' => _("Oman"), 'PK' => _("Pakistan"), 'PW' => _("Palau"), 'PS' => _("Palestinian Territory, Occupied"), 'PA' => _("Panama"), 'PG' => _("Papua New Guinea"), 'PY' => _("Paraguay"), 'PE' => _("Peru"), 'PH' => _("Philippines"), 'PN' => _("Pitcairn"), 'PL' => _("Poland"), 'PT' => _("Portugal"), 'PR' => _("Puerto Rico"), 'QA' => _("Qatar"), 'RE' => _("Reunion"), 'RO' => _("Romania"), 'RU' => _("Russian Federation"), 'RW' => _("Rwanda"), 'SH' => _("Saint Helena"), 'KN' => _("Saint Kitts and Nevis"), 'LC' => _("Saint Lucia"), 'PM' => _("Saint Pierre and Miquelon"), 'VC' => _("Saint Vincent and the Grenadines"), 'WS' => _("Samoa"), 'SM' => _("San Marino"), 'ST' => _("Sao Tome and Principe"), 'SA' => _("Saudi Arabia"), 'SN' => _("Senegal"), 'CS' => _("Serbia and Montenegro"), 'SC' => _("Seychelles"), 'SL' => _("Sierra Leone"), 'SG' => _("Singapore"), 'SK' => _("Slovakia"), 'SI' => _("Slovenia"), 'SB' => _("Solomon Islands"), 'SO' => _("Somalia"), 'ZA' => _("South Africa"), 'GS' => _("South Georgia and the South Sandwich Islands"), 'ES' => _("Spain"), 'LK' => _("Sri Lanka"), 'SD' => _("Sudan"), 'SR' => _("Suriname"), 'SJ' => _("Svalbard and Jan Mayen"), 'SZ' => _("Swaziland"), 'SE' => _("Sweden"), 'CH' => _("Switzerland"), 'SY' => _("Syrian Arab Republic"), 'TW' => _("Taiwan, Province of China"), 'TJ' => _("Tajikistan"), 'TZ' => _("Tanzania, United Republic of"), 'TH' => _("Thailand"), 'TL' => _("Timor-Leste"), 'TG' => _("Togo"), 'TK' => _("Tokelau"), 'TO' => _("Tonga"), 'TT' => _("Trinidad and Tobago"), 'TN' => _("Tunisia"), 'TR' => _("Turkey"), 'TM' => _("Turkmenistan"), 'TC' => _("Turks and Caicos Islands"), 'TV' => _("Tuvalu"), 'UG' => _("Uganda"), 'UA' => _("Ukraine"), 'AE' => _("United Arab Emirates"), 'GB' => _("United Kingdom"), 'US' => _("United States"), 'UM' => _("United States Minor Outlying Islands"), 'UY' => _("Uruguay"), 'UZ' => _("Uzbekistan"), 'VU' => _("Vanuatu"), 'VE' => _("Venezuela"), 'VN' => _("Viet Nam"), 'VG' => _("Virgin Islands, British"), 'VI' => _("Virgin Islands, U.S."), 'WF' => _("Wallis and Futuna"), 'EH' => _("Western Sahara"), 'YE' => _("Yemen"), 'ZM' => _("Zambia"), 'ZW' => _("Zimbabwe")); --- NEW FILE: tld.php --- _("Ascension Island"), 'ad' => _("Andorra"), 'ae' => _("United Arab Emirates"), 'af' => _("Afghanistan"), 'ag' => _("Antigua and Barbuda"), 'ai' => _("Anguilla"), 'al' => _("Albania"), 'am' => _("Armenia"), 'an' => _("Netherlands Antilles"), 'ao' => _("Angola"), 'aq' => _("Antarctica"), 'ar' => _("Argentina"), 'as' => _("American Samoa"), 'at' => _("Austria"), 'au' => _("Australia"), 'aw' => _("Aruba"), 'az' => _("Azerbaijan"), 'ba' => _("Bosnia and Herzegovina"), 'bb' => _("Barbados"), 'bd' => _("Bangladesh"), 'be' => _("Belgium"), 'bf' => _("Burkina Faso"), 'bg' => _("Bulgaria"), 'bh' => _("Bahrain"), 'bi' => _("Burundi"), 'bj' => _("Benin"), 'bm' => _("Bermuda"), 'bn' => _("Brunei Darussalam"), 'bo' => _("Bolivia"), 'br' => _("Brazil"), 'bs' => _("Bahamas"), 'bt' => _("Bhutan"), 'bv' => _("Bouvet Island"), 'bw' => _("Botswana"), 'by' => _("Belarus"), 'bz' => _("Belize"), 'ca' => _("Canada"), 'cc' => _("Cocos (Keeling) Islands"), 'cd' => _("Congo, The Democratic Republic of the"), 'cf' => _("Central African Republic"), 'cg' => _("Congo"), 'ch' => _("Switzerland"), 'ci' => _("Cote d'Ivoire"), 'ck' => _("Cook Islands"), 'cl' => _("Chile"), 'cm' => _("Cameroon"), 'cn' => _("China"), 'co' => _("Colombia"), 'cr' => _("Costa Rica"), 'cu' => _("Cuba"), 'cv' => _("Cape Verde"), 'cx' => _("Christmas Island"), 'cy' => _("Cyprus"), 'cz' => _("Czech Republic"), 'de' => _("Germany"), 'dj' => _("Djibouti"), 'dk' => _("Denmark"), 'dm' => _("Dominica"), 'do' => _("Dominican Republic"), 'dz' => _("Algeria"), 'ec' => _("Ecuador"), 'ee' => _("Estonia"), 'eg' => _("Egypt"), 'eh' => _("Western Sahara"), 'er' => _("Eritrea"), 'es' => _("Spain"), 'et' => _("Ethiopia"), 'fi' => _("Finland"), 'fj' => _("Fiji"), 'fk' => _("Falkland Islands (Malvinas)"), 'fm' => _("Micronesia, Federated States of"), 'fo' => _("Faroe Islands"), 'fr' => _("France"), 'ga' => _("Gabon"), 'gd' => _("Grenada"), 'ge' => _("Georgia"), 'gf' => _("French Guiana"), 'gg' => _("Guernsey"), 'gh' => _("Ghana"), 'gi' => _("Gibraltar"), 'gl' => _("Greenland"), 'gm' => _("Gambia"), 'gn' => _("Guinea"), 'gp' => _("Guadeloupe"), 'gq' => _("Equatorial Guinea"), 'gr' => _("Greece"), 'gs' => _("South Georgia and the South Sandwich Islands"), 'gt' => _("Guatemala"), 'gu' => _("Guam"), 'gw' => _("Guinea-Bissau"), 'gy' => _("Guyana"), 'hk' => _("Hong Kong"), 'hm' => _("Heard Island and McDonald Islands"), 'hn' => _("Honduras"), 'hr' => _("Croatia"), 'ht' => _("Haiti"), 'hu' => _("Hungary"), 'id' => _("Indonesia"), 'ie' => _("Ireland"), 'il' => _("Israel"), 'im' => _("Isle of Man"), 'in' => _("India"), 'io' => _("British Indian Ocean Territory"), 'iq' => _("Iraq"), 'ir' => _("Iran, Islamic Republic of"), 'is' => _("Iceland"), 'it' => _("Italy"), 'je' => _("Jersey"), 'jm' => _("Jamaica"), 'jo' => _("Jordan"), 'jp' => _("Japan"), 'ke' => _("Kenya"), 'kg' => _("Kyrgyzstan"), 'kh' => _("Cambodia"), 'ki' => _("Kiribati"), 'km' => _("Comoros"), 'kn' => _("Saint Kitts and Nevis"), 'kp' => _("Korea, Democratic People's Republic of"), 'kr' => _("Korea, Republic of"), 'kw' => _("Kuwait"), 'ky' => _("Cayman Islands"), 'kz' => _("Kazakhstan"), 'la' => _("Lao People's Democratic Republic"), 'lb' => _("Lebanon"), 'lc' => _("Saint Lucia"), 'li' => _("Liechtenstein"), 'lk' => _("Sri Lanka"), 'lr' => _("Liberia"), 'ls' => _("Lesotho"), 'lt' => _("Lithuania"), 'lu' => _("Luxembourg"), 'lv' => _("Latvia"), 'ly' => _("Libyan Arab Jamahiriya"), 'ma' => _("Morocco"), 'mc' => _("Monaco"), 'md' => _("Moldova, Republic of"), 'mg' => _("Madagascar"), 'mh' => _("Marshall Islands"), 'mk' => _("Macedonia, The Former Yugoslav Republic of"), 'ml' => _("Mali"), 'mm' => _("Myanmar"), 'mn' => _("Mongolia"), 'mo' => _("Macao"), 'mp' => _("Northern Mariana Islands"), 'mq' => _("Martinique"), 'mr' => _("Mauritania"), 'ms' => _("Montserrat"), 'mt' => _("Malta"), 'mu' => _("Mauritius"), 'mv' => _("Maldives"), 'mw' => _("Malawi"), 'mx' => _("Mexico"), 'my' => _("Malaysia"), 'mz' => _("Mozambique"), 'na' => _("Namibia"), 'nc' => _("New Caledonia"), 'ne' => _("Niger"), 'nf' => _("Norfolk Island"), 'ng' => _("Nigeria"), 'ni' => _("Nicaragua"), 'nl' => _("Netherlands"), 'no' => _("Norway"), 'np' => _("Nepal"), 'nr' => _("Nauru"), 'nu' => _("Niue"), 'nz' => _("New Zealand"), 'om' => _("Oman"), 'pa' => _("Panama"), 'pe' => _("Peru"), 'pf' => _("French Polynesia"), 'pg' => _("Papua New Guinea"), 'ph' => _("Philippines"), 'pk' => _("Pakistan"), 'pl' => _("Poland"), 'pm' => _("Saint Pierre and Miquelon"), 'pn' => _("Pitcairn"), 'pr' => _("Puerto Rico"), 'ps' => _("Palestinian Territory, Occupied"), 'pt' => _("Portugal"), 'pw' => _("Palau"), 'py' => _("Paraguay"), 'qa' => _("Qatar"), 're' => _("Reunion"), 'ro' => _("Romania"), 'ru' => _("Russian Federation"), 'rw' => _("Rwanda"), 'sa' => _("Saudi Arabia"), 'sb' => _("Solomon Islands"), 'sc' => _("Seychelles"), 'sd' => _("Sudan"), 'se' => _("Sweden"), 'sg' => _("Singapore"), 'sh' => _("Saint Helena"), 'si' => _("Slovenia"), 'sj' => _("Svalbard and Jan Mayen"), 'sk' => _("Slovakia"), 'sl' => _("Sierra Leone"), 'sm' => _("San Marino"), 'sn' => _("Senegal"), 'so' => _("Somalia"), 'sr' => _("Suriname"), 'st' => _("Sao Tome and Principe"), 'sv' => _("El Salvador"), 'sy' => _("Syrian Arab Republic"), 'sz' => _("Swaziland"), 'tc' => _("Turks and Caicos Islands"), 'td' => _("Chad"), 'tf' => _("French Southern Territories"), 'tg' => _("Togo"), 'th' => _("Thailand"), 'tj' => _("Tajikistan"), 'tk' => _("Tokelau"), 'tm' => _("Turkmenistan"), 'tn' => _("Tunisia"), 'to' => _("Tonga"), 'tp' => _("Timor-Leste"), 'tr' => _("Turkey"), 'tt' => _("Trinidad and Tobago"), 'tv' => _("Tuvalu"), 'tw' => _("Taiwan"), 'tz' => _("Tanzania, United Republic of"), 'ua' => _("Ukraine"), 'ug' => _("Uganda"), 'uk' => _("United Kingdom"), 'um' => _("United States Minor Outlying Islands"), 'us' => _("United States"), 'uy' => _("Uruguay"), 'uz' => _("Uzbekistan"), 'va' => _("Holy See (Vatican City State)"), 'vc' => _("Saint Vincent and the Grenadines"), 've' => _("Venezuela"), 'vg' => _("Virgin Islands, British"), 'vi' => _("Virgin Islands, U.S."), 'vn' => _("Viet Nam"), 'vu' => _("Vanuatu"), 'wf' => _("Wallis and Futuna"), 'ws' => _("Samoa"), 'ye' => _("Yemen"), 'yt' => _("Mayotte"), 'yu' => _("Yugoslavia"), 'za' => _("South Africa"), 'zm' => _("Zambia"), 'zw' => _("Zimbabwe") ); From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:13 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_Cyrus Cyrus.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143310.7611F102C61@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_Cyrus In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_Cyrus Added Files: Cyrus.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Cyrus.php --- * Copyright 2002-2004 Richard Heyes * Copyright 2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Gernot Stocker * @author Richard Heyes * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Net_Cyrus */ class Net_Cyrus { /** * Hostname of server * @var string */ var $_host; /** * Port number of server * @var string */ var $_port; /** * Username used to connect * @var string */ var $_user; /** * Password used to connect * @var string */ var $_pass; /** * Initial mailbox * @var string */ var $_mbox; /** * Timeout for socket connect * @var integer */ var $_timeout; /** * Constructor. * * @param string $user Cyrus admin username * @param string $pass Cyrus admin password * @param string $host Server hostname * @param integer $port Server port number * @param integer $timeout Connection timeout value */ function Net_Cyrus($user, $pass, $host = 'localhost', $port = 143, $timeout = 5) { $this->_sock = &new Net_Socket(); $this->_user = $user; $this->_pass = $pass; $this->_host = $host; $this->_port = $port; $this->_mbox = ''; $this->_timeout = $timeout; $this->_lastError = ''; if (is_a($res = $this->connect(), 'PEAR_Error')) { $this->_lastError = $res; } } /** * Connects and logs into the server. Uses the Auth_SASL * library to produce the LOGIN command. * * @access private */ function connect() { if (is_a($err = $this->_sock->connect($this->_host, $this->_port, null, $this->_timeout), 'PEAR_Error')) { return $err; } // Read greeting line $this->_sock->readLine(); $sasl = &Auth_SASL::factory('Login'); $this->_sendCommand($sasl->getResponse($this->_user, $this->_pass)); } /** * Ends the session. Issues the LOGOUT command first. */ function disconnect() { $this->_sendCommand('LOGOUT'); $this->_sock->disconnect(); } /** * Sends a command to the server. * * @param string $command The command to send to the server * * @return array An array of the lines of the response * * @access private */ function _sendCommand($command) { static $imapSequence = 0; $imapSequence++; $response = array(); $this->_sock->writeLine($imapSequence . ' ' . $command); while ($line = $this->_sock->readLine()) { $response[] = $line; if (preg_match('/^' . $imapSequence . ' (OK|NO|BAD)/i', $line)) { break; } } if (preg_match('/^' . $imapSequence . ' (NO|BAD)/i', $line) && !preg_match('/^' . $imapSequence . ' NO QUOTA/i', $line)) { // Set message *without* imap sequence number return PEAR::raiseError(preg_replace('/^\d+\s+/', '', $line)); } return $response; } /** * Sets admin privileges on a folder/mailbox. * * @param string $mailbox Mailbox * * @return string Previous permissions for admin user on this mailbox. * * @access private */ function _setAdminPriv($mailbox) { $oldPrivs = $this->getACL($mailbox, $this->_user); $this->setACL($mailbox, $this->_user, 'lrswipcda'); return $oldPrivs; } /** * Removes admin privileges on a folder/mailbox * after the above function has been used. If the * ACLs passed in is null, then the privs are deleted. * * @param string $mailbox Mailbox * @param string $privs Previous privileges as returned * by the _setAdminPriv() method * * @access private */ function _resetAdminPriv($mailbox, $privs = null) { if (is_null($privs)) { $this->deleteACL($mailbox, $this->_user); } else { $this->setACL($mailbox, $this->_user, $privs); } } /** * Returns quota details. * * @param string $mailbox Mailbox to get quota info for. * * @return mixed Array of current usage and quota limit or * false on failure. */ function getQuota($mailbox) { $response = $this->_sendCommand(sprintf('GETQUOTA "%s"', $mailbox)); if (is_a($response, 'PEAR_Error')) { return $response; } if (preg_match('/NO QUOTA/i', $response[0])) { return array('NOT SET', 'NOT SET'); } else { if (preg_match('/\(STORAGE (\d+) (\d+)\)/', $response[0], $matches)) { return array($matches[1], $matches[2]); } else { return PEAR::raiseError('Invalid format for GETQUOTA response: ' . $response[0]); } } } /** * Sets a quota. * * @param string $mailbox Mailbox to get quota info for * @param integer $quota The quota to set * * @return mixed True on success, PEAR_Error otherwise */ function setQuota($mailbox, $quota) { $response = $this->_sendCommand(sprintf('SETQUOTA "%s" (STORAGE %d)', $mailbox, $quota)); if (is_a($response, 'PEAR_Error')) { return $response; } return true; } /** * Copies a quota from one mailbox to another. * * @param string $from Mailbox to copy quota from * @param string $to Mailbox to set quota on */ function copyQuota($from, $to) { $currentQuota = $this->getQuota($from); $oldQuotaMax = trim($currentQuota[1]); if ($oldQuotaMax != 'NOT-SET') { $this->setQuota($to, $oldQuotaMax); } } /** * Retrieves details of current ACL. * * @param string $mailbox Name of mailbox * @param string $user Optional user to get ACL for * * @return string Access stuff */ function getACL($mailbox, $user = null) { $return = array(); $response = $this->_sendCommand(sprintf('GETACL "%s"', $mailbox)); if (is_a($response, 'PEAR_Error')) { return $response; } // Check format if (preg_match('/^\* ACL ' . preg_quote($mailbox) . '/', $response[0])) { $response = preg_replace('/^\* ACL ' . preg_quote($mailbox) . '\s+/i', '', $response[0]); $acls = explode(' ', $response); // Check correct number in array (must be even) if (count($acls) % 2 == 0) { for ($i = 0; $i < count($acls); $i += 2) { $return[$acls[$i]] = $acls[$i + 1]; } if ($user && isset($return[$user])) { return $return[$user]; } else if ($user) { return null; } else { return $return; } } } return PEAR::raiseError('Unrecognised response format: ' . $response[0]); } /** * Sets ACL on a mailbox. * * @param string $mailbox Name of mailbox * @param string $user Username to apply ACL to * @param string $acl The ACL * * @return mixed True on success, PEAR_Error otherwise */ function setACL($mailbox, $user, $acl) { $response = $this->_sendCommand(sprintf('SETACL "%s" "%s" %s', $mailbox, $user, $acl)); return is_a($response, 'PEAR_Error') ? $response : true; } /** * Deletes ACL from a mailbox. * * @param string $mailbox Name of mailbox * @param string $user Username to remove ACL from * * @return mixed True on success, PEAR_Error otherwise */ function deleteACL($mailbox, $user) { return is_a($response = $this->_sendCommand(sprintf('DELETEACL "%s" "%s"', $mailbox, $user)), 'PEAR_Error') ? $response : true; } /** * Creates a mailbox. * * @param string $mailbox Name of mailbox to create * * @return mixed True on success, PEAR error otherwise */ function createMailbox($mailbox) { return is_a($response = $this->_sendCommand(sprintf('CREATE "%s"', $mailbox)), 'PEAR_Error') ? $response : true; } /** * Renames a mailbox. * * @param string $mailbox Name of mailbox to rename * @param string $newname New name of mailbox * * @return mixed True on success, PEAR error otherwise */ function renameMailbox($mailbox, $newname) { $oldPrivs = $this->_setAdminPriv($mailbox); $response = $this->_sendCommand(sprintf('RENAME "%s" "%s"', $mailbox, $newname)); $this->_resetAdminPriv($mailbox, $oldPrivs); return is_a($response, 'PEAR_Error') ? $response : true; } /** * Deletes a mailbox. * * @param string $mailbox Name of mailbox to delete * * @return mixed True on success, PEAR error otherwise */ function deleteMailbox($mailbox) { $oldPrivs = $this->_setAdminPriv($mailbox); $response = $this->_sendcommand(sprintf('DELETE "%s"', $mailbox)); $this->_resetAdminPriv($mailbox, $oldPrivs); return is_a($response, 'PEAR_Error') ? $response : true; } /** * Returns a list of folders for a particular user. * * @param string $prepend Optional string to prepend * * @return array Array of folders matched */ function getFolderList($prepend = 'user.*') { $folders = array(); $response = $this->_sendCommand(sprintf('LIST "" %s', $prepend)); if (is_a($response, 'PEAR_Error')) { return $response; } // Lose last line of response array_pop($response); foreach ($response as $value) { $parts = explode('"', $value); $folders[] = $parts[3]; } return $folders; } /** * Returns a list of users. * * @return array Array of users found */ function getUserList() { $users = array(); $response = $this->getFolderList('user.%'); if (is_a($response, 'PEAR_Error')) { return $response; } foreach ($response as $value) { if (preg_match('/^user\.(.*)$/', $value, $matches)) { $users[] = $matches[1]; } } return $users; } /** * Renames a user. This is here since the RENAME command * is not allowed on a user's INBOX (ie. the user. * mailbox). Supplied args can be either with or without * the "user." at the beginning. * * @param string $oldUser Name of user to rename * @param string $newUser New name of user */ function renameUser($oldUser, $newUser) { if (!preg_match('/^user\./', $oldUser)) { $oldUser = 'user.' . $oldUser; } if (!preg_match('/^user\./', $newUser)) { $newUser = 'user.' . $newUser; } list($oldUsername, $newUsername) = preg_replace('/^user\./', '', array($oldUser, $newUser)); // Check new user doesn't already exist and old user exists if (!in_array($oldUsername, $this->getUserList())) { return PEAR::raiseError(sprintf('User "%s" doesn\'t exist', $oldUsername)); } elseif (in_array($newUsername, $this->getUserList())) { return PEAR::raiseError(sprintf('User "%s" already exists', $newUsername)); } // Create the new mailbox $this->createMailbox($newUser); $oldAdminPrivs = $this->_setAdminPriv($newUser); // Copy Mail and quotas $this->copyMail($oldUser, $newUser); $this->copyQuota($oldUser, $newUser); // Copy the folders $folderList = $this->getFolderList($oldUser . '.*'); if (!empty($folderList)) { foreach ($folderList as $folder) { $newFolderName = str_replace($oldUser, $newUser, $folder); $this->renameMailbox($folder, $newFolderName); $this->setACL($newFolderName, $newUsername, 'lrswipcd'); $this->deleteACL($newFolderName, $oldUsername); } } $this->_resetAdminPriv($newUser, $oldAdminPrivs); $this->deleteMailbox($oldUser); } /** * Copies mail from one folder to another. * * @param string $from From mailbox name * @param string $to To mailbox name */ function copyMail($from, $to) { $oldFromPrivs = $this->_setAdminPriv($from); $oldToPrivs = $this->_setAdminPriv($to); $this->_sendCommand('SELECT ' . $from); $this->_sendCommand('COPY 1:* ' . $to); $this->_resetAdminPriv($from, $oldFromPrivs); $this->_resetAdminPriv($to, $oldToPrivs); } } --- NEW FILE: package.xml --- Net_Cyrus Cyrus administration API The Net_Cyrus:: class provides an API for the administration of Cyrus IMAP servers. LGPL yunosh lead Jan Schneider jan@horde.org chuck lead Chuck Hagenbuch chuck@horde.org 0.1 alpha 2004-01-11 Initial Release. From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:14 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMAP IMAP.php, NONE, 1.1 IMAPProtocol.php, NONE, 1.1 IMAPProtocol.php.optimized, NONE, 1.1 IMAPProtocol.php.orig, NONE, 1.1 IMAPProtocol.php.working, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143310.837F5102C64@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMAP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_IMAP Added Files: IMAP.php IMAPProtocol.php IMAPProtocol.php.optimized IMAPProtocol.php.orig IMAPProtocol.php.working package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: IMAP.php --- | // +----------------------------------------------------------------------+ [...1800 lines suppressed...] } function getListing($msg_id = null) { return $this->getMessagesList($msg_id); } function deleteMsg($msg_id){ return $this->deleteMessages($msg_id); } } ?> --- NEW FILE: IMAPProtocol.php --- | // +----------------------------------------------------------------------+ require_once 'Net/Socket.php'; [...2990 lines suppressed...] $base64_part = ''; } else { $base64_part = sprintf("%s%s", $base64_part , $str[$i] ); } } else { if ($str[$i] == '&') { $base64_part = '&'; } else { $decoded_utf7 = sprintf("%s%s", $decoded_utf7 , $str[$i] ); } } } return $decoded_utf7; } }//Class ?> --- NEW FILE: IMAPProtocol.php.optimized --- | // +----------------------------------------------------------------------+ require_once 'Net/Socket.php'; [...3003 lines suppressed...] $base64_part = ''; } else { $base64_part = sprintf("%s%s", $base64_part , $str[$i] ); } } else { if ($str[$i] == '&') { $base64_part = '&'; } else { $decoded_utf7 = sprintf("%s%s", $decoded_utf7 , $str[$i] ); } } } return $decoded_utf7; } }//Class ?> --- NEW FILE: IMAPProtocol.php.orig --- | // +----------------------------------------------------------------------+ require_once 'Net/Socket.php'; [...2990 lines suppressed...] $base64_part = ''; } else { $base64_part = sprintf("%s%s", $base64_part , $str[$i] ); } } else { if ($str[$i] == '&') { $base64_part = '&'; } else { $decoded_utf7 = sprintf("%s%s", $decoded_utf7 , $str[$i] ); } } } return $decoded_utf7; } }//Class ?> --- NEW FILE: IMAPProtocol.php.working --- | // +----------------------------------------------------------------------+ require_once 'Net/Socket.php'; [...3015 lines suppressed...] $base64_part = ''; } else { $base64_part = sprintf("%s%s", $base64_part , $str[$i] ); } } else { if ($str[$i] == '&') { $base64_part = '&'; } else { $decoded_utf7 = sprintf("%s%s", $decoded_utf7 , $str[$i] ); } } } return $decoded_utf7; } }//Class ?> --- NEW FILE: package.xml --- Net_IMAP Provides an implementation of the IMAP protocol Provides an implementation of the IMAP4Rev1 protocol using PEAR's Net_Socket and the optional Auth_SASL class. damian Damian Alejandro Fernandez Sosa damlists@cnba.uba.ar lead 1.0.2 2004-08-04 PHP License stable * Fixed bug #1772 * Fixed bug #2028 * Changed getStorageQuota, getMessagesQuota,getACL defautting mailbox_name to current selected mailbox Net_Socket 1.0.1 2004-05-22 stable * Fixed bug #1568 1.0.0 2004-05-22 stable * The package is marked as stable * Fixed bug #1280 * Fixed a bug returning " , " when the password is not correct 0.7.1 2004-02-12 beta * The parser was modified to parse any BODY[XXXXXX] response (not supported spaces in XXXXX yet) thanks to Richard Heyes for the tip 0.7 2004-02-02 beta - Fixed bug in mailboxExist - Fixed bug #55 0.6 2003-07-20 beta - Fixed bugs 24706 and 24707 - Fixed method listsubscribedMailboxes() and now works like getMailboxes() - added hasFlag() method to allow th check any flag the IMAP server has - Modified isDeleted,isDraft,isAnswered,isFlagged,isSeen methods to use hasFlag to not duplicate the code - Removed duplicated method getHierarchyDelimiter() i have the same method in IMAP.php and IMAPProtocol.php but in one class it is called getHierachyDelimiter and in the other getHierarchyDelimiter() (missed 'r' ) - Removed $_hierachyDelimiter variable (not needed anymore) - Fixed cmdSetQuotaRoot now it can set both quotas storage and messages - Reduced the class size by 10kbytes (IMAPProtocol.php) - moved all redundant code to _genericCommand. - Removed cmdUid() we don't need it anymore. 0.5.1 2003-07-14 beta - Fix warning in login() where the imap server does not have any Auth method suported 0.5 2003-07-12 beta - new getHierachyDelimiter() method to find the character used to separate subfolder parts (cyrus uses '.' , wu-imapd uses '/') - added a 3rd parameter to getMailboxes() to return an array with mailboxnames and mailbox attributes instead of an array of names - new method getACLRights() to list the Rights any user has over a mailbox without been administrator (this is relative to the user's INBOX) 0.4 2003-04-27 beta - new search() method - new support for Message quotas (quotas for quantity of messages and not size) - new getNumberOfRecentMessages() method - new getNumberOfUnSeenMessages() method - new getEnvelope() method - new getSummary() method - new Subscription related methods: unsubscribeMailbox(),listsubscribedMailboxes(),subscribeMailbox() - updated Examples of use - tested with Ipswitch Imail 6.06 IMAP Server - tested with Cyrus Imapd 2.0.17 IMAP Server - tested with uw-imapd IMAP Server - minor fixes in protocol parser - fix the parsing of rfc email in _getAddressList() - changed appendMessage() to make the mailbox parameter optional - changed copyMessages() method (the messages list can be now an array) - workarround about getMailboxes() to allow work with wu-imapd - getSummary(), getMessages(),deleteMessages() can accept an array of numbers as msg_id to retrieve/delete msg_id that are in the array (designed to use the search() output as parammeter. For example: to delete all seen messages in current mailbox you can do: $imap->DeleteMessages($imap->search("SEEN")); 0.3 2003-03-05 beta - Fixed a lot of warnings and uninitialized variables(hope all of them) - new getSummary method - updated Examples of use - tested with Ipswitch Imail 6.06 IMAP Server - tested with Cyrus Imapd 2.0.17 IMAP Server - tested with uw-imapd IMAP Server - minor fixes in protocol parser - changed appendMessage() to make the mailbox parameter optional - added Subscription related methods: unsubscribeMailbox(),listsubscribedMailboxes(),subscribeMailbox() - workarround about getMailboxes() to allow work with wu-imapd - new search() method - added support for Message quotas (quotas for quantity of messages and not size) - getSummary(), getMessages(),deleteMessages() can accept an array of numbers as msg_id to retrieve/delete msg_id that are in the array (designed to use the search() output as parammeter. For example: to delete all seen messages in current mailbox you can do: $imap->getDeleteMessages($imap->search("SEEN")); 0.2 2003-02-22 beta - Ups I call require_once ./IMAPProtocol.php instead of require_once Net/IMAPProtocol.php sorry - login method can authenticate with the following methods: DIGEST-MD4, CRAM-MD5, LOGIN and the login command - A lot of new mailbox-related functions - 2 Examples of use to the test directory - fixes in protocol parser 0.1 2003-02-22 beta - The IMAP Procotol generic parser is now implemented. - Implemmented RFC2195 - Implemmented RFC2060 From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:16 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMAP/docs test_IMAP.php, NONE, 1.1 test_IMAPProtocol.php, NONE, 1.1 Message-ID: <20051014143310.9D72C102C66@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMAP/docs In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_IMAP/docs Added Files: test_IMAP.php test_IMAPProtocol.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: test_IMAP.php --- | // +----------------------------------------------------------------------+ /* This sample shows the use of the IMAP methods this is only useful for testing and to high level IMAP access example use */ include_once('Net/IMAP.php'); error_reporting(E_ALL); $user="user"; $passwd="password"; $host="localhost"; $port="143"; //you can create a file called passwords.php and store your $user,$pass,$host and $port values in it // or you can modify this script @require_once("../passwords.php"); $imap= new Net_IMAP($host,$port); //The the Protocol debug feature //$imap->setDebug(); //$imap->setUnparsedResponse(true); //print_r($imap->cmdCapability()); // Login to the IMAP Server Using plain passwords ($authMethod=false) // $authMethod can be true (dafault) , false or a string /*$authMethod=false; if ( PEAR::isError( $ret = $imap->login( $user , $passwd , $authMethod ) ) ) { echo "Unable to login! reason:" . $ret->getMessage() . "\n"; exit(); } */ if ( PEAR::isError( $ret = $imap->login( $user , $passwd ) ) ) { echo "Unable to login! reason:" . $ret->getMessage() . "\n"; exit(); } /********************* *** Let's show the Mailbox related methods *** *********************/ $imap->selectMailbox('inbox'); //$mailboxes=$imap->getMailboxes(''); $mailboxes=$imap->getMailboxes('inbox.INBOX2',2); $mailboxes=$imap->getMailboxes('inbox'); //$mailboxes=$imap->listsubscribedMailboxes('inbox'); echo "Here is the list of all mailboxes:\n\n"; prettyMailboxList($imap,$mailboxes); $mailboxes=$imap->listsubscribedMailboxes('inbox'); echo "Here is the list of all mailboxes you are subscribed:\n\n"; prettyMailboxList($imap,$mailboxes); //$mailboxes=0; //echo "PITERROR|" . print_r( $imap->_socket->eof()) . "|\n"; //echo $imap->getDebugDialog(); //exit(); $folder_delim=$imap->getHierarchyDelimiter(); echo "Folder Delim:|$folder_delim|\n"; $mailbox='INBOX'.$folder_delim .'INBOX2'; echo "Getting the summary of message 1\n"; $aa=$imap->getSummary(1); //print_r($aa); $aaa=$imap->examineMailbox("inbox"); //print_r($aaa); echo "creating mailbox $mailbox ...."; if( ! $ret = $imap->createMailbox($mailbox) ){ echo "\nCan't create the mailbox '$mailbox' because " . $ret->getMessage() . "\n"; } else{ echo "OK!\n"; } echo "\n\n\n+-----------------------------------------------------------------------------+\n"; //$mailbox='INBOX.INBOX2'; //print_r($imap->cmdList("","*")); //$mailbox='INBOX'.$folder_delim .'INBOX2'; if( $imap->mailboxExist($mailbox) ){ echo "The mailbox $mailbox exists\n"; }else{ echo "The mailbox $mailbox don't exists!\n"; } $email="From: \r\n"; $email.="To: \r\n"; $email.="Subject: Test\r\n"; $email.="\r\n"; $email.="\r\n"; $email.="test\r\n"; echo "APPEND\n"; //$imap->cmdAppend("inbox",$email); $mailbox='inbox'; echo "Now lets check the flags of messages in $mailbox\n"; if ( !PEAR::isError( $num_messages = $imap->getNumberOfMessages( $mailbox ) ) ){ for($i=1; $i<=$num_messages;$i++) { print_r($imap->getFlags($i)); //echo "AAAA\n"; /* if ($imap->isSeen($i)) { echo "message $i has been read before...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } if ($imap->isFlagged($i)) { echo "message $i has been Flagged...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } if ($imap->isDeleted($i)) { echo "message $i is marked as Deleted...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } */ } }else{ echo "Or $mailbox has no messages or there was an error!\n"; } $imap->selectMailbox('inbox'); $nummsg = $imap->getNumberOfMessages(); for($i=1; $i<=$nummsg;$i++) { if ($imap->isSeen($i)) { echo "message $i has been read before...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } if ($imap->isFlagged($i)) { echo "message $i has been Flagged...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } if ($imap->isDeleted($i)) { echo "message $i is marked as Deleted...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } } /* echo "renaming mailbox INBOX2 to INBOX3 :
\n"; $imap->renameMailbox('INBOX2', 'INBOX3'); echo "deleting mailbox INBOX3 :
\n"; $imap->deleteMailbox('INBOX3'); //echo 'deleting msg 1 :
\n'; //$imap->delete(1); echo "creating mailbox TESTING :
\n"; $imap->createMailbox('TESTING'); echo "copying msg 1 INBOX to TESTING :
\n"; $imap->copyMessages(1, 'TESTING'); */ // Get the raw headers of message 1 echo "

getRawHeaders()

\n"; echo "
" . htmlspecialchars($imap->getRawHeaders(1)) . "
\n"; //* Get structured headers of message 1 echo "

getParsedHeaders()

\n";
print_r($imap->getParsedHeaders(1));
echo "
\n"; //* Get body of message 1 echo "

getBody()

\n"; echo "
" . htmlspecialchars($imap->getBody(1)) . "
\n"; //* Get number of messages in maildrop echo "

getNumMsg

\n"; echo "
" . $imap->numMsg('') . "
\n"; //* Get entire message echo "

getMsg()

\n"; if(!PEAR::isError($msg=$imap->getMsg(1))){ print_r($msg); echo '
' . htmlspecialchars($msg) . '
\n'; } //* Get listing details of the maildrop echo "

getListing()

\n"; echo "
\n";
print_r($imap->getListing());
echo "
\n"; //* Get size of maildrop echo "

getSize()

\n"; echo "
" . $imap->getSize() . "
\n"; //* Delete a msg //echo '

delete()

\n'; // Use with CARE!!! //echo '
' . $imap->deleteMsg(1) . '
\n'; $mailbox="inbox"; $imap->selectMailbox($mailbox); $nummsg=$imap->numMsg(); echo "You have $nummsg in $mailbox folder\n"; //echo "See header in message number 1: " . $imap->top(1) . '
'; echo "See header in message number 1: " . htmlspecialchars($imap->getRawHeaders(1)) . '
\n'; if(!PEAR::isError($msg=$imap->getMsg(1))){ print_r($msg); echo "Read message number 1: " . htmlspecialchars($msg) . '
\n'; } for($i=1; $i<=$nummsg;$i++) { if ($imap->isSeen($i)) { echo "message $i has been read before...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } if ($imap->isFlagged($i)) { echo "message $i has been Flagged...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } if ($imap->isDeleted($i)) { echo "message $i is marked as Deleted...
\n"; //$msg = $imap->getMsg($i); #echo $msg; } } //print_r($imap->getMailboxes('')); echo "creating mailbox INBOX2 :
\n"; $imap->createMailbox('INBOX2'); echo "renaming mailbox INBOX2 to INBOX3 :
\n"; $imap->renameMailbox('INBOX2', 'INBOX3'); echo "deleting mailbox INBOX3 :
\n"; $imap->deleteMailbox('INBOX3'); //echo 'deleting msg 1 :
\n'; //$imap->delete(1); echo "creating mailbox TESTING :
\n"; $imap->createMailbox('TESTING'); echo "copying msg 1 INBOX to TESTING :
\n"; $imap->copyMessages('TESTING', 1); //* Disconnect $imap->disconnect(); function prettyMailboxList($imap,$mailboxes){ if( count($mailboxes) > 0 ){ echo "You have " . count($mailboxes) . " Mailboxes\n\n"; echo "+-----------------------------------------------------------------------------+\n"; echo "|Mailbox | Mbox Size | Cant Mesages|\n"; echo "+-----------------------------------------------------------------------------+\n"; foreach($mailboxes as $mailbox){ if ( PEAR::isError( $mbox_size =$imap->getMailboxSize( $mailbox ) ) ){ //echo "Unable to retr msg size" . $mbox_size->getMessage() . "|\n"; $mbox_size="[ERROR]"; } //print_r($mbox_size); if ( PEAR::isError( $num_messages = $imap->getNumberOfMessages( $mailbox ) ) ){ //echo "Unable to rert msg" . $num_messages->getMessage() . "|\n"; $num_messages="[ERROR]"; } echo "|"; echo $mailbox; // Align the output for($i=strlen($mailbox) ; $i< 50 ; $i++) echo ' '; echo "|"; // Align the output for($i=strlen($mbox_size) ; $i< 12 ; $i++) echo ' '; echo $mbox_size; echo "|"; // Align the output //print_r($num_messages); for($i=strlen($num_messages) ; $i< 13 ; $i++) echo ' '; echo $num_messages; echo "|"; echo "\n"; } echo "+-----------------------------------------------------------------------------+\n"; }else{ echo "Warning!:\n You have any mailboxes!!\n"; } } ?> --- NEW FILE: test_IMAPProtocol.php --- | // +----------------------------------------------------------------------+ /* This sample shows the parsed returning of the IMAPProtocol methods this is only useful for testing and to low level IMAP access example */ require_once('Net/IMAPProtocol.php'); error_reporting(E_ALL); $user="user"; $passwd="password"; $host="localhost"; $port="143"; //you can create a file called passwords.php and store your $user,$pass,$host and $port values in it // or you can modify this script @require_once("../passwords.php"); $a= new Net_IMAPProtocol(); $a->setDebug(true); //$a->setUnparsedResponse(true); //$a->setUnparsedResponse(false); $aaa=$a->cmdConnect($host,$port); //Choose your auth method... //$aaa=$a->cmdAuthenticate($user,$passwd); //$aaa=$a->cmdAuthenticate($user,$passwd, "CRAM-MD5"); $aaa=$a->cmdLogin($user,$passwd); //$aaa=$a->login($user,$passwd); //$aaa=$a->cmdSelect("user.damian"); $aaa=$a->cmdSelect("inbox"); $str="inbox.pete"; //$str="inbox.inbox3aaa &4eE-"; //$str="inbox.&AOEA4QDh-"; echo "Method cmdCreate()\n"; print_r($aaa=$a->cmdCreate($str)); echo "Method cmdList()\n"; print_r($aaa=$a->cmdList("","*")); //Returns the Auth Methods the IMAP server Has //print_r($aaa=$a->getServerAuthMethods()); //print_r($aaa=$a->cmdFetch("4","(BODY[1.1])")); //print_r($aaa=$a->cmdFetch("4","(BODY[1])")); print_r($aaa=$a->cmdFetch("4","(RFC822.TEXT)")); print_r($aaa=$a->cmdFetch("1","(BODY[HEADER] BODY[TEXT])")); print_r($aaa=$a->cmdFetch("1","BODY[HEADER]")); print_r($aaa=$a->cmdFetch("15","FULL")); print_r($aaa=$a->cmdFetch("1:3","(FLAGS RFC822.SIZE UID ENVELOPE INTERNALDATE)")); //print_r($aaa=$a->cmdFetch("1:3","(FLAGS RFC822.SIZE UID INTERNALDATE)")); //$aaa=$a->cmdFetch("1","(FLAGS RFC822.SIZE UID ENVELOPE INTERNALDATE)"); //print_r($aaa=$a->cmdFetch("1","(FLAGS RFC822.SIZE UID INTERNALDATE)")); //$aaa=$a->cmdFetch("1:3","BODY[HEADER.FIELDS (References)]"); //$aaa=$a->cmdFetch("1","(UID RFC822.SIZE)"); //$aaa=$a->cmdFetch("1:10","RFC822.SIZE"); //$aaa=$a->cmdFetch("1:10","INTERNALDATE"); //$aaa=$a->cmdFetch("2:6","BODY[TEXT]"); //$aaa=$a->cmdFetch("1:3","(FLAGS)"); //$aaa=$a->cmdFetch("26:32","BODY"); //$aaa=$a->cmdFetch("26:29","BODY"); //$aaa=$a->cmdFetch("1","RFC822"); $aaa=$a->cmdFetch("28","BODY"); //$aaa=$a->cmdFetch("1","BODYSTRUCTURE"); //$aaa=$a->cmdFetch("27","BODYSTRUCTURE"); //$aaa=$a->cmdFetch("1:100","BODYSTRUCTURE"); $aaa=$a->cmdFetch("2:10","(RFC822.SIZE FLAGS INTERNALDATE)"); //$aaa=$a->cmdFetch("1:10","INTERNALDATE"); $aaa=$a->cmdFetch("1","ENVELOPE"); $aaa=$a->cmdFetch("10,9:16","FLAGS"); //$aaa=$a->cmdFetch("10","BODY[TEXT]"); //$aaa=$a->cmdFetch("10","RFC822.HEADER"); //$aaa=$a->cmdFetch("10","RFC822.TEXT"); //$aaa=$a->cmdFetch("10","BODYSTRUCTURE"); //$aaa=$a->cmdFetch("10","RFC822.HEADER"); $aaa=$a->cmdFetch("1:4","(BODY[HEADER] FLAGS RFC822.SIZE INTERNALDATE)"); //$aaa=$a->cmdFetch("1:4","(FLAGS RFC822.SIZE INTERNALDATE)"); //$aaa=$a->cmdFetch("10","BODY[1]"); //$aaa=$a->cmdFetch("1","RFC822.SIZE"); //$aaa=$a->cmdFetch("10","ENVELOPE"); //$aaa=$a->cmdFetch("10","RFC822"); //$aaa=$a->cmdFetch("10","ENVELOPE"); //$aaa=$a->cmdFetch("1:30","(RFC822.SIZE FLAGS)"); //$aaa=$a->cmdFetch("1:30","FLAGS"); //print_r($aaa=$a->cmdFetch(32,"FLAGS")); //print_r($aaa=$a->cmdFetch("1:3","(FLAGS RFC822.SIZE UID ENVELOPE INTERNALDATE)")); //print_r($aaa=$a->cmdFetch("1","(FLAGS RFC822.SIZE UID ENVELOPE INTERNALDATE)")); //print_r($aaa=$a->cmdFetch("10","ENVELOPE")); //print_r($aaa=$a->cmdFetch("10","FLAGS")); //$aaa=$a->cmdUidFetch("1","FLAGS"); //print_r($aaa=$a->cmdCapability()); //print_r($aaa=$a->cmdStore("1:2","+FLAGS","\Deleted")); echo "Method cmdCheck()\n"; print_r($aaa=$a->cmdCheck()); //print_r($aaa=$a->cmdClose()); echo "Method cmdNoop()\n"; print_r($aaa=$a->cmdNoop()); echo "Method cmdRename()\n"; print_r($aaa=$a->cmdRename("inbox.test2","inbox.test3")); echo "Method cmdSubscribe()\n"; print_r($aaa=$a->cmdSubscribe("inbox.test1")); echo "Method cmdStatus()\n"; print_r($aaa=$a->cmdStatus("inbox","MESSAGES UNSEEN")); echo "Method cmdUnsubscribe()\n"; print_r($aaa=$a->cmdUnsubscribe("inbox.test1")); echo "Method cmdList()\n"; print_r($aaa=$a->cmdList("","*")); echo "Method cmdLsub()\n"; print_r($aaa=$a->cmdLsub("*","*")); echo "Method cmdSearch()\n"; print_r($aaa=$a->cmdSearch("ALL")); echo "Method cmdUidSearch()\n"; print_r($aaa=$a->cmdUidSearch("ALL")); echo "Method cmdCopy()\n"; print_r($aaa=$a->cmdCopy("1","inbox.test1")); echo "Method cmdGetQuota()\n"; print_r($aaa=$a->cmdGetQuota("user.montoto")); echo "Method cmdMyRights()\n"; print_r($aaa=$a->cmdMyRights("inbox")); echo "Method cmdListRights()\n"; print_r($aaa=$a->cmdListRights("inbox","montoto")); echo "Method cmdGetACL()\n"; print_r($aaa=$a->cmdGetACL("user.montoto")); echo "Method cmdSetQuota()\n"; print_r($aaa=$a->cmdSetQuota("user.montoto","500000")); echo "Method cmdCheck()\n"; print_r($aaa=$a->cmdCheck()); echo "Method cmdCreate()\n"; print_r($aaa=$a->cmdCreate("inbox.inbox3")); echo "Method cmdStatus()\n"; print_r($a->cmdStatus("inbox","MESSAGES UNSEEN")); print_r($a->_serverSupportedCapabilities); echo "Method cmdExamine()\n"; print_r($aaa=$a->cmdExamine("inbox")); echo "Method cmdStore()\n"; print_r($aaa=$a->cmdStore("1:2","+FLAGS","\Deleted")); echo "Method cmdExpunge()\n"; print_r($a->cmdExpunge()); echo "Check if the server has ANNOTATEMORE Support\n"; if( $a->hasAnnotateMoreSupport() ){ echo "Yes the server has ANNOTATEMORE Support\n"; //print_r( $a->cmdGetAnnotation("inbox" , array("test"), "algo") ); print_r( $a->cmdSetAnnotation("INBOX" , "/comment",array("value.priv"=>"My comment" ) ) ); print_r( $a->cmdGetAnnotation("INBOX" , "/comment","value.priv" ) ); } else{ echo "The server has NOT ANNOTATEMORE Support\n"; } //print_r($aaa); $aaa=$a->cmdLogout(); //print_r($aaa); ?> From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:18 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP/Auth cram_md5.php, NONE, 1.1 plaintext.php, NONE, 1.1 Message-ID: <20051014143311.02060102C6A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP/Auth In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP/Auth Added Files: cram_md5.php plaintext.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: cram_md5.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @version $Revision 1.5 $ * @author Michael Rubinsky * @package Net_IMSP */ class Net_IMSP_Auth_cram_md5 extends Net_IMSP_Auth { /** * Private authentication function. Provides actual * authentication code. * * @access private * @param mixed $params Hash of IMSP parameters. * @return mixed Net_IMSP object connected to server if successful, * PEAR_Error on failure. */ function &_authenticate($params) { $imsp = &Net_IMSP::singleton('none',$params); $result = $imsp->init(); if (is_a($result, 'PEAR_Error')) { return $result; } $userId = $params['username']; $credentials = $params['password']; $result = $imsp->imspSend('AUTHENTICATE CRAM-MD5'); if (is_a($result, 'PEAR_Error')) { return $result; } // Get response and decode it. Note that we remove the 1st 2 // characters from the response to get rid of the '+' // continuation character and the space that is sent as part // of the CRAM-MD5 response (at least on cyrus-imspd). $server_response = $imsp->imspReceive(); if (is_a($server_response, 'PEAR_Error')) { return $server_response; } $server_response = base64_decode(trim(substr($server_response, 2))); // Build and base64 encode the response to the challange. $response_to_send = $userId . ' ' . $this->_hmac($credentials, $server_response); $command_string = base64_encode($response_to_send); // Send the response. $result = $imsp->imspSend($command_string, false); if (is_a($result, 'PEAR_Error')) { return $result; } // See if we are OK. $result = $imsp->imspReceive(); if (is_a($result, 'PEAR_Error')) { return $result; } if ($result != 'OK') { return $imsp->imspError(IMSP_EXIT_LOGIN_FAILED,__FILE__,__LINE__); } else { return $imsp; } } /** * RFC 2104 HMAC implementation. Eliminates the reliance on mhash. * * @access private * @param string $key The HMAC key. * @param string $data The data to hash with the key. * @return string The MD5 HMAC. */ function _hmac($key, $data) { // Byte length for md5. $b = 64; if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } --- NEW FILE: plaintext.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @version $Revision: 1.1 $ * @author Michael Rubinsky * @package Net_IMSP */ class Net_IMSP_Auth_plaintext extends Net_IMSP_Auth { /** * Private authentication function. Provides actual * authentication code. * * @access private * @param mixed $params Hash of IMSP parameters. * @return mixed Net_IMSP object connected to server if successful, * PEAR_Error on failure. */ function &_authenticate($params) { $imsp = &Net_IMSP::singleton('none',$params); $result = $imsp->init(); if (is_a($result, 'PEAR_Error')) { return $result; } $userId = $params['username']; $credentials = $params['password']; // Start the command. $result = $imsp->imspSend('LOGIN ', true, false); if (is_a($result, 'PEAR_Error')) { return $result; } // Username as a {}? if (preg_match(IMSP_MUST_USE_LITERAL, $userId)) { $biUser = sprintf('{%d}', strlen($userId)); $result = $imsp->imspSend($biUser, false, true); if (is_a($result, 'PEAR_Error')) { return $result; } if (!preg_match(IMSP_COMMAND_CONTINUATION_RESPONSE, $imsp->imspReceive())) { return $imsp->imspError(IMSP_NO_CONTINUATION_RESPONSE, __FILE__,__LINE__); } } $result = $imsp->imspSend($userId . ' ', false, false); if (is_a($result, 'PEAR_Error')) { return $result; } //Don't want to log the password! $logValue = $imsp->logEnabled; $imsp->logEnabled = false; // Pass as {}? if (preg_match(IMSP_MUST_USE_LITERAL, $credentials)) { $biPass = sprintf('{%d}', strlen($credentials)); $result = $imsp->imspSend($biPass, false, true); if (is_a($result, 'PEAR_Error')) { return $result; } if (!preg_match(IMSP_COMMAND_CONTINUATION_RESPONSE, $imsp->imspReceive())) { return $imsp->imspError(IMSP_NO_CONTINUATION_RESPONSE, __FILE__,__LINE__); } } $result = $imsp->imspSend($credentials, false, true); if (is_a($result, 'PEAR_Error')) { return $result; } // Restore the logging boolean. $imsp->logEnabled = $logValue; $server_response = $imsp->imspReceive(); if (is_a($server_response, 'PEAR_Error')) { return $server_response; } if ($server_response != 'OK') { return $imsp->imspError(IMSP_EXIT_LOGIN_FAILED,__FILE__,__LINE__); } return $imsp; } } From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:21 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP Auth.php, NONE, 1.1 Book.php, NONE, 1.1 Options.php, NONE, 1.1 Utils.php, NONE, 1.1 Message-ID: <20051014143310.C0F6C102C0B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_IMSP/IMSP Added Files: Auth.php Book.php Options.php Utils.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Auth.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @version $Revision 1.5 $ * @author Michael Rubinsky * @package Net_IMSP */ class Net_IMSP_Auth { /** * Attempts to login to IMSP server. * * @access public * @param array $params Parameters for Net_IMSP * @param boolean $login Should we remain logged in after auth? * @return mixed Returns a Net_IMSP object connected to * the IMSP server if login is true and * successful. Returns boolean true if * successful and login is false. Returns * PEAR_Error on failure. */ function &authenticate($params, $login = true) { $_imsp = &$this->_authenticate($params); if (is_a($_imsp, 'PEAR_Error')) { return $_imsp; } if (!$login) { $_imsp->logout(); return true; } return $_imsp; } /** * Private authentication function. Provides actual authentication * code. * * @abstract * @access private * @param array $params Parameters for Net_IMSP_Auth driver. * @return mixed Returns Net_IMSP object connected to server * if successful, PEAR_Error on failure. */ function &_authenticate($params) { } /** * Attempts to return a concrete Net_IMSP_Auth instance based on $driver * Must be called as &Net_IMSP_Auth::factory() * * @access public * @param string $driver Type of Net_IMSP_Auth subclass to return. * @return mixed The created Net_IMSP_Auth subclass or PEAR_Error. */ function &factory($driver) { $driver = basename($driver); if (empty($driver) || (strcmp($driver, 'none') == 0)) { return $ret = &new IMSP_Auth(); } if (file_exists(dirname(__FILE__) . '/Auth/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Auth/' . $driver . '.php'; } $class = 'Net_IMSP_Auth_' . $driver; if (class_exists($class)) { return $ret = &new $class(); } else { Horde::fatal(PEAR::raiseError(sprintf(_("Unable to load the definition of %s."), $class)), __FILE__, __LINE__); } } /** * Attempts to return a concrete Net_IMSP_Auth instance based on $driver. * Will only create a new object if one with the same parameters already * does not exist. * Must be called like: $var = &Net_IMSP_Auth::singleton('driver_type'); * * @param string $driver Type of IMSP_Auth subclass to return. * @return object Reference to IMSP_Auth subclass. */ function &singleton($driver) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver)); if (!isset($instances[$signature])) { $instances[$signature] = &Net_IMSP_Auth::factory($driver); } return $instances[$signature]; } } --- NEW FILE: Book.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @version $Revision: 1.1 $ * @author Michael Rubinsky * @package Net_IMSP */ class Net_IMSP_Options { var $_imsp; var $user = ''; var $pass = ''; var $auth_method = ''; var $server = ''; var $port = ''; var $params; /** * Constructor function. * * @access public * @param array $params Hash containing IMSP parameters. */ function Net_IMSP_Options($params) { $this->params = $params; } /** * Initialization function to be called after object is returned. * This allows errors to occur and not break the script. * * @access public * @return mixed True on success PEAR_Error on failure. */ function init() { if (!isset($this->_imsp)) { $auth = &Net_IMSP_Auth::singleton($this->params['auth_method']); $this->_imsp = $auth->authenticate($this->params); } if (is_a($this->_imsp, 'PEAR_Error')) { return $this->_imsp; } $this->_imsp->writeToLog('Net_IMSP_Options initialized.', __FILE__, __LINE__, PEAR_LOG_DEBUG); return true; } /** * Function sends a GET command to IMSP server and retrieves values. * * @access public * @param string $optionName Name of option to retrieve. Accepts '*' * as wild card. * @return mixed Associative array containing option=>value pairs or * PEAR_Error. */ function get($optionName) { $options = array(); $result = $this->_imsp->imspSend("GET $optionName", true, true); if (is_a($result, 'PEAR_Error')) { return $result; } $server_response = $this->_imsp->imspReceive(); if (is_a($server_response, 'PEAR_Error')) { return $server_response; } while (preg_match(IMSP_GETOPTION_RESPONSE,$server_response)){ /* First, check for a {}. */ if (preg_match(IMSP_OCTET_COUNT, $server_response, $tempArray)){ $temp = split(' ', $server_response); $options[$temp[2]] = $this->_imsp->receiveStringLiteral($tempArray[2]); $this->_imsp->imspReceive(); // [READ WRITE] } else { $temp = split(' ', $server_response); $options[$temp[2]] = trim($temp[3]); $i = 3; $lastChar = ""; $nextElement = trim($temp[3]); // Was the value quoted and spaced? if ((substr($nextElement,0,1) == '"') && (substr($nextElement,strlen($nextElement)-1,1) != '"')) { do { $nextElement = $temp[$i+1]; $lastChar = substr($nextElement, strlen($nextElement)-1,1); $options[$temp[2]] .= ' ' . $nextElement; if ($lastChar == '"') { $done = true; } else { $done = false; $lastChar = substr($temp[$i+2], strlen($temp[$i+2])-1,1); $i++; } } while ($lastChar != '"'); if (!$done) { $nextElement = $temp[$i+1]; $options[$temp[2]] .= ' ' . $nextElement; } } } $server_response = $this->_imsp->imspReceive(); if (is_a($server_response, 'PEAR_Error')){ return $server_response; } } if ($server_response != 'OK') { return $this->_imsp->imspError(IMSP_UNEXPECTED_RESPONSE, __FILE__,__LINE__); } $this->_imsp->writeToLog('GET command OK.', '', '', PEAR_LOG_DEBUG); return $options; } /** * Function sets an option value on the IMSP server. * * @access public * @param string $optionName Name of option to set. * @param string $optionValue Value to assign. * @return mixed True or PEAR_Error. */ function set($optionName, $optionValue) { // Send the beginning of the command. $result = $this->_imsp->imspSend("SET $optionName ", true, false); // Send $optionValue as a literal {}? if (preg_match(IMSP_MUST_USE_LITERAL, $optionValue)) { $biValue = sprintf("{%d}",strlen($optionValue)); $result = $this->_imsp->imspSend($biValue,false,true); if (is_a($result, 'PEAR_Error')) { return $result; } if (!preg_match(IMSP_COMMAND_CONTINUATION_RESPONSE, $this->_imsp->imspReceive())) { return $this->_imsp->imspError(IMSP_NO_CONTINUATION_RESPONSE, __FILE__,__LINE__); } } // Now send the rest of the command. $result = $this->_imsp->imspSend($optionValue, false, true); if (is_a($result, 'PEAR_Error')) { return $result; } $server_response = $this->_imsp->imspReceive(); if (is_a($server_response, 'PEAR_Error')) { return $server_response; } elseif ($server_response != 'OK') { return $this->_imsp->imspError('The option could not be set on the IMSP server.',__FILE__, __LINE__); } $this->_imsp->writeToLog('SET command OK.', '', '', PEAR_LOG_DEBUG); return true; } /** * Sets the log information in the Net_IMSP object. * * @access public * @param array The log parameters. * @return mixed True on success PEAR_Error on failure. */ function setLogger($params) { if (isset($this->_imsp)) { return $this->_imsp->setLogger($params); } else { return $this->_imsp->imspError('The IMSP log could not be initialized.'); } } } --- NEW FILE: Utils.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Rubinsky * @package Net_IMSP */ class Net_IMSP_Utils { /** * Utility function to retrieve the names of all the addressbooks * that the user has access to, along with the acl for those * books. For information about the $serverInfo array see * turba/config/sources.php as this is the cfgSources[] entry for * the addressbooks. * * @param array $serverInfo Information about the server * and the current user. * * @return array Information about all the addressbooks. */ function getAllBooks($serverInfo) { require_once 'Net/IMSP.php'; $results = array(); $imsp = &Net_IMSP::singleton('Book', $serverInfo['params']); $result = $imsp->init(); if (is_a($result, 'PEAR_Error')) { return $result; } $books = $imsp->getAddressBookList(); for ($i = 0; $i < count($books); $i++) { if ($books[$i] != $serverInfo['params']['username']) { $newBook = $serverInfo; $newBook['title'] = 'IMSP_' . $books[$i]; $newBook['params']['name'] = $books[$i]; if (strstr($imsp->myRights($books[$i]), 'w')) { $newBook['readonly'] = false; } else { $newBook['readonly'] = true; } $results[] = $newBook; } } return $results; } } From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:22 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_LMTP LMTP.php, NONE, 1.1 package.xml, NONE, 1.1 test_lmtp.php, NONE, 1.1 Message-ID: <20051014143311.12A81102C6C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_LMTP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_LMTP Added Files: LMTP.php package.xml test_lmtp.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: LMTP.php --- | // | Chuck Hagenbuch | // | Jon Parise | // | | // +----------------------------------------------------------------------+ require_once 'Net/Socket.php'; /** * Provides an implementation of the LMTP protocol using PEAR's * Net_Socket:: class. * * @package Net_LMTP * @author Chuck Hagenbuch * @author Jon Parise * @author Damian Alejandro Fernandez Sosa */ class Net_LMTP { /** * The server to connect to. * @var string */ var $_host; /** * The port to connect to. * @var int */ var $_port; /** * The value to give when sending LHLO. * @var string */ var $_localhost; /** * Should debugging output be enabled? * @var boolean * @access private */ var $_debug = false; /** * The socket resource being used to connect to the LMTP server. * @var resource * @access private */ var $_socket = null; /** * The most recent server response code. * @var int * @access private */ var $_code = -1; /** * The most recent server response arguments. * @var array * @access private */ var $_arguments = array(); /** * Stores detected features of the LMTP server. * @var array * @access private */ var $_esmtp = array(); /** * The auth methods this class support * @var array */ var $supportedAuthMethods=array('DIGEST-MD5', 'CRAM-MD5', 'LOGIN'); /** * The auth methods this class support * @var array */ var $supportedSASLAuthMethods=array('DIGEST-MD5', 'CRAM-MD5'); /** * Instantiates a new Net_LMTP object, overriding any defaults * with parameters that are passed in. * * @param string The server to connect to. * @param int The port to connect to. * @param string The value to give when sending LHLO. * * @access public * @since 1.0 */ function Net_LMTP($host = 'localhost', $port = 2003, $localhost = 'localhost') { $this->_host = $host; $this->_port = $port; $this->_localhost = $localhost; $this->_socket = new Net_Socket(); if ((@include_once 'Auth/SASL.php') == false) { foreach($this->supportedSASLAuthMethods as $SASLMethod){ $pos = array_search( $SASLMethod , $this->supportedAuthMethods); unset($this->supportedAuthMethods[$pos]); } } } /** * Set the value of the debugging flag. * * @param boolean $debug New value for the debugging flag. * * @access public * @since 1.0 */ function setDebug($debug) { $this->_debug = $debug; } /** * Send the given string of data to the server. * * @param string $data The string of data to send. * * @return mixed True on success or a PEAR_Error object on failure. * * @access private * @since 1.0 */ function _send($data) { if ($this->_debug) { echo "DEBUG: Send: $data\n"; } if (PEAR::isError($error = $this->_socket->write($data))) { return new PEAR_Error('Failed to write to socket: ' . $error->getMessage()); } return true; } /** * Send a command to the server with an optional string of arguments. * A carriage return / linefeed (CRLF) sequence will be appended to each * command string before it is sent to the LMTP server. * * @param string $command The LMTP command to send to the server. * @param string $args A string of optional arguments to append * to the command. * * @return mixed The result of the _send() call. * * @access private * @since 1.0 */ function _put($command, $args = '') { if (!empty($args)) { return $this->_send($command . ' ' . $args . "\r\n"); } return $this->_send($command . "\r\n"); } /** * Read a reply from the LMTP server. The reply consists of a response * code and a response message. * * @param mixed $valid The set of valid response codes. These * may be specified as an array of integer * values or as a single integer value. * * @return mixed True if the server returned a valid response code or * a PEAR_Error object is an error condition is reached. * * @access private * @since 1.0 * * @see getResponse */ function _parseResponse($valid) { $this->_code = -1; $this->_arguments = array(); while ($line = $this->_socket->readLine()) { if ($this->_debug) { echo "DEBUG: Recv: $line\n"; } /* If we receive an empty line, the connection has been closed. */ if (empty($line)) { $this->disconnect(); return new PEAR_Error("Connection was unexpectedly closed"); } /* Read the code and store the rest in the arguments array. */ $code = substr($line, 0, 3); $this->_arguments[] = trim(substr($line, 4)); /* Check the syntax of the response code. */ if (is_numeric($code)) { $this->_code = (int)$code; } else { $this->_code = -1; break; } /* If this is not a multiline response, we're done. */ if (substr($line, 3, 1) != '-') { break; } } /* Compare the server's response code with the valid code. */ if (is_int($valid) && ($this->_code === $valid)) { return true; } /* If we were given an array of valid response codes, check each one. */ if (is_array($valid)) { foreach ($valid as $valid_code) { if ($this->_code === $valid_code) { return true; } } } return new PEAR_Error("Invalid response code received from server"); } /** * Return a 2-tuple containing the last response from the LMTP server. * * @return array A two-element array: the first element contains the * response code as an integer and the second element * contains the response's arguments as a string. * * @access public * @since 1.0 */ function getResponse() { return array($this->_code, join("\n", $this->_arguments)); } /** * Attempt to connect to the LMTP server. * * @param int $timeout The timeout value (in seconds) for the * socket connection. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function connect($timeout = null) { $result = $this->_socket->connect($this->_host, $this->_port, false, $timeout); if (PEAR::isError($result)) { return new PEAR_Error('Failed to connect socket: ' . $result->getMessage()); } if (PEAR::isError($error = $this->_parseResponse(220))) { return $error; } if (PEAR::isError($error = $this->_negotiate())) { return $error; } return true; } /** * Attempt to disconnect from the LMTP server. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function disconnect() { if (PEAR::isError($error = $this->_put('QUIT'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(221))) { return $error; } if (PEAR::isError($error = $this->_socket->disconnect())) { return new PEAR_Error('Failed to disconnect socket: ' . $error->getMessage()); } return true; } /** * Attempt to send the LHLO command and obtain a list of ESMTP * extensions available * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * * @access private * @since 1.0 */ function _negotiate() { if (PEAR::isError($error = $this->_put('LHLO', $this->_localhost))) { return $error; } if (PEAR::isError($this->_parseResponse(250))) { return new PEAR_Error('LHLO was not accepted: ', $this->_code); return true; } foreach ($this->_arguments as $argument) { $verb = strtok($argument, ' '); $arguments = substr($argument, strlen($verb) + 1, strlen($argument) - strlen($verb) - 1); $this->_esmtp[$verb] = $arguments; } return true; } /** * Returns the name of the best authentication method that the server * has advertised. * * @return mixed Returns a string containing the name of the best * supported authentication method or a PEAR_Error object * if a failure condition is encountered. * @access private * @since 1.0 */ function _getBestAuthMethod() { $available_methods = explode(' ', $this->_esmtp['AUTH']); foreach ($this->supportedAuthMethods as $method) { if (in_array($method, $available_methods)) { return $method; } } return new PEAR_Error('No supported authentication methods'); } /** * Attempt to do LMTP authentication. * * @param string The userid to authenticate as. * @param string The password to authenticate with. * @param string The requested authentication method. If none is * specified, the best supported method will be used. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function auth($uid, $pwd , $method = '') { if (!array_key_exists('AUTH', $this->_esmtp)) { return new PEAR_Error('LMTP server does no support authentication'); } /* * If no method has been specified, get the name of the best supported * method advertised by the LMTP server. */ if (empty($method) || $method === true ) { if (PEAR::isError($method = $this->_getBestAuthMethod())) { /* Return the PEAR_Error object from _getBestAuthMethod(). */ return $method; } } else { $method = strtoupper($method); } switch ($method) { case 'DIGEST-MD5': $result = $this->_authDigest_MD5($uid, $pwd); break; case 'CRAM-MD5': $result = $this->_authCRAM_MD5($uid, $pwd); break; case 'LOGIN': $result = $this->_authLogin($uid, $pwd); break; case 'PLAIN': $result = $this->_authPlain($uid, $pwd); break; default : $result = new PEAR_Error("$method is not a supported authentication method"); break; } /* If an error was encountered, return the PEAR_Error object. */ if (PEAR::isError($result)) { return $result; } /* RFC-2554 requires us to re-negotiate ESMTP after an AUTH. */ if (PEAR::isError($error = $this->_negotiate())) { return $error; } return true; } /* Authenticates the user using the DIGEST-MD5 method. * * @param string The userid to authenticate as. * @param string The password to authenticate with. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access private * @since 1.0 */ function _authDigest_MD5($uid, $pwd) { if (PEAR::isError($error = $this->_put('AUTH', 'DIGEST-MD5'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(334))) { return $error; } $challenge = base64_decode($this->_arguments[0]); $digest = &Auth_SASL::factory('digestmd5'); $auth_str = base64_encode($digest->getResponse($uid, $pwd, $challenge, $this->_host, "smtp")); if (PEAR::isError($error = $this->_put($auth_str ))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(334))) { return $error; } /* * We don't use the protocol's third step because LMTP doesn't allow * subsequent authentication, so we just silently ignore it. */ if (PEAR::isError($error = $this->_put(' '))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(235))) { return $error; } } /* Authenticates the user using the CRAM-MD5 method. * * @param string The userid to authenticate as. * @param string The password to authenticate with. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access private * @since 1.0 */ function _authCRAM_MD5($uid, $pwd) { if (PEAR::isError($error = $this->_put('AUTH', 'CRAM-MD5'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(334))) { return $error; } $challenge = base64_decode($this->_arguments[0]); $cram = &Auth_SASL::factory('crammd5'); $auth_str = base64_encode($cram->getResponse($uid, $pwd, $challenge)); if (PEAR::isError($error = $this->_put($auth_str))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(235))) { return $error; } } /** * Authenticates the user using the LOGIN method. * * @param string The userid to authenticate as. * @param string The password to authenticate with. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access private * @since 1.0 */ function _authLogin($uid, $pwd) { if (PEAR::isError($error = $this->_put('AUTH', 'LOGIN'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(334))) { return $error; } if (PEAR::isError($error = $this->_put(base64_encode($uid)))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(334))) { return $error; } if (PEAR::isError($error = $this->_put(base64_encode($pwd)))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(235))) { return $error; } return true; } /** * Authenticates the user using the PLAIN method. * * @param string The userid to authenticate as. * @param string The password to authenticate with. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access private * @since 1.0 */ function _authPlain($uid, $pwd) { if (PEAR::isError($error = $this->_put('AUTH', 'PLAIN'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(334))) { return $error; } $auth_str = base64_encode(chr(0) . $uid . chr(0) . $pwd); if (PEAR::isError($error = $this->_put($auth_str))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(235))) { return $error; } return true; } /** * Send the MAIL FROM: command. * * @param string The sender (reverse path) to set. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function mailFrom($sender) { if (PEAR::isError($error = $this->_put('MAIL', "FROM:<$sender>"))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(250))) { return $error; } return true; } /** * Send the RCPT TO: command. * * @param string The recipient (forward path) to add. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function rcptTo($recipient) { if (PEAR::isError($error = $this->_put('RCPT', "TO:<$recipient>"))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(array(250, 251)))) { return $error; } return true; } /** * Send the DATA command. * * @param string The message body to send. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function data($data) { if (isset($this->_esmtp['SIZE']) && ($this->_esmtp['SIZE'] > 0)) { if (strlen($data) >= $this->_esmtp['SIZE']) { $this->disconnect(); return new PEAR_Error('Message size excedes the server limit'); } } /* * Change Unix (\n) and Mac (\r) linefeeds into Internet-standard CRLF * (\r\n) linefeeds. */ $data = preg_replace("/([^\r]{1})\n/", "\\1\r\n", $data); $data = preg_replace("/\n\n/", "\n\r\n", $data); /* * Because a single leading period (.) signifies an end to the data, * legitimate leading periods need to be "doubled" (e.g. '..'). */ $data = preg_replace("/\n\./", "\n..", $data); if (PEAR::isError($error = $this->_put('DATA'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(354))) { return $error; } if (PEAR::isError($this->_send($data . "\r\n.\r\n"))) { return new PEAR_Error('write to socket failed'); } if (PEAR::isError($error = $this->_parseResponse(250))) { return $error; } return true; } /** * Send the RSET command. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function rset() { if (PEAR::isError($error = $this->_put('RSET'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(250))) { return $error; } return true; } /** * Send the NOOP command. * * @return mixed Returns a PEAR_Error with an error message on any * kind of failure, or true on success. * @access public * @since 1.0 */ function noop() { if (PEAR::isError($error = $this->_put('NOOP'))) { return $error; } if (PEAR::isError($error = $this->_parseResponse(250))) { return $error; } return true; } } ?> --- NEW FILE: package.xml --- Net_LMTP Provides an implementation of the RFC2033 LMTP protocol Provides an implementation of the RFC2033 LMTP using PEAR's Net_Socket and Auth_SASL class. damian Damian Alejandro Fernandez Sosa damlists@cnba.uba.ar lead 1.0.1 2004-08-25 PHP License stable * Fixed a bug in SIZE handling (thanks to Steffen Hansen for bug report) * Marked as Stable Net_Socket 0.7.0 2004-03-02 stable * Removed dependency on Auth_SASL, but if installed automatically uses it probiding DIGEST-MD5 and CRAM-MD5 auth methods * Marked as stable 0.6 2003-03-27 beta - Fixed a bug in DIGEST-MD5 Auth Method. - Now Uses defaults values in constructor. 0.5 2003-03-24 beta - All methods are implemmented based on Net_SMTP --- NEW FILE: test_lmtp.php --- | // | Jon Parise | // | Damian Alejandro Fernandez Sosa | // +----------------------------------------------------------------------+ require_once('Net/LMTP.php'); // The LMTP server $host="localhost"; // The default LMTP port $port="2003"; // The username to authenticate to the LMTP server $user="cyrus"; // The password to authenticate to the LMTP server $pwd="password"; //you can create a file called passwords.php and store your $user,$pass,$host and $port values in it // or you can modify this script @require_once("./passwords.php"); // The name we send to initiate the LMTP dialog $localhost="localhost"; // The email as we send the email in the LMTP dialog $from="damian@cnba.uba.ar"; // The email to send the email in the LMTP dialog //$to="damian@fernandezsosa.com.ar"; $to="damian@1aaafernandezsosa.com.ar"; //$to="damian"; // The email text (RFC822 format) $email="From:damian@cnba.uba.ar\r\nTo:damian@cnba.uba.ar\r\nDate: Wed, 12 Feb 2004 21:07:35 -300\r\nSubject: testing LMTP\r\n\r\nthis is a test email\r\n"; // We create the Net_LMTP instance $lmtp_conn= new Net_LMTP( $host , $port , $localhost); $lmtp_conn->setDebug(true); // Connect to the LMTP server if (PEAR::isError( $error = $lmtp_conn->connect())) { echo "ERROR:" . $error->getMessage() . "\n"; exit(); } // Authenticates against the LMTP server using PLAIN method. if (PEAR::isError( $error = $lmtp_conn->auth($user,$pwd,'PLAIN'))) { echo "ERROR:" . $error->getMessage() . "\n"; exit(); } // Send the MAIL FROM: LMTP command if (PEAR::isError( $error = $lmtp_conn->mailFrom($from))) { echo "ERROR:" . $error->getMessage() . "\n"; exit(); } // Send the RCPT TO: LMTP command if (PEAR::isError( $error = $lmtp_conn->rcptTo($to))) { echo "ERROR:" . $error->getMessage() . "\n"; exit(); } // Send the DATA: LMTP command (we send the email RFC822 encoded) if (PEAR::isError( $error = $lmtp_conn->data($email))) { echo "ERROR:" . $error->getMessage() . "\n"; exit(); } // now the email was accepted by the LMTP server, so we close // the connection // Send the QUIT LMTP command and disconnect from the LMTP server if (PEAR::isError( $error = $lmtp_conn->disconnect())) { echo "ERROR:" . $error->getMessage() . "\n"; exit(); } ?> From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:24 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_SMS SMS.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143311.1C3A1102C6F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_SMS In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_SMS Added Files: SMS.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: SMS.php --- * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Net_SMS/SMS.php,v 1.10 2004/05/04 21:54:11 mdjukic Exp $ * * @author Marko Djukic * @version $Revision: 1.1 $ * @package Net_SMS */ class Net_SMS { /** * A hash containing any parameters for the current gateway driver. * * @var array $_params */ var $_params = array(); var $_auth = null; /** * Constructor * * @param optional array $params Any parameters needed for this gateway * driver. */ function Net_SMS($params = null) { $this->_params = $params; } /** * Returns a list of available gateway drivers. * * @access public * * @return array An array of available drivers. */ function getDrivers() { static $drivers = array(); if (!empty($drivers)) { return $drivers; } $drivers = array(); if ($driver_dir = opendir(dirname(__FILE__) . '/SMS/')) { while (false !== ($file = readdir($driver_dir))) { /* Hide dot files and non .php files. */ if (substr($file, 0, 1) != '.' && substr($file, -4) == '.php') { $driver = substr($file, 0, -4); $driver_info = Net_SMS::getGatewayInfo($driver); $drivers[$driver] = $driver_info['name']; } } closedir($driver_dir); } return $drivers; } /** * Returns information on a gateway, such as name and a brief description, * from the driver subclass getInfo() function. * * @access public * * @return array An array of extra information. */ function getGatewayInfo($gateway) { static $info = array(); if (isset($info[$gateway])) { return $info[$gateway]; } require_once 'Net/SMS/' . $gateway . '.php'; $class = 'Net_SMS_' . $gateway; $info[$gateway] = call_user_func(array($class, 'getInfo')); return $info[$gateway]; } /** * Returns parameters for a gateway from the driver subclass getParams() * function. * * @access public * * @param string The name of the gateway driver for which to return the * parameters. * * @return array An array of extra information. */ function getGatewayParams($gateway) { static $params = array(); if (isset($params[$gateway])) { return $params[$gateway]; } require_once 'Net/SMS/' . $gateway . '.php'; $class = 'Net_SMS_' . $gateway; $params[$gateway] = call_user_func(array($class, 'getParams')); return $params[$gateway]; } /** * Returns send parameters for a gateway from the driver subclass * getDefaultSendParams()function. These are parameters which are available * to the user during sending, such as setting a time for delivery, or * type of SMS (normal text or flash), or source address, etc. * * @access public * * @param string The name of the gateway driver for which to return the * send parameters. * * @return array An array of available send parameters. */ function getDefaultSendParams($gateway) { static $params = array(); if (isset($params[$gateway])) { return $params[$gateway]; } require_once 'Net/SMS/' . $gateway . '.php'; $class = 'Net_SMS_' . $gateway; $params[$gateway] = call_user_func(array($class, 'getDefaultSendParams')); return $params[$gateway]; } /** * Query the current Gateway object to find out if it supports the given * capability. * * @access public * * @param string $capability The capability to test for. * * @return mixed Whether or not the capability is supported or any other * value that the capability wishes to report. */ function hasCapability($capability) { if (!empty($this->capabilities[$capability])) { return $this->capabilities[$capability]; } return false; } /** * Authenticates against the gateway if required. * * @access public * * @return mixed True on success or PEAR Error on failure. */ function authenticate() { /* Do authentication for this gateway if driver requires it. */ if ($this->hasCapability('auth')) { $this->_auth = $this->_authenticate(); return $this->_auth; } return true; } /** * Sends a message to one or more recipients. Hands off the actual sending * to the gateway driver. * * @access public * * @param array $message The message to be sent, which is composed of: * id - A unique ID for the message; * to - An array of recipients; * text - The text of the message; * * * @return mixed True on success or PEAR Error on failure. */ function send(&$message) { /* Authenticate. */ if (is_a($this->authenticate(), 'PEAR_Error')) { return $this->_auth; } /* Make sure the recipients are in an array. */ if (!is_array($message['to'])) { $message['to'] = array($message['to']); } /* Array to store each send. */ $sends = array(); /* If gateway supports batch sending, preference is given to this * method. */ if ($max_per_batch = $this->hasCapability('batch')) { /* Split up the recipients in the max recipients per batch as * supported by gateway. */ $iMax = count($message['to']); $batches = ceil($iMax / $max_per_batch); /* Loop through the batches and compose messages to be sent. */ for ($b = 0; $b < $batches; $b++) { $recipients = array_slice($message['to'], ($b * $max_per_batch), $max_per_batch); $response = $this->_send($message, $recipients); foreach ($recipients as $recipient) { if ($response[$recipient][0] == 1) { /* Message was sent, store remote id. */ $remote_id = $response[$recipient][1]; $error = null; } else { /* Message failed, store error code. */ $remote_id = null; $error = $response[$recipient][1]; } /* Store the sends. */ $sends[] = array('message_id' => $message['id'], 'remote_id' => $remote_id, 'recipient' => $recipient, 'error' => $error); } } } else { /* No batch sending available, just loop through all recipients * and send a message for each one. */ foreach ($message['to'] as $recipient) { $response = $this->_send($message, $recipient); if ($response[0] == 1) { /* Message was sent, store remote id if any. */ $remote_id = (isset($response[1]) ? $response[1] : null); $error = null; } else { /* Message failed, store error code. */ $remote_id = null; $error = $response[1]; } /* Store the sends. */ $sends[] = array('message_id' => $message['id'], 'remote_id' => $remote_id, 'recipient' => $recipient, 'error' => $error); } } return $sends; } /** * If the current driver has a credit capability, queries the gateway for * a credit balance and returns the value. * * @access public * * @return int Value indicating available credit or null if not supported. */ function getBalance() { /* Authenticate. */ if (is_a($this->authenticate(), 'PEAR_Error')) { return $this->_auth; } /* Check balance. */ if ($this->hasCapability('credit')) { return $this->_getBalance(); } else { return null; } } /** * Attempts to return a concrete Gateway instance based on $driver. * * @param string $driver The type of concrete Gateway subclass to * return. This is based on the gateway * driver ($driver). The code is dynamically * included. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Net_SMS The newly created concrete Gateway instance or * false on an error. */ function &factory($driver, $params = array()) { include_once 'Net/SMS/' . $driver . '.php'; $class = 'Net_SMS_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError(sprintf(_("Class definition of %s not found."), $driver)); } } /** * Attempts to return a reference to a concrete Net_SMS instance based on * $driver. It wil only create a new instance if no Net_SMS instance with * the same parameters currently exists. * * This method must be invoked as: $var = &Net_SMS::singleton() * * @param string $driver The type of concrete Net_SMS * subclass to return. The is based on the * gateway driver ($driver). The code is * dynamically included. * * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return mixed The created concrete Net_SMS instance, or false on * error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Net_SMS::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Net_SMS SMS functionality. This package provides SMS functionality and access to SMS gateways. LGPL mdjukic lead Marko Djukic mdjukic@horde.org 0.0.1 beta 2004-03-15 Initial release as a PEAR package HTTP_Request Mail 0.0.1 beta 2004-03-15 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:25 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_SMS/SMS clickatell_http.php, NONE, 1.1 sms2email_http.php, NONE, 1.1 vodafoneitaly_smtp.php, NONE, 1.1 Message-ID: <20051014143311.21F8A102C74@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_SMS/SMS In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_SMS/SMS Added Files: clickatell_http.php sms2email_http.php vodafoneitaly_smtp.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: clickatell_http.php --- * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Net_SMS/SMS/clickatell_http.php,v 1.13 2004/04/28 23:38:29 mdjukic Exp $ * * @author Marko Djukic * @version $Revision: 1.1 $ * @package Net_SMS */ class Net_SMS_clickatell_http extends Net_SMS { var $_session_id = null; var $_base_url = 'http://api.clickatell.com/http/'; /** * An array of capabilities, so that the driver can report which operations * it supports and which it doesn't. Possible values are: * auth - The gateway require authentication before sending; * batch - Batch sending is supported; * multi - Sending of messages to multiple recipients is supported; * receive - Whether this driver is capable of receiving SMS; * credit - Is use of the gateway based on credits; * addressbook - Are gateway addressbooks supported; * lists - Gateway support for distribution lists. * * @var array $capabilities */ var $capabilities = array('auth' => true, 'batch' => 100, 'multi' => true, 'receive' => false, 'credit' => true, 'addressbook' => false, 'lists' => false); /** * Authenticate at the gateway and set a session id if successful. Caching * is used to minimise the http calls for subsequent messages. * * @access private * * @return mixed True on success or PEAR Error on failure. */ function _authenticate() { global $conf; /* We have already authenticated so return true. */ if (!empty($this->_session_id)) { return true; } /* Set up the http authentication url. */ $url = sprintf('auth?user=%s&password=%s&api_id=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), $this->_params['api_id']); /* Do the HTTP authentication and get the response. */ $response = Net_SMS_clickatell_http::_callURL($url); if (is_a($response, 'PEAR_Error')) { return PEAR::raiseError(sprintf(_("Authentication failed. %s"), $response->getMessage())); } /* Split up the response. */ $response = explode(':', $response); if ($response[0] == 'OK') { $this->_session_id = trim($response[1]); return true; } else { return $this->getError($response[1], _("Authentication failed. %s")); } } /** * This function does the actual sending of the message. * * @access private * * @param array $message The array containing the message and its send * parameters. * @param string $to The destination string. * * @return mixed True on success or PEAR Error on failure. */ function _send(&$message, $to) { /* Set up the http sending url. */ $url = sprintf('sendmsg?session_id=%s&text=%s', $this->_session_id, urlencode($message['text'])); $req_feat = 0; if (!empty($message['send_params']['from'])) { /* If source from is set, require it for transit gateways and append to url. */ $req_feat =+ 16; $url .= '&from=' . urlencode($message['send_params']['from']); } if ($message['send_params']['msg_type'] == 'SMS_FLASH') { /* If message type is flash, require it for transit gateways. */ $req_feat =+ 512; $url .= '&msg_type=' . $message['send_params']['msg_type']; } if (!empty($req_feat)) { /* If features have been required, add to url. */ $url .= '&req_feat=' . $req_feat; } /* Append the recipients of this message and call the url. */ foreach ($to as $key => $val) { if (preg_match('/^.*?|$)/', $val, $matches)) { $to[$key] = $matches[1]; } else { /* FIXME: Silently drop bad recipients. This should be logged * and/or reported. */ unset($to[$key]); } } $to = implode(',', $to); $url .= '&to=' . $to; $response = trim($this->_callURL($url)); /* Ugly parsing of the response, but that's how it comes back. */ $lines = explode("\n", $response); $response = array(); if (count($lines) > 1) { foreach ($lines as $line) { $parts = explode('To:', $line); $recipient = trim($parts[1]); $outcome = explode(':', $parts[0]); $response[$recipient] = array(($outcome[0] == 'ID' ? 1 : 0), $outcome[1]); } } else { /* Single recipient. */ $outcome = explode(':', $lines[0]); $response[$to] = array(($outcome[0] == 'ID' ? 1 : 0), $outcome[1]); } return $response; } /** * Returns the current credit balance on the gateway. * * @access private * * @return int The credit balance available on the gateway. */ function _getBalance() { /* Set up the url and call it. */ $url = sprintf('getbalance?session_id=%s', $this->_session_id); $response = trim($this->_callURL($url)); /* Try splitting up the response. */ $lines = explode('=', $response); /* Split up the response. */ $response = explode(':', $response); if ($response[0] == 'Credit') { return trim($response[1]); } else { return $this->getError($response[1], _("Could not check balance. %s")); } } /** * Identifies this gateway driver and returns a brief description. * * @access public * * @return array Array of driver info. */ function getInfo() { $info['name'] = _("Clickatell via HTTP"); $info['desc'] = _("This driver allows sending of messages through the Clickatell (http://clickatell.com) gateway, using the HTTP API"); return $info; } /** * Returns the required parameters for this gateway driver. * * @access public * * @return array Array of required parameters. */ function getParams() { $params = array(); $params['user'] = array('label' => _("Username"), 'type' => 'text'); $params['password'] = array('label' => _("Password"), 'type' => 'text'); $params['api_id'] = array('label' => _("API ID"), 'type' => 'text'); return $params; } /** * Returns the parameters that can be set as default for sending messages * using this gateway driver and displayed when sending messages. * * @access public * * @return array Array of parameters that can be set as default. * @todo Set up batch fields/params, would be nice to have ringtone/logo * support too, queue choice, unicode choice. */ function getDefaultSendParams() { $params = array(); $params['from'] = array( 'label' => _("Source address"), 'type' => 'text'); $params['deliv_time'] = array( 'label' => _("Delivery time"), 'type' => 'enum', 'params' => array(array('now' => _("immediate"), 'user' => _("user select")))); $types = array('SMS_TEXT' => 'SMS_TEXT', 'SMS_FLASH' => 'SMS_FLASH'); $params['msg_type'] = array( 'label' => _("Message type"), 'type' => 'multienum', 'params' => array($types)); return $params; } /** * Returns the parameters for sending messages using this gateway driver, * displayed when sending messages. These are filtered out using the * default values set for the gateway. * * @access public * * @return array Array of required parameters. * @todo Would be nice to use a time/date setup rather than minutes from * now for the delivery time. Upload field for ringtones/logos? */ function getSendParams($params) { if (empty($params['from'])) { $params['from'] = array( 'label' => _("Source address"), 'type' => 'text'); } if ($params['deliv_time'] == 'user') { $params['deliv_time'] = array( 'label' => _("Delivery time"), 'type' => 'int', 'desc' => _("Value in minutes from now.")); } if (count($params['msg_type']) > 1) { $params['msg_type'] = array( 'label' => _("Message type"), 'type' => 'enum', 'params' => array($params['msg_type'])); } else { $params['msg_type'] = $params['msg_type'][0]; } return $params; } /** * Returns a string representation of an error code. * * @access public * * @param int $error The error code to look up. * @param optional string $text An existing error text to use to raise a * PEAR Error. * * @return mixed A textual message corrisponding to the error code or a * PEAR Error if passed an existing error text. * * @todo Check which of these are actually required and trim down the list. */ function getError($error, $error_text = '') { /* Make sure we get only the number at the start of an error. */ list($error) = explode(',', $error); $error = trim($error); /* An array of error codes returned by the gateway. */ $errors = array('001' => _("Authentication failed"), '002' => _("Unknown username or password."), '003' => _("Session ID expired."), '004' => _("Account frozen."), '005' => _("Missing session ID."), '007' => _("IP lockdown violation."), '101' => _("Invalid or missing parameters."), '102' => _("Invalid UDH. (User Data Header)."), '103' => _("Unknown apimsgid (API Message ID)."), '104' => _("Unknown climsgid (Client Message ID)."), '105' => _("Invalid destination address."), '106' => _("Invalid source address."), '107' => _("Empty message."), '108' => _("Invalid or missing api_id."), '109' => _("Missing message ID."), '110' => _("Error with email message."), '111' => _("Invalid protocol."), '112' => _("Invalid msg_type."), '113' => _("Max message parts exceeded."), '114' => _("Cannot route message to specified number."), '115' => _("Message expired."), '116' => _("Invalid unicode data."), '201' => _("Invalid batch ID."), '202' => _("No batch template."), '301' => _("No credit left."), '302' => _("Max allowed credit.")); if (empty($error_text)) { return $errors[$error]; } else { return PEAR::raiseError(sprintf($error_text, $errors[$error])); } } /** * Do the http call using a url passed to the function. * * @access private * * @param string $url The url to call. * * @return mixed The response on success or PEAR Error on failure. */ function _callURL($url) { $options['method'] = 'POST'; $options['timeout'] = 5; $options['allowRedirects'] = true; if (!@include_once 'HTTP/Request.php') { return PEAR::raiseError(_("Missing PEAR package HTTP_Request.")); } $http = &new HTTP_Request($this->_base_url . $url, $options); @$http->sendRequest(); if ($http->getResponseCode() != 200) { return PEAR::raiseError(sprintf(_("Could not open %s."), $url)); } return $http->getResponseBody(); } } --- NEW FILE: sms2email_http.php --- * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Net_SMS/SMS/sms2email_http.php,v 1.23 2004/04/29 16:38:52 mdjukic Exp $ * * @author Marko Djukic * @version $Revision: 1.1 $ * @package Net_SMS */ class Net_SMS_sms2email_http extends Net_SMS { var $_base_url = 'horde.sms2email.com/horde/'; /** * An array of capabilities, so that the driver can report which operations * it supports and which it doesn't. Possible values are: * auth - The gateway requires authentication before sending; * batch - Batch sending is supported; * multi - Sending of messages to multiple recipients is supported; * receive - Whether this driver is capable of receiving SMS; * credit - Is use of the gateway based on credits; * addressbook - Are gateway addressbooks supported; * lists - Gateway support for distribution lists. * * @var array $capabilities */ var $capabilities = array('auth' => false, 'batch' => 100, 'multi' => true, 'receive' => false, 'credit' => true, 'addressbook' => true, 'lists' => true); /** * This function does the actual sending of the message. * * @access private * * @param array $message The array containing the message and its send * parameters. * @param string $to The destination string. * * @return mixed True on success or PEAR Error on failure. */ function _send(&$message, $to) { /* Set up the sending url. */ $url = sprintf('postmsg.php?username=%s&password=%s&message=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), urlencode($message['text'])); /* Check if source from is set. */ if (!empty($message['send_params']['from'])) { $url .= '&orig=' . urlencode($message['send_params']['from']); } /* Check if message type is flash. */ if ($message['send_params']['msg_type'] == 'SMS_FLASH') { $url .= '&flash=1'; } /* Check if delivery report url has been set. */ if (!empty($this->_params['delivery_report'])) { $url .= '&dlurl=' . urlencode($this->_params['delivery_report']) . 'reportcode=%code&destinationnumber=%dest'; } /* Loop through recipients and do some minimal validity checking. */ if (is_array($to)) { foreach ($to as $key => $val) { if (preg_match('/^.*?|$)/', $val, $matches)) { $to[$key] = $matches[1]; } else { /* FIXME: Silently drop bad recipients. This should be * logged and/or reported. */ unset($to[$key]); } } $to = implode(',', $to); } else { if (preg_match('/^.*?|$)/', $to, $matches)) { $to = $matches[1]; } else { return PEAR::raiseError(sprintf(_("Invalid recipient: '%s'"), $to)); } } /* Append the recipients of this message and call the url. */ $url .= '&to_num=' . $to; $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Parse the response, check for new lines in case of multiple * recipients. */ $lines = explode("\n", $response); $response = array(); if (count($lines) > 1) { /* Multiple recipients. */ foreach ($lines as $line) { $parts = explode('To:', $line); $recipient = trim($parts[1]); if ($lines[0] == 'AQSMS-OK') { $response[$recipient] = array(1, null); } else { $response[$recipient] = array(0, $lines[0]); } } } else { /* Single recipient. */ if ($lines[0] == 'AQSMS-OK') { $response[$to] = array(1, null); } else { $response[$to] = array(0, $lines[0]); } } return $response; } /** * Returns the current credit balance on the gateway. * * @access private * * @return int The credit balance available on the gateway. */ function _getBalance() { /* Set up the url and call it. */ $url = sprintf('postmsg.php?username=%s&password=%s&cmd=credit', urlencode($this->_params['user']), urlencode($this->_params['password'])); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Try splitting up the response. */ $lines = explode('=', $response); if ($lines[0] == 'AQSMS-CREDIT') { return $lines[1]; } else { return $this->getError($lines[0], _("Could not check balance. %s")); } } /** * Adds a contact to the gateway's addressbook. * * @access public * * @param string $name The name for this contact * @param int $number The contact's phone number. * * @return mixed The remote contact ID on success or PEAR Error on * failure. */ function addContact($name, $number) { /* Set up the url and call it. */ $url = sprintf('postcontacts.php?username=%s&password=%s&cmd=ADDCONTACT&name=%s&number=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), urlencode($name), $number); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check if there was an error response. */ if (substr($response, 0, 17) != 'AQSMS-CONTACTIDOK') { return $this->getError($response, _("Could not add contact. %s")); } /* Split up the response. */ $lines = explode(',=', $response); return $lines[1]; } /** * Updates a contact in the gateway's addressbook. * * @access public * * @param int $id The contact's ID on the gateway. * @param string $name The name for this contact * @param int $number The contact's phone number. * * @return mixed True on success or PEAR Error on failure. */ function updateContact($id, $name, $number) { /* Set up the url and call it. */ $url = sprintf('postcontacts.php?username=%s&password=%s&cmd=UPDATECONTACT&id=%s&name=%s&number=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), $id, urlencode($name), $number); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Parse the response. */ if ($response == 'AQSMS-OK') { return true; } else { return $this->getError($response, _("Could not update contact. %s")); } } /** * Deletes a contact in the gateway's addressbook. * * @access public * * @param int $id The contact's ID on the gateway. * * @return mixed True on success or PEAR Error on failure. */ function deleteContact($id) { /* Set up the url and call it. */ $url = sprintf('postcontacts.php?username=%s&password=%s&cmd=DELETECONTACT&id=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), $id); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Parse the response. */ if ($response == 'AQSMS-OK') { return true; } else { return $this->getError($response, _("Could not delete contact. %s")); } } /** * Fetches the entire address book from the gateway. * * @access public * * @return mixed Array of contacts on success or PEAR Error on failure. * Format of the returned contacts is for example: * array( => array('name' => , * 'number' => ), * => array('name' => , * 'number' => )); */ function getAddressBook() { /* Set up the url and call it. */ $url = sprintf('postcontacts.php?username=%s&password=%s&cmd=GETADDRESSBOOK', urlencode($this->_params['user']), urlencode($this->_params['password'])); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check if there was an error response. */ if (substr($response, 0, 19) != 'AQSMS-ADDRESSBOOKOK') { return $this->getError($response, _("Could not retrieve address book. %s")); } /* Parse the response and construct the array. */ list($response, $contacts_str) = explode(',', $response, 2); /* Check that the full address book list has been received. */ $length = substr($response, 19); if (strlen($contacts_str) != $length) { return PEAR::raiseError(_("Could not fetch complete address book.")); } $contacts_lines = explode("\n", $contacts_str); $contacts = array(); /* Loop through lines and pick out the fields, make sure that the "" * are not included in the values, so get the line less 1 char on each * end and split for ",". */ foreach ($contacts_lines as $line) { list($id, $name, $number) = explode('","', substr($line, 1, -1)); $contacts[$id] = array('name' => $name, 'number' => $number); } return $contacts; } /** * Creates a new distribution list on the gateway. * * @access public * * @param string $name An arbitrary name for the new list. * @param array $numbers A simple array of numbers to add to the list. * * @return mixed Gateway ID for the created list on success or PEAR Error * on failure. */ function listCreate($name, $numbers) { /* Set up the url and call it. */ $url = sprintf('postdistribution.php?username=%s&password=%s&cmd=ADDDISTLIST&name=%s&numlist=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), urlencode($name), implode(',', $numbers)); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check if there was an error response. */ if (substr($response, 0, 16) != 'AQSMS-DISTITEMID') { return $this->getError($response, _("Could not create distribution list. %s")); } /* Parse the response and get the distribution list ID. */ list($response, $id) = explode('=', $response); /* TODO: do we need to check the length of the id string? */ return $id; } /** * Deletes a distribution list from the gateway. * * @access public * * @param string $id The gateway ID for the list to delete. * * @return mixed True on success or PEAR Error on failure. */ function listDelete($id) { /* Set up the url and call it. */ $url = sprintf('postdistribution.php?username=%s&password=%s&cmd=DELETEDISTLIST&distid=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), $id); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check response. */ if ($response == 'AQSMS-OK') { return true; } else { return $this->getError($response, _("Could not delete distribution list. %s")); } } /** * Updates a distribution list on the gateway. * * @access public * * @param string $id The gateway ID for the list to update. * @param string $name The arbitrary name of the list. If * different from the original name that * the list was created under, the list * will be renamed. * @param optional string $numbers The new list of numbers in the list. * If left empty, the result will be the * same as calling the listRename() * function. * * @return mixed True on success or PEAR Error on failure. */ function listUpdate($id, $name, $numbers = array()) { /* Set up the url and call it. */ $url = sprintf('postdistribution.php?username=%s&password=%s&cmd=UPDATELISTNAME&distid=%s&name=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), $id, urlencode($name)); /* Check if the list numbers need updating. */ if (!empty($numbers)) { $url .= '&numbers=' . implode(',', $numbers); } $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check response. */ if ($response == 'AQSMS-OK') { return true; } else { return $this->getError($response, _("Could not update distribution list. %s")); } } /** * Renames a distribution list on the gateway. Does nothing other than * calling the listUpdate() function with just the $id and $name variables. * * @access public * * @param string $id The gateway ID for the list to update. * @param string $name The new arbitrary name for the list. * * @return mixed True on success or PEAR Error on failure. */ function listRename($id, $name) { return $this->listUpdate($id, $name); } /** * Fetches a listing of available distribution lists on the server. * * @access public * * @return mixed An array of lists on success or PEAR Error on failure. * Format of the returned lists is for example: * array( => array('name' => ), * => array('name' => )); */ function getLists() { /* Set up the url and call it. */ $url = sprintf('postdistribution.php?username=%s&password=%s&cmd=GETCOMPACTLIST', urlencode($this->_params['user']), urlencode($this->_params['password'])); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check if there was an error response. */ if (substr($response, 0, 22) != 'AQSMS-DISTRIBUTIONLIST') { return $this->getError($response, _("Could not retrieve distribution lists. %s")); } /* Parse the response and construct the array. */ list($response, $lists_str) = explode(',', $response, 2); /* Check that the full list of distribution lists has been received. */ $length = substr($response, 22); if (strlen($lists_str) != $length) { return PEAR::raiseError(_("Could not fetch the complete list of distribution lists.")); } $lists_lines = explode("\n", $lists_str); $lists = array(); /* Loop through lines and pick out the fields, make sure that the "" * are not included in the values, so get the line less 1 char on each * end and split for ",". */ foreach ($lists_lines as $line) { list($id, $name, $count) = explode('","', substr($line, 1, -1)); $lists[$id] = array('name' => $name, 'count' => $count); } return $lists; } /** * Fetches a specific distribution list from the gateway. * * @access public * * @param string The ID of the distribution list to fetch. * * @return mixed An array of numbers in the list on success or PEAR Error * on failure. */ function getList($id) { /* Set up the url and call it. */ $url = sprintf('postdistribution.php?username=%s&password=%s&cmd=GETNUMBERSWITHID&distid=%s', urlencode($this->_params['user']), urlencode($this->_params['password']), $id); $response = $this->_callURL($url); if (is_a($response, 'PEAR_Error')) { return $response; } /* Check if there was an error response. */ if (substr($response, 0, 22) != 'AQSMS-DISTRIBUTIONLIST') { return $this->getError($response, _("Could not retrieve distribution list. %s")); } /* Parse the response and construct the array. */ list($response, $list_str) = explode(',', $response, 2); /* Check that the full list of distribution lists has been received. */ $length = substr($response, 22); if (strlen($list_str) != $length) { return PEAR::raiseError(_("Could not fetch complete distribution list.")); } $list_str = trim($list_str); list($count, $numbers) = explode('","', $list_str); /* TODO: Anything useful that can be done with the count of numbers at * the start? */ $count = substr($count, 1); /* Explode the list of numbers into an array and return. */ $numbers = substr($numbers, 0, -1); return explode(',', $numbers); } /** * Identifies this gateway driver and returns a brief description. * * @access public * * @return array Array of driver info. */ function getInfo() { $info['name'] = _("sms2email via HTTP"); $info['desc'] = _("This driver allows sending of messages through the sms2email (http://sms2email.com) gateway, using the HTTP API"); return $info; } /** * Returns the required parameters for this gateway driver. The settable * parameters for this gateway are: * - user - The username for authentication on the gateway; * - password - The password for authentication on the gateway; * - ssl - Whether or not to use SSL for communication with * the gateway. * - delivery_report - A URL for a script which would accept delivery * report from the gateway. * * @access public * * @return array Array of required parameters. */ function getParams() { $params = array(); $params['user'] = array('label' => _("Username"), 'type' => 'text'); $params['password'] = array('label' => _("Password"), 'type' => 'text'); $params['ssl'] = array('label' => _("Use SSL"), 'type' => 'boolean', 'required' => false); $params['delivery_report'] = array('label' => _("URL for your script delivery status report"), 'type' => 'text', 'required' => false); return $params; } /** * Returns the parameters that can be set as default for sending messages * using this gateway driver and displayed when sending messages. * * @access public * * @return array Array of parameters that can be set as default. */ function getDefaultSendParams() { $params = array(); $params['from'] = array( 'label' => _("Source address"), 'type' => 'text'); $params['deliv_time'] = array( 'label' => _("Delivery time"), 'type' => 'enum', 'params' => array(array('now' => _("immediate"), 'user' => _("user select")))); $types = array('SMS_TEXT' => 'SMS_TEXT', 'SMS_FLASH' => 'SMS_FLASH'); $params['msg_type'] = array( 'label' => _("Message type"), 'type' => 'multienum', 'params' => array($types)); return $params; } /** * Returns the parameters for sending messages using this gateway driver, * displayed when sending messages. These are filtered out using the * default values set up when creating the gateway. * * @access public * * @return array Array of required parameters. * @todo Would be nice to use a time/date setup rather than minutes from * now for the delivery time. Upload field for ringtones/logos? */ function getSendParams($params) { if (empty($params['from'])) { $params['from'] = array( 'label' => _("Source address"), 'type' => 'text'); } if ($params['deliv_time'] == 'user') { $params['deliv_time'] = array( 'label' => _("Delivery time"), 'type' => 'int', 'desc' => _("Value in minutes from now.")); } if (count($params['msg_type']) > 1) { $params['msg_type'] = array( 'label' => _("Message type"), 'type' => 'enum', 'params' => array($params['msg_type'])); } else { $params['msg_type'] = $params['msg_type'][0]; } return $params; } /** * Returns a string representation of an error code. * * @access public * * @param int $error The error code to look up. * @param optional string $text An existing error text to use to raise a * PEAR Error. * * @return mixed A textual message corrisponding to the error code or a * PEAR Error if passed an existing error text. * * @todo Check which of these are actually required and trim down the list. */ function getError($error, $error_text = '') { $error = trim($error); /* An array of error codes returned by the gateway. */ $errors = array( 'AQSMS-NOAUTHDETAILS' => _("No username and/or password sent."), 'AQSMS-AUTHERROR' => _("Incorrect username and/or password."), 'AQSMS-NOMSG' => _("No message supplied."), 'AQSMS-NODEST' => _("No destination supplied."), 'AQSMS-NOCREDIT' => _("Insufficient credit."), 'AQSMS-NONAMESUPPLIED' => _("No name specified."), 'AQSMS-NONUMBERSUPPLIED' => _("No number specified."), 'AQSMS-ADDRESSBOOKERROR' => _("There was an error performing the specified address book function. Please try again later."), 'AQSMS-CONTACTIDERROR' => _("The contact ID number was not specified, left blank or was not found in the database."), 'AQSMS-CONTACTUPDATEERROR' => _("There was an error updating the contact details. Please try again later."), 'AQSMS-DISTIDERROR' => _("The distribution list ID was either not specified, left blank or not found in the database."), 'AQSMS-NODISTLISTSUPPLIED' => _("The distribution list was not specified."), 'AQSMS-INSUFFICIENTCREDITS' => _("Insufficient credit to send to the distribution list."), 'AQSMS-NONUMBERLISTSUPPLIED' => _("Numbers not specified for updating in distribution list."), 'AQSMS-DISTLISTUPDATEERROR' => _("There was an error updating the distribution list. Please try again later.")); if (empty($error_text)) { return $errors[$error]; } else { return PEAR::raiseError(sprintf($error_text, $errors[$error])); } } /** * Do the http call using a url passed to the function. * * @access private * * @param string $url The url to call. * * @return mixed The response on success or PEAR Error on failure. */ function _callURL($url) { $options['method'] = 'POST'; $options['timeout'] = 5; $options['allowRedirects'] = true; $url = ($this->_params['ssl'] ? 'https://' : 'http://') . $this->_base_url . $url; if (!@include_once 'HTTP/Request.php') { return PEAR::raiseError(_("Missing PEAR package HTTP_Request.")); } $http = &new HTTP_Request($url, $options); @$http->sendRequest(); if ($http->getResponseCode() != 200) { return PEAR::raiseError(sprintf(_("Could not open %s."), $url)); } return $http->getResponseBody(); } } --- NEW FILE: vodafoneitaly_smtp.php --- * Copyright 2003-2004 Matteo Zambelli * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/Net_SMS/SMS/vodafoneitaly_smtp.php,v 1.11 2004/04/28 23:38:29 mdjukic Exp $ * * @author Marko Djukic * @author Matteo Zambelli * @version $Revision: 1.1 $ * @package Net_SMS */ class Net_SMS_vodafoneitaly_smtp extends Net_SMS { /** * An array of capabilities, so that the driver can report which operations * it supports and which it doesn't. Possible values are: * auth - The gateway require authentication before sending; * batch - Batch sending is supported; * multi - Sending of messages to multiple recipients is supported; * receive - Whether this driver is capable of receiving SMS; * credit - Is use of the gateway based on credits; * addressbook - Are gateway addressbooks supported; * lists - Gateway support for distribution lists. * * @var array $capabilities */ var $capabilities = array('auth' => false, 'batch' => false, 'multi' => false, 'receive' => false, 'credit' => false, 'addressbook' => false, 'lists' => false); /** * This function does the actual sending of the message. * * @access private * * @param array $message The array containing the message and its send * parameters. * @param string $to The destination string. * * @return mixed True on success or PEAR Error on failure. */ function _send(&$message, $to) { if (!@include_once 'Mail.php') { return PEAR::raiseError(_("Missing required PEAR package Mail.")); } $mailer = &Mail::factory('mail'); /* Since this only works for Italian numbers, this is hardcoded. */ if (preg_match('/^.*??/', $to, $matches)) { $headers['From'] = $this->_params['user']; $to = $matches[2] . '@sms.vodafone.it'; $result = $mailer->send($to, $headers, $message['text']); return $result; } else { return false; } } /** * Identifies this gateway driver and returns a brief description. * * @access public * * @return array Array of driver info. */ function getInfo() { $info['name'] = _("Vodafone Italy via SMTP"); $info['desc'] = _("This driver allows sending of messages via SMTP through the Vodafone Italy gateway, only to Vodafone numbers. It requires an email account with Vodafone Italy (http://www.190.it)."); return $info; } /** * Returns the required parameters for this gateway driver. * * @access public * * @return array Array of required parameters. */ function getParams() { $params = array(); $params['user'] = array('label' => _("Username"), 'type' => 'text'); return $params; } /** * Returns the parameters that can be set as default for sending messages * using this gateway driver and displayed when sending messages. * * @access public * * @return array Array of parameters that can be set as default. */ function getDefaultSendParams() { return array(); } /** * Returns the parameters for sending messages using this gateway driver, * displayed when sending messages. These are filtered out using the * default values set up when creating the gateway. * * @access public * * @return array Array of required parameters. * @todo Would be nice to use a time/date setup rather than minutes from * now for the delivery time. Upload field for ringtones/logos? */ function getSendParams($params) { return array(); } /** * Returns a string representation of an error code. * * @access public * * @param int $error The error code to look up. * @param optional string $text An existing error text to use to raise a * PEAR Error. * * @return mixed A textual message corrisponding to the error code or a * PEAR Error if passed an existing error text. * * @todo Check which of these are actually required and trim down the list. */ function getError($error, $error_text = '') { } } From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:27 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification Notification.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143311.3CC62102C76@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Notification Added Files: Notification.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Notification.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Notification */ class Notification { /** * Hash containing all attached listener objects. * * @var array $_listeners */ var $_listeners = array(); /** * Returns a reference to the global Notification object, only * creating it if it doesn't already exist. * * This method must be invoked as: * $notification = &Notification::singleton() * * @return object Notification The Horde Notification instance. */ function &singleton() { static $notification; if (!isset($notification)) { $notification = new Notification(); } return $notification; } /** * Initialize the notification system, set up any needed session * variables, etc. Should never be called except by * &Notification::singleton(); * * @access private */ function Notification() { /* Make sure the message stack is registered in the session, * and obtain a global-scope reference to it. */ if (!isset($_SESSION['hordeMessageStacks'])) { $_SESSION['hordeMessageStacks'] = array(); } } /** * Registers a listener with the notification object and includes * the necessary library file dynamically. * * @param string $driver The name of the listener to attach. * These names must be unique; further * listeners with the same name will be * ignored. * @param optional array $params A hash containing any additional * configuration or connection parameters * a listener driver might need. * @param optional string $class The class name from which the driver * was instantiated if not the default * one. If given you have to include the * library file containing this class * yourself. * This is useful if you want the * listener driver to be overriden by an * application's implementation. */ function &attach($listener, $params = array(), $class = null) { $listener = basename($listener); if (!empty($this->_listeners[$listener])) { return false; } if (is_null($class)) { require_once dirname(__FILE__) . '/Notification/Listener/' . $listener . '.php'; $class = 'Notification_Listener_' . $listener; } if (class_exists($class)) { $this->_listeners[$listener] = &new $class($params); if (!isset($_SESSION['hordeMessageStacks'][$listener])) { $_SESSION['hordeMessageStacks'][$listener] = array(); } return $this->_listeners[$listener]; } else { Horde::fatal(PEAR::raiseError(sprintf('Notification listener %s not found.', $listener)), __FILE__, __LINE__); } } /** * Remove a listener from the notification list. * * @access public * * @param string $listner The name of the listener to detach. */ function detach($listener) { $listener = basename($listener); if (!isset($this->_listeners[$listener])) { return PEAR::raiseError(sprintf('Notification listener %s not found.', $listener)); } $list = $this->_listeners[$listener]; unset($this->_listeners[$listener]); unset($_SESSION['hordeMessageStacks'][$list->getName()]); return true; } /** * Add an event to the Horde message stack. * * The event type parameter should begin with 'horde.' unless the * application defines its own Notification_Listener subclass that * handles additional codes. * * @access public * * @param mixed $event Notification_Event object or message string. * @param optional integer $type The type of message: 'horde.error', * 'horde.warning', 'horde.success', or * 'horde.message'. * @param optional array $flags Array of optional flags that will be * passed to the registered listeners. */ function push($event, $type = 'horde.message', $flags = array()) { if (!is_a($event, 'Notification_Event') && !is_a($event, 'PEAR_Error')) { /* Transparently create a Notification_Event object and * set the message attribute. */ require_once dirname(__FILE__) . '/Notification/Event.php'; $event = &new Notification_Event($event); } if (is_a($event, 'PEAR_Error')) { Horde::logMessage($event, __FILE__, __LINE__, PEAR_LOG_DEBUG); } foreach ($this->_listeners as $listener) { if ($listener->handles($type)) { $_SESSION['hordeMessageStacks'][$listener->getName()][] = array('type' => $type, 'class' => get_class($event), 'event' => serialize($event), 'flags' => serialize($flags)); } } } /** * Passes the message stack to all listeners and asks them to * handle their messages. * * @access public * * @param optional array $options An array containing display options * for the listeners. */ function notify($options = array()) { if (!isset($options['listeners'])) { $options['listeners'] = array_keys($this->_listeners); } elseif (!is_array($options['listeners'])) { $options['listeners'] = array($options['listeners']); } foreach ($options['listeners'] as $listener) { $this->_listeners[$listener]->notify($_SESSION['hordeMessageStacks'][$this->_listeners[$listener]->getName()], $options); } } /** * Return the number of notification messages in the stack. * * @author David Ulevitch * * @access public * * @param optional string $my_listener The name of the listener. * * @return integer The number of messages in the stack. * * @since Horde 2.2 */ function count($my_listener = null) { if (is_null($my_listener)) { $count = 0; foreach ($this->_listeners as $listener) { if (isset($_SESSION['hordeMessageStacks'][$listener->getName()])) { $count += count($_SESSION['hordeMessageStacks'][$listener->getName()]); } } return $count; } else { return @count($_SESSION['hordeMessageStacks'][$this->_listeners[$my_listener]->getName()]); } } } --- NEW FILE: package.xml --- Horde_Notification Horde Notification System The Notification:: class provides a subject-observer pattern for raising and showing messages of different types and to different listeners. LGPL yunosh lead Jan Schneider jan@horde.org 0.0.1 alpha 2003-07-05 Initial packaging. gettext Horde_Framework 0.0.1 alpha 2003-07-05 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:28 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification Event.php, NONE, 1.1 Listener.php, NONE, 1.1 Message-ID: <20051014143311.A90CF102C09@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Notification/Notification Added Files: Event.php Listener.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Event.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Hans Lellelid * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Notification */ class Notification_Event { /** * The message being passed. * @var string $_message * @access private */ var $_message = ''; /** * If passed, sets the message for this event. * * @param string $message (optional) The text message for this event. * @access public */ function Notification_Event($message = null) { if (!is_null($message)) { $this->setMessage($message); } } /** * Sets the text message for this event. * * @param string $message The text message to display. * @access public */ function setMessage($message) { $this->_message = $message; } /** * Gets the text message for this event. * * @return string The text message to display. * @access public */ function getMessage() { return $this->_message; } } --- NEW FILE: Listener.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Notification */ class Notification_Listener { /** * Array of message types that this listener handles. * * @var array $_handles */ var $_handles = array(); /** * Constructor * * @access public */ function Notification_Listener() { } /** * Does this listener handle a certain type of message? * * @access public * * @param string $type The message type in question. * * @return boolean Whether this listener handles the type. */ function handles($type) { return isset($this->_handles[$type]); } /** * Return a unique identifier for this listener. * * @access public * * @return string Unique id. */ function getName() { return get_class($this); } /** * Outputs the status line, sends emails, pages, etc., if there * are any messages on this listener's message stack. * * @access public * * @param array &$messageStack The stack of messages. * @param optional array $options An array of options. * Options: 'nospace' */ function notify(&$messageStacks, $options) { } /** * Processes one message from the message stack. * * @access public * * @param array $message One message hash from the stack. */ function getMessage($message) { } /** * Unserialize an event from the message stack, checking to see if * the appropriate class exists and kludging it into a base * Notification_Event object if not. * * @access public */ function getEvent($message) { $ob = false; if (class_exists($message['class'])) { $ob = @unserialize($message['event']); } else { require_once dirname(__FILE__) . '/Event.php'; $ob = @unserialize($message['event']); if (!method_exists($ob, 'getMessage')) { if (isset($ob->_message)) { $ob = &new Notification_Event($ob->_message); } } } /* If we've failed to create a valid Notification_Event object * (or subclass object) so far, return a PEAR_Error. */ if (!method_exists($ob, 'getMessage')) { $ob = PEAR::raiseError('Unable to decode message event: ' . $message['event']); } return $ob; } /** * Unserialize an array of event flags from the message stack. If * this event has no flags, or the flags array could not be * unserialized, an empty array is returned. * * @access public * * @return array An array of flags. */ function getFlags($message) { /* If this message doesn't have any flags, return an empty * array. */ if (empty($message['flags'])) { return array(); } /* Unserialize the flags array from the message. */ $flags = @unserialize($message['flags']); /* If we couldn't unserialize the flags array, return an empty * array. */ if (!is_array($flags)) { return array(); } return $flags; } } From cvs at intevation.de Fri Oct 14 16:33:11 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:30 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener javascript.php, NONE, 1.1 mobile.php, NONE, 1.1 status.php, NONE, 1.1 Message-ID: <20051014143311.AF4B0102C0C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Notification/Notification/Listener Added Files: javascript.php mobile.php status.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: javascript.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Notification */ class Notification_Listener_javascript extends Notification_Listener { /** * Constructor * * @access public */ function Notification_Listener_javascript() { $this->_handles = array('javascript' => ''); } /** * Return a unique identifier for this listener. * * @access public * * @return string Unique id. */ function getName() { return 'javascript'; } /** * Outputs the javascript code if there are any messages on the * 'javascript' message stack and if the 'notify_javascript' option is set. * * @access public * * @param array &$messageStack The stack of messages. * @param optional array $options An array of options. * Options: 'noscript' */ function notify(&$messageStack, $options = array()) { if (count($messageStack)) { if (empty($options['noscript'])) { echo '\n"; } } } /** * Outputs one message. * * @access public * * @param array $message One message hash from the stack. */ function getMessage($message) { $event = $this->getEvent($message); echo $event->getMessage() . "\n"; } } --- NEW FILE: mobile.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Notification */ class Notification_Listener_mobile extends Notification_Listener { /** * The Horde_Mobile:: object that status lines should be added to. * * @var object Horde_Mobile $_mobile */ var $_mobile = null; /** * Constructor * * @access public */ function Notification_Listener_mobile() { $this->_handles = array('horde.error' => _("ERR"), 'horde.success' => _("SUCCESS"), 'horde.warning' => _("WARN"), 'horde.message' => _("MSG")); } /** * Associate a Horde_Mobile:: object with the listener. * * @param object Horde_Mobile The Horde_Mobile:: object to send * status lines to. */ function setMobileObject(&$mobile) { $this->_mobile = &$mobile; } /** * Return a unique identifier for this listener. * * @access public * * @return string Unique id. */ function getName() { return 'mobile'; } /** * Outputs the status line if there are any messages on the 'mobile' * message stack. * * @access public * * @param array &$messageStack The stack of messages. * @param optional array $options An array of options. * Options: 'nospace' */ function notify(&$messageStack, $options = array()) { if (count($messageStack)) { while ($message = array_shift($messageStack)) { $this->getMessage($message); } $t = &$this->_mobile->add(new Horde_Mobile_text("\n")); $t->set('linebreaks', true); } } /** * Outputs one message. * * @access public * * @param array $message One message hash from the stack. */ function getMessage($message) { $event = $this->getEvent($message); $this->_mobile->add(new Horde_Mobile_text(sprintf(_("%s: %s"), $this->_handles[$message['type']], $event->getMessage()))); } } --- NEW FILE: status.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Notification */ class Notification_Listener_status extends Notification_Listener { /** * Constructor * * @access public */ function Notification_Listener_status() { $this->_handles = array('horde.error' => array('alerts/error.gif', _("Error")), 'horde.success' => array('alerts/success.gif', _("Success")), 'horde.warning' => array('alerts/warning.gif', _("Warning")), 'horde.message' => array('alerts/message.gif', _("Message"))); } /** * Return a unique identifier for this listener. * * @access public * * @return string Unique id. */ function getName() { return 'status'; } /** * Outputs the status line if there are any messages on the 'status' * message stack. * * @access public * * @param array &$messageStack The stack of messages. * @param optional array $options An array of options. * Options: 'nospace' */ function notify(&$messageStack, $options = array()) { if (count($messageStack)) { echo '
'; while ($message = array_shift($messageStack)) { $this->getMessage($message); } echo "
\n"; if (empty($options['nospace'])) { echo "
\n"; } } } /** * Outputs one message. * * @access public * * @param array $message One message hash from the stack. */ function getMessage($message) { global $registry; $event = $this->getEvent($message); $text = $event->getMessage(); if (!in_array('content.raw', $this->getFlags($message))) { $text = htmlspecialchars($text); } echo '' . Horde::img($this->_handles[$message['type']][0], $this->_handles[$message['type']][1], '', $registry->getParam('graphics', 'horde')) . '  ' . $text . ''; } } From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:33 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Perms Perms.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143312.0C29E102C0F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Perms In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Perms Added Files: Perms.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Perms.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Perms */ class Perms { /** * Pointer to a DataTree instance to manage the different * permissions. * * @var object DataTree $_datatree */ var $_datatree; /** * Constructor. */ function Perms() { global $conf; if (!isset($conf['datatree']['driver'])) { Horde::fatal(_("You must configure a DataTree backend to use Horde."), __FILE__, __LINE__); } $driver = $conf['datatree']['driver']; $this->_datatree = &DataTree::singleton($driver, array_merge(Horde::getDriverConfig('datatree', $driver), array('group' => 'horde.perms'))); } /** * Attempts to return a reference to a concrete Perms instance. * It will only create a new instance if no Perms instance * currently exists. * * This method must be invoked as: $var = &Perms::singleton() * * @return object Perms The concrete Perm reference, or false on an * error. */ function &singleton() { static $perm; if (!isset($perm)) { $perm = &new Perms(); } return $perm; } /** * Return the available permissions for a given level. * * @param string $name The perm's name. * * @return array An array of available permissions and their titles. */ function getAvailable($name) { global $registry; if (empty($name)) { /* No name passed, so top level permissions are requested. These * can only be applications. */ $apps = $registry->listApps(array('notoolbar', 'active', 'hidden'), true); asort($apps); return $apps; } else { /* Name has been passed, explode the name to get all the levels in * permission being requisted, with the app as the first level. */ $levels = array(); $levels = explode(':', $name); /* First level is always app. */ $app = $levels[0]; /* Return empty if no app defined API method for providing * permission information. */ if (!$registry->hasMethod('perms', $app)) { return ''; } /* Call the app's permission function to return the permissions * specific to this app. */ $perms = $registry->callByPackage($app, 'perms'); require_once 'Horde/Array.php'; /* Get the part of the app's permissions based on the permission * name requested. */ $childs = Horde_Array::getElement($perms['tree'], $levels); if ($childs === false || !is_array($childs)) { /* No array of childs available for this permission name. */ return $childs; } $perms_list = array(); foreach ($childs as $perm_key => $perm_val) { $perms_list[$perm_key] = $perms['title'][$name . ':' . $perm_key]; } return $perms_list; } } /** * Given a permission name, return the title for that permission by * looking it up in the app's permission api. * * @param string $name The perm's name. * * @return string The title for the permission. */ function getTitle($name) { global $registry; $levels = explode(':', $name); if (count($levels) == 1) { return $name; } $perm = array_pop($levels); /* First level is always app. */ $app = $levels[0]; /* Return empty if no app defined API method for providing * permission information. */ if (!$registry->hasMethod('perms', $app)) { return DataTree::getShortName($name); } /* Call the app's permission function to return the * permissions specific to this app. */ $perms = $registry->callByPackage($app, 'perms'); return isset($perms['title'][$name]) ? $perms['title'][$name] : $name; } /** * Return a new permissions object. * * @param string $name The perm's name. * * @return object DataTreeObject_Permissions A new permissions object. */ function &newPermission($name) { if (empty($name)) { return PEAR::raiseError('Permission names must be non-empty'); } $perm = &new DataTreeObject_Permission($name); $perm->setPermsOb($this); return $perm; } /** * Return a DataTreeObject_Permission object corresponding to the * named perm, with the users and other data retrieved * appropriately. * * @param string $name The name of the perm to retrieve. */ function &getPermission($name) { /* Cache of previously retrieved permissions. */ static $permsCache = array(); if (isset($permsCache[$name])) { return $permsCache[$name]; } $permsCache[$name] = $this->_datatree->getObject($name, 'DataTreeObject_Permission'); if (!is_a($permsCache[$name], 'PEAR_Error')) { $permsCache[$name]->setPermsOb($this); } return $permsCache[$name]; } /** * Return a DataTreeObject_Permission object corresponding to the * given unique ID, with the users and other data retrieved * appropriately. * * @param string $cid The unique ID of the permission to retrieve. */ function &getPermissionById($cid) { $perm = $this->_datatree->getObjectById($cid, 'DataTreeObject_Permission'); if (!is_a($perm, 'PEAR_Error')) { $perm->setPermsOb($this); } return $perm; } /** * Add a perm to the perms system. The perm must first be created * with Perm::newPermission(), and have any initial users added to * it, before this function is called. * * @param object DataTreeObject_Permission $perm The new perm object. */ function addPermission($perm) { if (!is_a($perm, 'DataTreeObject_Permission')) { return PEAR::raiseError('Permissions must be DataTreeObject_Permission objects or extend that class.'); } return $this->_datatree->add($perm); } /** * Store updated data - users, etc. - of a perm to the backend * system. * * @param object DataTreeObject_Permission $perm The perm to update. */ function updatePermission($perm) { if (!is_a($perm, 'DataTreeObject_Permission')) { return PEAR::raiseError('Permissions must be DataTreeObject_Permission objects or extend that class.'); } return $this->_datatree->updateData($perm); } /** * Remove a perm from the perms system permanently. * * @param object DataTreeObject_Permission $perm The permission to remove. * * @param optional boolean force [default = false] Force to remove * every child */ function removePermission($perm, $force = false) { if (!is_a($perm, 'DataTreeObject_Permission')) { return PEAR::raiseError('Permissions must be DataTreeObject_Permission objects or extend that class.'); } return $this->_datatree->remove($perm->getName(), $force); } /** * Find out what rights the given user has to this object. * * @param mixed $permission The full permission name of the object * to check the permissions of, or the * DataTreeObject_Permission object. * @param string $user (optional) The user to check for. * Defaults to Auth::getAuth(). * @param string $creator (optional) The user who created the event. * * @return integer Any permissions the user has, false if there * are none. */ function getPermissions($permission, $user = null, $creator = null) { if (!is_a($permission, 'DataTreeObject_Permission')) { $permission = &$this->getPermission($permission); if (is_a($permission, 'PEAR_Error')) { Horde::logMessage($permission, __FILE__, __LINE__); return false; } } if (is_null($user)) { $user = Auth::getAuth(); } // If this is a guest user, only check guest permissions. if (empty($user)) { return $permission->getGuestPermissions(); } // Check user-level permissions first. $userperms = $permission->getUserPermissions(); if (isset($userperms[$user])) { return $userperms[$user]; } // If no user permissions are found, try group permissions. if (isset($permission->data['groups']) && is_array($permission->data['groups']) && count($permission->data['groups'])) { require_once 'Horde/Group.php'; $groups = &Group::singleton(); $composite_perm = null; foreach ($permission->data['groups'] as $group => $perm) { if ($groups->userIsInGroup($user, $groups->getGroupName($group))) { if (is_null($composite_perm)) { $composite_perm = 0; } $composite_perm |= $perm; } } if (!is_null($composite_perm)) { return $composite_perm; } } // If there is no creator, then assume the current user will // be the creator (likely it's an add). if (empty($creator)) { $creator = Auth::getAuth(); } // If the user is the creator of the event see if there are // creator permissions. if (!empty($user) && $user == $creator && ($perms = $permission->getCreatorPermissions()) !== null) { return $perms; } // If there are default permissions, return them. if (($perms = $permission->getDefaultPermissions()) !== null) { return $perms; } // Otherwise, deny all permissions to the object. return false; } /** * Get the unique identifier of this permission. * * @param object DataTreeObject_Permission $permission The permission object to get the ID of. * * @return integer The unique id. */ function getPermissionId($permission) { return $this->_datatree->getId($permission->getName()); } /** * Find out if the user has the specified rights to the given object. * * @param string $permission The permission to check. * @param string $user The user to check for. * @param int $perm The permission level that needs to be checked for. * @param string $creator (optional) The creator of the event * * @return boolean True if the user has the specified permissions, and * false otherwise. */ function hasPermission($permission, $user, $perm, $creator = null) { return ($this->getPermissions($permission, $user, $creator) & $perm); } /** * Check if a permission exists in the system. * * @param string $permission The permission to check. * * @return boolean True if the permission exists, false otherwise. */ function exists($permission) { return $this->_datatree->exists($permission); } /** * Get a list of parent permissions. * * @param string $child The name of the child to retrieve parents for. * * @return array [child] [parent] with a tree format */ function getParents($child) { return $this->_datatree->getParents($child); } /** * Returns an array of the available permissions. * * @return array The available permissions as an array. */ function getPermsArray() { return array(PERMS_SHOW => _("Show"), PERMS_READ => _("Read"), PERMS_EDIT => _("Edit"), PERMS_DELETE => _("Delete")); } /** * Given an integer value of permissions returns an array representation * of the integer. * * @param int $int The integer representation of permissions. */ function integerToArray($int) { static $array = array(); if (isset($array[$int])) { return $array[$int]; } $array[$int] = array(); /* Get the available perms array. */ $perms = Perms::getPermsArray(); /* Loop through each perm and check if its value is included in the * integer representation. */ foreach ($perms as $val => $label) { if ($int & $val) { $array[$int][$val] = true; } } return $array[$int]; } } /** * Extension of the DataTreeObject class for storing Permission * information in the DataTree driver. If you want to store * specialized Permission information, you should extend this class * instead of extending DataTreeObject directly. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Perms */ class DataTreeObject_Permission extends DataTreeObject { /** * The Perms object which this permission came from - needed for * updating data in the backend to make changes stick, etc. * * @var object Perms $permsOb */ var $_permsOb; /** * The DataTreeObject_Permission constructor. Just makes sure to * call the parent constructor so that the perm's name is set * properly. * * @param string $name The name of the perm. */ function DataTreeObject_Permission($name) { parent::DataTreeObject($name); } /** * Associates a Perms object with this perm. * * @param object Perm $permsOb The Perm object. */ function setPermsOb(&$permsOb) { $this->_permsOb = &$permsOb; } /** * Get the unique identifier of this permission. * * @return integer The unique id. */ function getId() { return $this->_permsOb->getPermissionId($this); } /** * Update the permissions based on data passed in the array. * * @param array $perms An array containing the permissions which are to be * updated. */ function updatePermissions($perms) { /* Array of permission types to iterate through. */ $perm_types = Perms::getPermsArray(); foreach ($perms as $perm_class => $perm_values) { switch ($perm_class) { case 'default': case 'guest': case 'creator': foreach ($perm_types as $val => $label) { if (!empty($perm_values[$val])) { $this->setPerm($perm_class, $val, false); } else { $this->unsetPerm($perm_class, $val, false); } } break; case 'u': case 'g': $permId = array('class' => $perm_class == 'u' ? 'users' : 'groups'); /* Figure out what names that are stored in this permission * class have not been submitted for an update, ie. have been * removed entirely. */ $current_names = isset($this->data[$permId['class']]) ? array_keys($this->data[$permId['class']]) : array(); $updated_names = array_keys($perm_values); $removed_names = array_diff($current_names, $updated_names); /* Remove any names that have been completely unset. */ foreach ($removed_names as $name) { unset($this->data[$permId['class']][$name]); } /* If nothing to actually update finish with this case. */ if (is_null($perm_values)) { continue; } /* Loop through the names and update permissions for each. */ foreach ($perm_values as $name => $name_values) { $permId['name'] = $name; foreach ($perm_types as $val => $label) { if (!empty($name_values[$val])) { $this->setPerm($permId, $val, false); } else { $this->unsetPerm($permId, $val, false); } } } break; } } } /** * FIXME: needs docs */ function setPerm($permId, $permission, $update = true) { if (is_array($permId)) { if (empty($permId['name'])) { return; } if (isset($this->data[$permId['class']][$permId['name']])) { $this->data[$permId['class']][$permId['name']] |= $permission; } else { $this->data[$permId['class']][$permId['name']] = $permission; } } else { if (isset($this->data[$permId])) { $this->data[$permId] |= $permission; } else { $this->data[$permId] = $permission; } } if ($update) { $this->_permsOb->updatePermission($this); } } /** * FIXME: needs docs */ function unsetPerm($permId, $permission, $update = true) { if (is_array($permId)) { if (empty($permId['name'])) { return; } if (isset($this->data[$permId['class']][$permId['name']])) { $this->data[$permId['class']][$permId['name']] &= ~$permission; if (empty($this->data[$permId['class']][$permId['name']])) { unset($this->data[$permId['class']][$permId['name']]); } if ($update) { $this->_permsOb->updatePermission($this); } } } else { if (isset($this->data[$permId])) { $this->data[$permId] &= ~$permission; if ($update) { $this->_permsOb->updatePermission($this); } } } } /** * Give a user additional permissions to this object. * * @param string $user The user to grant additional permissions to. * @param constant $permission The permission (PERMS_DELE, etc.) to add. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function addUserPermission($user, $permission, $update = true) { if (empty($user)) { return; } if (isset($this->data['users'][$user])) { $this->data['users'][$user] |= $permission; } else { $this->data['users'][$user] = $permission; } if ($update) { $this->_permsOb->updatePermission($this); } } /** * Grant guests additional permissions to this object. * * @param constant $permission The permission (PERMS_DELE, etc.) to add. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function addGuestPermission($permission, $update = true) { if (isset($this->data['guest'])) { $this->data['guest'] |= $permission; } else { $this->data['guest'] = $permission; } if ($update) { $this->_permsOb->updatePermission($this); } } /** * Grant creators additional permissions to this object. * * @param constant $permission The permission (PERMS_DELE, etc.) to add. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function addCreatorPermission($permission, $update = true) { if (isset($this->data['creator'])) { $this->data['creator'] |= $permission; } else { $this->data['creator'] = $permission; } if ($update) { $this->_permsOb->updatePermission($this); } } /** * Grant additional default permissions to this object. * * @param integer $permission The permission (PERMS_DELE, etc.) to add. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function addDefaultPermission($permission, $update = true) { if (isset($this->data['default'])) { $this->data['default'] |= $permission; } else { $this->data['default'] = $permission; } if ($update) { $this->_permsOb->updatePermission($this); } } /** * Give a group additional permissions to this object. * * @param integer $groupId The id of the group to grant additional permissions to. * @param constant $permission The permission (PERMS_DELE, etc.) to add. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function addGroupPermission($groupId, $permission, $update = true) { if (empty($groupId)) { return; } if (isset($this->data['groups'][$groupId])) { $this->data['groups'][$groupId] |= $permission; } else { $this->data['groups'][$groupId] = $permission; } if ($update) { $this->_permsOb->updatePermission($this); } } /** * Remove a permission that a user currently has on this object. * * @param string $user The user to remove the permission from. * @param constant $permission The permission (PERMS_DELE, etc.) to * remove. * @param optional bool $update Whether to automatically update the * backend. Defaults to true. */ function removeUserPermission($user, $permission, $update = true) { if (empty($user)) { return; } if (isset($this->data['users'][$user])) { $this->data['users'][$user] &= ~$permission; if (empty($this->data['users'][$user])) { unset($this->data['users'][$user]); } if ($update) { $this->_permsOb->updatePermission($this); } } } /** * Remove a permission that guests currently have on this object. * * @param constant $permission The permission (PERMS_DELE, etc.) to remove. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function removeGuestPermission($permission, $update = true) { if (isset($this->data['guest'])) { $this->data['guest'] &= ~$permission; if ($update) { $this->_permsOb->updatePermission($this); } } } /** * Remove a permission that creators currently have on this object. * * @param constant $permission The permission (PERMS_DELE, etc.) to remove. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function removeCreatorPermission($permission, $update = true) { if (isset($this->data['creator'])) { $this->data['creator'] &= ~$permission; if ($update) { $this->_permsOb->updatePermission($this); } } } /** * Remove a default permission on this object. * * @param constant $permission The permission (PERMS_DELE, etc.) to remove. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function removeDefaultPermission($permission, $update = true) { if (isset($this->data['default'])) { $this->data['default'] &= ~$permission; if ($update) { $this->_permsOb->updatePermission($this); } } } /** * Remove a permission that a group currently has on this object. * * @param integer $groupId The id of the group to remove the permission from. * @param constant $permission The permission (PERMS_DELE, etc.) to remove. * @param boolean $update (optional) Whether to automatically update the * backend. Defaults to true. */ function removeGroupPermission($groupId, $permission, $update = true) { if (empty($groupId)) { return; } if (isset($this->data['groups'][$groupId])) { $this->data['groups'][$groupId] &= ~$permission; if (empty($this->data['groups'][$groupId])) { unset($this->data['groups'][$groupId]); } if ($update) { $this->_permsOb->updatePermission($this); } } } /** * Save any changes to this object to the backend permanently. */ function save() { $this->_permsOb->updatePermission($this); } /** * Get an array of all user permissions on this object. * * @param optional integer $perm List only users with this permission * level. Defaults to all users. * * @return array All user permissions for this object, indexed by user. */ function getUserPermissions($perm = null) { if (!isset($this->data['users']) || !is_array($this->data['users'])) { return array(); } elseif (!$perm) { return $this->data['users']; } else { $users = array(); foreach ($this->data['users'] as $user => $uperm) { if ($uperm & $perm) { $users[$user] = $uperm; } } return $users; } } /** * Get the guest permissions on this object. * * @return integer The guest permissions on this object. */ function getGuestPermissions() { return !empty($this->data['guest']) ? $this->data['guest'] : null; } /** * Get the creator permissions on this object. * * @return integer The creator permissions on this object. */ function getCreatorPermissions() { return !empty($this->data['creator']) ? $this->data['creator'] : null; } /** * Get the default permissions on this object. * * @return integer The default permissions on this object. */ function getDefaultPermissions() { return !empty($this->data['default']) ? $this->data['default'] : null; } /** * Get an array of all group permissions on this object. * * @param optional integer $perm List only users with this permission * level. Defaults to all users. * * @return array All group permissions for this object, indexed by group. */ function getGroupPermissions($perm = null) { if (!isset($this->data['groups']) || !is_array($this->data['groups'])) { return array(); } elseif (!$perm) { return $this->data['groups']; } else { $groups = array(); foreach ($this->data['groups'] as $group => $gperm) { if ($gperm & $perm) { $groups[$group] = $gperm; } } return $groups; } } } --- NEW FILE: package.xml --- Horde_Perms Horde Permissions System The Perms:: class provides the Horde permissions system. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-05 Initial packaging. gettext Horde_Framework Horde_Array Horde_DataTree Horde_Group Horde_Tree 0.0.1 alpha 2003-07-05 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:35 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Perms/Perms UI.php, NONE, 1.1 Message-ID: <20051014143312.15921102C10@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Perms/Perms In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Perms/Perms Added Files: UI.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: UI.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Perms */ class Perms_UI { /** * The Perms object we're displaying UI stuff for. * @var object Perms $_perms */ var $_perms; /** * The Horde_Form object that will be used for displaying the edit form. * @var object Horde_Form $_form */ var $_form = null; /** * The Variables object used in Horde_Form. * @var object Variables $_vars */ var $_vars = null; function Perms_UI(&$perms) { $this->_perms = &$perms; } /** * Return a Horde_Tree representation of the permissions tree. * * @return string The html showing the permissions as a Horde_Tree. */ function renderTree($current = -1) { require_once 'Horde/Tree.php'; /* Get the perms tree. */ $nodes = $this->_perms->_datatree->get(DATATREE_FORMAT_FLAT, -1, true); $spacer = '    '; $icondir = array('icondir' => $GLOBALS['registry']->getParam('graphics')); $perms_node = $icondir + array('icon' => 'perms.gif'); $add = Horde::applicationUrl('admin/perms/addchild.php'); $edit = Horde::applicationUrl('admin/perms/edit.php'); $delete = Horde::applicationUrl('admin/perms/delete.php'); $edit_img = Horde::img('edit.gif', _("Edit Permission"), 'hspace="2"'); $delete_img = Horde::img('delete.gif', _("Delete Permission"), 'hspace="2"'); /* Set up the tree. */ $tree = &Horde_Tree::singleton('datatree', 'javascript'); $tree->setOption(array('border' => '0', 'class' => 'item', 'cellpadding' => '0', 'cellspacing' => '0', 'alternate' => true)); foreach ($nodes as $cid => $node) { $node_class = ($current == $cid) ? array('class' => 'selected') : array(); if ($cid == -1) { $add_img = Horde::img('perms.gif', _("Add New Permission"), 'hspace="2"'); $add_link = Horde::link(Util::addParameter($add, 'cid', $cid), _("Add New Permission")) . $add_img . ''; $base_node_params = $icondir + array('icon' => 'administration.gif'); $tree->addNode($cid, null, _("All Permissions"), 0, true, $base_node_params + $node_class, array($spacer, $add_link)); } else { $add_img = Horde::img('perms.gif', _("Add Child Permission"), 'hspace="2"'); $add_link = Horde::link(Util::addParameter($add, 'cid', $cid), _("Add Child Permission")) . $add_img . ''; $edit_link = Horde::link(Util::addParameter($edit, 'cid', $cid), _("Edit Permission")) . $edit_img . ''; $delete_link = Horde::link(Util::addParameter($delete, 'cid', $cid), _("Delete Permission")) . $delete_img . ''; $parent_id = $this->_perms->_datatree->getParent($node); $perms_extra = array($spacer, $add_link, $edit_link, $delete_link); $tree->addNode($cid, $parent_id, DataTree::getShortName($node), substr_count($node, ':') + 1, false, $perms_node + $node_class, $perms_extra); } } return $tree->renderTree(); } /** * Set an existing form object to use for the edit form. * * @access public * * @param object Horde_Form $form An existing Horde_Form object to use. */ function &setForm(&$form) { $this->_form = &$form; } /** * Set an existing vars object to use for the edit form. * * @access public * * @param object Variables $vars An existing Variables object * to use. */ function &setVars(&$vars) { $this->_vars = &$vars; } /** * Create a form to add a permission. * * @access public * * @param object $permission * @param optional string $force_choice If the permission to be added * can be one of many, setting this * will force the choice to one * particular. */ function setupAddForm($permission, $force_choice = null) { /* Initialise form if required. */ $this->_formInit(); $this->_form->setTitle(Horde::img('perms.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . sprintf(_("Add a child permission to '%s'"), $permission->getName())); $this->_form->setButtons(_("Add"), true); $this->_vars->set('parent_perm_id', $this->_perms->getPermissionId($permission)); $this->_form->addHidden('', 'parent_perm_id', 'text', false); /* Set up the actual child adding field. */ $child_perms = $this->_perms->getAvailable($permission->getName()); if ($child_perms === false) { /* False, so no childs are to be added below this level. */ $this->_form->addVariable(_("No child permissions are to be added below this level."), 'child', 'description', false); } elseif (is_array($child_perms)) { if (!empty($force_choice)) { /* Choice array available, but choice being forced. */ $this->_vars->set('child', $force_choice); $this->_form->addVariable(_("Permissions for"), 'child', 'enum', true, true, null, array($child_perms)); } else { /* Choice array available, so set up enum field. */ $this->_form->addVariable(_("Permissions for"), 'child', 'enum', true, false, null, array($child_perms)); } } else { /* No choices returned, so give a free form text field. */ $this->_form->addVariable(_("Permissions for"), 'child', 'text', true); } } /** * Function to validate any add form input. * * @access public * * @returns mixed Either false if the form does not validate correctly * or an array with all the form values. */ function validateAddForm(&$info) { if (!$this->_form->validate($this->_vars)) { return false; } $this->_form->getInfo($this->_vars, $info); return true; } /** * Create a permission editing form. * * @access public * * @param object $permission */ function setupEditForm($permission) { /* Initialise form if required. */ $this->_formInit(); $this->_form->setButtons(_("Update"), true); $perm_id = $this->_perms->getPermissionId($permission); $this->_form->addHidden('', 'perm_id', 'text', false); /* Set up the columns for the permissions matrix. */ $cols = Perms::getPermsArray(); /* Default permissions. */ $perm_val = $permission->getDefaultPermissions(); /* Define a single matrix row for default perms. */ $matrix = array(); $matrix[0] = Perms::integerToArray($perm_val); $this->_form->setSection('default', Horde::img('perms.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . _("Default Permissions"), false); $this->_form->addVariable(_("Default permissions"), 'default', 'matrix', false, false, null, array($cols, array(0 => ''), $matrix)); /* Guest permissions. */ $perm_val = $permission->getGuestPermissions(); /* Define a single matrix row for guest perms. */ $matrix = array(); $matrix[0] = Perms::integerToArray($perm_val); $this->_form->setSection('guest', Horde::img('guest.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . _("Guest Permissions"), false); $this->_form->addVariable(_("Guest permissions"), 'guest', 'matrix', false, false, null, array($cols, array(0 => ''), $matrix)); /* Object creator permissions. */ $perm_val = $permission->getCreatorPermissions(); /* Define a single matrix row for creator perms. */ $matrix = array(); $matrix[0] = Perms::integerToArray($perm_val); $this->_form->setSection('creator', Horde::img('user.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . _("Creator Permissions"), false); $this->_form->addVariable(_("Object creator permissions"), 'creator', 'matrix', false, false, null, array($cols, array(0 => ''), $matrix)); /* Users permissions. */ $perm_val = $permission->getUserPermissions(); $this->_form->setSection('users', Horde::img('user.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . _("Users"), false); $auth = &Auth::singleton($GLOBALS['conf']['auth']['driver']); if ($auth->hasCapability('list')) { /* The auth driver has list capabilities so set up an array which * the matrix field type will recognise to set up an enum box for * adding new users to the permissions matrix. */ $new_users = array(); $user_list = $auth->listUsers(); foreach ($user_list as $user) { if (!isset($perm_val[$user])) { $new_users[$user] = $user; } } } else { /* No list capabilities, setting to true so that the matrix field * type will offer a text input box for adding new users. */ $new_users = true; } /* Set up the matrix array, breaking up each permission integer into * an array. The keys of this array will be the row headers. */ $rows = array(); $matrix = array(); foreach ($perm_val as $u_id => $u_perms) { $rows[$u_id] = $u_id; $matrix[$u_id] = Perms::integerToArray($u_perms); } $this->_form->addVariable(_("User permissions"), 'u', 'matrix', false, false, null, array($cols, $rows, $matrix, $new_users)); /* Groups permissions. */ $perm_val = $permission->getGroupPermissions(); $this->_form->setSection('groups', Horde::img('group.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . _("Groups"), false); require_once 'Horde/Group.php'; $groups = &Group::singleton(); $group_list = $groups->listGroups(); if (!empty($group_list)) { /* There is an available list of groups so set up an array which * the matrix field type will recognise to set up an enum box for * adding new groups to the permissions matrix. */ $new_groups = array(); foreach ($group_list as $groupId => $group) { if (!isset($perm_val[$groupId])) { $new_groups[$groupId] = $group; } } } else { /* Do not offer a text box to add new groups. */ $new_groups = false; } /* Set up the matrix array, break up each permission integer into an * array. The keys of this array will be the row headers. */ $rows = array(); $matrix = array(); foreach ($perm_val as $g_id => $g_perms) { $rows[$g_id] = isset($group_list[$g_id]) ? $group_list[$g_id] : $g_id; $matrix[$g_id] = Perms::integerToArray($g_perms); } $this->_form->addVariable(_("Group permissions"), 'g', 'matrix', false, false, null, array($cols, $rows, $matrix, $new_groups)); /* Set form title. */ $this->_form->setTitle(Horde::img('edit.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . sprintf(_("Edit permissions for '%s'"), $this->_perms->getTitle($permission->getName()))); } /** * Function to validate any edit form input. * * @access public * * @returns mixed Either false if the form does not validate correctly * or an array with all the form values. */ function validateEditForm(&$info) { if (!$this->_form->validate($this->_vars)) { return false; } $this->_form->getInfo($this->_vars, $info); /* Collapse the array for default/guest/creator. */ $info['default'] = isset($info['default'][0]) ? $info['default'][0] : null; $info['guest'] = isset($info['guest'][0]) ? $info['guest'][0] : null; $info['creator'] = isset($info['creator'][0]) ? $info['creator'][0] : null; return true; } /** * Create a permission deleting form. * * @access public * * @param object $permission */ function setupDeleteForm($permission) { /* Initialise form if required. */ $this->_formInit(); $this->_form->setTitle(Horde::img('delete.gif', '', '', $GLOBALS['registry']->getParam('graphics', 'horde')) . ' ' . sprintf(_("Delete permissions for '%s'"), $this->_perms->getTitle($permission->getName()))); $this->_form->setButtons(array(_("Delete"), _("Do not delete"))); $this->_form->addHidden('', 'perm_id', 'text', false); $this->_form->addVariable(sprintf(_("Delete permissions for '%s' and any sub-permissions?"), $this->_perms->getTitle($permission->getName())), 'prompt', 'description', false); } /** * Function to validate any delete form input. * * @access public * * @returns mixed If the delete button confirmation has been pressed * return true, if any other submit button has been * pressed return false. If form did not validate return * null. */ function validateDeleteForm(&$info) { $form_submit = $this->_vars->get('submitbutton'); if ($form_submit == _("Delete")) { if ($this->_form->validate($this->_vars)) { $this->_form->getInfo($this->_vars, $info); return true; } } elseif (!empty($form_submit)) { return false; } return null; } /** * Renders the edit form. * * @access public */ function renderForm($form_script = 'edit.php') { require_once 'Horde/Form/Renderer.php'; $renderer = &new Horde_Form_Renderer(); $this->_form->renderActive($renderer, $this->_vars, $form_script, 'post'); } /** * Creates any form objects if they have not been initialised yet. * * @access private */ function _formInit() { if (is_null($this->_vars)) { /* No existing vars set, get them now. */ require_once 'Horde/Variables.php'; $this->_vars = &Variables::getDefaultVariables(); } if (!is_a($this->_form, 'Horde_Form')) { /* No existing valid form object set so set up a new one. */ require_once 'Horde/Form.php'; $this->_form = &Horde_Form::singleton('', $this->_vars); } } } From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:37 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Prefs Prefs.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143312.3F853102C13@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Prefs In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Prefs Added Files: Prefs.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Prefs.php --- *Default value*, * 'locked' => *boolean*, * 'shared' => *boolean*, * 'type' => 'checkbox' * 'text' * 'password' * 'textarea' * 'select' * 'number' * 'implicit' * 'special' * 'link' - There must be a field named either 'url' * (internal application link) or 'xurl' * (external application link) if this type is used. * 'enum' * 'enum' => TODO, * 'desc' => _(*Description string*), * 'help' => *Name of the entry in the XML help file* * ); * * $Horde: framework/Prefs/Prefs.php,v 1.132 2004/04/07 14:43:12 chuck Exp $ * * Copyright 1999-2004 Jon Parise * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Prefs */ class Prefs { /** * Hash holding all of the user's preferences. Each preference is * itself a hash, so this will ultimately be multi-dimensional. * * @access private * * [*pref name*] => Array( * [d] => *default value* * [m] => *pref mask* * [v] => *pref value* * ) * * @var array $_prefs */ var $_prefs = array(); /** * String containing the name of this scope. This is used to * maintain the application scope between sets of preferences. By * default, all preferences belong to the "global" (Horde) scope. * * @var string $scope */ var $_scope = 'horde'; /** * String containing the current username. This indicates the * owner of the preferences. * * @var string $user */ var $_user = ''; /** * Boolean indicating whether preference caching should be used. * * @var boolean $caching */ var $_caching = false; /** * Hash holding preferences with hook functions defined. * * @var array $_hooks */ var $_hooks = array(); /** * Have we run hook functions yet? * * @var boolean $_hooksCalled */ var $_hooksCalled = null; /** * Default constructor (must be called from each extending class * in their constructors via parent::Prefs()). * * @access public */ function Prefs() { $this->_shutdown(); } /** * Returns the charset used by the concrete preference backend. * * @access public * * @return string The preference backend's charset. */ function getCharset() { return NLS::getCharset(); } /** * Updates the session-based preferences cache (if available) with * the current set of preferences. * * @access public */ function cacheUpdate() { /* Return immediately if caching is disabled. */ if (!$this->_caching) { return; } if (isset($_SESSION['prefs_cache'])) { /* Place each preference in the cache according to its * scope. */ foreach ($this->_prefs as $name => $pref) { $_SESSION['prefs_cache'][$this->getScope($name)][$name] = $pref; } } } /** * Tries to find the requested preferences in the cache. If they * exist, update the $prefs hash with the cached values. * * @access public * * @return boolean True on success, false on failure. */ function cacheLookup() { /* Return immediately if caching is disabled. */ if (!$this->_caching) { return false; } if (isset($_SESSION['prefs_cache']['horde']) && !empty($_SESSION['prefs_cache']['_filled'][$this->_scope]) && isset($_SESSION['prefs_cache'][$this->_scope])) { /* Restore global preferences. */ foreach ($_SESSION['prefs_cache']['horde'] as $name => $pref) { $this->_prefs[$name] = $pref; } /* Restore application-specific preferences. */ foreach ($_SESSION['prefs_cache'][$this->_scope] as $name => $pref) { $this->_prefs[$name] = $pref; } return true; } return false; } /** * Adds a new preference entry to the $prefs hash. * * @access public * * @param string $pref The name of the preference to add. * @param optional string $val The initial value of the preference. * @param optional integer $mask The initial bitmask of the preference. */ function add($pref, $val = '', $mask = 0) { if (is_array($this->_prefs)) { $this->_prefs[$pref] = array('v' => $val, 'm' => $mask, 'd' => $val); } } /** * Removes a preference entry from the $prefs hash. * * @access public * * @param string $pref The name of the preference to remove. */ function remove($pref) { if (is_array($this->_prefs)) { unset($this->_prefs[$pref]); } } /** * Sets the given preferences ($pref) to the specified value * ($val), if the preference is modifiable. * * @access public * * @param string $pref The name of the preference to modify. * @param string $val The new value for this preference. * * @return boolean True if the value was successfully set, false on a * failure. */ function setValue($pref, $val) { /* Exit early if this preference is locked or doesn't exist. */ if (!isset($this->_prefs[$pref]) || $this->isLocked($pref)) { return false; } return $this->_setValue($pref, $val); } /** * Sets the given preferences ($pref) to the specified value * ($val), whether or not the preference is user-modifiable, unset * the default bit, and set the dirty bit. * * @access protected * * @param string $pref The name of the preference to modify. * @param string $val The new value for this preference. * @param boolean $dirty True if we should mark the new value as * dirty (changed). * * @return boolean True if the value was successfully set, false on a * failure. */ function _setValue($pref, $val, $dirty = true) { global $conf; /* If the preference's value is already equal to $val, don't * bother changing it. Changing it would set the "dirty" bit, * causing an unnecessary update later on in the storage * routine. */ if (isset($this->_prefs[$pref]) && (($this->_prefs[$pref]['v'] == $val) && !$this->isDefault($pref))) { return true; } /* Check to see if the value exceeds the allowable storage * limit. */ if (isset($conf['prefs']['maxsize'])) { if (strlen($val) > $conf['prefs']['maxsize']) { global $notification; if (isset($notification)) { $notification->push(sprintf(_("The preference \"%s\" could not be saved because its data exceeded the maximum allowable size"), $pref), 'horde.error'); return false; } } } /* Assign the new value, unset the "default" bit, and set the "dirty" bit. */ if (empty($this->_prefs[$pref]['m'])) { $this->_prefs[$pref]['m'] = 0; } $this->_prefs[$pref]['v'] = $val; $this->setDefault($pref, false); if ($dirty) { $this->setDirty($pref, true); } return true; } /** * Returns the value of the requested preference. * * @access public * * @param string $pref The name of the preference to retrieve. * * @return string The value of the preference, null if it doesn't exist. */ function getValue($pref) { return (isset($this->_prefs[$pref]['v'])) ? $this->_prefs[$pref]['v'] : null; } /** * Modifies the "locked" bit for the given preference. * * @access public * * @param string $pref The name of the preference to modify. * @param boolean $bool The new boolean value for the "locked" bit. */ function setLocked($pref, $bool) { $this->_setMask($pref, $bool, _PREF_LOCKED); } /** * Returns the state of the "locked" bit for the given preference. * * @access public * * @param string $pref The name of the preference to check. * * @return boolean The boolean state of $pref's "locked" bit. */ function isLocked($pref) { return $this->_getMask($pref, _PREF_LOCKED); } /** * Modifies the "shared" bit for the given preference. * * @access public * * @param string $pref The name of the preference to modify. * @param boolean $bool The new boolean value for the "shared" bit. */ function setShared($pref, $bool) { $this->_setMask($pref, $bool, _PREF_SHARED); } /** * Returns the state of the "shared" bit for the given preference. * * @access public * * @param string $pref The name of the preference to check. * * @return boolean The boolean state of $pref's "shared" bit. */ function isShared($pref) { return $this->_getMask($pref, _PREF_SHARED); } /** * Modifies the "dirty" bit for the given preference. * * @param string $pref The name of the preference to modify. * @param boolean $bool The new boolean value for the "dirty" bit. */ function setDirty($pref, $bool) { $this->_setMask($pref, $bool, _PREF_DIRTY); } /** * Returns the state of the "dirty" bit for the given preference. * * @access public * * @param string $pref The name of the preference to check. * * @return boolean The boolean state of $pref's "dirty" bit. */ function isDirty($pref) { return $this->_getMask($pref, _PREF_DIRTY); } /** * Modifies the "default" bit for the given preference. * * @access public * * @param string $pref The name of the preference to modify. * @param boolean $bool The new boolean value for the "default" bit. * * @since Horde 2.1 */ function setDefault($pref, $bool) { $this->_setMask($pref, $bool, _PREF_DEFAULT); } /** * Returns the default value of the given preference. * * @access public * * @param string $pref The name of the preference to get the default for. * * @return string The preference's default value. */ function getDefault($pref) { return !empty($this->_prefs[$pref]['d']) ? $this->_prefs[$pref]['d'] : ''; } /** * Determines if the current preference value is the default * value from prefs.php or a user defined value * * @access public * * @param string $pref The name of the preference to check. * * @return boolean True if the preference is the application default * value. * * @since Horde 2.1 */ function isDefault($pref) { return $this->_getMask($pref, _PREF_DEFAULT); } /** * Sets the value for a given mask. * * @access private * * @param string $pref The name of the preference to modify. * @param boolean $bool The new boolean value for the "default" bit. * @param integer $mask The mask to add. */ function _setMask($pref, $bool, $mask) { if (isset($this->_prefs[$pref])) { if ($bool != $this->_getMask($pref, $mask)) { if ($bool) { $this->_prefs[$pref]['m'] |= $mask; } else { $this->_prefs[$pref]['m'] &= ~$mask; } } } } /** * Gets the boolean state for a given mask. * * @access private * * @param string $pref The name of the preference to modify. * @param integer $mask The mask to get. * * @return boolean The boolean state for the given mask. */ function _getMask($pref, $mask) { return isset($this->_prefs[$pref]['m']) ? ($this->_prefs[$pref]['m'] & $mask) : false; } /** * Determines whether the current preference is empty. * * @access public * * @param string $pref The name of the preference to check. * * @return boolean True if the preference is empty. */ function isEmpty($pref) { return empty($this->_prefs[$pref]['v']); } /** * Returns the scope of the given preference. * * @access public * * @param string $pref The name of the preference to examine. * * @return string The scope of the $pref. */ function getScope($pref) { if ($this->isShared($pref)) { return 'horde'; } else { return $this->_scope; } } /** * Return a list of "dirty" preferences. * * @access private * * @return array The list of "dirty" preferences in $this->_prefs. */ function _dirtyPrefs() { $dirty_prefs = array(); foreach (array_keys($this->_prefs) as $pref) { if ($this->isDirty($pref)) { $dirty_prefs[] = $pref; } } return $dirty_prefs; } /** * This method should be overridden by a subclass * implementation. It's here to retain code integrity in the case * that no subclass is loaded ($driver == 'none'). */ function retrieve() { /* Load defaults to make sure we have all preferences. */ $this->_setDefaults('horde'); $this->_setDefaults($this->_scope); return true; } /** * This is an abstract method that should be overridden by a * subclass implementation. It's here to retain code integrity in * the case that no subclass is loaded ($driver == 'none'). * * This function will be run at the end of every request as a * shutdown function (registered by the Prefs:: constructor). All * prefs with the dirty bit set will be saved to the storage * backend at this time; thus, there is no need to manually call * $prefs->store() every time a preference is changed. * * @abstract */ function store() { return true; } /** * This function provides common cleanup functions for all of the driver * implementations. * * @param optional boolean $all Clean up all Horde preferences. */ function cleanup($all = false) { /* Remove this scope from the preferences cache, if it exists. */ if (isset($_SESSION['prefs_cache'])) { if (isset($_SESSION['prefs_cache'][$this->_scope])) { unset($_SESSION['prefs_cache'][$this->_scope]); } if (isset($_SESSION['prefs_cache']['_filled'][$this->_scope])) { unset($_SESSION['prefs_cache']['_filled'][$this->_scope]); } } /* Perform a Horde-wide cleanup? */ if ($all) { /* Destroy the contents of the preferences hash. */ $this->_prefs = array(); /* Destroy the contents of the preferences cache. */ if (isset($_SESSION['prefs_cache'])) { unset($_SESSION['prefs_cache']); } } } /** * Populates the $prefs hash with new entries and externally * defined default values. * * @param string $app The application to load defaults for. * * @access public */ function _setDefaults($app) { global $registry; $filename = $registry->getParam('fileroot', $app) . '/config/prefs.php'; /* Ensure that the defaults from this file are only read once. Also, make sure we can read this file. */ if (!@is_readable($filename)) { return; } /* Read the configuration file. The $_prefs array, which will be in local scope, is assumed to hold the default values. */ include $filename; foreach ($_prefs as $pref => $pvals) { if (isset($pvals['value']) && isset($pvals['locked']) && isset($pvals['shared']) && ($pvals['type'] != 'link') && ($pvals['type'] != 'special')) { $pref = str_replace('.', '_', $pref); $mask = 0; if ($pvals['locked']) { $mask |= _PREF_LOCKED; } if ($pvals['shared'] || $app == 'horde') { $mask |= _PREF_SHARED; } $mask &= ~_PREF_DIRTY; $mask |= _PREF_DEFAULT; $this->add($pref, $pvals['value'], $mask); if (!empty($pvals['hook'])) { $this->_setHook($pref); } } } /* Update the preferences cache with the defaults. */ $this->cacheUpdate(); } /** * Performs shutdown activities. * * @access private */ function _shutdown() { register_shutdown_function(array(&$this, 'store')); } /** * Add $pref to the list of preferences with hook functions. * * @param string $pref The preference with a hook. */ function _setHook($pref) { $this->_hooks[] = $pref; } /** * After preferences have been loaded, set any locked or empty * preferences that have hooks to the result of the hook. */ function _callHooks() { if (!is_null($this->_hooksCalled) && !Auth::getAuth()) { return; } $this->_hooksCalled = true; if (!count($this->_hooks)) { return; } global $registry; include $registry->getParam('fileroot', 'horde') . '/config/hooks.php'; foreach ($this->_hooks as $pref) { if ($this->isLocked($pref) || !$this->getValue($pref)) { $func = '_prefs_hook_' . $pref; if (function_exists($func)) { $this->_setValue($pref, $func($this->_user)); } } } } /** * Attempts to return a concrete Prefs instance based on $driver. * * @param mixed $driver The type of concrete Prefs subclass * to return. This is based on the * storage driver ($driver). The code is * dynamically included. If $driver is * an array, then we will look in * $driver[0]/lib/Prefs/ for the subclass * implementation named $driver[1].php. * @param optional string $scope The scope for this set of preferences. * @param optional string $user The name of the user who owns this * set of preferences. * @param optional string $password The password associated with $user. * @param optional array $params A hash containing any additional * configuration or connection * parameters a subclass might need. * @param optional boolean $caching Should caching be used? * * @return object Prefs The newly created concrete Prefs instance, or * false on error. */ function &factory($driver, $scope = 'horde', $user = '', $password = '', $params = null, $caching = true) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } /* Attempt to register (cache) the $prefs hash in session * storage. */ if ($caching) { if (!isset($_SESSION['prefs_cache'])) { $_SESSION['prefs_cache'] = array(); $_SESSION['prefs_cache']['_filled'] = array(); } } $driver = basename($driver); if (empty($driver) || $driver == 'none') { $prefs = &new Prefs(); $prefs->_scope = $scope; return $prefs; } if (is_null($params)) { $params = Horde::getDriverConfig('prefs', $driver); } /* If $params['user_hook'] is defined, use it to retrieve the value to use for the username ($this->_user). Otherwise, just use the value passed in the $user parameter. */ if (!empty($params['user_hook']) && function_exists($params['user_hook'])) { $user = call_user_func($params['user_hook'], $user); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Prefs/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Prefs/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Prefs/' . $driver . '.php'; } else { @include_once 'Horde/Prefs/' . $driver . '.php'; } $class = 'Prefs_' . $driver; if (class_exists($class)) { return $ret = &new $class($user, $password, $scope, $params, $caching); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Prefs instance based on * $driver. It will only create a new instance if no Prefs instance * with the same parameters currently exists. * * This should be used if multiple preference sources (and, thus, * multiple Prefs instances) are required. * * This method must be invoked as: $var = &Prefs::singleton() * * @param mixed $driver The type of concrete Prefs subclass * to return. This is based on the * storage driver ($driver). The code is * dynamically included. If $driver is * an array, then we will look in * $driver[0]/lib/Prefs/ for the subclass * implementation named $driver[1].php. * @param optional string $scope The scope for this set of preferences. * @param optional string $user The name of the user who owns this * set of preferences. * @param optional string $password The password associated with $user. * @param optional array $params A hash containing any additional * configuration or connection * parameters a subclass might need. * @param optional boolean $caching Should caching be used? * * @return object Prefs The concrete Prefs reference, or false on an * error. */ function &singleton($driver, $scope = 'horde', $user = '', $password = '', $params = null, $caching = true) { static $instances; if (!isset($instances)) { $instances = array(); } if (is_null($params)) { $params = Horde::getDriverConfig('prefs', $driver); } $signature = serialize(array($driver, $user, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Prefs::factory($driver, $scope, $user, $password, $params, $caching); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_Prefs Horde Preferances API The Prefs:: class provides a common abstracted interface into the various preferences storage mediums. It also includes all of the functions for retrieving, storing, and checking preference values. LGPL chuck lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org 0.0.1 alpha 2003-07-05 Initial Release. gettext Horde_Framework Horde_Util 0.0.1 alpha 2003-07-05 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:38 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/RPC RPC.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143312.6414A102C03@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/RPC Added Files: RPC.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: RPC.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_RPC */ class Horde_RPC { /** * RPC server constructor * * @access private * @return object An RPC server instance. */ function Horde_RPC() { register_shutdown_function(array($this, 'shutdown')); } /** * Cleans up the RPC server. * * @abstract */ function shutdown() { } /** * Check authentication. Different backends may handle * authentication in different ways. The base class implementation * checks for HTTP Authentication against the Horde auth setup. * * @return boolean Returns true if authentication is successful. * Should send appropriate "not authorized" headers * or other response codes/body if auth fails, * and take care of exiting. */ function authorize() { $auth = &Auth::singleton($GLOBALS['conf']['auth']['driver']); if (isset($_SERVER['PHP_AUTH_USER'])) { $user = $_SERVER['PHP_AUTH_USER']; $pass = $_SERVER['PHP_AUTH_PW']; } if (!isset($user) || !$auth->authenticate($user, array('password' => $pass))) { header('WWW-Authenticate: Basic realm="Horde RPC"'); header('HTTP/1.0 401 Unauthorized'); echo '401 Unauthorized'; exit; } return true; } /** * Get the request body input. Different RPC backends can override * this to return an open stream to php://stdin, for instance - * whatever is easiest to handle in the getResponse() method. * * The base class implementation looks for $HTTP_RAW_POST_DATA and * returns that if it's available; otherwise, it returns the * contents of php://stdin. * * @return mixed The input - a string (default), a filehandle, etc. */ function getInput() { if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) { return $GLOBALS['HTTP_RAW_POST_DATA']; } else { return implode("\r\n", file('php://input')); } } /** * Sends an RPC request to the server and returns the result. * * @param string The raw request string. * * @return string The XML encoded response from the server. */ function getResponse($request) { return _("not implemented"); } /** * Get the Content-Type of the response. * * @return string The MIME Content-Type of the RPC response. */ function getResponseContentType() { return 'text/xml'; } /** * Builds an RPC request and sends it to the RPC server. * * This statically called method is actually the RPC client. * * @param string $driver The protocol driver to use. Currently 'soap' and * 'xmlrpc' are available. * @param string $url The path to the RPC server on the called host. * @param string $method The method to call. * @param array $params (optional) A hash containing any necessary * parameters for the method call. * @param $options Optional associative array of parameters depending on * the selected protocol driver. * * @return mixed The returned result from the method or a PEAR * error object on failure. */ function request($driver, $url, $method, $params = null, $options = array()) { if (is_array($driver)) { list($app, $driver) = $driver; } $driver = basename($driver); if (!empty($app)) { require_once $app . '/lib/RPC/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/RPC/' . $driver . '.php')) { require_once dirname(__FILE__) . '/RPC/' . $driver . '.php'; } else { @include_once 'Horde/RPC/' . $driver . '.php'; } $class = 'Horde_RPC_' . $driver; if (class_exists($class)) { return call_user_func(array($class, 'request'), $url, $method, $params, $options); } else { require_once 'PEAR.php'; return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a concrete RPC server instance based on * $driver. * * @access public * * @param mixed $driver The type of concrete RPC subclass to * return. This is based on the protocol * driver ($driver). The code is dynamically * included. If $driver is an array, then * we will look in $driver[0]/lib/RPC/ * for the subclass implementation named * $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters * a subclass might need. * * @return object Horde_RPC The newly created concrete Horde_RPC server * instance, or a PEAR_Error on an error. */ function &factory($driver, $params = null) { if (is_array($driver)) { list($app, $driver) = $driver; } $driver = basename($driver); if (!empty($app)) { require_once $app . '/lib/RPC/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/RPC/' . $driver . '.php')) { require_once dirname(__FILE__) . '/RPC/' . $driver . '.php'; } else { @include_once 'Horde/RPC/' . $driver . '.php'; } $class = 'Horde_RPC_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { require_once 'PEAR.php'; return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete RPC server * instance based on $driver. It will only create a new instance * if no RPC server instance with the same parameters currently * exists. * * This should be used if multiple RPC servers (and thus, multiple RPC * server instances) are required. * * This method must be invoked as: $var = &Horde_RPC::singleton() * * @access public * * @param string $driver The type of concrete RPC subclass to * return. This is based on the protocol * driver ($driver). The code is dynamically * included. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Horde_RPC The concrete Horde_RPC server reference, or a * PEAR_Error * on an error. */ function &singleton($driver, $params = null) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!array_key_exists($signature, $instances)) { $instances[$signature] = &Horde_RPC::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_RPC Horde RPC API The Horde_RPC:: class provides a common abstracted interface to various remote methods of accessing Horde functionality. LGPL chuck lead Chuck Hagenbuch chuck@horde.org jan lead Jan Schneider jan@horde.org 0.0.1 beta 2003-11-25 Initial Release. xmlrpc SOAP Horde_Framework 0.0.1 beta 2003-11-25 Initial release as a Horde package From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:45 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/RPC/tests rpc-test.php, NONE, 1.1 Message-ID: <20051014143312.9839A102C25@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/RPC/tests Added Files: rpc-test.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: rpc-test.php --- #!/usr/local/bin/php $user, 'pass' => $pass)); break; case 1: $response = Horde_RPC::request('xmlrpc', Horde::url('rpc.php', true, -1), 'system.describeMethods', array('tasks.list'), array('user' => $user, 'pass' => $pass)); break; case 2: $response = Horde_RPC::request('xmlrpc', Horde::url('rpc.php', true, -1), 'tasks.list', array(0), array('user' => $user, 'pass' => $pass)); break; case 3: $response = Horde_RPC::request('xmlrpc', 'http://dev.horde.org/horde/rpc.php', 'system.listMethods', null, array('user' => $user, 'pass' => $pass)); break; case 4: $response = Horde_RPC::request('xmlrpc', 'http://pear.php.net/xmlrpc.php', 'package.listAll'); break; case 5: $response = Horde_RPC::request('soap', 'http://api.google.com/search/beta2', 'doGoogleSearch', array('key' => '5a/mF/FQFHKTD4vgNxfFeODwtLdifPPq', 'q' => 'Horde IMP', 'start' => 0, 'maxResults' => 10, 'filter' => true, 'restrict' => '', 'safeSearch' => false, 'lr' => '', 'ie' => 'iso-8859-1', 'oe' => 'iso-8859-1'), array('namespace' => 'urn:GoogleSearch')); break; case 6: $response = Horde_RPC::request('soap', Horde::url('rpc.php', true, -1), 'tasks.list', array(0, 0), array('namespace' => 'urn:horde', 'user' => $user, 'pass' => $pass)); break; } if (is_a($response, 'PEAR_Error')) { echo "===error======\n"; echo $response->getMessage(); echo "\n"; $info = $response->getUserInfo(); if (is_string($info)) { echo strtr($info, array_flip(get_html_translation_table(HTML_ENTITIES))); } else { var_dump($info); } echo "\n==============\n"; } else { echo "===value======\n"; var_dump($response); echo "==============\n"; } From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:47 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SQL SQL.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143312.C57B5102C7B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SQL In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SQL Added Files: SQL.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: SQL.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_SQL */ class Horde_SQL { /** * Return a boolean expression using the specified operator. Uses * database-specific casting, if necessary. * * @access public * * @param object $dbh The PEAR::DB database object. * @param string $lhs The column or expression to test. * @param string $op The operator. * @param string $rhs The comparison value. * * @returns string The SQL test fragment. */ function buildClause($dbh, $lhs, $op, $rhs) { switch ($op) { case '|': case '&': switch ($dbh->phptype) { case 'pgsql': // Only PgSQL 7.3+ understands SQL99 'SIMILAR TO'; use // ~ for greater backwards compatibility. return sprintf('CASE WHEN CAST(%s AS VARCHAR) ~ \'^-?[0-9]+$\' THEN (CAST(%s AS INTEGER) %s %d) <> 0 ELSE FALSE END', $lhs, $lhs, $op, (int)$rhs); case 'oci8': // Oracle uses & for variables. We need to use the // bitand function that is available, but may be // unsupported. return sprintf('bitand(%s,%d) = %d', $lhs, (int)$rhs, (int)$rhs); case 'odbc': // ODBC must have a valid boolean expression return sprintf('(%s & %d) = %d', $lhs, (int)$rhs, (int)$rhs); default: return sprintf('%s %s %d', $lhs, $op, (int)$rhs); } case '~': if ($dbh->phptype == 'mysql') { $op = 'REGEXP'; } return sprintf('%s %s %s', $lhs, $op, $rhs); case 'IN': return sprintf('%s IN %s', $lhs, $rhs); case 'LIKE': if ($dbh->phptype == 'pgsql') { $clause = '%s ILIKE %s'; } else { $clause = '%s LIKE LOWER(%s)'; } return sprintf($clause, $lhs, $dbh->quote('%' . $rhs . '%')); default: return sprintf('%s %s %s', $lhs, $op, $dbh->quote($rhs)); } } function readBlob($dbh, $table, $field, $criteria) { if (!count($criteria)) { return PEAR::raiseError('You must specify the fetch criteria'); } $where = ''; switch ($dbh->dbsyntax) { case 'oci8': foreach ($criteria as $key => $value) { if (!empty($where)) { $where .= ' AND '; } if (empty($value)) { $where .= $key . ' IS NULL'; } else { $where .= $key . ' = ' . $dbh->quote($value); } } $statement = OCIParse($dbh->connection, sprintf('SELECT %s FROM %s WHERE %s', $field, $table, $where)); OCIExecute($statement); if (OCIFetchInto($statement, $lob)) { $result = $lob[0]->load(); } else { $result = PEAR::raiseError('Unable to load SQL Data'); } OCIFreeStatement($statement); break; default: foreach ($criteria as $key => $value) { if (!empty($where)) { $where .= ' AND '; } $where .= $key . ' = ' . $dbh->quote($value); } $result = $dbh->getOne(sprintf('SELECT %s FROM %s WHERE %s', $field, $table, $where)); switch ($dbh->dbsyntax) { case 'pgsql': $result = pack('H' . strlen($result), $result); break; } } return $result; } function insertBlob($dbh, $table, $field, $data, $attributes) { $fields = array(); $values = array(); switch ($dbh->dbsyntax) { case 'oci8': foreach ($attributes as $key => $value) { $fields[] = $key; $values[] = $dbh->quote($value); } $statement = OCIParse($dbh->connection, sprintf('INSERT INTO %s (%s, %s)' . ' VALUES (%s, EMPTY_BLOB()) RETURNING %s INTO :blob', $table, implode(', ', $fields), $field, implode(', ', $values), $field)); $lob = OCINewDescriptor($dbh->connection); OCIBindByName($statement, ':blob', $lob, -1, SQLT_BLOB); OCIExecute($statement, OCI_DEFAULT); $lob->save($data); $result = OCICommit($dbh->connection); $lob->free(); OCIFreeStatement($statement); return $result ? true : PEAR::raiseError('Unknown Error'); default: foreach ($attributes as $key => $value) { $fields[] = $key; $values[] = $value; } $query = sprintf('INSERT INTO %s (%s, %s) VALUES (%s)', $table, implode(', ', $fields), $field, '?' . str_repeat(', ?', count($values))); break; } switch ($dbh->dbsyntax) { case 'mssql': case 'pgsql': $values[] = bin2hex($data); break; default: $values[] = $data; } /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by Horde_SQL::insertBlob(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $stmt = $this->_db->prepare($query); return $this->_db->execute($stmt, $values); } function updateBlob($dbh, $table, $field, $data, $where, $alsoupdate) { $fields = array(); $values = array(); switch ($dbh->dbsyntax) { case 'oci8': $wherestring = ''; foreach ($where as $key => $value) { if (!empty($wherestring)) { $wherestring .= ' AND '; } $wherestring .= $key . ' = ' . $dbh->quote($value); } $statement = OCIParse($dbh->connection, sprintf('SELECT %s FROM %s FOR UPDATE WHERE %s', $field, $table, $wherestring)); OCIExecute($statement, OCI_DEFAULT); OCIFetchInto($statement, $lob); $lob[0]->save($data); $result = OCICommit($dbh->connection); $lob[0]->free(); OCIFreeStatement($statement); return $result ? true : PEAR::raiseError('Unknown Error'); default: $updatestring = ''; $values = array(); foreach ($alsoupdate as $key => $value) { $updatestring .= $key . ' = ?, '; $values[] = $value; } $updatestring .= $field . ' = ?'; switch ($dbh->dbsyntax) { case 'mssql': case 'pgsql': $values[] = bin2hex($data); break; default: $values[] = $data; } $wherestring = ''; foreach ($where as $key => $value) { if (!empty($wherestring)) { $wherestring .= ' AND '; } $wherestring .= $key . ' = ?'; $values[] = $value; } $query = sprintf('UPDATE %s SET %s WHERE %s', $table, $updatestring, $wherestring); break; } /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by Horde_SQL::updateBlob(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $stmt = $dbh->prepare($query); return $dbh->execute($stmt, $values); } } --- NEW FILE: package.xml --- Horde_SQL SQL Utility Class Horde_SQL:: contains some utility functions for dealing with SQL. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-03 Initial Release. 0.0.1 2003-07-03 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:49 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SQL/SQL Attributes.php, NONE, 1.1 Message-ID: <20051014143312.D8E62102C26@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SQL/SQL In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SQL/SQL Added Files: Attributes.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Attributes.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_SQL */ class Horde_SQL_Attributes { /** * The PEAR::DB object to run queries with. * @var object DB $_db */ var $_db; /** * Parameters to use when generating queries: * id_column - The primary id column to use in joins. * primary_table - The main table name. * attribute_table - The table that the attributes are stored in. * @var array $_params */ var $_params = array(); /** * The number of copies of the attributes table that we need to * join on in the current query. * @var integer $_table_count */ var $_table_count = 1; /** * Constructor. * * @param object DB $dbh A PEAR::DB object. * @param array $params The id column, table names, etc. */ function Horde_SQL_Attributes($dbh, $params) { $this->_db = $dbh; $this->_params = $params; } /** * Returns all attributes for a given id or multiple ids. * * @param integer | array $id The id to fetch or an array of ids. * * @return array A hash of attributes, or a multi-level hash * of ids => their attributes. */ function getAttributes($id) { if (is_array($id)) { $query = sprintf('SELECT %1$s, attribute_name as name, attribute_key as "key", attribute_value as value FROM %2$s WHERE %1$s IN (%3$s)', $this->_params['id_column'], $this->_params['attribute_table'], implode(', ', $id)); Horde::logMessage('SQL Query by Horde_SQL_Attributes::getAttributes(): ' . $query, __FILE__, __LINE__, PEAR_LOG_DEBUG); $rows = $this->_db->getAll($query, DB_FETCHMODE_ASSOC); if (is_a($rows, 'PEAR_Error')) { return $rows; } $id_column = $this->_params['id_column']; $data = array(); foreach ($rows as $row) { if (empty($data[$row[$id_column]])) { $data[$row[$id_column]] = array(); } $data[$row[$id_column]][] = array('name' => $row['name'], 'key' => $row['key'], 'value' => $row['value']); } return $data; } else { $query = sprintf('SELECT %1$s, attribute_name as name, attribute_key as "key", attribute_value as value FROM %2$s WHERE %1$s = %3$s', $this->_params['id_column'], $this->_params['attribute_table'], (int)$id); Horde::logMessage('SQL Query by Horde_SQL_Attributes::getAttributes(): ' . $query, __FILE__, __LINE__, PEAR_LOG_DEBUG); return $this->_db->getAll($query, DB_FETCHMODE_ASSOC); } } /** * Return a set of ids based on a set of attribute criteria. * * @param array $criteria The array of criteria. Example: * $criteria['OR'] = array( * array('field' => 'name', * 'op' => '=', * 'test' => 'foo'), * array('field' => 'name', * 'op' => '=', * 'test' => 'bar')); * This would return all ids for which the field * attribute_name is either 'foo' or 'bar'. */ function getByAttributes($criteria) { if (!count($criteria)) { return array(); } /* Build the query. */ $this->_table_count = 1; $query = ''; foreach ($criteria as $key => $vals) { if ($key == 'OR' || $key == 'AND') { if (!empty($query)) { $query .= ' ' . $key . ' '; } $query .= '(' . $this->_buildAttributeQuery($key, $vals) . ')'; } } /* Build the FROM/JOIN clauses. */ $joins = array(); $pairs = array(); for ($i = 1; $i <= $this->_table_count; $i++) { $joins[] = sprintf('LEFT JOIN %1$s a%2$s ON a%2$s.%3$s = m.%3$s', $this->_params['attribute_table'], $i, $this->_params['id_column']); $pairs[] = 'AND a1.attribute_name = a' . $i . '.attribute_name'; } $joins = implode(' ', $joins); $pairs = implode(' ', $pairs); $query = sprintf('SELECT DISTINCT a1.%s FROM %s m %s WHERE %s %s', $this->_params['id_column'], $this->_params['primary_table'], $joins, $query, $pairs); Horde::logMessage('SQL Query by Horde_SQL_Attributes::getByAttributes(): ' . $query, __FILE__, __LINE__, PEAR_LOG_DEBUG); return $this->_db->getCol($query); } /** * Given a new attribute set and an id, insert each into the * DB. If anything fails in here, rollback the transaction, return * the relevant error and bail out. * * @params int $id The id of the record for which attributes * are being inserted. * @params array $attributes An hash containing the attributes. */ function insertAttributes($id, $attributes) { foreach ($attributes as $attr) { $query = sprintf('INSERT INTO %s (%s, attribute_name, attribute_key, attribute_value) VALUES (%s, %s, %s, %s)', $this->_params['attribute_table'], $this->_params['id_column'], (int)$id, $this->_db->quote($attr['name']), $this->_db->quote($attr['key']), $this->_db->quote($attr['value'])); Horde::logMessage('SQL Query by Horde_SQL_Attributes::insertAttributes(): ' . $query, __FILE__, __LINE__, PEAR_LOG_DEBUG); $result = $this->_db->query($query); if (is_a($result, 'PEAR_Error')) { $this->_db->rollback(); $this->_db->autoCommit(true); return $result; } } /* Commit the transaction, and turn autocommit back on. */ $result = $this->_db->commit(); $this->_db->autoCommit(true); } /** * Given an id, delete all attributes for that id from the * attributes table. * * @params int $id The id of the record for which attributes are being * deleted. */ function deleteAttributes($id) { /* Delete attributes. */ $query = sprintf('DELETE FROM %s WHERE %s = %s', $this->_params['attribute_table'], $this->_params['id_column'], (int)$id); Horde::logMessage('SQL Query by Horde_SQL_Attributes::deleteAttributes(): ' . $query, __FILE__, __LINE__, PEAR_LOG_DEBUG); $result = $this->_db->query($query); if (is_a($result, 'PEAR_Error')) { return $result; } return true; } /** * Given an id, update all attributes for that id in the * attributes table with the new attributes. * * @params int $id The id of the record for which attributes * are being deleted. * @params array $attributes An hash containing the attributes. */ function updateAttributes($id, $attributes) { /* Delete the old attributes. */ $result = $this->deleteAttributes($id); if (is_a($result, 'PEAR_Error')) { return $result; } /* Insert the new attribute set. */ $result = $this->insertAttributes($id, $attributes); return $result; } /** * Build a piece of an attribute query. * * @param string $glue The glue to join the criteria (OR/AND). * @param array $criteria The array of criteria. * @param bool $join Should we join on a clean attributes table? * Defaults to false. * * @return string An SQL fragment. */ function _buildAttributeQuery($glue, $criteria, $join = false) { require_once 'Horde/SQL.php'; /* Initialize the clause that we're building. */ $clause = ''; /* Get the table alias to use for this set of criteria. */ if ($join) { $alias = $this->_getAlias(true); } else { $alias = $this->_getAlias(); } foreach ($criteria as $key => $vals) { if (!empty($vals['OR']) || !empty($vals['AND'])) { if (!empty($clause)) { $clause .= ' ' . $glue . ' '; } $clause .= '(' . $this->_buildAttributeQuery($glue, $vals) . ')'; } elseif (!empty($vals['JOIN'])) { if (!empty($clause)) { $clause .= ' ' . $glue . ' '; } $clause .= $this->_buildAttributeQuery($glue, $vals['JOIN'], true); } else { if (isset($vals['field'])) { if (!empty($clause)) { $clause .= ' ' . $glue . ' '; } $clause .= Horde_SQL::buildClause($this->_db, $alias . '.attribute_' . $vals['field'], $vals['op'], $vals['test']); } else { foreach ($vals as $test) { if (!empty($clause)) { $clause .= ' ' . $key . ' '; } $clause .= Horde_SQL::buildClause($this->_db, $alias . '.attribute_' . $test['field'], $test['op'], $test['test']); } } } } return $clause; } /** * Get an alias to an attributes table, incrementing it if * necessary. * * @param optional bool $increment Increment the alias count? Defaults to * false. */ function _getAlias($increment = false) { static $seen = array(); if ($increment && !empty($seen[$this->_table_count])) { $this->_table_count++; } $seen[$this->_table_count] = true; return 'a' . $this->_table_count; } /** * Attempts to return a reference to a concrete SQL Attributes * instance based on parameters passed. It will only create a new * instance if no Attributes instance with the same parameters * currently exists. * * This should be used if multiple SQL attribute tables are * required. * * This method must be invoked as: $var = * &Horde_SQL_Attributes::singleton() * * @param object $dbh An object pointing to a SQL database handle. * * @param array $params Parameters for the attributes table, consisting * of the following keys: * 'primary_table' - the main SQL table * 'attribute_table' - the second table containing * the attributes to the main * table. * 'id_column' - the name of the column with * the ID or key field. */ function &singleton($dbh, $params) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize($params); if (!isset($instances[$signature])) { $instances[$signature] = &new Horde_SQL_Attributes($dbh, $params); } return $instances[$signature]; } } From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:50 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Scheduler Scheduler.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143312.DD928102C7E@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Scheduler In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Scheduler Added Files: Scheduler.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Scheduler.php --- _sleep = 'sleep'; $this->_sleep_adj = 1000000; } else { $this->_sleep = 'usleep'; $this->_sleep_adj = 1; } } /** * Main loop/action function. * * @abstract */ function run() { } /** * Preserve the internal state of the scheduler object that we are * passed, and save it to the Horde VFS backend. Horde_Scheduler * objects should define __sleep() and __wakeup() serialization * callbacks for anything that needs to be done at object * serialization or deserialization - handling database * connections, etc. * * @param optional string $id An id to uniquely identify this * scheduler from others of the same class. */ function serialize($id = '') { require_once 'VFS.php'; $vfs = &VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type'])); if (is_a($vfs, 'PEAR_Error')) { Horde::logMessage($vfs, __FILE__, __LINE__, PEAR_LOG_ERR); return false; } $result = $vfs->writeData('.horde/scheduler', get_class($this) . $id, serialize($this), true); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } /** * Restore a Horde_Scheduler object from the cache. * * @param string $class The name of the Horde_Scheduler object to restore. * @param string $id An id to uniquely identify this * scheduler from others of the same class. * @param boolean $autosave (optional) Automatically store (serialize) * the returned object at script shutdown. * Defaults to true. * * @see Horde_Scheduler::serialize() */ function &unserialize($class, $id = '', $autosave = true) { require_once 'VFS.php'; // Need a lowercase version of the classname, and a default // instance of the scheduler object in case we can't retrieve // one. $class = strtolower($class); $scheduler = &new $class; $vfs = &VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type'])); if (is_a($vfs, 'PEAR_Error')) { Horde::logMessage($vfs, __FILE__, __LINE__, PEAR_LOG_ERR); } else { $data = $vfs->read('.horde/scheduler', $class . $id); if (is_a($data, 'PEAR_Error')) { Horde::logMessage($data, __FILE__, __LINE__, PEAR_LOG_ERR); } else { $scheduler = @unserialize($data); if (!$scheduler) { $scheduler = &new $class; } } } if ($autosave) { register_shutdown_function(array(&$scheduler, 'serialize')); } return $scheduler; } /** * Platform-independant sleep $msec microseconds. * * @param integer $msec Microseconds to sleep. */ function sleep($msec) { call_user_func($this->_sleep, $msec / $this->_sleep_adj); } /** * Attempts to return a concrete Horde_Scheduler instance based on * $driver. * * @access public * * @param mixed $driver The type of concrete Horde_Scheduler subclass to * return. This is based on the storage * driver ($driver). The code is dynamically * included. If $driver is an array, then we * will look in $driver[0]/lib/Horde_Scheduler/ for * the subclass implementation named * $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Horde_Scheduler The newly created concrete Horde_Scheduler instance, or false * on an error. */ function &factory($driver, $params = null) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } $driver = basename($driver); if (empty($driver) || (strcmp($driver, 'none') == 0)) { return $ret = &new Horde_Scheduler(); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/Scheduler/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Scheduler/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Scheduler/' . $driver . '.php'; } else { // Use include_once here to avoid a fatal error if the // class isn't found. @include_once 'Horde/Scheduler/' . $driver . '.php'; } $class = 'Horde_Scheduler_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Horde_Scheduler * instance based on $driver. It will only create a new instance * if no Horde_Scheduler instance with the same parameters * currently exists. * * This should be used if multiple schedulers (and, thus, multiple * Horde_Scheduler instances) are required. * * This method must be invoked as: $var = &Horde_Scheduler::singleton() * * @access public * * @param string $driver The type of concrete Horde_Scheduler subclass to * return. This is based on the storage * driver ($driver). The code is dynamically * included. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Horde_Scheduler The concrete Horde_Scheduler reference, or false on an error. */ function &singleton($driver, $params = null) { static $instances = array(); $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Horde_Scheduler::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_Scheduler Horde Scheduler System TODO LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-05 Initial packaging. Horde_Util VFS 0.0.1 2003-07-05 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:52 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Scheduler/Scheduler cron.php, NONE, 1.1 Message-ID: <20051014143312.DD9B1102C7F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Scheduler/Scheduler In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Scheduler/Scheduler Added Files: cron.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: cron.php --- addTask('perl somescript.pl', '0 0,5,10,15,20,25,30,35,40,45,50,55 * * *'); * * // Run this command midnight of the first Friday of odd numbered months. * $cron->addTask('php -q somescript.php', '0 0 0 1-7&Fri 1,3,5,7,9,11'); * * // Also run this command midnight of the second Thursday and Saturday of the even numbered months. * $cron->addTask('php -q somescript.php', '0 0 0 8-15&Thu,8-15&Sat 2,4,6,8,10,12'); * * $cron->run(); * * $Horde: framework/Scheduler/Scheduler/cron.php,v 1.13 2004/04/07 14:43:12 chuck Exp $ * * @author Ryan Flynn * @author Chuck Hagenbuch * @package Horde_Scheduler */ class Horde_Scheduler_cron extends Horde_Scheduler { var $_tasks = array(); /** * Every time a task is added it will get a fresh uid even if * immediately removed. */ var $_counter = 1; function addTask($cmd, $rules) { $ds = &new Horde_Scheduler_cronDate($rules); $this->_counter++; $this->_tasks[] = array( 'uid' => $this->_counter, 'rules' => $ds, 'cmd' => $cmd ); return $this->_counter; } function removeTask($uid) { $count = count($this->_tasks); for ($i = 0; $i < $count; $i++) { if ($this->_tasks['uid'] == $uid) { $found = $i; array_splice($this->_tasks, $i); return $i; } } return 0; } function run() { if (!count($this->_tasks)) { exit("crond: Nothing to schedule; exiting.\n"); } while (true) { $t = time(); // Check each task. foreach ($this->_tasks as $task) { if ($task['rules']->nowMatches()) { $this->runcmd($task); } } // Wait until the next second. while (time() == $t) { $this->sleep(100000); } } } function runcmd(&$task) { Horde::logMessage('Horde_Scheduler_Cron::runcmd(): ' . $task['cmd'] . ' run by ' . $task['uid'], __FILE__, __LINE__, PEAR_LOG_INFO); return shell_exec($task['cmd']); } } /** * @package Horde_Scheduler */ class Horde_Scheduler_cronDate { var $legalDays = array('MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN'); var $sec; var $min; var $hour; var $day; var $month; function Horde_Scheduler_cronDate($raw) { require_once 'Horde/String.php'; $this->parse(String::upper($raw)); } function nowMatches() { return $this->scheduledAt(time()); } function scheduledAt($ts = null) { if ($ts === null) { $ts = time(); } return ($this->monthMatches($ts) && $this->monthMatches($ts) && $this->dayMatches($ts) && $this->hourMatches($ts) && $this->minMatches($ts) && $this->secMatches($ts)); } function monthMatches($ts) { if ($this->month == '*') { return true; } $currentmonth = '-' . date('n', $ts) . '-'; return (bool)strpos($this->month, $currentmonth); } function dayMatches($ts) { if (!empty($this->day['value']) && $this->day['value'] == '*') { return true; } $currentdaynum = '-' . date('j', $ts) . '-'; $currentdaytxt = String::upper(date('D')); foreach ($this->day as $day) { if (@strpos($day['not'], $currentdaytxt) === false) { $v1 = (@strpos($day['value'], $currentdaynum) !== false); $v2 = (@strpos($day['and'], $currentdaytxt) !== false); if (!empty($day['and']) && ($v1 && $v2)) { return true; } elseif (empty($day['and']) && $v1) { return true; } } } return false; } function hourMatches($ts) { if ($this->hour == '*') { return true; } $currenthour = '-' . date('G', $ts) . '-'; return (strpos($this->hour, $currenthour) !== false); } function minMatches($ts) { if ($this->min == '*') { return true; } $currentmin = '-' . intval(date('i', $ts)) . '-'; return (strpos($this->min, $currentmin) !== false); } function secMatches($ts) { if ($this->sec == '*') { return true; } $currentsec = '-' . intval(date('s', $ts)) . '-'; return (strpos($this->sec, $currentsec) !== false); } function parse($str) { $s = array(); list($s['sec'], $s['min'], $s['hour'], $s['day'], $s['month']) = preg_split('|[\n\t ]+|', $str); foreach ($s as $k => $v) { if (strpos($v, '*') !== false) { $s[$k] = array('*'); } else if (!$this->generallyDecentSyntax($v)) { die("Illegal syntax in '$v'\n"); } else { $s[$k] = explode(',', $s[$k]); } } if ($s['sec'][0] == '*') { $this->sec = '*'; } else { for ($i = 0; $i < sizeof($s['sec']); $i++) { if ($this->isRange($s['sec'][$i])) { $s['sec'][$i] = $this->expandRange($this->rangeVals($s['sec'][$i])); } } $this->sec = '-' . join('-', $s['sec']) . '-'; } if ($s['min'][0] == '*') { $this->min = '*'; } else { for ($i = 0; $i < sizeof($s['min']); $i++) { if ($this->isRange($s['min'][$i])) { $s['min'][$i] = $this->expandRange($this->rangeVals($s['min'][$i])); } } $this->min = '-' . join('-', $s['min']) . '-'; } if ($s['hour'][0] == '*') { $this->hour = '*'; } else { for ($i = 0; $i < sizeof($s['hour']); $i++) { if ($this->isRange($s['hour'][$i])) { $s['hour'][$i] = $this->expandRange($this->rangeVals($s['hour'][$i])); } } $this->hour = '-' . join('-', $s['hour']) . '-'; } if ($s['day'][0] == '*') { $this->day = '*'; } else { for ($i = 0; $i < sizeof($s['day']); $i++) { $tmp = array(); if (($char = $this->isCond($s['day'][$i])) !== false) { if ($char == '&') { list($tmp['value'], $tmp['and']) = explode($char, $s['day'][$i]); if ($this->isRange($tmp['and'])) { $tmp['and'] = $this->expandRange($this->rangeVals($tmp['and'])); } } else { list($tmp['value'], $tmp['not']) = explode($char, $s['day'][$i]); if ($this->isRange($tmp['not'])) { $tmp['not'] = $this->expandRange($this->rangeVals($tmp['not'])); } } } else { $tmp = array('value' => $s['day'][$i]); } $s['day'][$i] = $tmp; if ($this->isRange($s['day'][$i]['value'])) { $s['day'][$i]['value'] = $this->expandRange($this->rangeVals($s['day'][$i]['value'])); } } $this->day = $s['day']; } if ($s['month'][0] == '*') { $this->month = '*'; } else { for ($i = 0; $i < sizeof($s['month']); $i++) { if ($this->isRange($s['month'][$i])) { $s['month'][$i] = $this->expandRange($this->rangeVals($s['month'][$i])); } } $this->month = '-' . join('-', $s['month']) . '-'; } } function isCond($s) { if (strpos($s, '&') !== false) { return '&'; } elseif (strpos($s, '!') !== false) { return '!'; } else { return false; } } function isRange($s) { return preg_match('/^\w+\-\w+/', $s); } function isCondRange($s) { return (isCond($s) && isRange($s)); } function isCondVal($s) { return (isCond($s) && !isRange($s)); } function rangeVals($s) { return explode('-', $s); } function expandRange($l, $h = '') { // Expand range from 1-5 -> '-1-2-3-4-5-'. if (is_array($l)) { $h = $l[1]; $l = $l[0]; } if ($this->isDigit($l)) { if (!$this->isDigit($h)) { die("Invalid value '$h' in range '$l-$h'"); } // Currently there is no possible reason to need to do a // range beyond 0-59 for anything. if ($l < 0) { $l = 0; } elseif ($l > 59) { $l = 59; } if ($h < 0) { $h = 0; } elseif ($h > 59) { $h = 59; } if ($l > $h) { $tmp = $l; $l = $h; $h = $tmp; unset($tmp); } // For some reason range() doesn't work w/o the explicit // intval() calls. return '-' . join('-', range(intval($l), intval($h))) . '-'; } else { // Invalid. die("Invalid value '$l' in range '$l-$h'"); } } function dayValue($s) { for ($i = 0; $i < count($this->legalDays); $i++) { if ($this->legalDays[$i] == $s) { return $i; } } return -1; } function isDigit($s) { return preg_match('/^\d+$/', $s); } function isAlpha($s) { return $this->isLegalDay($s); } function isLegalDay($s) { return in_array($s, $this->legalDays); } function generallyDecentSyntax($s) { return ($s == '*' || preg_match('/^\d+(-\d+)?([!&][A-Z\*]+(-[A-Z\*]+)?)?(,\d+(-\d+)?([!&][A-Z\*]+(-[A-Z\*]+)?)?)*$/', $s)); } } From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:53 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Search Search.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.159FA102BDA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Search In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Search Added Files: Search.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Search.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Search */ class Horde_Search { /** * Attempts to return a concrete Horde_Search instance based on * $driver. * * @access public * * @param mixed $driver The type of concrete Horde_Search subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. If $driver is an * array, then we will look in * $driver[0]/lib/Search/ for the subclass * implementation named $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Horde_Search The newly created concrete Horde_Search instance, * or false on error. */ function &factory($driver, $params = null) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } if (is_null($params) && class_exists('Horde')) { $params = Horde::getDriverConfig('search', $driver); } if (!empty($app)) { global $registry; require_once $registry->getParam('fileroot', $app) . '/lib/Search/' . $driver . '.php'; } elseif (file_exists(dirname(__FILE__) . '/Search/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Search/' . $driver . '.php'; } else { @include_once 'Horde/Search/' . $driver . '.php'; } $class = 'Horde_Search_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Horde_Search * instance based on $driver. It will only create a new instance * if no Horde_Search instance with the same parameters currently * exists. * * This should be used if multiple search backends (and, thus, * multiple Horde_Search instances) are required. * * This method must be invoked as: * $var = &Horde_Search::singleton() * * @access public * * @param mixed $driver The type of concrete Horde_Search subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. If $driver is an * array, then we will look in * $driver[0]/lib/Search/ for the subclass * implementation named $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @since Horde 2.2 * * @return object Horde_Search The concrete Horde_Search reference, * or false on error. */ function &singleton($driver, $params = null) { static $instances; if (!isset($instances)) { $instances = array(); } if (is_null($params) && class_exists('Horde')) { $params = Horde::getDriverConfig('search', $driver); } $signature = serialize(array($driver, $params)); if (!array_key_exists($signature, $instances)) { $instances[$signature] = &Horde_Search::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_Search Horde Search API The Horde_Search:: API tries to provide a generic API to several remote search services. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2004-01-25 Initial packaging Horde_Framework 0.0.1 alpha 2004-01-25 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:55 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Search/Search google.php, NONE, 1.1 Message-ID: <20051014143313.36925102C82@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Search/Search In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Search/Search Added Files: google.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: google.php --- */ class Horde_Search_google { /** * @var string * @access private */ var $_licenseKey = ''; /** * @var object * @access private */ var $_soapClient = NULL; /** * Constructor. * * @param array * @access public */ function Horde_Search_google($params) { $this->_licenseKey = $params['key']; $this->_soapClient = &new SOAP_Client('http://api.google.com/search/beta2'); } /** * Retrieves a page by URL from the Google Cache. * * @param string * @return mixed * @access public */ function getCachedPage($url) { $result = $this->_performAPICall('doGetCachedPage', array( 'key' => $this->_licenseKey, 'url' => $url ) ); if ($result) { $result = base64_decode($result); } return $result; } /** * Retrieves a spelling suggestion for a phrase. * * @param string * @return mixed * @access public */ function getSpellingSuggestion($phrase) { return $this->_performAPICall('doSpellingSuggestion', array( 'key' => $this->_licenseKey, 'phrase' => $phrase ) ); } /** * Performs a web search. * * @param array * @return mixed * @access public */ function search($parameters = array()) { if (!isset($parameters['query'])) { return false; } return $this->_performAPICall('doGoogleSearch', array( 'key' => $this->_licenseKey, 'q' => $parameters['query'], 'start' => isset($parameters['start']) ? $parameters['start'] : 0, 'maxResults' => isset($parameters['maxResults']) ? $parameters['maxResults'] : 10, 'filter' => isset($parameters['filter']) ? $parameters['filter'] : false, 'restrict' => isset($parameters['restrict']) ? $parameters['restrict'] : '', 'safeSearch' => isset($parameters['safeSearch']) ? $parameters['safeSearch'] : false, 'lr' => isset($parameters['lr']) ? $parameters['lr'] : '', 'ie' => isset($parameters['ie']) ? $parameters['ie'] : '', 'oe' => isset($parameters['oe']) ? $parameters['oe'] : '' ) ); } /** * @param string * @param array * @return mixed * @access private */ function _performAPICall($apiCall, $parameters) { $result = $this->_soapClient->call($apiCall, $parameters, 'urn:GoogleSearch'); if (!is_a($result, 'PEAR_Error')) { return $result; } else { return false; } } } From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:56 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Secret Secret.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.441B2102C84@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Secret In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Secret Added Files: Secret.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Secret.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Secret */ class Secret { /** * Take a small piece of data and encrypt it with a key. * * @access public * * @param string $key The key to use for encryption. * @param string $message The plaintext message. * * @return string The ciphertext message. */ function write($key, $message) { if (Util::extensionExists('mcrypt')) { $td = @mcrypt_module_open(MCRYPT_GOST, '', MCRYPT_MODE_ECB, ''); if ($td) { $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); @mcrypt_generic_init($td, $key, $iv); $encrypted_data = mcrypt_generic($td, $message); mcrypt_generic_deinit($td); return $encrypted_data; } } static $cipherCache; $cacheIdx = md5($key); if (!is_array($cipherCache) || !isset($cipherCache[$cacheIdx])) { require_once 'Horde/Cipher.php'; $cipherCache[$cacheIdx] = &Horde_Cipher::factory('blowfish'); $cipherCache[$cacheIdx]->setBlockMode('ofb64'); $cipherCache[$cacheIdx]->setKey($key); } return $cipherCache[$cacheIdx]->encrypt($message); } /** * Decrypt a message encrypted with Secret::write(). * * @access public * * @param string $key The key to use for decryption. * @param string $message The ciphertext message. * * @return string The plaintext message. */ function read($key, $ciphertext) { if (Util::extensionExists('mcrypt')) { $td = @mcrypt_module_open(MCRYPT_GOST, '', MCRYPT_MODE_ECB, ''); if ($td) { $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); @mcrypt_generic_init($td, $key, $iv); $decrypted_data = mdecrypt_generic($td, $ciphertext); mcrypt_generic_deinit($td); // Strip padding characters. return rtrim($decrypted_data, "\0"); } } static $cipherCache; $cacheIdx = md5($key); if (!is_array($cipherCache) || !isset($cipherCache[$cacheIdx])) { require_once 'Horde/Cipher.php'; $cipherCache[$cacheIdx] = &Horde_Cipher::factory('blowfish'); $cipherCache[$cacheIdx]->setBlockMode('ofb64'); $cipherCache[$cacheIdx]->setKey($key); } return $cipherCache[$cacheIdx]->decrypt($ciphertext); } /** * Generate a secret key (for encryption), either using a random * md5 string and storing it in a cookie if the user has cookies * enabled, or munging some known values if they don't. * * @access public * * @param optional string $keyname The name of the key to set. * * @return string The secret key that has been generated. */ function setKey($keyname = 'generic') { global $conf; if (isset($_COOKIE) && array_key_exists($conf['session']['name'], $_COOKIE)) { if (array_key_exists($keyname . '_key', $_COOKIE)) { $key = $_COOKIE[$keyname . '_key']; } else { $key = md5(mt_rand()); $_COOKIE[$keyname . '_key'] = $key; setcookie($keyname . '_key', $key, null, $conf['cookie']['path'], $conf['cookie']['domain'], $conf['use_ssl'] == 1 ? 1 : 0); } } else { $key = md5(session_id() . $conf['server']['name']); } return $key; } /** * Return a secret key, either from a cookie, or if the cookie * isn't there, assume we are using a munged version of a known * base value. * * @access public * * @param optional string $keyname The name of the key to get. * * @return string The secret key. */ function getKey($keyname = 'generic') { static $keycache; if (is_null($keycache)) { $keycache = array(); } if (!array_key_exists($keyname, $keycache)) { if (array_key_exists($keyname . '_key', $_COOKIE)) { $keycache[$keyname] = $_COOKIE[$keyname . '_key']; } else { global $conf; $keycache[$keyname] = md5(session_id() . $conf['server']['name']); $_COOKIE[$keyname . '_key'] = $keycache[$keyname]; } } return $keycache[$keyname]; } } --- NEW FILE: package.xml --- Horde_Secret Secret Encryption API The Secret:: class provides an API for encrypting and decrypting small pieces of data with the use of a shared key. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-05 Initial packaging. mcrypt Horde_Cipher Horde_Util 0.0.1 2003-07-05 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:58 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SessionHandler SessionHandler.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.7F9DA102C2D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionHandler In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SessionHandler Added Files: SessionHandler.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: SessionHandler.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SessionHandler */ class SessionHandler { /** * Attempts to return a concrete SessionHandler instance based on * $driver. * * @param string $driver The type of concrete SessionHandler * subclass to return. The is based on the * driver ($driver). The code is * dynamically included. * @param optional array $params A hash containing any additional * configuration or connection parameters * a subclass might need. * * @return mixed The newly created concrete SessionHandler instance, or * false on an error. */ function &factory($driver, $params = null) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } $driver = basename($driver); if (is_null($params)) { require_once 'Horde.php'; $params = Horde::getDriverConfig('sessionhandler', $driver); } if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/SessionHandler/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/SessionHandler/' . $driver . '.php')) { require_once dirname(__FILE__) . '/SessionHandler/' . $driver . '.php'; } else { @include_once 'Horde/SessionHandler/' . $driver . '.php'; } $class = 'SessionHandler_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete SessionHandler * instance based on $driver. It will only create a new instance * if no SessionHandler instance with the same parameters * currently exists. * * This method must be invoked as: $var = &SessionHandler::singleton() * * @param string $driver See SessionHandler::factory(). * @param optional array $params See SessionHandler::factory(). * * @return mixed The created concrete SessionHandler instance, or false * on error. */ function &singleton($driver, $params = null) { static $instances = array(); $signature = serialize(array($driver, $params)); if (empty($instances[$signature])) { $instances[$signature] = &SessionHandler::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_SessionHandler Session Handler API SessionHandler:: defines an API for implementing custom session handlers for PHP. This package contains implementations for: * PEAR DB * MySql * DBM Files * Oracle 8i * PostgreSQL * ODBC LGPL mac lead Mike Cochrane mike@graftonhall.co.nz 0.0.1 alpha 2003-07-03 Initial Release. Horde_SQL 0.0.1 2003-07-03 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:35:59 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Serialize Serialize.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.68BA3102C2B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Serialize In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Serialize Added Files: Serialize.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Serialize.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Stephane Huther * @version $Revision: 1.1 $ * @since Horde 2.0 * @package Horde_Serialize */ class Horde_Serialize { /** * Serialize a value. * See the list of constants at the top of the file for the serializing * techniques that can be used. * * @access public * * @param mixed $data The data to be serialized. * @param optional mixed $mode The mode of serialization. Can be * either a single mode or array of modes. * If array, will be serialized in the * order provided. * @param optional mixed $params Any additional parameters the * serialization method requires. * * @return string The serialized data. * Returns PEAR_Error on error. */ function serialize($data, $mode = array(SERIALIZE_BASIC), $params = null) { if (!is_array($mode)) { $mode = array($mode); } /* Return now if no data. */ if (empty($data) && !is_array($data)) { return $data; } /* Parse through the list of serializing modes. */ foreach ($mode as $val) { /* Check to make sure the mode is supported. */ if (!Horde_Serialize::hasCapability($val)) { return PEAR::raiseError('Unsupported serialization type'); } Horde_Serialize::_serialize($data, $val, $params); if (is_a($data, 'PEAR_Error')) { break; } } return $data; } /** * Serialize data. * * @access private * * @param mixed &$data The data to be serialized. * @param mixed $mode The mode of serialization. Can be * either a single mode or array of modes. * If array, will be serialized in the * order provided. * @param optional mixed $params Any additional parameters the * serialization method requires. */ function _serialize(&$data, $mode, $params = null) { switch ($mode) { case SERIALIZE_NONE: break; case SERIALIZE_BZIP: $data = bzcompress($data, SERIALIZE_BZIP_BLOCK, SERIALIZE_BZIP_FACTOR); break; case SERIALIZE_WDDX: $data = wddx_serialize_value($data); break; case SERIALIZE_IMAP8: $data = imap_8bit($data); break; case SERIALIZE_IMAPUTF7: $data = imap_utf7_encode($data); break; case SERIALIZE_IMAPUTF8: $data = imap_utf8($data); break; case SERIALIZE_GZ_DEFLATE: $data = gzdeflate($data, SERIALIZE_GZ_DEFLATE_LEVEL); break; case SERIALIZE_BASIC: $data = serialize($data); break; case SERIALIZE_GZ_COMPRESS: $data = gzcompress($data, SERIALIZE_GZ_COMPRESS_LEVEL); break; case SERIALIZE_BASE64: $data = base64_encode($data); break; case SERIALIZE_GZ_ENCOD: $data = gzencode($data, SERIALIZE_GZ_ENCOD_LEVEL); break; case SERIALIZE_RAW: $data = rawurlencode($data); break; case SERIALIZE_URL: $data = urlencode($data); break; case SERIALIZE_SQLXML: require_once 'DB.php'; require_once 'XML/sql2xml.php'; $sql2xml = &new xml_sql2xml(); $data = $sql2xml->getXML($data); break; case SERIALIZE_UTF7: require_once 'Horde/String.php'; $data = String::convertCharset($data, $params, 'utf-7'); break; case SERIALIZE_UTF7_BASIC: Horde_Serialize::_serialize($data, SERIALIZE_UTF7, $params); Horde_Serialize::_serialize($data, SERIALIZE_BASIC, $params); break; } } /** * Unserialize a value. * See the list of constants at the top of the file for the serializing * techniques that can be used. * * @access public * * @param mixed $data The data to be unserialized. * @param optional mixed $mode The mode of unserialization. Can be * either a single mode or array of modes. * If array, will be unserialized in the * order provided. * @param optional mixed $params Any additional parameters the * unserialization method requires. * * @return string The unserialized data. * Returns PEAR_Error on error. */ function unserialize($data, $mode = SERIALIZE_BASIC, $params = null) { if (!is_array($mode)) { $mode = array($mode); } /* Return now if no data. */ if (empty($data)) { return $data; } /* Parse through the list of unserializing modes. */ foreach ($mode as $val) { /* Check to make sure the mode is supported. */ if (!Horde_Serialize::hasCapability($val)) { return PEAR::raiseError('Unsupported unserialization type'); } Horde_Serialize::_unserialize($data, $val, $params); if (is_a($data, 'PEAR_Error')) { break; } } return $data; } /** * Unserialize data. * * @access private * * @param mixed &$data The data to be unserialized. * @param mixed $mode The mode of unserialization. Can be * either a single mode or array of modes. * If array, will be unserialized in the * order provided. * @param optional mixed $params Any additional parameters the * unserialization method requires. */ function _unserialize(&$data, $mode, $params = null) { switch ($mode) { case SERIALIZE_NONE: case SERIALIZE_SQLXML: break; case SERIALIZE_RAW: $data = rawurldecode($data); break; case SERIALIZE_URL: $data = urldecode($data); break; case SERIALIZE_WDDX: $data = wddx_deserialize($data); break; case SERIALIZE_BZIP: $data = bzdecompress($data, SERIALIZE_BZIP_SMALLMEM); break; case SERIALIZE_IMAPUTF7: $data = imap_utf7_decode($data); break; case SERIALIZE_BASIC: $data = @unserialize($data); break; case SERIALIZE_GZ_DEFLATE: $data = gzinflate($data, SERIALIZE_GZ_DEFLATE_LENGTH); break; case SERIALIZE_BASE64: $data = base64_decode($data); break; case SERIALIZE_GZ_COMPRESS: $data = gzuncompress($data, SERIALIZE_GZ_COMPRESS_LENGTH); break; case SERIALIZE_UTF7: require_once 'Horde/String.php'; $data = String::convertCharset($data, 'utf-7', $params); break; case SERIALIZE_UTF7_BASIC: Horde_Serialize::_unserialize($data, SERIALIZE_BASIC, $params); Horde_Serialize::_unserialize($data, SERIALIZE_UTF7, $params); break; } } /** * Check whether or not a serialization method is supported. * * @access public * * @param integer $mode The serialization method. * * @return boolean True if supported, false if not. */ function hasCapability($mode) { switch ($mode) { case SERIALIZE_BZIP: return Util::extensionExists('bz2'); case SERIALIZE_WDDX: return Util::extensionExists('wddx'); case SERIALIZE_IMAPUTF7: case SERIALIZE_IMAPUTF8: case SERIALIZE_IMAP8: return Util::extensionExists('imap'); case SERIALIZE_GZ_DEFLATE: case SERIALIZE_GZ_COMPRESS: case SERIALIZE_GZ_ENCOD: return Util::extensionExists('zlib'); case SERIALIZE_NONE: case SERIALIZE_BASIC: case SERIALIZE_BASE64: case SERIALIZE_SQLXML: case SERIALIZE_RAW: case SERIALIZE_URL: case SERIALIZE_UTF7: case SERIALIZE_UTF7_BASIC: return true; default: return false; } } } --- NEW FILE: package.xml --- Horde_Serialize Data Encapulation API The Serialize:: class provides various methods of encapsulating data. LGPL chuck lead Chuck Hagenbuch chuck@horde.org yunosh lead Jan Schneider jan@horde.org steph developer Stephane Huther shuther@bigfoot.com 0.0.1 alpha 2003-07-04 Initial packaging. Horde_Util From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:01 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SessionObjects SessionObjects.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.8C6AA102C87@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionObjects In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SessionObjects Added Files: SessionObjects.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: SessionObjects.php --- * * See the enclosed file COPYING for license information (LGPL). If youq * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_SessionObjects */ class Horde_SessionObjects { /** * The list of oids to prune at the end of a request. * * @var array $_pruneList */ var $_pruneList = null; /** * The name of the store. * * @var string $_name */ var $_name = 'horde_session_objects'; /** * Allow store() to overwrite current objects? * * @var boolean $_overwrite */ var $_overwrite = false; /** * The maximum number of objects that the store should hold. * * @var integer $size */ var $_size = 20; /** * Returns a reference to the global Horde_SessionObjects object, * only creating it if it doesn't already exist. * * This method must be invoked as: * $objectstore = &Horde_SessionObjects::singleton(); * * @access public * * @return object Horde_SessionObjects The Horde_SessionObjects instance. */ function &singleton() { static $object; if (!isset($object)) { $object = new Horde_SessionObjects(); } return $object; } /** * Constructor. * * @access public * * @param optional array $params The parameter array. *
     * Optional Parameters:
     * 'name'  --  The name of the session variable to store the objects in.
     * 'size'  --  The maximum size of the (non-prunable) object store.
     * 
*/ function Horde_SessionObjects($params = array()) { if (isset($params['name'])) { $this->_name = $params['name']; } if (isset($params['size']) && is_int($params['size'])) { $this->_size = $params['size']; } } /** * Wrapper around store that will return the oid instead. * * @see store * * @access public * * @param mixed $data The data to store in the session * store. * @param optional boolean $prune If false, this object will not be * pruned from the store if the maximum * store size is exceeded. * * @return string The MD5 string representing the object's ID. */ function storeOid($data, $prune = true) { $oid = $this->oid($data); $this->store($oid, $data, $prune); return $oid; } /** * Attempts to store an object in the session store. * * @access public * * @param string $oid Object ID used as the storage key. * @param mixed $data The data to store in the session * store. * @param optional boolean $prune If false, this object will not be * pruned from the store if the maximum * store size is exceeded. * * @return boolean True on success, false on failure. */ function store($oid, $data, $prune = true) { /* Set up object now. */ $dataObject = array(); $dataObject['data'] = serialize($data); $dataObject['prune'] = $prune; if (!isset($_SESSION[$this->_name])) { $_SESSION[$this->_name] = array(); $_SESSION[$this->_name]['__prune'] = 0; } if ($this->_overwrite || !isset($_SESSION[$this->_name][$oid])) { $_SESSION[$this->_name][$oid] = $dataObject; if ($prune) { $_SESSION[$this->_name]['__prune']++; } } /* Check for prunable Oids. */ $this->_pruneOids(); return true; } /** * Overwrites a current element in the object store. * * @access public * * @param string $oid Object ID used as the storage key. * @param mixed $data The data to store in the session * store. * @param optional boolean $prune If false, this object will not be * pruned from the store if the maximum * store size is exceeded. * * @return boolean True on success, false on failure. */ function overwrite($oid, $data, $prune = true) { $this->_overwrite = true; $success = $this->store($oid, $data, $prune); $this->_overwrite = false; return $success; } /** * Attempts to retrive an object from the store. * * @access public * * @param string $oid Object ID to query. * @param optional enum $type NOT USED * @param optional integer $val NOT USED * * @return mixed The requested object, or false on failure. */ function query($oid, $type = null, $val = null) { if (!isset($_SESSION[$this->_name]) || (is_null($oid) || !isset($_SESSION[$this->_name][$oid]))) { return false; } else { return unserialize($_SESSION[$this->_name][$oid]['data']); } } /** * Sets the prune flag on a store object. * * @access public * * @param string $oid The object ID. * @param boolean $prune True to allow pruning, false for no pruning. */ function setPruneFlag($oid, $prune) { if (isset($_SESSION[$this->_name][$oid]) && ($_SESSION[$this->_name][$oid]['prune'] != $prune)) { $_SESSION[$this->_name][$oid]['prune'] = $prune; if ($prune) { $_SESSION[$this->_name]['__prune']++; } else { $_SESSION[$this->_name]['__prune']--; } } } /** * Generates an OID for an object. * * @access public * * @param mixed $data The data to store in the store. * * @return string $oid An object ID to use as the storage key. */ function oid($data) { return md5(serialize($data)); } /** * Generate the list of prunable oids. * * @access private */ function _pruneOids() { if (is_null($this->_pruneList) && isset($_SESSION[$this->_name]['__prune']) && ($_SESSION[$this->_name]['__prune'] > $this->_size)) { $this->_pruneList = array(); foreach ($_SESSION[$this->_name] as $key => $val) { if ($val['prune']) { $this->_pruneList[] = $key; } } register_shutdown_function(array(&$this, '_prune')); } } /** * Prune old store entries at request shutdown. * * @access private */ function _prune() { $pruneOids = array_slice($this->_pruneList, 0, $_SESSION[$this->_name]['__prune'] - $this->_size); foreach ($pruneOids as $val) { unset($_SESSION[$this->_name][$val]); } $_SESSION[$this->_name]['__prune'] -= count($pruneOids); } } --- NEW FILE: package.xml --- Horde_SessionObjects Horde Session Storage API The Horde_SessionObjects:: class provides a way for storing data (usually, but not necessarily, objects) in the current user's session. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-07-05 Initial packaging. baseinstalldir="/Horde" Horde_Framework 0.0.1 2003-07-05 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:02 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SessionHandler/SessionHandler dbm.php, NONE, 1.1 mysql.php, NONE, 1.1 oci8.php, NONE, 1.1 pgsql.php, NONE, 1.1 sapdb.php, NONE, 1.1 sql.php, NONE, 1.1 Message-ID: <20051014143313.92F7A102C88@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SessionHandler/SessionHandler In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SessionHandler/SessionHandler Added Files: dbm.php mysql.php oci8.php pgsql.php sapdb.php sql.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: dbm.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SessionHandler */ class SessionHandler_dbm extends SessionHandler { /** * Our pointer to the DBM file, if open. * * @var resource $_dbm */ var $_dbm; /** * Constructs a new DBM SessionHandler object. * * @access public * * @param optional array $params [Unused]. */ function SessionHandler_dbm($params = array()) { } /** * TODO */ function open($save_path, $session_name) { $this->_dbm = @dbmopen("$save_path/$session_name", 'c'); return $this->_dbm; } /** * TODO */ function close() { return @dbmclose($this->_dbm); } /** * TODO */ function read($id) { if ($data = dbmfetch($this->_dbm, $id)) { return base64_decode(substr($data, strpos($data, '|') + 1)); } else { return ''; } } /** * TODO */ function write($id, $session_data) { return @dbmreplace($this->_dbm, $id, time() . '|' . base64_encode($session_data)); } /** * TODO */ function destroy($id) { if (!(@dbmdelete($this->_dbm, $id))) { Horde::logMessage('Failed to delete session (id = ' . $id . ')', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } /** * TODO */ function gc($maxlifetime = 300) { $expired = time() - $maxlifetime; $id = dbmfirstkey($this->_dbm); while ($id) { if ($data = dbmfetch($this->_dbm, $id)) { $age = substr($tmp, 0, strpos($data, '|')); if ($expired > $age) { $this->destroy($id); } } $id = dbmnextkey($this->_dbm, $id); } return true; } } --- NEW FILE: mysql.php --- * 'hostspec' -- The hostname of the database server. * 'protocol' -- The communication protocol ('tcp', 'unix', etc.). * 'username' -- The username with which to connect to the database. * 'password' -- The password associated with 'username'. * 'database' -- The name of the database. * 'table' -- The name of the sessiondata table in 'database'. * * Required for some configurations: * 'port' -- The port on which to connect to the database. * * Optional parameters: * 'persistent' -- Use persistent DB connections? (boolean) * * The table structure can be created by the scripts/db/sessionhandler.sql * script. * * $Horde: framework/SessionHandler/SessionHandler/mysql.php,v 1.16 2004/01/01 15:14:28 jan Exp $ * * Copyright 2002-2004 Mike Cochrane * Copyright 2002-2004 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrame * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SessionHandler */ class SessionHandler_mysql extends SessionHandler { /** * Hash containing connection parameters. * * @var array $_params */ var $_params = array(); /** * Handle for the current database connection. * * @var resource $_db */ var $_db; /** * Are we connected to the SQL server. * * @var boolean $_connected */ var $_connected = false; /** * Constructs a new MySQL SessionHandler object. * * @access public * * @param optional array $params A hash containing connection parameters. * See details above. */ function SessionHandler_mysql($params = array()) { $this->_params = $params; } /** * TODO */ function open($save_path, $session_name) { /* Connect to database. */ $this->_connect(); } /** * TODO */ function close() { /* Disconnect from database. */ $this->_disconnect(); } /** * TODO */ function read($id) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Session timeout, don't rely on garbage collection */ $timeout = time() - ini_get('session.gc_maxlifetime'); $query = sprintf('SELECT session_data FROM %s WHERE session_id = %s' . ' AND session_lastmodified > %s', $this->_params['table'], $this->_quote($id), $timeout); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_mysql::read(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); $result = @mysql_query($query, $this->_db); if (!$result){ Horde::logMessage('Error retrieving session data (id = ' . $id . ')', __FILE__, __LINE__, PEAR_LOG_ERR); return ''; } list($value) = mysql_fetch_row($result); return $value; } /** * TODO */ function write($id, $session_data) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('REPLACE INTO %s (session_id, session_data, session_lastmodified)' . ' VALUES (%s, %s, %s)', $this->_params['table'], $this->_quote($id), $this->_quote($session_data), time()); $result = mysql_query($query, $this->_db); if (!$result){ Horde::logMessage('Error writing session data', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } /** * TODO */ function destroy($id) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_id = %s', $this->_params['table'], $this->_quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_mysql::destroy(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = @mysql_query($query, $this->_db); if (!$result) { Horde::logMessage('Failed to delete session (id = ' . $id . ')', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } /** * TODO */ function gc($maxlifetime = 300) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_lastmodified < %s', $this->_params['table'], (int)(time() - $maxlifetime)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_mysql::gc(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = @mysql_query($query, $this->_db); if (!$result) { Horde::logMessage('Error garbage collecting old sessions', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return @mysql_affected_rows($this->_db); } /** * Escape a mysql string. * * @access private * * @param string $value The string to quote. * * @return string The quoted string. */ function _quote($value) { switch (strtolower(gettype($value))) { case 'null': return 'NULL'; case 'integer': return $value; case 'string': default: return "'" . mysql_real_escape_string($value) . "'"; } } /** * Attempts to open a connection to the SQL server. * * @access private */ function _connect() { if ($this->_connected) { return; } Horde::assertDriverConfig($this->_params, 'sessionhandler', array('hostspec', 'username', 'database', 'password'), 'session handler MySQL'); if (empty($this->_params['table'])) { $this->_params['table'] = 'horde_sessionhandler'; } if (empty($this->_params['persistent'])) { $connect = 'mysql_connect'; } else { $connect = 'mysql_pconnect'; } if (!$this->_db = @$connect($this->_params['hostspec'], $this->_params['username'], $this->_params['password'])) { Horde::fatal(PEAR::raiseError('Could not connect to database for SQL SessionHandler.'), __FILE__, __LINE__); } if (!@mysql_select_db($this->_params['database'], $this->_db)) { Horde::fatal(PEAR::raiseError(sprintf('Could not connect to table %s for SQL SessionHandler.', $this->_params['database']), __FILE__, __LINE__)); } $this->_connected = true; } /** * Disconnect from the SQL server and clean up the connection. * * @access private */ function _disconnect() { if ($this->_connected) { return @mysql_close($this->_db); } $this->_connected = false; } } --- NEW FILE: oci8.php --- * 'hostspec' -- The hostname of the database server. * 'protocol' -- The communication protocol ('tcp', 'unix', etc.). * 'username' -- The username with which to connect to the database. * 'password' -- The password associated with 'username'. * 'database' -- The name of the database. * 'table' -- The name of the sessiondata table in 'database'. * * Required for some configurations: * 'port' -- The port on which to connect to the database. * * Optional parameters: * 'persistent' -- Use persistent DB connections? (boolean) * * The table structure can be created by the scripts/db/sessionhandler.sql * script. * * $Horde: framework/SessionHandler/SessionHandler/oci8.php,v 1.7 2004/01/01 15:14:28 jan Exp $ * * Copyright 2003-2004 Liam Hoekenga * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Liam Hoekenga * @version $Revision: 1.1 $ * @since Horde 2.2 * @package Horde_SessionHandler */ class SessionHandler_oci8 extends SessionHandler { /** * Hash containing connection parameters. * * @var array $_params */ var $_params = array(); /** * Handle for the current database connection. * * @var resource $_db */ var $_db; /** * Are we connected to the SQL server. * * @var boolean $_connected */ var $_connected = false; /** * The quote function to use. * * @var string $_quote */ var $_quote = null; /** * Constructs a new Oracle8 SessionHandler object. * * @access public * * @param optional array $params A hash containing connection parameters. * See details above. */ function SessionHandler_oci8($params = array()) { $this->_params = $params; } function open($save_path, $session_name) { /* Connect to database. */ $this->_connect(); } function close() { /* Disconnect from database. */ $this->_disconnect(); } function read($id) { /* Make sure we have a valid database connection. */ $this->_connect(); $select_query = sprintf('SELECT session_data FROM %s WHERE session_id = %s', $this->_params['table'], $this->_quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_oci8::read(): query = "%s"', $select_query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute query */ $select_statement = OCIParse($this->_db, $select_query); OCIExecute($select_statement); if (!OCIFetchInto($select_statement, $result)) { $insert_query = sprintf('INSERT INTO %s (session_id, session_lastmodified, session_data) VALUES (%s, %s, EMPTY_BLOB()) RETURNING session_data INTO :blob', $this->_params['table'], $this->_quote($id), $this->_quote(time())); $insert_statement = OCIParse($this->_db, $insert_query); $lob = OCINewDescriptor($this->_db); OCIBindByName($insert_statement, ':blob', $lob, -1, SQLT_BLOB); OCIExecute($insert_statement, OCI_DEFAULT); if ($session_data) { $lob->save($session_data); } $result = OCICommit($this->_db); OCIFreeStatement($insert_statement); OCIExecute($select_statement); OCIFetchInto($select_statement, $result); } $value = $result[0]->load(); OCIFreeStatement($select_statement); return($value); } function write($id, $session_data) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ /* there has to be a better way to to do this... */ $query = sprintf('UPDATE %s SET session_lastmodified = %s, session_data = EMPTY_BLOB() WHERE session_id = %s RETURNING session_data INTO :blob', $this->_params['table'], $this->_quote(time()), $this->_quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_oci8::write(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute query */ $statement = OCIParse($this->_db, $query); $lob = OCINewDescriptor($this->_db); OCIBindByName($statement, ':blob', $lob, -1, SQLT_BLOB); OCIExecute($statement, OCI_DEFAULT); if ($session_data) { $lob->save($session_data); } $result = OCICommit($this->_db); if (!$result){ Horde::logMessage('Error writing session data', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } function destroy($id) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf( 'DELETE FROM %s WHERE session_id = %s', $this->_params['table'], $this->_quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_oci8::destroy(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $statement = OCIParse($this->_db, $query); $result = OCIExecute($statement); if (!$result) { OCIFreeStatement($statement); Horde::logMessage('Failed to delete session (id = ' . $id . ')', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } OCIFreeStatement($statement); return true; } function gc($maxlifetime = 1) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_lastmodified < %s', $this->_params['table'], $this->_quote(time() - $maxlifetime)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_oci8::gc(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $statement = OCIParse($this->_db, $query); $result = OCIExecute($statement); if (!$result) { OCIFreeStatement($statement); Horde::logMessage('Error garbage collecting old sessions', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } OCIFreeStatement($statement); return true; } /** * Escape a string for insertion. stolen from PEAR::DB * @access private * * @param string $value The string to quote. * * @return string The quoted string. */ function _quote($value) { return ($value === null) ? 'NULL' : "'" . str_replace("'", "''", $value) . "'"; } /** * Attempts to open a connection to the SQL server. * * @access private */ function _connect() { if ($this->_connected) { return; } Horde::assertDriverConfig($this->_params, 'sessionhandler', array('hostspec', 'username', 'database', 'password'), 'session handler Oracle'); if (!array_key_exists('table', $this->_params)) { $this->_params['table'] = 'horde_sessionhandler'; } if (empty($this->_params['persistent'])) { $connect = 'OCILogon'; } else { $connect = 'OCIPLogon'; } if (!$this->_db = @$connect($this->_params['username'], $this->_params['password'], $this->_params['hostspec'])) { Horde::fatal(PEAR::raiseError('Could not connect to database for SQL SessionHandler.'), __FILE__, __LINE__); } $this->_connected = true; } /** * Disconnect from the SQL server and clean up the connection. * * @access private */ function _disconnect() { if ($this->_connected) { return OCILogOff($this->_db); } $this->_connected = false; } } --- NEW FILE: pgsql.php --- . All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *
 * Required values for $params:
 *     'database'  --  The name of the database.
 *     'password'  --  The password associated with 'username'.
 *     'protocol'  --  The communication protocol ('tcp', 'unix').
 *     'username'  --  The username with which to connect to the database.
 *
 * Required for some configurations (i.e. 'protocol' = 'tcp'):
 *     'hostspec'  --  The hostname of the database server.
 *     'port'      --  The port on which to connect to the database.
 *
 * Optional parameters:
 *     'persistent'  --  Use persistent DB connections? (boolean)
 *                       Default: NO
 *     'table'       --  The name of the sessiondata table in 'database'.
 *                       Default: 'horde_sessionhandler'
 * 
* * The table structure can be created by the * scripts/db/pgsql_sessionhandler.sql script. * * Contributors: * Jason Carlson Return an empty string on failed reads * pat@pcprogrammer.com Perform update in a single transaction * Jonathan Crompton Lock row for life of session * * $Horde: framework/SessionHandler/SessionHandler/pgsql.php,v 1.11 2004/01/01 15:14:28 jan Exp $ * * @author Jon Parise * @version 1.10, 9/11/02 * @since Horde 3.0 * @package Horde_SessionHandler */ class SessionHandler_pgsql extends SessionHandler { /** Hash containing connection parameters. */ var $_params = array(); /** Handle for the current database connection. @var resource $_db */ var $_db; /** * Boolean indicating whether or not we're connected to the SQL * server. */ var $_connected = false; /** * Constructs a new PostgreSQL SessionHandler object. * * @param array $params A hash containing connection parameters. */ function SessionHandler_pgsql($params = array()) { $this->_params = $params; } function open($save_path, $session_name) { /* Connect to database. */ $this->_connect(); } function close() { /* Disconnect from database. */ $this->_disconnect(); } function read($id) { /* Make sure we have a valid database connection. */ $this->_connect(); $expired = time() - ini_get('session.gc_maxlifetime'); $squery = sprintf('BEGIN; SELECT session_data FROM %s WHERE session_id = %s AND session_lastmodified >= %s FOR UPDATE;', $this->_params['table'], $this->quote($id), $expired); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_pgsql::read(): query = "%s"', $squery), __FILE__, __LINE__, PEAR_LOG_DEBUG); $result = @pg_exec($this->_db, $squery); if (pg_numrows($result) < 1) { pg_freeresult($result); $iquery = sprintf('INSERT INTO %s VALUES (%s, %s, \'\')', $this->_params['table'], $this->quote($id), time()); $result = @pg_exec($this->_db, $iquery); $result = @pg_exec($this->_db, $squery); } $data = pg_result($result, 0, 'session_data'); pg_freeresult($result); return $data; } function write($id, $session_data) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('UPDATE %s SET session_lastmodified = %s, session_data = %s WHERE session_id = %s; commit;', $this->_params['table'], time(), $this->quote($session_data), $this->quote($id)); $result = @pg_exec($this->_db, $query); $success = (pg_cmdtuples($result) == 0); pg_freeresult($result); if (!$success){ Horde::logMessage('Error writing session data', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } function destroy($id) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_id = %s; commit;', $this->_params['table'], $this->quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_pgsql::destroy(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = @pg_exec($this->_db, $query); if (!$result) { pg_freeresult($result); Horde::logMessage('Failed to delete session (id = ' . $id . ')', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } pg_freeresult($result); return true; } function gc($maxlifetime = 300) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_lastmodified < %s', $this->_params['table'], $this->quote(time() - $maxlifetime)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_pgsql::gc(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = @pg_exec($this->_db, $query); if (!$result) { pg_freeresult($result); Horde::logMessage('Error garbage collecting old sessions', __FILE__, __LINE__, PEAR_LOG_ERR); return false; } pg_freeresult($result); return $result; } function quote($value) { return "'" . addslashes($value) . "'"; } /** * Attempts to open a connection to the SQL server. * * @return boolean True on success; exits (Horde::fatal()) on error. */ function _connect() { if (!$this->_connected) { Horde::assertDriverConfig($this->_params, 'sessionhandler', array('hostspec', 'username', 'database', 'password'), 'session handler pgsql'); if (!array_key_exists('table', $this->_params)) { $this->_params['table'] = 'horde_sessionhandler'; } $connect = (empty($this->_params['persistent'])) ? 'pg_connect' :'pg_pconnect'; $paramstr = ''; if ($tcp_protocol) { $paramstr .= ' host=' . $this->_params['hostspec']; $paramstr .= ' port=' . $this->_params['port']; } $paramstr .= ' dbname=' . $this->_params['database']; $paramstr .= ' user=' . $this->_params['username']; $paramstr .= ' password=' . $this->_params['password']; if (!$this->_db = @$connect($paramstr)) { return false; } $this->_connected = true; } return true; } /** * Disconnect from the SQL server and clean up the connection. * * @return boolean true on success, false on failure. */ function _disconnect() { if ($this->_connected) { $this->_connected = false; return @pg_close($this->_db); } return true; } } --- NEW FILE: sapdb.php --- * 'hostspec' -- The hostname of the database server. * 'protocol' -- The communication protocol ('tcp', 'unix', etc.). * 'username' -- The username with which to connect to the database. * 'password' -- The password associated with 'username'. * 'database' -- The name of the database. * 'table' -- The name of the sessiondata table in 'database'. * * The table structure can be created by the scripts/db/sessionhandler.sql * script. * * $Horde: framework/SessionHandler/SessionHandler/sapdb.php,v 1.13 2004/01/01 15:14:28 jan Exp $ * * Copyright 2002-2004 Mike Cochrane * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SessionHandler */ class SessionHandler_sapdb extends SessionHandler_sql { /** Hash containing connection parameters. */ var $_params = array(); /** Handle for the current database connection. @var object DB $db */ var $_db; /** * Boolean indicating whether or not we're connected to the SQL * server. */ var $_connected = false; /** * Constructs a new SQL SessionHandler object. * * @param array $params A hash containing connection parameters. */ function SessionHandler_sapdb($params = array()) { $this->_params = $params; $this->_params['phptype'] = 'odbc'; } function read($id) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('SELECT session_data FROM %s WHERE session_id = %s', $this->_params['table'], $this->_db->quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_sql::read(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query */ $result = odbc_exec($this->_db->connection, $query); odbc_longreadlen($result, 1024*1024); /* Fetch the value */ odbc_fetch_row($result, 0); $data = odbc_result($result, 'session_data'); /* Clean up */ odbc_free_result($result); return $data; } } --- NEW FILE: sql.php --- * 'phptype' -- The database type (e.g. 'pgsql', 'mysql', etc.). * 'hostspec' -- The hostname of the database server. * 'protocol' -- The communication protocol ('tcp', 'unix', etc.). * 'username' -- The username with which to connect to the database. * 'password' -- The password associated with 'username'. * 'database' -- The name of the database. * 'table' -- The name of the sessiondata table in 'database'. * * Required by some database implementations: * 'options' -- Additional options to pass to the database. * 'tty' -- The TTY on which to connect to the database. * 'port' -- The port on which to connect to the database. * * Optional parameters: * 'persistent' -- Use persistent DB connections? (boolean) * * Ths table structure can be created by the scripts/db/sessionhandler.sql * script. * * $Horde: framework/SessionHandler/SessionHandler/sql.php,v 1.21 2004/04/07 14:43:13 chuck Exp $ * * Copyright 2002-2004 Mike Cochrane * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SessionHandler */ class SessionHandler_sql extends SessionHandler { /** Hash containing connection parameters. */ var $_params = array(); /** Handle for the current database connection. @var object DB $_db */ var $_db; /** * Boolean indicating whether or not we're connected to the SQL * server. */ var $_connected = false; /** * Constructs a new SQL SessionHandler object. * * @param array $params A hash containing connection parameters. */ function SessionHandler_sql($params = array()) { $this->_params = $params; } function open($save_path, $session_name) { /* Connect to database */ $this->_connect(); } function close() { /* Disconnect from Database */ $this->_disconnect(); } function read($id) { /* Make sure we have a valid database connection. */ $this->_connect(); require_once 'Horde/SQL.php'; /* Execute the query. */ $result = Horde_SQL::readBlob($this->_db, $this->_params['table'], 'session_data', array('session_id' => $id)); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); return ''; } return $result; } function write($id, $session_data) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('SELECT session_id FROM %s WHERE session_id = %s', $this->_params['table'], $this->_db->quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_sql::write(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = $this->_db->getOne($query); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); return false; } require_once 'Horde/SQL.php'; if ($result) { $result = Horde_SQL::updateBlob($this->_db, $this->_params['table'], 'session_data', $session_data, array('session_id' => $id), array('session_lastmodified' => time())); } else { $result = Horde_SQL::insertBlob($this->_db, $this->_params['table'], 'session_data', $session_data, array('session_id' => $id, 'session_lastmodified' => time())); } if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } function destroy($id) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_id = %s', $this->_params['table'], $this->_db->quote($id)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_sql::destroy(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = $this->_db->query($query); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } function gc($maxlifetime = 300) { /* Make sure we have a valid database connection. */ $this->_connect(); /* Build the SQL query. */ $query = sprintf('DELETE FROM %s WHERE session_lastmodified < %s', $this->_params['table'], $this->_db->quote(time() - $maxlifetime)); /* Log the query at a DEBUG log level. */ Horde::logMessage(sprintf('SQL Query by SessionHandler_sql::gc(): query = "%s"', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = $this->_db->query($query); if (is_a($result, 'PEAR_Error')) { Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR); return false; } return true; } /** * Attempts to open a connection to the SQL server. * * @return boolean True on success; exits (Horde::fatal()) on error. */ function _connect() { if (!$this->_connected) { Horde::assertDriverConfig($this->_params, 'sessionhandler', array('phptype', 'hostspec', 'username', 'database', 'password'), 'session handler SQL'); if (empty($this->_params['table'])) { $this->_params['table'] = 'horde_sessionhandler'; } /* Connect to the SQL server using the supplied * parameters. */ include_once 'DB.php'; $this->_db = &DB::connect($this->_params, array('persistent' => !empty($this->_params['persistent']))); if (is_a($this->_db, 'PEAR_Error')) { Horde::fatal($this->_db, __FILE__, __LINE__); } /* Enable the "portability" option. */ $this->_db->setOption('optimize', 'portability'); $this->_connected = true; } return true; } /** * Disconnect from the SQL server and clean up the connection. * * @return boolean true on success, false on failure. */ function _disconnect() { if ($this->_connected) { $this->_connected = false; return $this->_db->disconnect(); } return true; } } From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Share Share.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.CE9F9102C38@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Share In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Share Added Files: Share.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Share.php --- * Copyright 2002-2004 Infoteck Internet * Copyright 2002-2004 Chuck Hagenbuch * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Joel Vandal * @author Mike Cochrame * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Share */ class Horde_Share { /** * Pointer to a DataTree instance to manage/store shares * * @var object DataTree $_datatree */ var $_datatree; /** * The application we're managing shares for. * * @var string $_app */ var $_app; /** * The subclass of DataTreeObject to instantiate shares as. * * @var string $_shareObject */ var $_shareObject = 'DataTreeObject_Share'; /** * A cache of all shares that have been retrieved, so we don't hit * the backend again and again for them. * * @var array $_cache */ var $_cache = array(); /** * Cache used for listShares(). * * @var array $_listcache */ var $_listcache = array(); /** * A list of objects that we're currently sorting, for reference * during the sorting algorithm. * * @var array $_sortList */ var $_sortList; /** * Attempts to return a reference to a concrete Horde_Share * instance. It will only create a new instance if no Horde_Share * instance currently exists. * * This method must be invoked as: * $var = &Horde_Share::singleton($app); * * @access public * * @param string $app The applications that the shares relate to. * relate to. * * @return object Share The concrete Share reference, or false on an * error. */ function &singleton($app) { static $shares; if (!isset($shares[$app])) { $shares[$app] = new Horde_Share($app); } return $shares[$app]; } /** * Constructor. * Reads all the user's shares from the prefs object or builds * a new share from the standard values given in prefs.php. * * @access public * * @param string $app The applications that the shares relate ro. * relate to. */ function Horde_Share($app) { global $conf, $registry; if (!isset($conf['datatree']['driver'])) { Horde::fatal('You must configure a DataTree backend to use Shares.'); } $driver = $conf['datatree']['driver']; $this->_app = $app; $this->_datatree = &DataTree::singleton( $driver, array_merge(Horde::getDriverConfig('datatree', $driver), array('group' => 'horde.shares.' . $app)) ); } /** * Return a DataTreeObject_Share object corresponding to the given * share name, with the details retrieved appropriately. * * @access public * * @param string $name The name of the share to retrieve. * * @return TODO */ function &getShare($name) { if (isset($this->_cache[$name])) { return $this->_cache[$name]; } $this->_cache[$name] = &$this->_datatree->getObject($name, $this->_shareObject); if (!is_a($this->_cache[$name], 'PEAR_Error')) { $this->_cache[$name]->setShareOb($this); } return $this->_cache[$name]; } /** * Return a DataTreeObject_Share object corresponding to the given * unique ID, with the details retrieved appropriately. * * @access public * * @param string $cid The id of the share to retrieve. * * @return TODO */ function &getShareById($cid) { $share = $this->_datatree->getObjectById($cid, $this->_shareObject); if (!is_a($share, 'PEAR_Error')) { $share->setShareOb($this); } return $share; } /** * Return an array of DataTreeObject_Share objects corresponding * to the given set of unique IDs, with the details retrieved * appropriately. * * @access public * * @param array $cids The array of ids to retrieve. * * @return TODO */ function &getShares($cids) { $shares = $this->_datatree->getObjects($cids, $this->_shareObject); if (is_a($shares, 'PEAR_Error')) { return $shares; } $keys = array_keys($shares); foreach ($keys as $key) { if (is_a($shares[$key], 'PEAR_Error')) { return $shares[$key]; } $this->_cache[$key] = &$shares[$key]; $shares[$key]->setShareOb($this); } return $shares; } /** * Return a new share object. * * @access public * * @param string $name The share's name. * * @return object DataTreeObject_Share A new share object. */ function &newShare($name) { if (empty($name)) { return PEAR::raiseError('Share names must be non-empty'); } $share = &new $this->_shareObject($name); $share->setShareOb($this); return $share; } /** * Add a share to the shares system. The share must first be * created with Horde_Share::newShare(), and have any initial * details added to it, before this function is called. * * @access public * * @param object DataTreeObject_Share $share The new share object. * * @return TODO */ function addShare($share) { if (!is_a($share, 'DataTreeObject_Share')) { return PEAR::raiseError('Shares must be DataTreeObject_Share objects or extend that class.'); } $perm = &$GLOBALS['perms']->newPermission($share->getName()); /* Give the owner full access */ $perm->addUserPermission($share->get('owner'), PERMS_SHOW, false); $perm->addUserPermission($share->get('owner'), PERMS_READ, false); $perm->addUserPermission($share->get('owner'), PERMS_EDIT, false); $perm->addUserPermission($share->get('owner'), PERMS_DELETE, false); $share->setPermission($perm, false); return $this->_datatree->add($share); } /** * Store updated data - name, etc. - of a share to the backend * system. * * @access public * * @param object DataTreeObject_Share $share The share to update. * * @return TODO */ function updateShare($share) { if (!is_a($share, 'DataTreeObject_Share')) { return PEAR::raiseError('Shares must be DataTreeObject_Share objects or extend that class.'); } return $this->_datatree->updateData($share); } /** * Remove a share from the shares system permanently. * * @param object DataTreeObject_Share $share The share to remove. */ function removeShare($share) { if (!is_a($share, 'DataTreeObject_Share')) { return PEAR::raiseError('Shares must be DataTreeObject_Share objects or extend that class.'); } return $this->_datatree->remove($share); } /** * Check to see if $share has any child shares. * * @access public * * @param object DataTreeObject_Share $share The share to remove. * * @return boolean TODO */ function hasChildren($share) { if (!is_a($share, 'DataTreeObject_Share')) { return PEAR::raiseError('Shares must be DataTreeObject_Share objects or extend that class.'); } return (boolean)$this->_datatree->getNumberOfChildren($share); } /** * Get a $share's direct parent object. * * @access public * * @param string $share Get the parent of this share. * * @return object DataTreeObject_Share The parent share, if it exists. */ function &getParent($child) { $id = $this->_datatree->getParent($child); if (is_a($id, 'PEAR_Error')) { return $id; } if (!$id || ($id == '-1')) { return PEAR::raiseError('Parent does not exist.'); } return $this->getShareById($id); } /** * TODO * * @access public * * @param TODO * * @return TODO */ function getShareId($share) { return $this->_datatree->getId($share->getName()); } /** * Utility function to be used with uasort() (do NOT use usort; * you'll lose key => value associations) for sorting arrays of * Horde_Share:: objects. * * Usage: uasort($list, array('Horde_Share', '_sortShares')); * * @access private */ function _sortShares($a, $b) { $aParts = explode(':', $a->getName()); $bParts = explode(':', $b->getName()); $min = min(count($aParts), count($bParts)); $idA = ''; $idB = ''; for ($i = 0; $i < $min; $i++) { if ($idA) { $idA .= ':'; $idB .= ':'; } $idA .= $aParts[$i]; $idB .= $bParts[$i]; if ($idA != $idB) { $curA = $this->_sortList[$idA]; $curB = $this->_sortList[$idB]; return strnatcasecmp($curA->get('name'), $curB->get('name')); } } return count($aParts) > count($bParts); } /** * Check if a share exists in the system. * * @access public * * @param string $share The share to check. * * @return boolean True if the share exists, false otherwise. */ function exists($share) { return $this->_datatree->exists($share); } /** * Return an array of all shares that $userid has access to. * * @param string $userid The userid of the user to check * access for. * @param optional integer $perm The level of permissions required. * @param optional boolean $owner Only return shares that $userid * owns. * @param optional string $parent The parent share to start * searching at. * @param optional boolean $allLevels Return all levels, or just the * direct children of $parent? * Defaults to all levels. * * @return array The shares the user has access to. */ function &listShares($userid, $perm = PERMS_SHOW, $owner = false, $parent = '-1', $allLevels = true) { $key = serialize(array($this->_app, $userid, $perm, $owner)); if (empty($this->_listcache[$key])) { if (!empty($userid)) { if ($owner) { $criteria = array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'owner'), array('field' => 'value', 'op' => '=', 'test' => $userid))); } else { $criteria = array( 'OR' => array( // (owner == $userid) array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'owner'), array('field' => 'value', 'op' => '=', 'test' => $userid))), // (name == perm_users and key == $userid and val & $perm) array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'perm_users'), array('field' => 'key', 'op' => '=', 'test' => $userid), array('field' => 'value', 'op' => '&', 'test' => $perm))), // (name == perm_creator and val & $perm) array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'perm_creator'), array('field' => 'value', 'op' => '&', 'test' => $perm))), // (name == perm_default and val & $perm) array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'perm_default'), array('field' => 'value', 'op' => '&', 'test' => $perm))))); // If the user has any group memberships, check // for those also. require_once 'Horde/Group.php'; $group = &Group::singleton(); $groups = $group->getGroupMemberships($userid, true); if (!is_a($groups, 'PEAR_Error') && count($groups)) { // (name == perm_groups and key in ($groups) and val & $perm) $criteria['OR'][] = array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'perm_groups'), array('field' => 'key', 'op' => 'IN', 'test' => '(' . implode(', ', array_keys($groups)) . ')'), array('field' => 'value', 'op' => '&', 'test' => $perm))); } } } else { $criteria = array( 'AND' => array( array('field' => 'name', 'op' => '=', 'test' => 'perm_guest'), array('field' => 'value', 'op' => '&', 'test' => $perm))); } $sharelist = $this->_datatree->getByAttributes($criteria, $parent, $allLevels); if (is_a($sharelist, 'PEAR_Error') || !count($sharelist)) { /* If we got back an error or an empty array, pass it * back to the caller. */ return $sharelist; } /* Make sure getShares() didn't return an error. */ $shares = &$this->getShares(array_keys($sharelist)); if (is_a($shares, 'PEAR_Error')) { return $shares; } $this->_listcache[$key] = &$shares; $this->_sortList = $this->_listcache[$key]; uasort($this->_listcache[$key], array($this, '_sortShares')); $this->_sortList = null; } return $this->_listcache[$key]; } /** * List *all* shares for the current app/share, regardless of * permissions. This is for admin functionality and scripting * tools, and shouldn't be called from user-level code! * * @access public * * @param optional boolean $parent Start the listing at a certain point * in the tree. * Defaults to '-1', the root. * * @return array All shares for the current app/share. */ function listAllShares($parent = '-1') { $sharelist = $this->_datatree->get(DATATREE_FORMAT_FLAT, $parent, true); if (is_a($sharelist, 'PEAR_Error') || !count($sharelist)) { // If we got back an error or an empty array, just // return it. return $sharelist; } unset($sharelist[$parent]); $shares = &$this->getShares(array_keys($sharelist)); if (is_a($shares, 'PEAR_Error')) { return $shares; } $this->_sortList = $shares; uasort($shares, array($this, '_sortShares')); $this->_sortList = null; return $shares; } /** * TODO * * @access public * * @param TODO * @param TODO * * @return TODO */ function getPermissions($share, $user = null) { if (!is_a($share, 'DataTreeObject_share')) { $share = &$this->getShare($share); } $perm = &$share->getPermission(); return $GLOBALS['perms']->getPermissions($perm, $user); } /** * Returns the Identity for a particular share owner. * * @access public * * @param mixed $share The share to fetch the Identity for - either * the string name, or the DataTreeObject_Share * object. * * @return string The preference's value. */ function &getIdentityByShare($share) { if (!is_a($share, 'DataTreeObject_Share')) { $share = $this->getShare($share); if (is_a($share, 'PEAR_Error')) { return null; } } require_once 'Horde/Identity.php'; $owner = $share->get('owner'); return $ret = &Identity::singleton('none', $owner); } } /** * Extension of the DataTreeObject class for storing Share information * in the DataTree driver. If you want to store specialized Share * information, you should extend this class instead of extending * DataTreeObject directly. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Share */ class DataTreeObject_Share extends DataTreeObject { /** * The Horde_Share object which this share came from - needed for * updating data in the backend to make changes stick, etc. * * @var object Horde_Share $_shareOb */ var $_shareOb; /** * The DataTreeObject_Share constructor. Just makes sure to call * the parent constructor so that the share's is is set properly. * * @access public * * @param string $id The id of the share. */ function DataTreeObject_Share($id) { parent::DataTreeObject($id); if (is_null($this->data)) { $this->data = array(); } } /** * Associates a Share object with this share. * * @access public * * @param object Share $shareOb The Share object. */ function setShareOb(&$shareOb) { $this->_shareOb = &$shareOb; } /** * TODO * * @access public * * @return TODO */ function getId() { return $this->_shareOb->getShareId($this); } /** * Get this share's parent object. * * @access public * * @return object DataTreeObject_Share The parent share, if it exists. */ function &getParent() { return $this->_shareOb->getParent($this); } /** * Gives a user certain privileges for this share. * * @access public * * @param string $userid The userid of the user. * @param integer $permission A PERMS_* constant. */ function addUserPermission($userid, $permission) { $perm = &$this->getPermission(); $perm->addUserPermission($userid, $permission, false); $this->setPermission($perm); } /** * Removes a certain privileges from a user. * * @access public * * @param string $userid The userid of the user. * @param integer $permission A PERMS_* constant. */ function removeUserPermission($userid, $permission) { $perm = &$this->getPermission(); $perm->removeUserPermission($userid, $permission, false); $this->setPermission($perm); } /** * Gives a group certain privileges for this share. * * @access public * * @param string $group The group to add permissions for. * @param integer $permission A PERMS_* constant. */ function addGroupPermission($group, $permission) { $perm = &$this->getPermission(); $perm->addGroupPermission($group, $permission, false); $this->setPermission($perm); } /** * Removes a certain privileges from a group. * * @access public * * @param string $group The group to remove permissions from. * @param constant $permission A PERMS_* constant. */ function removeGroupPermission($group, $permission) { $perm = &$this->getPermission(); $perm->removeGroupPermission($group, $permission, false); $this->setPermission($perm); } /** * Checks to see if a user has a given permission. * * @access public * * @param string $userid The userid of the user. * @param integer $priv A PERMS_* constant to test for. * @param optional string $creator The creator of the event. * * @return boolean Whether or not $userid has $permission. */ function hasPermission($userid, $permission, $creator = null) { if ($userid == $this->get('owner')) { return true; } if ($this->get('type') == 0) { return false; } return $GLOBALS['perms']->hasPermission($this->getPermission(), $userid, $permission, $creator); } /** * Remove a user from this share * * @access public * * @param string $userid The userid of the user to remove */ function removeUser($userid) { /* Remove all $userid's permissions. */ $perm = &$this->getPermission(); $perm->removeUserPermission($userid, PERMS_SHOW, false); $perm->removeUserPermission($userid, PERMS_READ, false); $perm->removeUserPermission($userid, PERMS_EDIT, false); $perm->removeUserPermission($userid, PERMS_DELETE, false); } /** * Returns an array containing all the userids of the users with * access to this share. * * @access public * * @param optional integer $perm_level List only users with this permission * level. Defaults to all users. * * @return array The users with access to this share. */ function listUsers($perm_level = null) { $perm = &$this->getPermission(); return array_keys($perm->getUserPermissions($perm_level)); } /** * Returns an array containing all the groupids of the groups * with access to this share. * * @access public * * @param optional integer $perm_level List only users with this permission * level. Defaults to all users. * * @return array The users with access to this share. */ function listGroups($perm_level = null) { $perm = &$this->getPermission(); return array_keys($perm->getGroupPermissions($perm_level)); } /** * TODO * * @access public * * @param TODO * @param optional boolean $update TODO * * @return TODO */ function setPermission(&$perm, $update = true) { $this->data['perm'] = $perm->getData(); if ($update) { return $this->_shareOb->updateShare($this); } return true; } /** * TODO * * @access public * * @return TODO */ function &getPermission() { $perm = &new DataTreeObject_Permission($this->getName()); $perm->data = isset($this->data['perm']) ? $this->data['perm'] : array(); return $perm; } /** * Force all children of this share to inherit the permissions set * on this share. * * @access public * * @return TODO */ function inheritPermissions() { $perm = &$this->getPermission(); $children = $this->_shareOb->listAllShares($this->getName()); if (is_a($children, 'PEAR_Error')) { return $children; } foreach ($children as $child) { $child->setPermission($perm); } return true; } /** * Save any changes to this object to the backend permanently. * * @access public * * @return mixed Either true or a PEAR_Error on error. */ function save() { return $this->_shareOb->updateShare($this); } /** * Map this object's attributes from the data array into a format * that we can store in the attributes storage backend. * * @access private * * @param optional boolean $permsonly Only process permissions? Lets * subclasses override part of this * method while handling their * additional attributes seperately. * * @return array The attributes array. */ function _toAttributes($permsonly = false) { // Default to no attributes. $attributes = array(); foreach ($this->data as $key => $value) { if ($key == 'perm') { foreach ($value as $type => $perms) { if (is_array($perms)) { foreach ($perms as $member => $perm) { $attributes[] = array('name' => 'perm_' . $type, 'key' => $member, 'value' => $perm); } } else { $attributes[] = array('name' => 'perm_' . $type, 'key' => '', 'value' => $perms); } } } elseif (!$permsonly) { $attributes[] = array('name' => $key, 'key' => '', 'value' => $value); } } return $attributes; } /** * Take in a list of attributes from the backend and map it to our * internal data array. * * @access public * * @param array $attributes The list of attributes from the * backend (attribute name, key, and * value). * @param optional boolean $permsonly Only process permissions? Lets * subclasses override part of this * method while handling their * additional attributes seperately. */ function _fromAttributes($attributes, $permsonly = false) { // Initialize data array. $this->data['perm'] = array(); foreach ($attributes as $attr) { if (substr($attr['name'], 0, 4) == 'perm') { if (!empty($attr['key'])) { $this->data['perm'][substr($attr['name'], 5)][$attr['key']] = $attr['value']; } else { $this->data['perm'][substr($attr['name'], 5)] = $attr['value']; } } elseif (!$permsonly) { $this->data[$attr['name']] = $attr['value']; } } } } --- NEW FILE: package.xml --- Horde_Share Horde Shared Permissions System Horde_Share:: This class provides an interface to all shares a user might have. LGPL chuck lead Chuck Hagenbuch chuck@horde.org mac lead Mike Cochrane mike@graftonhall.co.nz jvandal developer Joel Vandal jvandal@infoteck.qc.ca 0.0.1 alpha 2003-07-05 Initial packaging. Horde_Identity Horde_Perms 0.0.1 alpha 2003-07-05 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:06 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML SyncML.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143313.D2DB8102C8B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML Added Files: SyncML.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: SyncML.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_ContentHandler { /** * Output ContentHandler used to output XML events. * @var object $_output */ var $_output; /** * @var integer $_xmlStack */ var $_xmlStack = 1; /** * @var string $_chars */ var $_chars; function setOutput(&$output) { $this->_output = &$output; } function startElement($uri, $element, $attrs) { $this->_xmlStack++; } function endElement($uri, $element) { if (isset($this->_chars)) { unset($this->_chars); } $this->_xmlStack--; } function characters($str) { if (isset($this->_chars)) { $this->_chars = $this->_chars . $str; } else { $this->_chars = $str; } } } /** * Defined in SyncML Representation Protocol, version 1.1 5.2.2 * * @package Horde_SyncML */ class Horde_SyncML_SyncMLHdr extends Horde_SyncML_ContentHandler { /** * Used to specify if in Source tag. Defined in SyncML * Representation Protocol, version 1.1 5.1.20. * * @var boolean $_isSource */ var $_isSource = false; /** * Defined in SyncML Representation Protocol, version 1.1 * 5.1.9. User name. * * @var string $_locName */ var $_locName; /** * Defined in SyncML Representation Protocol, version 1.1 5.1.18 * * @var string $_sessionID */ var $_sessionID; /** * Defined in SyncML Representation Protocol, version 1.1. Must * be 1.0 (0) or 1.1 (1). * * @var string $_version */ var $_version; /** * Defined in SyncML Representation Protocol, version 1.1 5.1.12 * * @var string $_msgID */ var $_msgID; /** * Defined in SyncML Representation Protocol, version 1.1 5.1.10 * * @var string $_targetURI */ var $_targetURI; /** * Defined in SyncML Representation Protocol, version 1.1 5.1.10, * 5.1.20 * * @var string $_sourceURI */ var $_sourceURI; var $_isCred; var $_credData; var $_credFormat; var $_credType; function getStateFromSession($sourceURI, $locName, $sessionID) { // Remove any existing session since we'll be contructing a // custom session id. session_destroy(); // It would seem multisync does not send the user name once it // has been authorized. Make sure we have a valid session id. session_id('syncml' . preg_replace('/[^a-zA-Z0-9]/', '', $sourceURI . $sessionID)); session_start(); Horde::logMessage('SyncML: session id = ' . session_id(), __FILE__, __LINE__, PEAR_LOG_DEBUG); if (!isset($_SESSION['SyncML.state'])) { // Create a new state if one does not already exist. Horde::logMessage('SyncML: new session state', __FILE__, __LINE__, PEAR_LOG_DEBUG); $_SESSION['SyncML.state'] = &new Horde_SyncML_State($sourceURI, $locName, $sessionID); } return $_SESSION['SyncML.state']; } function startElement($uri, $element, $attrs) { parent::startElement($uri, $element, $attrs); switch ($this->_xmlStack) { case 3: if ($element == 'Source') { // $this->_isSource = true; } elseif ($element == 'Cred') { $this->_isCred = true; } break; } } function endElement($uri, $element) { switch ($this->_xmlStack) { case 2: /* $str = 'localname=' . $this->_locName; $str .= ' version=' . $this->_version; $str .= ' msgid=' . $this->_msgID; $str .= ' source=' . $this->_sourceURI; $str .= ' target=' . $this->_targetURI; $str .= ' sessionID=' . $this->_sessionID; */ // // Find the state. $state = $this->getStateFromSession($this->_sourceURI, $this->_locName, $this->_sessionID); $state->setVersion($this->_version); $state->setMsgID($this->_msgID); $state->setTargetURI($this->_targetURI); $state->setPassword($this->_credData); $str = 'authorized=' . $state->isAuthorized(); $str .= ' version=' . $state->getVersion(); $str .= ' msgid=' . $state->getMsgID(); $str .= ' source=' . $state->getSourceURI(); $str .= ' target=' . $state->getTargetURI(); $str .= ' locName=' . $state->getLocName(); $_SESSION['SyncML.state'] = $state; Horde::logMessage('SymcML: ' . $str, __FILE__, __LINE__, PEAR_LOG_DEBUG); // Got the state; now write our SyncHdr header. $this->outputSyncHdr($this->_output); break; case 3: if ($element == 'VerProto') { // if (trim($this->_chars) == 'SyncML/1.1') { $this->_version = 1; } else { $this->_version = 0; } } elseif ($element == 'SessionID') { // $this->_sessionID = trim($this->_chars); } elseif ($element == 'MsgID') { // $this->_msgID = intval(trim($this->_chars)); } elseif ($element == 'Source') { // $this->_isSource = false; } elseif ($element == 'Cred') { // $this->_isCred = false; //multisync does not specify the cred format //if ($this->_credFormat == 'b64') { $this->_credData = base64_decode($this->_credData); //} $tmp = split(':', $this->_credData); $this->_locName = $tmp[0]; $this->_credData = $tmp[1]; Horde::logMessage('SyncML: $this->_locName: ' . $this->_locName, __FILE__, __LINE__, PEAR_LOG_DEBUG); } break; case 4: if ($element == 'LocURI') { if ($this->_isSource) { // $this->_sourceURI = trim($this->_chars); } else { // $this->_targetURI = trim($this->_chars); } } elseif ($element == 'LocName') { if ($this->_isSource) { // $this->_locName = trim($this->_chars); } } elseif ($element == 'Data') { // if ($this->_isCred) { $this->_credData = trim($this->_chars); } } break; case 5: if ($this->_isCred) { if ($element == 'Format') { // $this->_credFormat = trim($this->_chars); } elseif ($element == 'Type') { // $this->_credType = trim($this->_chars); } } break; } parent::endElement($uri, $element); } function outputSyncHdr(&$output) { $attrs = array(); $state = $_SESSION['SyncML.state']; $uri = $state->getURI(); $uriMeta = $state->getURIMeta(); $output->startElement($uri, 'SyncHdr', $attrs); $output->startElement($uri, 'VerDTD', $attrs); $chars = ($this->_version == 1) ? '1.1' : '1.0'; $output->characters($chars); $output->endElement($uri, 'VerDTD'); $output->startElement($uri, 'VerProto', $attrs); $chars = ($this->_version == 1) ? 'SyncML/1.1' : 'SyncML/1.0'; $output->characters($chars); $output->endElement($uri, 'VerProto'); $output->startElement($uri, 'SessionID', $attrs); $output->characters($this->_sessionID); $output->endElement($uri, 'SessionID'); $output->startElement($uri, 'MsgID', $attrs); $output->characters($this->_msgID); $output->endElement($uri, 'MsgID'); $output->startElement($uri, 'Target', $attrs); $output->startElement($uri, 'LocURI', $attrs); $output->characters($this->_sourceURI); $output->endElement($uri, 'LocURI'); if (isset($this->_locName)) { $output->startElement($uri, 'LocName', $attrs); $output->characters($this->_locName); $output->endElement($uri, 'LocName'); } $output->endElement($uri, 'Target'); $output->startElement($uri, 'Source', $attrs); $output->startElement($uri, 'LocURI', $attrs); $output->characters($this->_targetURI); $output->endElement($uri, 'LocURI'); $output->endElement($uri, 'Source'); $output->startElement($uri, 'Meta', $attrs); // Dummy Max MsqSize, this is just put in to make the packet // work, it is not a real value. $output->startElement($uriMeta, 'MaxMsgSize', $attrs); $chars = '50000'; $output->characters($chars); $output->endElement($uriMeta, 'MaxMsgSize'); // Dummy MaxObjSize, this is just put in to make the packet // work, it is not a real value. $output->startElement($uriMeta, 'MaxObjSize', $attrs); $chars = '4000000'; $output->characters($chars); $output->endElement($uriMeta, 'MaxObjSize'); $output->endElement($uri, 'Meta'); $output->endElement($uri, 'SyncHdr'); } function getSourceURI() { return $this->_sourceURI; } function getLocName() { return $this->_locName; } function getSessionID() { return $this->_sessionID; } function getVersion() { return $this->_version; } function getMsgID() { return $this->_msgID; } function getTargetURI() { return $this->_targetURI; } function opaque($o) { } } /** * Defined in SyncML Representation Protocol, version 1.1 5.2.3 * * @package Horde_SyncML */ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler { var $_currentCmdID = 1; var $_currentCommand; function startElement($uri, $element, $attrs) { parent::startElement($uri, $element, $attrs); switch ($this->_xmlStack) { case 2: $state = $_SESSION['SyncML.state']; // $this->_output->startElement($uri, $element, $attrs); // Right our status about the header. $status = &new Horde_SyncML_Command_Status(($state->isAuthorized()) ? RESPONSE_AUTHENTICATION_ACCEPTED : RESPONSE_INVALID_CREDENTIALS, 'SyncHdr'); $status->setSourceRef($state->getSourceURI()); $status->setTargetRef($state->getTargetURI()); $status->setCmdRef(0); /*$str = 'authorized=' . $state->isAuthorized(); $str .= ' version=' . $state->getVersion(); $str .= ' msgid=' . $state->getMsgID(); $str .= ' source=' . $state->getSourceURI(); $str .= ' target=' . $state->getTargetURI(); */ $this->_currentCmdID = $status->output($this->_currentCmdID, $this->_output); break; case 3: // <[Command]> $this->_currentCommand = Horde_SyncML_Command::factory($element); $this->_currentCommand->startElement($uri, $element, $attrs); break; default: // <...> $this->_currentCommand->startElement($uri, $element, $attrs); break; } } function endElement($uri, $element) { switch ($this->_xmlStack) { case 2: // $this->_output->endElement($uri, $element); break; case 3: // $this->_currentCommand->endElement($uri, $element); $this->_currentCmdID = $this->_currentCommand->output($this->_currentCmdID, $this->_output); unset($this->_currentCommand); break; default: // $this->_currentCommand->endElement($uri, $element); break; } parent::endElement($uri, $element); } function characters($str) { if (isset($this->_currentCommand)) { $this->_currentCommand->characters($str); } } } --- NEW FILE: package.xml --- SyncML SyncML:: provides an API for processing SyncML requests. This package provides classes for implementing a SyncML server. LGPL amills lead Anthony Mills amills@horde.org chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2004-01-19 Initial implementation. XML_WBXML 0.0.1 2004-01-19 alpha Initial implementation From cvs at intevation.de Fri Oct 14 16:33:13 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:08 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML Command.php, NONE, 1.1 State.php, NONE, 1.1 Sync.php, NONE, 1.1 Message-ID: <20051014143313.E77EA102C8D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML Added Files: Command.php State.php Sync.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Command.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command { var $_cmdID; var $_xmlStack; var $_chars; function &factory($command, $params = null) { @include_once 'Horde/SyncML/Command/' . $command . '.php'; $class = 'Horde_SyncML_Command_' . $command; if (class_exists($class)) { return new $class($params); } else { require_once 'PEAR.php'; return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } function output($currentCmdID, $output) { } function startElement($uri, $localName, $attrs) { $this->_xmlStack++; } function endElement($uri, $element) { switch ($this->_xmlStack) { case 2: if ($element == 'CmdID') { $this->_cmdID = intval(trim($this->_chars)); } break; } if (isset($this->_chars)) { unset($this->_chars); } $this->_xmlStack--; } function characters($str) { if (isset($this->_chars)) { $this->_chars = $this->_chars . $str; } else { $this->_chars = $str; } } } --- NEW FILE: State.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_State { var $_sessionID; var $_verProto; var $_msgID; var $_targetURI; var $_sourceURI; var $_version; var $_locName; var $_password; var $_isAuthorized; var $_uri; var $_uriMeta; var $_syncs = array(); var $_datatree; /** * Creates a new instance of Horde_SyncML_State. */ function Horde_SyncML_State($sourceURI, $locName, $sessionID, $password = false) { $this->setSourceURI($sourceURI); $this->setLocName($locName); $this->setSessionID($sessionID); if ($password) { $this->setPassword($password); } $this->isAuthorized = false; $driver = $GLOBALS['conf']['datatree']['driver']; $params = Horde::getDriverConfig('datatree', $driver); $params = array_merge($params, array( 'group' => 'syncml' )); $this->_datatree = &DataTree::singleton($driver, $params); } function getLocName() { return $this->_locName; } function getSourceURI() { return $this->_sourceURI; } function getTargetURI() { return $this->_targetURI; } function getVersion() { return $this->_version; } function getMsgID() { return $this->_msgID; } /** * Setter for property msgID. * @param msgID New value of property msgID. */ function setMsgID($msgID) { $this->_msgID = $msgID; } /** * Setter for property locName. * @param locName New value of property locName. */ function setLocName($locName) { $this->_locName = $locName; } /** * Setter for property locName. * @param locName New value of property locName. */ function setPassword($password) { $this->_password = $password; } function setSourceURI($sourceURI) { $this->_sourceURI = $sourceURI; } function setTargetURI($targetURI) { $this->_targetURI = $targetURI; } function setVersion($version) { $this->_version = $version; if ($version == 0) { $this->_uri = NAME_SPACE_URI_SYNCML; $this->_uriMeta = NAME_SPACE_URI_METINF; } else { $this->_uri = NAME_SPACE_URI_SYNCML_1_1; $this->_uriMeta = NAME_SPACE_URI_METINF_1_1; } } function setSessionID($sessionID) { $this->_sessionID = $sessionID; } function isAuthorized() { if (!$this->_isAuthorized) { $auth = &Auth::singleton($GLOBALS['conf']['auth']['driver']); $this->_isAuthorized = $auth->authenticate($this->_locName, array('password' => $this->_password)); } return $this->_isAuthorized; } function setSync($target, $sync) { $this->_syncs[$target] = $sync; } function getSync($target) { if (isset($this->_syncs[$target])) { return $this->_syncs[$target]; } else { return false; } } function getURI() { return $this->_uri; } function getURIMeta() { return $this->_uriMeta; } function getLocID($guid) { $id = $this->_datatree->getId($guid); $gid = $this->_datatree->get($id); return $gid->get('locid'); } function setUID($type, $locid, $guid) { // Set $locid $gid = &new DataTreeObject($guid); $gid->set('type', $type); $gid->set('locid', $locid); $this->_datatree->add($gid); // Set $globaluid $lid = &new DataTreeObject($this->_locName . $this->_sourceURI . $type . $locid); $lid->set('globaluid', $locid); $this->_datatree->add($lid); } function getGlobalUID($type, $locid) { $id = $this->_datatree->getId($this->_locName . $this->_sourceURI . $type . $locid); $lid = $this->_datatree->get($id); return $lid->get('globaluid'); } function removeUID($type, $locid) { $id = $this->_datatree->getId($this->_locName . $this->_sourceURI . $type . $locid); $lid = $this->_datatree->get($id); $guid = $lid->get('globaluid'); $this->_datatree->remove($guid); $this->_datatree->remove($lid); return $guid; } /** * This function should use DevINF information. */ function getPreferedContentType($type) { if ($type == 'contacts') { return 'text/x-vcard'; } elseif ($type == 'notes') { return 'text/plain'; } elseif ($type == 'tasks') { return 'text/x-vcalendar'; } elseif ($type == 'calendar') { return 'text/x-vcalendar'; } } function getLastSyncDate($type) { $id = $this->_datatree->getId($this->_locName . $this->_sourceURI . $type . 'lastSyncDate'); $obj = $this->_datatree->get($id); return $obj->get('date'); } function setLastSyncDate($type, $date) { $lsd = &new DataTreeObject($this->_locName . $this->_sourceURI . $type . 'lastSyncDate'); $lsd->set('date', $date); $this->_datatree->add($lsd); } function getLastSyncAnchor($type) { $id = $this->_datatree->getId($this->_locName . $this->_sourceURI . $type . 'lastSyncAnchor'); $obj = $this->_datatree->get($id); return $obj->get('anchor'); } function setLastSyncAnchor($type, $date) { $lsd = &new DataTreeObject($this->_locName . $this->_sourceURI . $type . 'lastSyncAnchor'); $lsd->set('anchor', $date); $this->_datatree->add($lsd); } } --- NEW FILE: Sync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync { /** * Target, either contacts, notes, events, */ var $targetLocURI; var $sourceLocURI; /** * Return if all commands success. */ var $globalSuccess; /** * This is the content type to use to export data. */ var $preferedContentType; function &factory($alert) { switch ($alert) { case ALERT_TWO_WAY: include_once 'Horde/SyncML/Sync/TwoWaySync.php'; return new Horde_SyncML_Sync_TwoWaySync(); case ALERT_SLOW_SYNC: include_once 'Horde/SyncML/Sync/SlowSync.php'; return new Horde_SyncML_Sync_SlowSync(); case ALERT_ONE_WAY_FROM_CLIENT: include_once 'Horde/SyncML/Sync/OneWayFromClientSync.php'; return new Horde_SyncML_Sync_OneWayFromClientSync(); case ALERT_REFRESH_FROM_CLIENT: include_once 'Horde/SyncML/Sync/RefreshFromClientSync.php'; return new Horde_SyncML_Sync_RefreshFromClientSync(); case ALERT_ONE_WAY_FROM_SERVER: include_once 'Horde/SyncML/Sync/OneWayFromServerSync.php'; return new Horde_SyncML_Sync_OneWayFromServerSync(); case ALERT_REFRESH_FROM_SERVER: include_once 'Horde/SyncML/Sync/RefreshFromServerSync.php'; return new Horde_SyncML_Sync_RefreshFromServerSync(); } require_once 'PEAR.php'; return PEAR::raiseError('Alert ' . $alert . ' not found.'); } function nextSyncCommand($currentCmdID, &$syncCommand, &$output) { $syncComand->setSuccess($this->runCommand($syncCommand)); return $syncCommand->output($currentCmdID, $output); } function startSync($currentCmdID, &$output) { return $currentCmdID; } function endSync($currentCmdID, &$output) { return $currentCmdID; } function runSyncCommand($command) { global $registry; $guid = false; if (is_a($command, 'Horde_SyncML_Command_Sync_Add')) { $guid = $registry->call($targetLocURI . '/import', array($command->getContent(), $command->getContentType())); if (!is_a($guid, 'PEAR_Error')) { $this->currentState->setUID($this->type, $command->getLocURI(), $guid); } } elseif (is_a($command, 'Horde_SyncML_Command_Sync_Delete')) { $guid = $this->currentState->removeUID($this->type, $command->getLocURI()); if (!is_a($guid, 'PEAR_Error')) { $registry->call($targetLocURI . '/remove', array($guid)); } } elseif (is_a($command, 'Horde_SyncML_Command_Sync_Replace')) { $guid = $this->currentState->getGlobalUID($this->type, $command->getLocURI()); if ($guid) { $guid = call($targetLocURI . 'replace', array($guid, $command->getContent(), $command->getContentType())); } else { $guid = call($targetLocURI . '/import', $command->getContent(), $command->getContentType()); $this->currentState->setUID($this->type, $command->getLocURI(), $guid); } } return $shareid; } } From cvs at intevation.de Fri Oct 14 16:33:14 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command Alert.php, NONE, 1.1 Final.php, NONE, 1.1 Get.php, NONE, 1.1 Put.php, NONE, 1.1 Replace.php, NONE, 1.1 Results.php, NONE, 1.1 Status.php, NONE, 1.1 Sync.php, NONE, 1.1 Message-ID: <20051014143314.58CD0102C37@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command Added Files: Alert.php Final.php Get.php Put.php Replace.php Results.php Status.php Sync.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Alert.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command { /** * @var integer $_alert */ var $_alert; /** * @var string $_sourceURI */ var $_sourceLocURI; /** * @var string $_targetURI */ var $_targetLocURI; /** * @var string $_metaAnchorNext */ var $_metaAnchorNext; /** * @var integer $_metaAnchorLast */ var $_metaAnchorLast; /** * @var integer $_alert */ var $_outputMetaAnchorNext; /** * @var integer $_alert */ var $_outputMetaAnchorLast; /** * Use in xml tag. */ var $_isInSource; /** * Creates a new instance of Alert. */ function Horde_SyncML_Command_Alert($alert = null) { if ($alert != null) { $this->_alert = $alert; } } function output($currentCmdID, &$output) { $attrs = array(); $state = $_SESSION['SyncML.state']; $status = &new Horde_SyncML_Command_Status($state->isAuthorized() ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS, 'Alert'); $status->setCmdRef($this->_cmdID); if ($state->isAuthorized() && isset($this->_metaAnchorNext)) { $status->setItemDataAnchorNext($this->_metaAnchorNext); } $currentCmdID = $status->output($currentCmdID, $output); if ($state->isAuthorized()) { $output->startElement($state->getURI(), 'Alert', $attrs); $output->startElement($state->getURI(), 'CmdID', $attrs); $chars = $currentCmdID; $output->characters($chars); $output->endElement($state->getURI(), 'CmdID'); $output->startElement($state->getURI(), 'Data', $attrs); $chars = $this->_alert; $output->characters($chars); $output->endElement($state->getURI(), 'Data'); $output->startElement($state->getURI(), 'Item', $attrs); if ($this->_sourceLocURI != null) { $output->startElement($state->getURI(), 'Target', $attrs); $output->startElement($state->getURI(), 'LocURI', $attrs); $chars = $this->_sourceLocURI; $output->characters($chars); $output->endElement($state->getURI(), 'LocURI'); $output->endElement($state->getURI(), 'Target'); } if ($this->_targetLocURI != null) { $output->startElement($state->getURI(), 'Source', $attrs); $output->startElement($state->getURI(), 'LocURI', $attrs); $chars = $this->_targetLocURI; $output->characters($chars); $output->endElement($state->getURI(), 'LocURI'); $output->endElement($state->getURI(), 'Source'); } $output->startElement($state->getURI(), 'Meta', $attrs); $output->startElement($state->getURIMeta(), 'Anchor', $attrs); if (isset($this->_outputMetaAnchorLast)) { $output->startElement($state->getURIMeta(), 'Last', $attrs); $chars = $this->_outputMetaAnchorLast; $output->characters($chars); $output->endElement($state->getURIMeta(), 'Last'); } if (isset($this->_outputMetaAnchorNext)) { $output->startElement($state->getURIMeta(), 'Next', $attrs); $chars = $this->_outputMetaAnchorNext; $output->characters($chars); $output->endElement($state->getURIMeta(), 'Next'); } $output->endElement($state->getURIMeta(), 'Anchor'); $output->endElement($state->getURI(), 'Meta'); $output->endElement($state->getURI(), 'Item'); $output->endElement($state->getURI(), 'Alert'); $currentCmdID++; } return $currentCmdID; } /** * Setter for property sourceURI. * * @param string $sourceURI New value of property sourceURI. */ function setSourceLocURI($sourceURI) { $this->_sourceURI = $sourceURI; } function getTargetLocURI() { return $this->_targetURI; } /** * Setter for property targetURI. * * @param string $targetURI New value of property targetURI. */ function setTargetURI($targetURI) { $this->_targetURI = $targetURI; } function startElement($uri, $element, $attrs) { parent::startElement($uri, $element, $attrs); switch ($this->_xmlStack) { case 3: if ($element == 'Target') { $this->_isInSource = false; } else { $this->_isInSource = true; } break; } } function endElement($uri, $element) { switch ($this->_xmlStack) { case 1: $state = $_SESSION['SyncML.state']; Horde::logMessage('looking for sync for: ' . $this->_targetLocURI, __FILE__, __LINE__, PEAR_LOG_DEBUG); $sync = $state->getSync($this->_targetLocURI); if (!$sync) { Horde::logMessage('create new sync for: ' . $this->_targetLocURI . ' ' . $this->_alert, __FILE__, __LINE__, PEAR_LOG_DEBUG); $sync = &Horde_SyncML_Sync::factory($this->_alert); $state->setSync($this->_targetLocURI, $sync); } $_SESSION['SyncML.state'] = $state; break; case 2: if ($element == 'Data') { $this->_alert = intval(trim($this->_chars)); } break; case 4: if ($element == 'LocURI') { Horde::logMessage('<'. $element . ' stack ' . $this->_xmlStack . ' source ' . $this->_isInSource, __FILE__, __LINE__, PEAR_LOG_DEBUG); if ($this->_isInSource) { $this->_sourceLocURI = trim($this->_chars); } else { $this->_targetLocURI = trim($this->_chars); } } break; case 5: if ($element == 'Next') { $this->_metaAnchorNext = trim($this->_chars); $this->_outputMetaAnchorNext = $this->_metaAnchorNext; } break; } parent::endElement($uri, $element); } function getAlert() { return $this->_alert; } function setAlet($alert) { $this->_alert = $alert; } } --- NEW FILE: Final.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Final extends Horde_SyncML_Command { function output($currentCmdID, &$output) { $state = $_SESSION['SyncML.state']; $attrs = array(); $output->startElement($state->getURI(), 'Final', $attrs); $output->endElement($state->getURI(), 'Final'); return $currentCmdID; } } --- NEW FILE: Get.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Get extends Horde_SyncML_Command { function output($currentCmdID, &$output) { $state = $_SESSION['SyncML.state']; $status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Get'); $status->setCmdRef($this->_cmdID); $status->setTargetRef('./devinf11'); $currentCmdID = $status->output($currentCmdID, $output); if ($state->isAuthorized()) { // Synthesis does not like this one. // $results = &new Horde_SyncML_Command_Results(); // $results->setCmdRef($this->_cmdID); // DevInf returnDevInf = new DevInf((version == 0) ? "./devinf" : "./devinf11"); // result.setData(devinf); // $currentCmdID = $results->output($currentCmdID, $output); } return $currentCmdID; } } // DevInf info to return. May need to send something like this back: // // // // application/vnd.syncml-devinf+xml // // // // // // ./devinf11 // // // // // // 1.1 // // // Synthesis AG // // // Synthesis Sync Server 1.0 Demo // // // Synthesis AG // // // 2.0.1.5 // // // SySync Server (textdb,standalone) // // // server // // // // // // // // // // ./contacts // // // contacts // // // // text/x-vcard // // // 2.1 // // // // // text/vcard // // // 3.0 // // // // // text/x-vcard // // // 2.1 // // // // // text/vcard // // // 3.0 // // // // // 1 // // // 2 // // // 4 // // // 5 // // // 6 // // // // // // ./events // // // events // // // // text/x-vcalendar // // // 1.0 // // // // // text/x-vcalendar // // // 1.0 // // // // // 1 // // // 2 // // // 4 // // // 5 // // // 6 // // // // // // ./tasks // // // tasks // // // // text/x-vcalendar // // // 1.0 // // // // // text/x-vcalendar // // // 1.0 // // // // // 1 // // // 2 // // // 4 // // // 5 // // // 6 // // // // // // ./calendar // // // calendar // // // // text/x-vcalendar // // // 1.0 // // // // // text/x-vcalendar // // // 1.0 // // // // // 1 // // // 2 // // // 3 // // // 4 // // // 5 // // // 6 // // // // // // ./notes // // // notes // // // // text/plain // // // 1.0 // // // // // text/plain // // // 1.0 // // // // // 1 // // // 2 // // // 4 // // // 5 // // // 6 // // // // // // text/x-vcard // // // BEGIN // // // VCARD // // // END // // // VCARD // // // VERSION // // // 2.1 // // // REV // // // N // // // TITLE // // // ORG // // // EMAIL // // // URL // // // TEL // // // ADR // // // BDAY // // // NOTE // // // text/vcard // // // BEGIN // // // VCARD // // // END // // // VCARD // // // VERSION // // // 3.0 // // // REV // // // N // // // TITLE // // // ORG // // // EMAIL // // // URL // // // TEL // // // ADR // // // BDAY // // // NOTE // // // text/x-vcalendar // // // BEGIN // // // VCALENDAR // // // VEVENT // // // VTODO // // // END // // // VCALENDAR // // // VEVENT // // // VTODO // // // VERSION // // // 1.0 // // // TZ // // // LAST-MODIFIED // // // DCREATED // // // SUMMARY // // // DESCRIPTION // // // LOCATION // // // CATEGORIES // // // DTSTART // // // DTEND // // // ATTENDEE // // // RRULE // // // EXDATE // // // AALARM // // // DALARM // // // LOCATION // // // CATEGORIES // // // DUE // // // PRIORITY // // // STATUS // // // AALARM // // // DALARM // // // // // --- NEW FILE: Put.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Put extends Horde_SyncML_Command { function output($currentCmdID, &$output ) { $state = $_SESSION['SyncML.state']; $status = &new Horde_SyncML_Command_Status((($state->isAuthorized()) ? RESPONSE_OK : RESPONSE_INVALID_CREDENTIALS), 'Put'); $status->setCmdRef($this->_cmdID); $status->setSourceRef('./devinf11'); return $status->output($currentCmdID, $output); } } --- NEW FILE: Replace.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Final extends Horde_SyncML_Command { function output($currentCmdID, &$output) { return $currentCmdID; } } --- NEW FILE: Results.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Results extends Horde_SyncML_Command { var $_cmdRef; function output($currentCmdID, &$output) { $state = $_SESSION['SyncML.state']; $attrs = array(); $output->startElement($state->getURI(), 'Results', $attrs); $output->startElement($state->getURI(), 'CmdID', $attrs); $chars = $currentCmdID; $output->characters($chars); $output->endElement($state->getURI(), 'CmdID'); $output->startElement($state->getURI(), 'MsgRef', $attrs); $chars = $state->getMsgID(); $output->characters($chars); $output->endElement($state->getURI(), 'MsgRef'); $output->startElement($state->getURI(), 'CmdRef', $attrs); $chars = $this->_cmdRef; $output->characters($chars); $output->endElement($state->getURI(), 'CmdRef'); /* $output->startElement($state->getURI(), 'Meta', $attrs); $output->startElement($state->getURIMeta(), 'Type', $attrs); $chars = $this->_cmdRef; $output->characters($chars); $output->endElement($state->getURIMeta(), 'Type'); $output->endElement($state->getURI(), 'Meta'); $output->startElement($state->getURI(), 'Item', $attrs); $output->startElement($state->getURI(), 'Source', $attrs); $output->startElement($state->getURI(), 'LocURI', $attrs); $chars = $this->_locSourceURI; $output->characters($chars); $output->endElement($state->getURI(), 'LocURI'); $output->endElement($state->getURI(), 'Source'); $output->startElement($state->getURI(), 'Data', $attrs); // Need to send this information as opaque data so the WBXML // will understand it. $output->opaque($this->_data); // $chars = $this->_data; // $output->characters($chars); $output->endElement($state->getURI(), 'Data'); $output->endElement($state->getURI(), 'Item'); */ $output->endElement($state->getURI(), 'Results'); $currentCmdID++; return $currentCmdID; } /** * Setter for property cmdRef. * * @param string $cmdRef New value of property cmdRef. */ function setCmdRef($cmdRef) { $this->_cmdRef = $cmdRef; } } --- NEW FILE: Status.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Status extends Horde_SyncML_Command { var $_response; var $_cmdRef; /** * Must be present. */ var $_cmd; /** * Must if not null (what does this mean?). */ var $_sourceRef; var $_targetRef; var $_chalMetaFormat; var $_chalMetaType; var $_chalMetaNextNonce; var $_itemDataAnchorNext; function Horde_SyncML_Command_Status($response = null, $cmd = null) { if ($response != null) { $this->_response = $response; } if ($cmd != null) { $this->_cmd = $cmd; } } function output($currentCmdID, &$output) { $attrs = array(); $state = $_SESSION['SyncML.state']; if ($this->_cmd != null) { $attrs = array(); $output->startElement($state->getURI(), 'Status', $attrs); $output->startElement($state->getURI(), 'CmdID', $attrs); $chars = $currentCmdID; $output->characters($chars); $output->endElement($state->getURI(), 'CmdID'); $output->startElement($state->getURI(), 'MsgRef', $attrs); $chars = $state->getMsgID(); $output->characters($chars); $output->endElement($state->getURI(), 'MsgRef'); $output->startElement($state->getURI(), 'CmdRef', $attrs); $chars = $this->_cmdRef; $output->characters($chars); $output->endElement($state->getURI(), 'CmdRef'); $output->startElement($state->getURI(), 'Cmd', $attrs); $chars = $this->_cmd; $output->characters($chars); $output->endElement($state->getURI(), 'Cmd'); if (isset($this->_sourceRef)) { $output->startElement($state->getURI(), 'SourceRef', $attrs); $chars = $this->_sourceRef; $output->characters($chars); $output->endElement($state->getURI(), 'SourceRef'); } if (isset($this->_targetRef)) { $output->startElement($state->getURI(), 'TargetRef', $attrs); $chars = $this->_targetRef; $output->characters($chars); $output->endElement($state->getURI(), 'TargetRef'); } // If we are responding to the SyncHdr and we are not // authorized then request basic authorization. // // FIXME: Right now we always send this, ignoring the // isAuthorized() test. Is that correct? if ($this->_cmd == 'SyncHdr') { // && !$state->isAuthorized()) { $this->_chalMetaFormat = 'b64'; $this->_chalMetaType = 'syncml:auth-basic'; } if (isset($this->_chalMetaFormat) && isset($this->_chalMetaType)) { $output->startElement($state->getURI(), 'Chal', $attrs); $output->startElement($state->getURI(), 'Meta', $attrs); $metainfuri = $state->getURIMeta(); $output->startElement($metainfuri, 'Format', $attrs); $chars = $this->_chalMetaFormat; $output->characters($chars); $output->endElement($metainfuri, 'Format'); $output->startElement($metainfuri, 'Type', $attrs); $chars = $this->_chalMetaType; $output->characters($chars); $output->endElement($metainfuri, 'Type'); //$output->startElement($metainfuri, 'NextNonce', $attrs); //$chars = $this->_chalMetaNextNonce; //$output->characters($chars); //$output->endElement($metainfuri, 'NextNonce'); $output->endElement($state->getURI(), 'Meta'); $output->endElement($state->getURI(), 'Chal'); } $output->startElement($state->getURI(), 'Data', $attrs); $chars = $this->_response; $output->characters($chars); $output->endElement($state->getURI(), 'Data'); if (isset($this->_itemDataAnchorNext)) { $output->startElement($state->getURI(), 'Item', $attrs); $output->startElement($state->getURI(), 'Data', $attrs); $metainfuri = $state->getURIMeta(); $output->startElement($metainfuri, 'Anchor', $attrs); $output->startElement($metainfuri, 'Next', $attrs); $chars = $this->_itemDataAnchorNext; $output->characters($chars); $output->endElement($metainfuri, 'Next'); $output->endElement($metainfuri, 'Anchor'); $output->endElement($state->getURI(), 'Data'); $output->endElement($state->getURI(), 'Item'); } $output->endElement($state->getURI(), 'Status'); $currentCmdID++; } return $currentCmdID; } /** * Setter for property response. * * @param string $response New value of property response. */ function setResponse($response) { $this->_response = $response; } /** * Setter for property cmd. * * @param string $cmd New value of property cmd. */ function setCmd($cmd) { $this->_cmd = $cmd; } /** * Setter for property cmdRef. * * @param string $cmdRef New value of property cmdRef. */ function setCmdRef($cmdRef) { $this->_cmdRef = $cmdRef; } /** * Setter for property sourceRef. * * @param string $sourceRef New value of property sourceRef. */ function setSourceRef($sourceRef) { $this->_sourceRef = $sourceRef; } /** * Setter for property targetRef. * * @param string $targetRef New value of property targetRef. */ function setTargetRef($targetRef) { $this->_targetRef = $targetRef; } /** * Setter for property itemDataAnchorNext. * * @param string $itemDataAnchorNext New value of property itemDataAnchorNext. */ function setItemDataAnchorNext($itemDataAnchorNext) { $this->_itemDataAnchorNext = $itemDataAnchorNext; } } --- NEW FILE: Sync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Sync extends Horde_Syncml_Command { var $_isInSource; var $_currentSyncElement; var $_syncElements = array(); function output($currentCmdID, &$output) { $state = $_SESSION['SyncML.state']; $attrs = array(); $output->startElement($state->getURI(), 'Sync', $attrs); $output->startElement($state->getURI(), 'CmdID', $attrs); $chars = $currentCmdID; $output->characters($chars); $output->endElement($state->getURI(), 'CmdID'); $output->startElement($state->getURI(), 'Target', $attrs); $output->startElement($state->getURI(), 'LocURI', $attrs); $chars = $this->_sourceURI; $output->characters($chars); $output->endElement($state->getURI(), 'LocURI'); $output->endElement($state->getURI(), 'Target'); $output->startElement($state->getURI(), 'Source', $attrs); $output->startElement($state->getURI(), 'LocURI', $attrs); $chars = $this->_targetURI; $output->characters($chars); $output->endElement($state->getURI(), 'LocURI'); $output->endElement($state->getURI(), 'Source'); $output->startElement($state->getURI(), 'NumberOfChanged', $attrs); // $chars = count($this->_syncElements); $chars = 0; $output->characters($chars); $output->endElement($state->getURI(), 'NumberOfChanged'); $output->endElement($state->getURI(), 'Sync'); $currentCmdID++; // Not sure where the status commands need to fall, but this // is a start. Horde::logMessage('SyncML: $this->_targetURI = ' . $this->_targetURI, __FILE__, __LINE__, PEAR_LOG_DEBUG); $sync = $state->getSync($this->_targetURI); $currentCmdID = $sync->startSync($currentCmdID, $output); foreach ($this->_syncElements as $element ) { $currentCmdID = $sync->nextSyncCommand($currentCmdID, $element, $output); } $currentCmdID = $sync->endSync($currentCmdID, $output); $status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Sync'); $status->setState($state); $status->setCmdRef($this->_cmdID); if ($this->_targetURI != null) { $status->setTargetRef($this->_targetURI); } if ($this->_sourceURI != null) { $status->setSourceRef($this->_sourceURI); } return $status->output($currentCmdID, $output); } function getTargetURI() { return $this->_targetURI; } function startElement($uri, $element, $attrs) { parent::startElement($uri, $element, $attrs); switch ($this->_xmlStack) { case 2: if ($element == 'Replace' || $element == 'Add' || $element == 'Delete') { $this->_currentSyncElement = &Horde_SyncML_Command_Sync_SyncElement::factory($element); $this->_currentSyncElement->setVersion($this->_version); $this->_currentSyncElement->setCmdRef($this->_cmdID); $this->_currentSyncElement->setMsgID($this->_msgID); } elseif ($element == 'Target') { $this->_isInSource = false; } else { $this->_isInSource = true; } break; } if (isset($this->_currentSyncElement)) { $this->_currentSyncElement->startElement($uri, $element, $attrs); } } function endElement($uri, $element) { if (isset($this->_currentSyncElement)) { $this->_currentSyncElement->endElement($uri, $element); } switch ($this->_xmlStack) { case 2: if ($element == 'Replace' || $element == 'Add' || $element == 'Delete') { $this->_syncElements[] = $this->_currentSyncElement; unset($this->_currentSyncElement); } break; case 3: if ($element = 'LocURI') { if ($this->_isInSource) { $this->_sourceURI = trim($this->_chars); } else { $this->_targetURI = trim($this->_chars); } } break; } parent::endElement($uri, $element); } function characters($str) { if (isset($this->_currentSyncElement)) { $this->_currentSyncElement->characters($str); } else { if (isset($this->_chars)) { $this->_chars = $this->_chars . $str; } else { $this->_chars = $str; } } } } From cvs at intevation.de Fri Oct 14 16:33:14 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:12 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Sync OneWayFromClientSync.php, NONE, 1.1 OneWayFromServerSync.php, NONE, 1.1 RefreshFromClientSync.php, NONE, 1.1 RefreshFromServerSync.php, NONE, 1.1 SlowSync.php, NONE, 1.1 TwoWaySync.php, NONE, 1.1 Message-ID: <20051014143314.5CB5A102C8E@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Sync In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Sync Added Files: OneWayFromClientSync.php OneWayFromServerSync.php RefreshFromClientSync.php RefreshFromServerSync.php SlowSync.php TwoWaySync.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: OneWayFromClientSync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync_OneWayFromClientSync extends Horde_SyncML_Sync { } --- NEW FILE: OneWayFromServerSync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync_OneWayFromServerSync extends Horde_SyncML_Sync_TwoWaySync { } --- NEW FILE: RefreshFromClientSync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync_RefreshFromClientSync extends Horde_SyncML_Sync { /** * We need to erase the current server contents, then we can add * the client's contents. */ function startSync($currentCmdID, &$output) { $deletes = $registry->call($this->targetLocURI, '/list', array()); foreach ($delete as $deletes) { $registry->call($this->targetLocURI . '/remove', array($delete)); } return $currentCmdID; } } --- NEW FILE: RefreshFromServerSync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync { function endSync($currentCmdID, &$output) { global $registry; $adds = $registry->call($this->targetLocURI, '/list', array()); foreach ($add as $adds) { $locid = $this->_currentState->getLocID($adds); // Add a replace. $add = &new Horde_SyncML_Command_Sync_ContentSyncElement(); $add->setContent($registry->call($this->targetLocURI . '/listByAction', array($this->_currentState->getPreferedContentType($this->targetLocURI)))); $currentCmdID = $add->outputCommand($currentCmdID, $output, 'Add'); } // @TODO Get deletes. // @TODO Get adds. return $currentCmdID; } } --- NEW FILE: SlowSync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync { } --- NEW FILE: TwoWaySync.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync { function endSync($currentCmdID, &$output) { global $registry; $state = $_SESSION['SyncML.state']; // Get changes. $changes = $registry->call($this->targetLocURI, '/listBy', array('timestamp' => 0, 'action' => 'modify')); foreach ($changes as $change) { $locid = $state->getLocID($changes); // Add a replace. $replace = &new Horde_SyncML_Command_Sync_ContentSyncElement(); $replace->setContent($registry->call($this->targetLocURI . '/export', array('guid' => $change, 'contentType' => $this->_currentState->getPreferedContentType($this->targetLocURI)))); $currentCmdID = $replace->outputCommand($currentCmdID, $output, 'Replace'); } // Get deletes. $deletes = $registry->call($this->targetLocURI, '/listByAction', array('timestamp' => 0, 'action' => 'delete')); foreach ($deletes as $delete) { $locid = $state->getLocID($delete); if ($locid) { // Add a replace. $delete = &new Horde_SyncML_Command_Sync_ContentSyncElement(); $currentCmdID = $delete->outputCommand($currentCmdID, $output, 'Delete'); } } // Get adds. $adds = $registry->call($this->targetLocURI, '/listByAction', array('timestamp' => 0, 'action' => 'add')); foreach ($adds as $add) { $locid = $state->getLocID($adds); // Add a replace. $add = &new Horde_SyncML_Command_Sync_ContentSyncElement(); $replace->setContent($registry->call($this->targetLocURI . '/export', array('guid' => $change, 'contentType' => $this->_currentState->getPreferedContentType($this->targetLocURI)))); $currentCmdID = $add->outputCommand($currentCmdID, $output, 'Add'); } return $currentCmdID; } } From cvs at intevation.de Fri Oct 14 16:33:14 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:14 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/docs TODO, NONE, 1.1 Message-ID: <20051014143314.73CDE102C92@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/docs In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML/docs Added Files: TODO Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: TODO --- WBXML support: Done, but does not work with SyncML Dev Authentication: Basic Done MD5 will not be supported Sync method (classes) support: TwoWaySync // Started SlowSync // May not be done, too complicated OneWayFromClientSync // Started OneWayFromServerSync // Started RefreshFromClientSync // Started RefreshFromServerSync // Started Session handling: Done, but need to remove when finished Registry functions: function import($content, $contenttype) // returns $guid or false if fails // called by $registry->call($type . '/import', array($content, $contenttype)) function export($guid, $contenttype) // returns $content or false if fails // called by $registry->call($type . '/export', array($content, $contenttype)) function remove($guid) // returns true/false? this one may exist // called by $registry->call($type . '/import', array($content, $contenttype)) function replace($guid, $content, $contenttype) // returns true/false // called by $registry->call($type . '/replace', array($guid, $content, $contenttype)); function listBy($timestamp, 'change'|'add'|'delete'); // returns an array of $guids false if fails // called by $registry->call($type . '/listBy', array($timestamp, $listtype)) function list(); // returns an array of $guids or false if fails // called by $registry->call($type . '/list') Implementation grid: |-----------------------------------------------------------| | | Kronolith | Mnemo | Nag | Turba | |-----------|-----------|-----------|-----------|-----------| | import() | X | X | X | | |-- -|- -|- -|- -|- -| | export() | X | X | X | | |-- -|- -|- -|- -|- -| | remove() | X | X | X | | |-- -|- -|- -|- -|- -| | replace() | X | X | X | | |-- -|- -|- -|- -|- -| | listBy() | X | X | X | X | |-- -|- -|- -|- -|- -| | list() | X | X | X | | |-----------------------------------------------------------| We should support these content types: notes: text/plain: text maybe only ascii? text/x-vnote? tasks: text/x-vcalendar: vCalendar calendar: text/x-vcalendar: vCalendar contacts: text/x-vcard: vCard ID mappings: need to write these functions in State: getLocUID($type, $guid) // returns local id setLocUID($type, $guid, $locid) // returns true/false removeLocUID($type, $locid) // returns $guid/false Sync Date: We need a function that returns the last sync date. I would put this in State and have something like this: getLastSyncDate($target) and it would use $sourceURI, and $username from the class: need to write this function in State getLastSyncDate($target) setLastSyncDate($target, $syncDate) We should also have getLastSyncAnchor($target) setLastSyncAnchor($target, $syncDate) SyncAnchor is either an ever increasing integer, or a UTC based ISO 8601 date/time stamp (20000824T133000Z, yyyymmddThhMMssZ) This is used by the client/server to see if any syncs were missed SyncML Dev: not implemented, and may not have to problem with WBXML prevents it from being used Sync commands: Alert Done Final Done Get not done but works, does not support SyncML Dev Put not done but works, does not Results Done Status Done Sync Done Add only used in Sync Atomic only used in Sync // May not be used Copy only used in Sync // May not be used Delete only used in Sync Replace only used in Sync Sequence only used in Sync // May not be used SyncBody: Need to clean up better when finished SyncHdr: No SyncML Dev support, see above $Horde: framework/SyncML/docs/TODO,v 1.22 2004/03/16 19:30:10 chuck Exp $ From cvs at intevation.de Fri Oct 14 16:33:14 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:16 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync Add.php, NONE, 1.1 ContentSyncElement.php, NONE, 1.1 Delete.php, NONE, 1.1 Replace.php, NONE, 1.1 SyncElement.php, NONE, 1.1 Message-ID: <20051014143314.5E23B102C91@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/SyncML/SyncML/Command/Sync Added Files: Add.php ContentSyncElement.php Delete.php Replace.php SyncElement.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Add.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Sync_Add extends Horde_SyncML_Command_Sync_SyncElement { function output($currentCmdID, $output) { $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Add'); $status->setCmdRef($this->_cmdID); if (isset($this->_luid)) { $status->setSourceRef($this->_luid); } return $status->output($currentCmdID, $output); } } --- NEW FILE: ContentSyncElement.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_Sync_SyncElement { var $_content; function getContent() { return $this->_content; } function setContent($content) { $this->_content = $content; } function endElement($uri, $element) { switch ($this->_xmlStack) { case 2: if ($element == 'Data') { $this->_content = trim($this->_chars); } break; } parent::endElement($uri, $element); } function outputCommand($currentCmdID, $output, $command) { $state = $_SESSION['SyncML.state']; $attrs = array(); $output->startElement($state->getURI(), $command, $attrs); $output->startElement($state->getURI(), 'CmdID', $attrs); $chars = $currentCmdID; $output->characters($chars); $output->endElement($state->getURI(), 'CmdID'); if (isset($this->_content)) { $output->startElement($state->getURI(), 'Data', $attrs); $chars = $this->_content; $output->characters($chars); $output->endElement($state->getURI(), 'Data'); } $output->endElement($state->getURI(), $command); return $currentCmdID++; } } --- NEW FILE: Delete.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Sync_Delete extends Horde_SyncML_Command_Sync_SyncElement { function output($currentCmdID, $output) { $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Delete'); $status->setCmdRef($this->_cmdID); if (isset($this->_luid)) { $status->setSourceRef($this->_luid); } return $status->output($currentCmdID, $output); } } --- NEW FILE: Replace.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Sync_Replace extends Horde_SyncML_Command_Sync_SyncElement { function output($currentCmdID, $output) { $status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Replace'); $status->setCmdRef($this->_cmdID); if (isset($this->_luid)) { $status->setSourceRef($this->_luid); } return $status->output($currentCmdID, $output); } } --- NEW FILE: SyncElement.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_SyncML */ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command { var $_luid; var $_guid; var $_isSource; function &factory($command, $params = null) { @include_once 'Horde/SyncML/Command/Sync/' . $command . '.php'; $class = 'Horde_SyncML_Command_Sync_' . $command; if (class_exists($class)) { return $ret = &new $class($params); } else { require_once 'PEAR.php'; return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } function startElement($uri, $element, $attrs) { parent::startElement($uri, $element, $attrs); switch ($this->_xmlStack) { case 2: if ($element == 'Source') { $this->_isSource = true; } break; } } function endElement($uri, $element) { switch ($this->_xmlStack) { case 1: // Need to add sync elements to the Sync method? break; case 2: if ($element == 'Source') { $this->_isSource = false; } elseif ($element == 'Data') { $this->_content = trim($this->_chars); } break; case 3: if ($element == 'LocURI' && $this->_isSource) { $this->_luid = trim($this->_chars); } break; } parent::endElement($uri, $element); } function getLUID() { return $this->_luid; } function getGUID() { return $this->_guid; } function setLUID($luid) { $this->_luid = $luid; } function setGUID($guid) { $this->_guid = $guid; } function getContent() { return $this->_content; } function setContent($content) { $this->_content = $content; } } From cvs at intevation.de Fri Oct 14 16:33:14 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:17 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text Text.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143314.AC3D7102C3B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Text Added Files: Text.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Text.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Text */ class Text { /** * Filter the given text based on the words found in $words. * * @access public * * @param string $text The text to filter. * @param string $words_file Filename containing the words to replace. * @param string $replacement The replacement string. * * @return string The filtered version of $text. */ function filter($text, $words_file, $replacement) { if (@is_readable($words_file)) { /* Read the file and iterate through the lines. */ $lines = file($words_file); foreach ($lines as $line) { /* Strip whitespace and comments. */ $line = trim($line); $line = preg_replace('|#.*$|', '', $line); /* Filter the text. */ if (!empty($line)) { $text = preg_replace("/(\b(\w*)$line\b|\b$line(\w*)\b)/i", $replacement, $text); } } } return $text; } /** * Fixes incorrect wrappings which split double-byte gb2312 * characters. * * @since Horde 2.2 * * @access public * * @param string $text String containing wrapped gb2312 characters * @param $break_char Character used to break lines. * * @return string String containing fixed text. */ function trim_gb2312($str, $break_char = "\n") { $lines = explode($break_char, $str); $iMax = count($lines) - 1; for ($i = 0; $i < $iMax; $i++) { $line = $lines[$i]; $len = strlen($line); /* parse double-byte gb2312 characters */ for ($c = 0; $c < $len - 1; $c++) { if (ord($line{$c}) & 128) { if (ord($line{$c + 1}) & 128) $c++; } } /* If the last character of the current line is the first byte of a double-byte character, move it to the start of the next line. */ if (($c == $len - 1) && (ord($line[$c]) & 128)) { $lines[$i] = substr($line, 0, -1); $lines[$i + 1] = $line[$c] . $lines[$i + 1]; } } return implode($break_char, $lines); } /** * Wraps the text of a message. * * @access public * * @param string $text String containing the text to wrap. * @param optional integer $length Wrap $text at this number of * characters. * @param optional string $break_char Character(s) to use when breaking * lines. * @param optional string $charset Character set to use when breaking * lines. * @param optional boolean $quote Ignore lines that are wrapped with * the '>' character (RFC 2646)? If * true, we don't remove any padding * whitespace at the end of the * string. * * @return string String containing the wrapped text. */ function wrap($text, $length = 80, $break_char = "\n", $charset = null, $quote = false) { $paragraphs = array(); $gb2312 = 0; if (!is_null($charset) && (strtolower($charset) == 'gb2312')) { $gb2312 = 1; } foreach (explode("\n", $text) as $input) { if ($quote && (strpos($input, '>') === 0)) { $line = $input; } else { /* We need to handle the Usenet-style signature line * separately; since the space after the two dashes is * REQUIRED, we don't want to trim the line. */ if ($input != '-- ') { $input = rtrim($input); } $line = wordwrap($input, $length, $break_char, $gb2312); } if ($gb2312) { $paragraphs[] = Text::trim_gb2312($line, $break_char); } else { $paragraphs[] = $line; } } return implode($break_char, $paragraphs); } /** * Turns all URLs in the text into hyperlinks. * * @access public * * @param string $text The text to be transformed. * @param optional boolean $capital Sometimes it's useful to generate * and so you can know which tags * you just generated. * @param optional string $class The CSS class the links should be * displayed with. * * @return string The linked text. */ function linkUrls($text, $capital = false, $class = '') { $a = 'a'; if ($capital) { $a = 'A'; /* Make sure that the original message doesn't contain any * capital tags or open tags , so we can assume * we generated them. */ $text = str_replace(array('', '', '' . $match[0] . ''; /* Replace URL with link using match offset. */ $text = substr_replace($text, $new, $offset, strlen($match[0])); /* Increase offset to compensate for more characters in link. */ $offset += (strlen($new) - strlen($match[0])); } /* Take the leading space back off. */ return substr($text, 1); } /** * Turn all mailto: strings in the text into Horde mail/compose * links. * * @access public * * @param string $text The text to be transformed. * @param optional string $charset The charset to use for * htmlspecialchars() calls. * * @return string The text with mailtos transformed into compose links. */ function linkMailtos($text, $charset = null) { global $registry; /* Make sure we have a safe charset. */ if (is_null($charset)) { $charset = NLS::getCharset(); } if ((strtolower($charset) == 'us-ascii') || !NLS::checkCharset($charset)) { $charset = 'iso-8859-1'; } /** * @TODO: someone needs to document this. */ $pattern = '|(\[\s+)*([Mm][Aa][Ii][Ll][Tt][Oo]):(\s?)([^\s\?(?(1)\])"<]*)(\??)([^\s"<]*[\w+#?/&=])?|e'; return @preg_replace($pattern, "'\\2:\\3call('mail/compose', array(array('to' => '\\4')), '&\\6')) . '\" onmouseover=\"status=\'' . htmlspecialchars(addslashes(sprintf(_(\"Compose Message (%s)\"), '\\4')), ENT_QUOTES, $charset) . '\'; return true;\" onmouseout=\"status=\'\';\">\\4\\5\\6'", $text); } /** * Re-convert links generated by Text::linkUrls() to working * hrefs, after htmlspecialchars() has been called on the * text. This is an awkward chain, but necessary to filter out * other HTML. * * @since Horde 2.1 * * @access public * * @param string $text The text to convert. * @param optional string $target The link target. * @param optional string $class The css class name for the links * * @return string The converted text. */ function enableCapitalLinks($text, $target = '_blank', $class = 'fixed') { $syntax = array( '<A href="' => '', '" onmouseover="' => '" onmouseover="', '" onmouseout="' => '" onmouseout="', '\');">' => '\');">', '">' => '">', /* Only reconvert capital /A tags - the ones we * generated. */ '</A>' => '' ); return str_replace(array_keys($syntax), $syntax, $text); } /** * Replace occurences of %VAR% with VAR, if VAR exists in the * webserver's environment. Ignores all text after a '#' character * (shell-style comments). * * @access public * * @param string $text The text to expand. * * @return string The expanded text. */ function expandEnvironment($text) { if (preg_match("|([^#]*)#.*|", $text, $regs)) { $text = $regs[1]; if (strlen($text) > 0) { $text = $text . "\n"; } } while (preg_match("|%([A-Za-z_]+)%|", $text, $regs)) { $text = preg_replace("|%([A-Za-z_]+)%|", getenv($regs[1]), $text); } return $text; } /** * Convert a line of text to display properly in HTML. * * @param string $text The string of text to convert. * * @return string The HTML-compliant converted text. */ function htmlSpaces($text = '') { $text = @htmlspecialchars($text, ENT_COMPAT, NLS::getCharset()); $text = str_replace("\t", '        ', $text); $text = str_replace(' ', '  ', $text); $text = str_replace(' ', '  ', $text); return $text; } /** * Same as htmlSpaces() but converts all spaces to   * @see htmlSpaces() * * @param string $text The string of text to convert. * * @return string The HTML-compliant converted text. */ function htmlAllSpaces($text = '') { $text = Text::htmlSpaces($text); $text = str_replace(' ', ' ', $text); return $text; } /** * Removes some common entities and high-ascii or otherwise * nonstandard characters common in text pasted from Microsoft * Word into a browser. * * This function should NOT be used on non-ASCII text; it may and * probably will butcher other character sets * indescriminately. Use it only to clean US-ASCII (7-bit) text * which you suspect (or know) may have invalid or non-printing * characters in it. * * @since Horde 2.1 * * @access public * * @param string $text The text to be cleaned. * * @return string The cleaned text. */ function cleanASCII($text) { // Remove control characters. $text = preg_replace('/[\x00-\x1f]+/', '', $text); /* The '' entry may look wrong, depending on your editor, but it's not - that's not really a single quote. */ $from = array('', '', '', '', '', '', '', '', '', '', chr(167), '', '', '', '', '', '', '', '', '•', '►'); $to = array('...', "'", "'", '"', '"', '*', '-', '-', '*', '*', '*', '.', '*', '*', '-', '-', '*', '*', '*', '*', '>'); return str_replace($from, $to, $text); } /** * Turn text into HTML with varying levels of parsing. * For no html whatsoever, use htmlspecialchars() instead. * * @since Horde 2.2 * * @access public * * @param string $input An url-decoded string, \n-separated * for lines. * @param integer $parselevel The parselevel of the output. See the * list of constants below. * @param optional string $charset The charset to use for * htmlspecialchars() calls. * @param optional string $class The css class name for the links. * *
     * List of valid constants for $parselevel:
     * ----------------------------------------
     * TEXT_HTML_PASSTHRU        =  No action. Pass-through. Included for
     *                              completeness.
     * TEXT_HTML_SYNTAX          =  Allow full html, also do line-breaks,
     *                              in-lining, syntax-parsing.
     * TEXT_HTML_REDUCED         =  Reduced html (bold, links, etc. by syntax
     *                              array).
     * TEXT_HTML_MICRO           =  Micro html (only line-breaks, in-line
     *                              linking).
     * TEXT_HTML_NOHTML          =  No html (all stripped, only line-breaks)
     * TEXT_HTML_NOHTML_NOBREAK  =  No html whatsoever, no line breaks added.
     *                              Included for completeness.
     * 
* * @return string The converted HTML. */ function toHTML($text, $parselevel, $charset = null, $class = 'fixed') { $syntax = array( 'B' => '', '/B' => '', 'I' => '', '/I' => '', 'U' => '', '/U' => '', 'Q' => '
', '/Q' => '
', 'LIST' => '
    ', '/LIST' => '
', '*' => '
  • ' ); if (is_null($charset)) { $charset = NLS::getCharset(); } if ((strtolower($charset) == 'us-ascii') || !NLS::checkCharset($charset)) { $charset = 'iso-8859-1'; } /* Abort out on simple cases. */ if ($parselevel == TEXT_HTML_PASSTHRU) { return $text; } if ($parselevel == TEXT_HTML_NOHTML_NOBREAK) { return htmlspecialchars($text, ENT_QUOTES, $charset); } /* Find tags we recognize with this parselevel and translate them to ==> [tag] and then translate the rest < --> < > --> > */ if ($parselevel == TEXT_HTML_REDUCED) { foreach ($syntax as $k => $val) { $text = str_replace('<' . $k . '>', '[' . $k . ']', $text); $k = strtolower($k); $text = str_replace('<' . $k . '>', '[' . $k . ']', $text); } } /* Interpret tags for parse levels TEXT_HTML_SYNTAX and TEXT_HTML_REDUCED. */ if ($parselevel <= TEXT_HTML_REDUCED) { foreach ($syntax as $k => $v) { $text = str_replace('[' . $k . ']', $v, $text); $text = str_replace('<' . $k . '>', $v, $text); $k = strtolower($k); $text = str_replace('[' . $k . ']', $v, $text); $text = str_replace('<' . $k . '>', $v, $text); } } /* Do in-lining of http://xxx.xxx to link, xxx@xxx.xxx to email, part one. */ if ($parselevel < TEXT_HTML_NOHTML) { /* Make sure that the original message doesn't contain any capital tags or open tags , so we can assume we generated them. */ $text = str_replace(array('', '', '
    substitution. Everybody gets this; if you don't want even that, just save the htmlspecialchars() version of the input. */ $text = nl2br($text); return $text; } /** * Highlights quoted messages with different colors for the * different quoting levels. CSS class names called "quoted1" * .. "quoted$level" must be present. * * @since Horde 2.2 * * @access public * * @param string $text The text to be highlighted. * @param optional integer $level The maximum numbers of different * colors. * * @return string The highlighted text. */ function highlightQuotes($text, $level = 5) { // Use a global var since the class is called statically. $GLOBALS['_tmp_maxQuoteChars'] = 0; // Tack a newline onto the beginning of the string so that we // correctly highlight when the first character in the string // is a quote character. $text = "\n$text"; preg_replace_callback("/^\s*((>\s?)+)/m", array('Text', '_countQuoteChars'), $text); // Go through each level of quote block and put the // appropriate style around it. Important to work downwards so // blocks with fewer quote chars aren't matched until their // turn. for ($i = $GLOBALS['_tmp_maxQuoteChars']; $i > 0; $i--) { $text = preg_replace( // Finds a quote block across multiple newlines. "/(\n)( *(>\s?)\{$i}(?! ?>).*?)(\n|$)(?! *(> ?)\{$i})/s", '\1\2\4', $text ); } /* Unset the global variable. */ unset($GLOBALS['_tmp_maxQuoteChars']); /* Remove the leading newline we added above. */ return substr($text, 1); } /** * Called by the preg_replace_callback function in * highlightQuotes(). This method finds the maximum number of * quote characters in all of the quote blocks. * * @access private * * @param array $matches The matches from the regexp. */ function _countQuoteChars($matches) { $num = count(preg_split('/>\s?/', $matches[1])) - 1; if ($num > $GLOBALS['_tmp_maxQuoteChars']) { $GLOBALS['_tmp_maxQuoteChars'] = $num; } } /** * Highlights simple markup as used in emails or usenet postings. * * @param string $text The text to highlight * * @return The text with markups being highlighted by html tags. */ function simpleMarkup($text) { // bold $text = preg_replace('/(\s|\n)(\*[^*\s]+\*)(\s|\r|\n|\2\3', $text); // underline $text = preg_replace('/(\s|\n)(_[^_\s]+_)(\s|\r|\n|\2\3', $text); // italic $text = preg_replace(';(\s|\n)(/[^/\s]+/)(\s|\r|\n|\2\3', $text); return $text; } /** * Displays message signatures marked by a '-- ' in the style of * the CSS class "signature". Class names inside the signature are * prefixed with "signature-". * * @since Horde 2.2 * * @access public * * @param string $text The text to be changed. * * @return string The changed text. */ function dimSignature($text) { $parts = preg_split('|(\n--\s*(
    )?\r?\n)|', $text, 2, PREG_SPLIT_DELIM_CAPTURE); $text = array_shift($parts); if (count($parts)) { $text .= '' . $parts[0]; $text .= preg_replace('|class="([^"]+)"|', 'class="signature-\1"', $parts[2]); $text .= ''; } return $text; } /** * Expand tabs into spaces * * @author Marc Jauvin * * @access public * * @param string $text The text to expand. * @param optional integer $tabstop Expand Tabs into that many spaces. * @param optional string $break_char Character(s) to use when breaking * lines. * * @return string The text after tab expansion. */ function smartExpandTabs($text, $tabstop = 8, $break_char = "\n") { $lines = explode($break_char, $text); for ($i = 0; $i < count($lines); $i++) { while(($pos = strpos($lines[$i], "\t")) !== false) { $n_space = $tabstop - ($pos % $tabstop); $new_str = str_repeat(' ', $n_space); $lines[$i] = substr_replace($lines[$i], $new_str, $pos, 1); } } return implode("\n", $lines); } } /** * Takes HTML and converts it to formatted, plain text. * * Copyright 2003-2004 Jon Abernathy * Original source: http://www.chuggnutt.com/html2text.php * * @author Jon Abernathy * @version $Horde: framework/Text/Text.php,v 1.107 2004/05/25 02:05:52 chuck Exp $ * @since Horde 3.0 * @package Horde_Text */ class Text_HTMLConverter { /** * Contains the HTML content to convert. * * @var string $_html */ var $_html = ''; /** * Maximum width of the formatted text, in columns. * * @var integer $_width */ var $_width = 70; /** * List of preg* regular expression patterns to search for, * used in conjunction with $replace. * * @see $replace * * @var array $_search */ var $_search = array( "/\r/", // Non-legal carriage return "/\n+/", // Newlines "/\t+/", // Tabs '/]*>.*?<\/script>/i', // ' . "\n"; return $js; } /** * Outputs the javascript to initialise the tree. * * @access private */ function _getTreeInit() { $instance = $this->_instance; $js = '\n", $instance, $this->_root_node_id); return $js; } function _getJsArrayElement($js_var, $value) { if (is_array($value)) { $js = $js_var . ' = new Array();' . "\n"; foreach ($value as $key => $val) { if (is_numeric($key)) { $new_js_var = $js_var . '[' . $key . ']'; } else { $new_js_var = $js_var . '[\'' . $key . '\']'; } $js .= $this->_getJsArrayElement($new_js_var, $val); } return $js; } else { require_once 'Horde/Browser.php'; $browser = &Browser::singleton(); return $js_var . " = '" . $browser->escapeJSCode(addslashes($value)) . "';\n"; } } } From cvs at intevation.de Fri Oct 14 16:33:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:47 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/UI package.xml, NONE, 1.1 Message-ID: <20051014143316.1778D102CA2@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/UI Added Files: package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: package.xml --- Horde_UI Horde's User Interface Classes The Horde_UI package provides several classes for handling UI elements in Horde. LGPL chagenbu lead Chuck Hagenbuch chuck@horde.org eraserhd developer Jay Felice jfelice@cronosys.com 0.0.1 alpha 2003-11-14 Initial release as a PEAR package 0.0.1 2003-11-14 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:49 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/UI/UI/VarRenderer html.php, NONE, 1.1 Message-ID: <20051014143316.7160E102C4A@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI/UI/VarRenderer In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/UI/UI/VarRenderer Added Files: html.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: html.php --- * * See the enclosed file LICENSE for license information (LGPL). * * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_VarRenderer_html extends Horde_UI_VarRenderer { var $_onLoadJS = array(); function _renderVarInputDefault(&$form, &$var, &$vars) [...1058 lines suppressed...] return $actions; } function _addOnLoadJavascript($script) { $this->_onLoadJS[] = $script; } function renderEnd() { if (count($this->_onLoadJS)) { return ""; } else { return ''; } } } From cvs at intevation.de Fri Oct 14 16:33:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:51 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/UI/UI Language.php, NONE, 1.1 Pager.php, NONE, 1.1 Table.php, NONE, 1.1 Tabs.php, NONE, 1.1 VarRenderer.php, NONE, 1.1 Widget.php, NONE, 1.1 Message-ID: <20051014143316.6BE5B102C06@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/UI/UI In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/UI/UI Added Files: Language.php Pager.php Table.php Tabs.php VarRenderer.php Widget.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Language.php --- * * See the enclosed file LICENSE for license information (LGPL). * * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_Language { /** * Render the language selection. * * @abstract * * @param optional bool $form Return the selection box as an complete * standalone form. * * @return string The HTML selection box. */ function render() { $html = ''; if (!$GLOBALS['prefs']->isLocked('language')) { Horde::addScriptFile('language.js', 'horde'); $_SESSION['horde_language'] = NLS::select(); $html = sprintf('
    ', Horde::url($GLOBALS['registry']->getParam('webroot', 'horde') . '/services/language.php', false, -1)); $html .= ''; $html .= '
    '; } return $html; } } --- NEW FILE: Pager.php --- * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @author Ben Chavet * @author Joel Vandal * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_Pager extends Horde_UI_Widget { function Horde_UI_Pager($name, &$vars, $config) { if (!isset($config['page_limit'])) { $config['page_limit'] = 10; } if (!isset($config['perpage'])) { $config['perpage'] = 100; } parent::Horde_UI_Widget($name, $vars, $config); } /** * Render the pager. * * @return string HTML code containing a centered table with the pager * links. */ function render() { global $prefs, $registry, $conf; $num = $this->_config['num']; $url = $this->_config['url']; $page_limit = $this->_config['page_limit']; $perpage = $this->_config['perpage']; $current_page = $this->_vars->get($this->_name); // Figure out how many pages there will be. $pages = ($num / $perpage); if (is_integer($pages)) { $pages--; } $pages = (int)$pages; // Return nothing if there is only one page. if ($pages == 0 || $num == 0) { return ''; } $html = ''; // Create the '<< Prev' link if we are not on the first page. $link = Util::addParameter($url, $this->_name, $current_page - 1); $link = $this->_addPreserved($link); if ($current_page > 0) { $html .= ''; } // Figure out the top & bottom display limits. $bottom = $current_page - ($current_page % $page_limit); $top = $bottom + $page_limit - 1; // Create bottom '[x-y]' link if necessary. $link = Util::addParameter($url, $this->_name, $bottom - 1); $link = $this->_addPreserved($link); if ($bottom > 1) { $html .= ''; } // Create links to individual pages between limits. for ($i = $bottom; $i <= $top && $i <= $pages; $i++) { if ($i == $current_page) { $html .= ''; } elseif ($i >= 0 && $i <= $pages) { $link = Util::addParameter($url, $this->_name, $i); $link = $this->_addPreserved($link); $html .= ''; } } // Create top '[x-y]' link if necessary. if ($top < $pages) { $last = $top + $page_limit < $pages ? $top + $page_limit + 1 : $pages + 1; $link = Util::addParameter($url, $this->_name, $top + 1); $link = $this->_addPreserved($link); $html .= ''; } // Create the 'Next>>' link if we are not on the last page. if ($current_page < $pages) { $link = Util::addParameter($url, $this->_name, $current_page + 1); $link = $this->_addPreserved($link); $html .= ''; } $html .= '
    ' . Horde::link(Horde::applicationUrl($link), _("Previous Page")); $html .= Horde::img('nav/left.gif', _("Previous Page"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '' . Horde::link(Horde::applicationUrl($link)) . '[' . ($bottom - $page_limit + 1) . '-' . $bottom . '](' . ($i + 1) . ')' . Horde::link(Horde::applicationUrl($link)) . ($i + 1) . '' . Horde::link(Horde::applicationUrl($link)) . '[' . ($top + 2) . '-' . $last . ']' . Horde::link(Horde::applicationUrl($link), _("Next Page")); $html .= Horde::img('nav/right.gif', _("Next Page"), 'width="16" height="16" align="middle"', $registry->getParam('graphics', 'horde')) . '
    '; return $html; } } --- NEW FILE: Table.php --- * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_Table extends Horde_UI_Widget { /** * Data loaded from the getTableMetaData API. * * @access private * @var array $_metaData */ var $_metaData = null; var $_formVars = array(); function getMetaData() { global $registry; if (is_null($this->_metaData)) { list($app, $name) = explode('/', $this->_config['name']); $args = array($name, $this->_config['params']); $this->_metaData = $registry->callByPackage($app, 'getTableMetaData', $args); // We need to make vars for the columns. foreach ($this->_metaData['columns'] as $col) { $typename = isset($col['type']) ? $col['type'] : 'text'; $params = isset($col['params']) ? $col['params'] : array(); $type = &Horde_Form::getType($typename, $params); $var = &new Horde_Form_Variable($col['title'], $col['name'], $type, false, true, ''); $this->_formVars[$col['name']] = &$var; } } return $this->_metaData; } function _getData($start, $end) { global $registry; list($app, $name) = explode('/', $this->_config['name']); $args = array($name, $this->_config['params'], $start, $end); return $registry->callByPackage($app, 'getTableData', $args); } function getColumnCount() { $this->getMetaData(); return count($this->_metaData['columns']); } /** * Render the tabs. */ function render() { global $registry; $this->getMetaData(); require_once dirname(__FILE__) . '/VarRenderer.php'; $varRenderer = &Horde_UI_VarRenderer::singleton('html'); $html = ''; foreach ($this->_metaData['columns'] as $col) { $html .= ''; } $html .= ''; // Display data. $data = $this->_getData(0, $this->_metaData['rows']); if (empty($data)) { $html .= ''; } else { /* This Variables:: is populated for each table row so that we * can use the Horde_UI_VarRenderer:: */ $vars = &new Variables(); $form = null; foreach ($data as $row) { $html .= ''; foreach ($row as $key => $value) { $vars->set($key, $value); } foreach ($this->_metaData['columns'] as $col) { $value = null; if (isset($row[$col['name']])) { $value = $row[$col['name']]; } $align = ''; if (isset($col['align'])) { $align = ' align="' . htmlspecialchars($col['align']) . '"'; } $html .= ""; if (!empty($col['nobr'])) { $html .= ''; } $html .= $varRenderer->render($form, $this->_formVars[$col['name']], $vars); if (!empty($col['nobr'])) { $html .= ''; } $html .= ''; } $html .= ''; } } $html .= '
    '; // Table title. if (isset($this->_config['title'])) { $title = $this->_config['title']; } else { $title = _("Table"); } $html .= $title; /* // // Export icon. We store the parameters in the session so that smart // users can't hack it (in Hermes, you could make it show other // people's time, for example). // $id = $this->_config['name'] . ':' . $this->_name; $_SESSION['horde']['tables'][$id] = $this->_config; $exportlink = Horde::url($registry->getParam('webroot', 'horde') . '/services/table/export.php'); $exportlink = Util::addParameter($exportlink, array('id' => $id)); $html .= '  ' . Horde::link($exportlink, _("Export Data")) . Horde::img('data.gif', _("Export Data"), 'hspace="2"', $registry->getParam('graphics', 'horde')) . ''; */ // Column titles. $html .= '
    ' . $col['title'] . '
    ' . '    ' . _("(There are no rows to display.)") . '
    '; return $html; } } --- NEW FILE: Tabs.php --- * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_Tabs extends Horde_UI_Widget { /** * The array of tabs. * @var array $_tabs */ var $_tabs = array(); /** * Add a tab to the interface. * * @access public * * @param string $title The text which appears on the tab. * @param string $link The target page. * @param string $tabname The value to set the tab variable to. */ function addTab($title, $link, $tabname = null) { $this->_tabs[] = array('title' => $title, 'link' => $link, 'tabname' => $tabname); } /** * Retreive the title of the tab with the specified name. * * @access public * * @param string $tabname The name of the tab. * * @return string The tab's title. */ function getTitleFromAction($tabname) { foreach ($this->_tabs as $tab) { if ($tab['tabname'] == $tabname) { return $tab['title']; } } return null; } /** * Render the tabs. */ function render() { $html = ''; $width = round(100.0 / count($this->_tabs)); $first = true; $active = $this->_vars->get($this->_name); foreach ($this->_tabs as $tab) { $class = 'tab'; $title = $tab['title']; $link = $this->_addPreserved($tab['link']); $accesskey = Horde::getAccessKey($title); if (!is_null($tab['tabname'])) { $link = Util::addParameter($link, $this->_name, $tab['tabname']); if ($active == $tab['tabname']) { $class = 'tab-hi'; } } $html .= ''; } $html .= '
     ' . Horde::link(Horde::applicationUrl($link), $title, $class, null, null, null, $accesskey) . Horde::highlightAccessKey($title, $accesskey) . ' 
    '; return $html; } } --- NEW FILE: VarRenderer.php --- * * See the enclosed file LICENSE for license information (LGPL). * * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_VarRenderer { /** * Parameters which change this renderer's behavior. * @var array $_params */ var $_params; /** * Construct a new renderer. * * @access public * * @param array $params The name of the variable which will track this * UI widget's state. */ function Horde_UI_VarRenderer($params = array()) { $this->_params = $params; } /** * Construct a new Horde_UI_VarRenderer:: instance. * * @param mixed $driver This is the renderer subclass we * will instantiate. If an array is * passed, the first element is the * library path and the second element * is the driver name. * @param optional array $params parameters specific to the subclass * @return object a Horde_UI_VarRenderer:: subclass instance. */ function &factory($driver, $params = array()) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } $driver = basename($driver); if (!empty($app)) { require_once $GLOBALS['registry']->getParam('fileroot', $app) . '/lib/UI/VarRenderer/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/VarRenderer/' . $driver . '.php')) { require_once dirname(__FILE__) . '/VarRenderer/' . $driver . '.php'; } else { @include_once 'Horde/UI/VarRenderer/' . $driver . '.php'; } $class = 'Horde_UI_VarRenderer_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Return a Horde_UI_VarRenderer:: instance, constructing one with * the specified parameters if necessary. * * @param string $driver This is the renderer subclass we * will instantiate. * @param optional array $params parameters specific to the subclass * @return object a Horde_UI_VarRenderer:: subclass instance. */ function &singleton($driver, $params = array()) { static $cache; if (is_null($driver)) { $class = 'Horde_UI_VarRenderer'; } $key = serialize(array ($driver, $params)); if (!isset($cache[$key])) { $cache[$key] = &Horde_UI_VarRenderer::factory($driver, $params); } return $cache[$key]; } /** * Render a variable. * * @param object &$form Reference to a Horde_Form:: instance, * or null if none is available. * @param object &$var Reference to a Horde_Form_Var:: * @param object &$vars A Variables:: * @param bool $isInput Whether this is an input field. */ function render(&$form, &$var, &$vars, $isInput = false) { if ($isInput) { $state = 'Input'; } else { $state = 'Display'; } $method = "_renderVar${state}_" . $var->type->getTypeName(); if (!@method_exists($this, $method)) { $method = "_renderVar${state}Default"; } return $this->$method($form, $var, $vars); } /** * Finish rendering after all fields are output. */ function renderEnd() { return ""; } } --- NEW FILE: Widget.php --- * * See the enclosed file LICENSE for license information (LGPL). * * @version $Revision: 1.1 $ * @since Horde_UI 0.0.1 * @package Horde_UI */ class Horde_UI_Widget { /** * Any variables that should be preserved in all of the widget's * links. * @var array $_preserve */ var $_preserve = array(); /** * The name of this widget. This is used as the basename for variables * we access and manipulate. * @var string $_name */ var $_name; /** * A reference to a Variables:: object this widget will use and * manipulate. * @var object Variables $_vars */ var $_vars; /** * An array of name => value pairs which configure how this widget * behaves. */ var $_config; /** * Construct a new UI Widget interface. * * @access public * * @param string $name The name of the variable which * will track this UI widget's state. * @param object Variables &$vars A Variables:: object. * @param optional array $config The widget's configuration. */ function Horde_UI_Widget($name, &$vars, $config = array()) { $this->_name = $name; $this->_vars = &$vars; $this->_config = $config; } /** * Instruct Horde_UI_Widget:: to preserve a variable. * * @access public * * @param string $var The name of the variable to preserve. * @param mixed $value The value of the variable to preserve. */ function preserve($var, $value) { $this->_preserve[$var] = $value; } /** * @access private */ function _addPreserved($link) { foreach ($this->_preserve as $varName => $varValue) { $link = Util::addParameter($link, $varName, $varValue); } return $link; } /** * Render the widget. * * @abstract * * @param optional mixed $data The widget's state data. */ function render() {} } From cvs at intevation.de Fri Oct 14 16:33:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:53 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Util Array.php, NONE, 1.1 String.php, NONE, 1.1 Util.php, NONE, 1.1 Variables.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143316.DFC19102C4B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Util In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Util Added Files: Array.php String.php Util.php Variables.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Array.php --- * Copyright 2003-2004 Marko Djukic * Copyright 2003-2004 Jan Schneider * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Michael Slusarz * @author Marko Djukic * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Util */ class Horde_Array { /** * Prepare a list of addresses for storage. * Namely, trims and lowercases all addresses and then sort. * * @access public * * @param array $addr The list of addresses. * * @return array The list of addresses, prepared for storage. */ function prepareAddressList($addr) { /* Remove any extra space in the address and make it lowercase. */ $addr = array_map('trim', $addr); $addr = array_map(array('String', 'lower'), $addr); /* Remove duplicate entries. */ $addr = array_unique($addr); /* Sort the list. */ usort($addr, array('Horde_Array', 'sortAddressList')); return $addr; } /** * Function used by usort() to sort an address list. * e.g. usort($foo, array('Horde_Array', 'sortAddressList')); * * @access public * * @param string $a Address #1. * @param string $b Address #2. * * @return integer -1, 0, or 1. */ function sortAddressList($a, $b) { $a = explode('@', $a); $b = explode('@', $b); /* One of the addresses doesn't have a host name. */ if (empty($a[0])) { array_shift($a); } if (empty($b[0])) { array_shift($b); } if (count($a) != count($b)) { return (count($a) > count($b)); } /* The addresses have different hostname or not hostname and different mailbox names. */ if ($a[(count($a) - 1)] != $b[(count($b) - 1)]) { return strcmp($a[(count($a) - 1)], $b[(count($b) - 1)]); } /* Compare mailbox names. */ return strcmp($a[0], $b[0]); } /** * Sorts an array on a specified key. If the key does not exist, * defaults to the first key of the array. * * @access public * * @param array &$array The array to be sorted, passed * by reference. * @param optional string $key The key by which to sort. If not * specified then the first key is * used. * @param optional integer $direction Sort direction * 0 = ascending (default) * 1 = descending */ function arraySort(&$array, $key = null, $direction = 0) { /* Return if the array is empty. */ if (empty($array)) { return; } /* If no key to sort by is specified, use the first key. */ if (is_null($key)) { $keys = array_keys($array); $key = $keys[0]; } /* Create the function that will be used to sort the keys. */ $function = sprintf('return String::lower($a[\'%1$s\']) %2$s String::lower($b[\'%1$s\']) ? 1 : -1;', $key, ($direction ? '<' : '>')); /* Call the sort function, preserving array key * association. */ uasort($array, create_function('$a, $b', $function)); } /** * Given an HTML type array field "example[key1][key2][key3]" breaks up * the keys so that they could be used to reference a regular PHP array. * * @access public * * @param string $field The field name to be examined. * @param string &$base Set to the base element. * @param array &$keys Set to the list of keys. * * @access boolean True on sucess, false on error. */ function getArrayParts($field, &$base, &$keys) { if (preg_match('|([^\[]*)((\[[^\[\]]*\])+)|', $field, $matches)) { $base = $matches[1]; $keys = explode('][', $matches[2]); $keys[0] = substr($keys[0], 1); $keys[count($keys) - 1] = substr($keys[count($keys) - 1], 0, strlen($keys[count($keys) - 1]) - 1); return true; } else { return false; } } /** * Using an array of keys itarate through the array following the keys to * find the final key value. If a value is passed then set that value. * * @access public * * @param array &$array The array to be used. * @param array &$keys The key path to follow as an array. * @param optional array $value If set the target element will have this * value set to it. * * @returns mixed The final value of the key path. */ function getElement(&$array, &$keys, $value = null) { if (count($keys) > 0) { $key = array_shift($keys); if (isset($array[$key])) { return Horde_Array::getElement($array[$key], $keys, $value); } else { return $array; } } else { if (!is_null($value)) { $array = $value; } return $array; } } /** * Returns a rectangle of a two-dimensional array. * * @access public * * @param array &$array The array to extract the rectangle from. * @param integer $row The start row of the rectangle. * @param integer $col The start column of the rectangle. * @param integer $height The height of the rectangle. * @param integer $width The width of the rectangle. * * @return array The extracted rectangle. */ function &getRectangle(&$array, $row, $col, $height, $width) { $rec = array(); for ($y = $row; $y < $row + $height; $y++) { $rec[] = array_slice($array[$y], $col, $width); } return $rec; } /** * Given an array, returns an associative array with each element key * derived from its value. * For example: * array(0 => 'foo', 1 => 'bar') * would become: * array('foo' => 'foo', 'bar' => 'bar') * * @access public * * @param array $array An array of values. * * @return array An array with keys the same as values. */ function valuesToKeys($array) { $mapped = array(); foreach ($array as $value) { $mapped[$value] = $value; } return $mapped; } /** * Creates an array by using one array for keys and another for * its values. Only exists in PHP5, so we call array_combine if it * exists and otherwise emulate it. * * @param array $keys Key array. * @param array $values Value array. * * @return mixed False if there are no elements, or the combined array. */ function combine($keys, $values) { if (function_exists('array_combine')) { return array_combine($keys, $values); } $size = count($keys); if (($size != count($values)) || ($size == 0)) { return false; } for ($x = 0; $x < $size; $x++) { $array[$keys[$x]] = $values[$x]; } return $array; } } --- NEW FILE: String.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Util */ class String { /** * Sets a default charset that the String:: methods will use if none is * explicitely specified. * * @param string $charset The charset to use as the default one. */ function setDefaultCharset($charset) { $GLOBALS['_HORDE_STRING_CHARSET'] = $charset; } /** * Converts a string from one charset to another. * * Works only if either the iconv or the mbstring extension * are present and best if both are available. * The original string is returned if conversion failed or none * of the extensions were available. * * @param mixed $input The data to be converted. If $input is an an * array, the array's values get converted recursively. * @param string $from The string's current charset. * @param string $to (optional) The charset to convert the string to. If * not specified, the global variable * $_HORDE_STRING_CHARSET will be used. * * @return string The converted string. */ function convertCharset($input, $from, $to = null) { if (is_array($input)) { $tmp = array(); foreach ($input as $key => $val) { $tmp[String::convertCharset($key, $from, $to)] = String::convertCharset($val, $from, $to); } return $tmp; } if (is_object($input)) { $vars = get_object_vars($input); foreach ($vars as $key => $val) { $input->$key = String::convertCharset($val, $from, $to); } return $input; } if (!is_string($input)) { return $input; } $output = false; /* Get the user's default character set if none passed in. */ if (is_null($to)) { $to = $GLOBALS['_HORDE_STRING_CHARSET']; } /* If the from and to chaacter sets are identical, return now. */ $str_from = String::lower($from); $str_to = String::lower($to); if ($str_from == $str_to) { return $input; } /* Use utf8_[en|de]code() if possible. */ $str_from_check = (($str_from == 'iso-8859-1') || ($str_from == 'us-ascii')); if ($str_from_check && ($str_to == 'utf-8')) { return utf8_encode($input); } $str_to_check = (($str_to == 'iso-8859-1') || ($str_to == 'us-ascii')); if (($str_from == 'utf-8') && $str_to_check) { return utf8_decode($input); } /* First try iconv with transliteration. */ if ($str_from != 'utf7-imap' && $str_to != 'utf7-imap' && Util::extensionExists('iconv')) { ini_set('track_errors', 1); /* We need to tack an extra character temporarily because of a bug in iconv() if the last character is not a 7 bit ASCII character. */ $output = @iconv($from, $to . '//TRANSLIT', $input . 'x'); if (isset($php_errormsg)) { $output = false; } else { $output = String::substr($output, 0, -1, $to); } ini_restore('track_errors'); } /* Next try mbstring. */ if (!$output && Util::extensionExists('mbstring')) { $output = @mb_convert_encoding($input, $to, $from); } /* At last try imap_utf7_[en|de]code if appropriate. */ if (!$output && Util::extensionExists('imap')) { if ($str_from_check && ($str_to == 'utf7-imap')) { return @imap_utf7_encode($input); } if (($str_from == 'utf7-imap') && $str_to_check) { return @imap_utf7_decode($input); } } return (!$output) ? $input : $output; } /** * Makes a string lowercase. * * @param string $string The string to be converted. * @param bool $locale (optional) If true the string will be converted * based on a given charset, locale independent else. * @param string $charset (optional) If $locale is true, the charset to use * when converting. If not provided the current * charset. * * @return string The string with lowercase characters */ function lower($string, $locale = false, $charset = null) { static $lowers; if ($locale) { /* The existence of mb_strtolower() depends on the platform. */ if (Util::extensionExists('mbstring') && function_exists('mb_strtolower')) { if (is_null($charset)) { $charset = $GLOBALS['_HORDE_STRING_CHARSET']; } $ret = @mb_strtolower($string, $charset); if (!empty($ret)) { return $ret; } } return strtolower($string); } if (!isset($lowers)) { $lowers = array(); } if (!isset($lowers[$string])) { $language = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'en'); $lowers[$string] = strtolower($string); setlocale(LC_CTYPE, $language); } return $lowers[$string]; } /** * Makes a string uppercase. * * @param string $string The string to be converted. * @param bool $locale (optional) If true the string will be converted * based on a given charset, locale independent else. * @param string $charset (optional) If $locale is true, the charset to use * when converting. If not provided the current * charset. * * @return string The string with uppercase characters */ function upper($string, $locale = false, $charset = null) { static $uppers; if ($locale) { /* The existence of mb_strtoupper() depends on the platform. */ if (Util::extensionExists('mbstring') && function_exists('mb_strtoupper')) { if (is_null($charset)) { $charset = $GLOBALS['_HORDE_STRING_CHARSET']; } $ret = @mb_strtoupper($string, $charset); if (!empty($ret)) { return $ret; } } return strtoupper($string); } if (!isset($uppers)) { $uppers = array(); } if (!isset($uppers[$string])) { $language = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'en'); $uppers[$string] = strtoupper($string); setlocale(LC_CTYPE, $language); } return $uppers[$string]; } /** * Returns part of a string. * * @param string $string The string to be converted. * @param int $start The part's start position, zero based. * @param int $length (optional) The part's length. * @param string $charset (optional) The charset to use when calculating * the part's position and length, defaults to * current charset. * * @return string The string's part. */ function substr($string, $start, $length = null, $charset = null) { if (Util::extensionExists('mbstring')) { if (is_null($charset)) { $charset = $GLOBALS['_HORDE_STRING_CHARSET']; } if (is_null($length)) { $length = String::length($string, $charset); } $ret = @mb_substr($string, $start, $length, $charset); if (!empty($ret)) { return $ret; } } if (is_null($length)) { $length = String::length($string); } return substr($string, $start, $length); } /** * Returns the character (not byte) length of a string. * * @param string $string The string to return the length of. * @param string $charset (optional) The charset to use when calculating * the string's length. * * @return string The string's part. */ function length($string, $charset = null) { if (Util::extensionExists('mbstring')) { if (is_null($charset)) { $charset = $GLOBALS['_HORDE_STRING_CHARSET']; } $ret = @mb_strlen($string, $charset); if (!empty($ret)) { return $ret; } } return strlen($string); } /** * Returns the numeric position of the first occurrence of $needle in * the $haystack string. * * @param string $haystack The string to search through. * @param string $needle The string to search for. * @param int $offset (optional) Allows to specify which character in * haystack to start searching. * @param string $charset (optional) The charset to use when searching * for the $needle string. * * @return int The position of first occurrence. */ function pos($haystack, $needle, $offset = 0, $charset = null) { if (Util::extensionExists('mbstring')) { if (is_null($charset)) { $charset = $GLOBALS['_HORDE_STRING_CHARSET']; } ini_set('track_errors', 1); $ret = @mb_strpos($haystack, $needle, $offset, $charset); ini_restore('track_errors'); if (!isset($php_errormsg)) { return $ret; } } return strpos($haystack, $needle, $offset); } function isAlpha($string, $charset = null) { return ctype_alpha($string); } /** * Returns true if every character in the parameter is a lowercase * letter in the current locale. * * @param $string The string to test. * @param $charset (optional) The charset to use when testing the string. * * @return bool True if the parameter was lowercase. */ function isLower($string, $charset = null) { return ((String::lower($string, true, $charset) === $string) && String::isAlpha($string, $charset)); } /** * Returns true if every character in the parameter is an uppercase * letter in the current locale. * * @param string $string The string to test. * @param string $charset (optional) The charset to use when testing the string. * * @return boolean True if the parameter was uppercase. */ function isUpper($string, $charset = null) { return ((String::upper($string, true, $charset) === $string) && String::isAlpha($string, $charset)); } } --- NEW FILE: Util.php --- * Copyright 1999-2004 Jon Parise * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Util */ class Util { /** * Returns an object's clone. * * @param object &$obj The object to clone. * * @return object The cloned object. */ function &cloneObject(&$obj) { if (version_compare(zend_version(), '2', '>')) { return clone($obj); } else { $newObj = $obj; return $newObj; } } /** * Buffer the output from a function call, like readfile() or * highlight_string(), that prints the output directly, so that * instead it can be returned as a string and used. * * @access public * * @param string $function The function to run. * @param optional mixed $arg1 First argument to $function(). * @param optional mixed $arg2 Second argument to $function(). * @param optional mixed $arg... ... * @param optional mixed $argN Nth argument to $function(). * * @return string The output of the function. */ function bufferOutput() { if (func_num_args() == 0) { return false; } $eval = false; $args = func_get_args(); $function = array_shift($args); if (is_array($function)) { if (!is_callable($function)) { return false; } } elseif (($function == 'include') || ($function == 'include_once') || ($function == 'require') || ($function == 'require_once')) { $eval = true; } elseif (!function_exists($function) && ($function != 'eval')) { return false; } ob_start(); if ($eval) { eval($function . " '" . implode(',', $args) . "';"); } elseif ($function == 'eval') { eval($args[0]); } else { call_user_func_array($function, $args); } $output = ob_get_contents(); ob_end_clean(); return $output; } /** * Check to see if a value has been set by the script and not by GET, * POST, or cookie input. The value being checked MUST be in the global * scope. * * @access public * * @param string $varname The variable name to check. * * @return mixed Null if the var is in user input, the variable value * otherwise. */ function nonInputVar($varname) { if (isset($_GET[$varname]) || isset($_POST[$varname]) || isset($_COOKIE[$varname])) { return null; } else { return isset($GLOBALS[$varname]) ? $GLOBALS[$varname] : null; } } /** * Add a name=value pair to the end of an URL, taking care of whether * there are existing parameters and whether to use ? or & as the glue. * All data will be urlencoded. * * @access public * * @param string $url The URL to modify * @param mixed $parameter Either the name=value pair to add * (DEPRECATED) -or- * the name value -or- * an array of name/value pairs. * @param optional string $value If specified, the value part ($parameter * is then assumed to just be the parameter * name). * * @return string The modified URL. * * @since Horde 2.1 */ function addParameter($url, $parameter, $value = null) { if (empty($parameter)) { return $url; } $arg = ini_get('arg_separator.output'); if (!is_array($parameter)) { /* This is deprecated should be removed in the future. */ if (is_null($value)) { @list($parameter, $value) = explode('=', $parameter, 2); } $add = array($parameter => $value); } else { $add = $parameter; } if (($pos = strpos($url, '?')) === false) { $url .= '?'; } else { /* Check if the argument separator has been already * htmlentities-ized in the URL. */ $query = substr($url, $pos + 1); if (preg_match('/=.*?' . htmlentities($arg) . '.*?=/', $query)) { $arg = htmlentities($arg); $query = strtr($query, array_flip(get_html_translation_table(HTML_ENTITIES))); } parse_str($query, $params); $url .= $arg; } $url_params = array(); foreach ($add as $parameter => $value) { if (!isset($params[$parameter])) { $url_params[] = urlencode($parameter) . '=' . urlencode($value); } } return $url . join($arg, $url_params); } /** * Removes name=value pairs from a URL. * * @access public * * @param string $url The URL to modify. * @param mixed $remove Either a single parameter to remove or an array * of parameters to remove. * * @return string The modified URL. * * @since Horde 2.2 */ function removeParameter($url, $remove) { if (!is_array($remove)) { $remove = array($remove); } /* Return immediately if there are no parameters to remove. */ if (($pos = strpos($url, '?')) === false) { return $url; } $arg = ini_get('arg_separator.output'); $entities = false; list($url, $query) = explode('?', $url, 2); /* Check if the argument separator has been already * htmlentities-ized in the URL. */ if (preg_match('/=.*?' . htmlentities($arg) . '.*?=/', $query)) { $entities = true; $query = strtr($query, array_flip(get_html_translation_table(HTML_ENTITIES))); } /* Get the list of parameters. */ parse_str($query, $params); /* Remove the parameters. */ foreach ($remove as $param) { unset($params[$param]); } if (!count($params)) { return $url; } /* Flatten arrays. * FIXME: should handle more than one array level somehow. */ $keys = array(); $vals = array(); foreach ($params as $key => $val) { if (is_array($val)) { foreach ($val as $v) { $keys[] = $key . '[]'; $vals[] = $v; } } else { $keys[] = $key; $vals[] = $val; } } $query = implode($arg, array_map(create_function('$a,$b', 'return str_replace(urlencode("[]"), "[]", urlencode($a)) . "=" . urlencode($b);'), $keys, $vals)); if ($entities) { $query = htmlentities($query); } return $url . '?' . $query; } /** * Returns a url with the 'nocache' parameter added, if the browser is * buggy and caches old URLs. * * @access public * * @param string $url The URL to modify. * * @return string The requested URI. */ function nocacheUrl($url) { static $rand_num; // FIXME: load from include_path. require_once 'Horde/Browser.php'; $browser = &Browser::singleton(); if (!isset($rand_num)) { $rand_num = base_convert(microtime(), 10, 36); } /* We may need to set a dummy parameter 'nocache' since some * browsers do not always honor the 'no-cache' header. */ if ($browser->hasQuirk('cache_same_url')) { return Util::addParameter($url, 'nocache', $rand_num); } else { return $url; } } /** * Return a hidden form input containing the session name and id. * * @access public * * @param optional boolean $append_session 0 = only if needed, 1 = always. * * @return string The hidden form input, if needed/requested. */ function formInput($append_session = 0) { if (($append_session == 1) || !array_key_exists(session_name(), $_COOKIE)) { return '\n"; } else { return ''; } } /** * Print a hidden form input containing the session name and id. * * @access public * * @param optional boolean $append_session 0 = only if needed, 1 = always. * * @return string The hidden form input, if needed/requested. */ function pformInput($append_session = 0) { echo Util::formInput($append_session); } /** * If magic_quotes_gpc is in use, run stripslashes() on $var. * * @access public * * @param string &$var The string to un-quote, if necessary. * * @return string $var, minus any magic quotes. */ function dispelMagicQuotes(&$var) { static $magic_quotes; if (!isset($magic_quotes)) { $magic_quotes = get_magic_quotes_gpc(); } if ($magic_quotes) { if (!is_array($var)) { $var = stripslashes($var); } else { array_walk($var, array('Util', 'dispelMagicQuotes')); } } return $var; } /** * Get a form variable from GET or POST data, stripped of magic quotes if * necessary. If the variable is somehow set in both the GET data and the * POST data, the value from the POST data will be returned and the GET * value will be ignored. * * @access public * * @param string $var The name of the form variable to look * for. * @param optional string $default The value to return if the variable is * not there. * * @return string The cleaned form variable, or $default. */ function getFormData($var, $default = null) { return (($val = Util::getPost($var)) !== null) ? $val : Util::getGet($var, $default); } /** * Get a form variable from GET data, stripped of magic quotes if necessary. * This function will NOT return a POST variable. * * @access public * * @param string $var The name of the form variable to look * for. * @param optional string $default The value to return if the variable is * not there. * * @return string The cleaned form variable, or $default. * * @since Horde 2.2 */ function getGet($var, $default = null) { return (isset($_GET[$var])) ? Util::dispelMagicQuotes($_GET[$var]) : $default; } /** * Get a form variable from POST data, stripped of magic quotes if * necessary. This function will NOT return a GET variable. * * @access public * * @param string $var The name of the form variable to look * for. * @param optional string $default The value to return if the variable is * not there. * * @return string The cleaned form variable, or $default. * * @since Horde 2.2 */ function getPost($var, $default = null) { return (isset($_POST[$var])) ? Util::dispelMagicQuotes($_POST[$var]) : $default; } /** * Determine the location of the system temporary directory. If a specific * setting cannot be found, it defaults to /tmp. * * @access public * * @return string A directory name which can be used for temp files. * Returns false if one could not be found. */ function getTempDir() { $tmp_locations = array('/tmp', '/var/tmp', 'c:\WUTemp', 'c:\temp', 'c:\windows\temp', 'c:\winnt\temp'); /* First, try PHP's upload_tmp_dir directive. */ if (empty($tmp)) { $tmp = ini_get('upload_tmp_dir'); } /* Otherwise, try to determine the TMPDIR environment variable. */ if (empty($tmp)) { $tmp = getenv('TMPDIR'); } /* If we still cannot determine a value, then cycle through a * list of preset possibilities. */ while (empty($tmp) && count($tmp_locations)) { $tmp_check = array_shift($tmp_locations); if (@is_dir($tmp_check)) { $tmp = $tmp_check; } } /* If it is still empty, we have failed, so return false; * otherwise return the directory determined. */ return empty($tmp) ? false : $tmp; } /** * Create a temporary filename for the lifetime of the script, and * (optionally) register it to be deleted at request shutdown. * * @param optional string $prefix Prefix to make the temporary name more * recognizable. * @param optional boolean $delete Delete the file at the end of the * request? * @param optional string $dir Directory to create the temporary file * in. * @param optional boolean $secure If deleting file, should we securely * delete the file? * * @return string Returns the full path-name to the temporary file. * Returns false if a temp file could not be created. */ function getTempFile($prefix = '', $delete = true, $dir = '', $secure = false) { if (empty($dir) || !is_dir($dir)) { $tmp_dir = Util::getTempDir(); } else { $tmp_dir = $dir; } if (empty($tmp_dir)) { return false; } $tmp_file = tempnam($tmp_dir, $prefix); /* If the file was created, then register it for deletion and return */ if (empty($tmp_file)) { return false; } else { if ($delete) { Util::deleteAtShutdown($tmp_file, true, $secure); } return $tmp_file; } } /** * Create a temporary directory in the system's temporary directory. * * @access public * * @param optional boolean $delete Delete the temporary directory at the * end of the request? * @param optional string $temp_dir Use this temporary directory as the * directory where the temporary * directory will be created. * * @return string The pathname to the new temporary directory. * Returns false if directory not created. */ function createTempDir($delete = true, $temp_dir = null) { if (is_null($temp_dir)) { $temp_dir = Util::getTempDir(); } if (empty($temp_dir)) { return false; } /* Get the first 8 characters of a random string to use as a temporary directory name. */ do { $temp_dir .= '/' . substr(base_convert(mt_rand() . microtime(), 10, 36), 0, 8); } while (file_exists($temp_dir)); $old_umask = umask(0000); if (!mkdir($temp_dir, 0700)) { $temp_dir = false; } elseif ($delete) { Util::deleteAtShutdown($temp_dir); } umask($old_umask); return $temp_dir; } /** * Removes given elements at request shutdown. * * If called with a filename will delete that file at request shutdown; if * called with a directory will remove that directory and all files in that * directory at request shutdown. * * If called with no arguments, return all elements to be deleted (this * should only be done by Util::_deleteAtShutdown). * * The first time it is called, it initializes the array and registers * Util::_deleteAtShutdown() as a shutdown function - no need to do so * manually. * * The second parameter allows the unregistering of previously registered * elements. * * @access public * * @param optional string $filename The filename to be deleted at the end * of the request. * @param optional boolean $register If true, then register the element for * deletion, otherwise, unregister it. * @param optional boolean $secure If deleting file, should we securely * delete the file? */ function deleteAtShutdown($filename = false, $register = true, $secure = false) { static $dirs, $files, $securedel; /* Initialization of variables and shutdown functions. */ if (is_null($dirs)){ $dirs = array(); $files = array(); $securedel = array(); register_shutdown_function(array('Util', '_deleteAtShutdown')); } if ($filename) { if ($register) { if (@is_dir($filename)) { $dirs[$filename] = true; } else { $files[$filename] = true; } if ($secure) { $securedel[$filename] = true; } } else { unset($dirs[$filename]); unset($files[$filename]); unset($securedel[$filename]); } } else { return array($dirs, $files, $securedel); } } /** * Delete registered files at request shutdown. * * This function should never be called manually; it is registered as a * shutdown function by Util::deleteAtShutdown() and called automatically * at the end of the request. It will retrieve the list of folders and files * to delete from Util::deleteAtShutdown()'s static array, and then iterate * through, deleting folders recursively. * * Contains code from gpg_functions.php. * Copyright (c) 2002-2003 Braverock Ventures * * @access private */ function _deleteAtShutdown() { $registered = Util::deleteAtShutdown(); $dirs = $registered[0]; $files = $registered[1]; $secure = $registered[2]; foreach ($files as $file => $val) { /* Delete files */ if ($val && @file_exists($file)) { /* Should we securely delete the file by overwriting the data with a random string? */ if (isset($secure[$file])) { $random_str = ''; for ($i = 0; $i < filesize($file); $i++) { $random_str .= chr(mt_rand(0, 255)); } $fp = fopen($file, 'r+'); fwrite($fp, $random_str); fclose($fp); } @unlink($file); } } foreach ($dirs as $dir => $val) { /* Delete directories */ if ($val && @file_exists($dir)) { /* Make sure directory is empty. */ $dir_class = dir($dir); while (false !== ($entry = $dir_class->read())) { if ($entry != '.' && $entry != '..') { @unlink($dir . '/' . $entry); } } $dir_class->close(); @rmdir($dir); } } } /** * Output javascript code to close the current window. * * @access public * * @param string $code Any addtional javascript code to run before * closing the window. */ function closeWindowJS($code = null) { echo ''; } /** * Caches the result of extension_loaded() calls. * * @access private * * @param string $ext The extension name. * * @return boolean Is the extension loaded? */ function extensionExists($ext) { static $cache = array(); if (!isset($cache[$ext])) { $cache[$ext] = extension_loaded($ext); } return $cache[$ext]; } /** * Try to load a PHP extension, behaving correctly for all * operating systems. * * @param string $ext The extension to load. * * @return boolean True if the extension is now loaded, false if not. * True can mean that the extension was already loaded, * OR was loaded dynamically. */ function loadExtension($ext) { /* If $ext is already loaded, our work is done. */ if (Util::extensionExists($ext)) { return true; } /* See if we can call dl() at all, by the current ini * settings. */ if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) { return false; } if (substr(PHP_OS, 0, 3) == 'WIN') { $suffix = 'dll'; } else { switch (PHP_OS) { case 'HP-UX': $suffix = 'sl'; break; case 'AIX': $suffix = 'a'; break; case 'OSX': $suffix = 'bundle'; break; default: $suffix = 'so'; } } return @dl($ext . '.' . $suffix) || @dl('php_' . $ext . '.' . $suffix); } /** * Checks if all necessary parameters for a driver's configuration * are set and returns a PEAR_Error if something is missing. * * @param array $params The configuration array with all parameters. * @param array $fields An array with mandatory parameter names for * this driver. * @param string $name The clear text name of the driver. If * not specified, the application name will be used. * @param array $info (optional) A hash containing detailed information * about the driver. Will be passed as the userInfo * to the PEAR_Error. */ function assertDriverConfig($params, $fields, $name, $info = array()) { $info = array_merge($info, array('params' => $params, 'fields' => $fields, 'name' => $name)); if (!is_array($params) || !count($params)) { return PEAR::throwError(sprintf(_("No configuration information specified for %s."), $name), HORDE_ERROR_DRIVER_CONFIG_MISSING, $info); } foreach ($fields as $field) { if (!isset($params[$field])) { return PEAR::throwError(sprintf(_("Required '%s' not specified in configuration."), $field, $name), HORDE_ERROR_DRIVER_CONFIG, $info); } } } /** * Returns a format string to be used by strftime(). * * @param string $format A format string as used by date(). * * @return string A format string as similar as possible to $format. */ function date2strftime($format) { $dateSymbols = array('a', 'A', 'd', 'D', 'F', 'g', 'G', 'h', 'H', 'i', 'j', 'l', 'm', 'M', 'n', 'r', 's', 'T', 'w', 'W', 'y', 'Y', 'z', 'm/d/Y', 'M', "\n", 'g:i a', 'G:i', "\t", 'H:i:s', '%'); $strftimeSymbols = array('%p', '%p', '%d', '%a', '%B', '%I', '%H', '%I', '%H', '%M', '%e', '%A', '%m', '%b', '%m', '%a, %e %b %Y %T %Z', '%S', '%Z', '%w', '%V', '%y', '%Y', '%j', '%D', '%h', '%n', '%r', '%R', '%t', '%T', '%%'); return str_replace($dateSymbols, $strftimeSymbols, $format); } /** * Returns a format string to be used by date(). * * @param string $format A format string as used by strftime(). * * @return string A format string as similar as possible to $format. */ function strftime2date($format) { $dateSymbols = array('a', 'A', 'd', 'D', 'F', 'g', 'G', 'h', 'H', 'i', 'j', 'l', 'm', 'M', 'n', 'r', 's', 'T', 'w', 'W', 'y', 'Y', 'z', 'm/d/Y', 'M', "\n", 'g:i a', 'G:i', "\t", 'H:i:s', '%'); $strftimeSymbols = array('%p', '%p', '%d', '%a', '%B', '%I', '%H', '%I', '%H', '%M', '%e', '%A', '%m', '%b', '%m', '%a, %e %b %Y %T %Z', '%S', '%Z', '%w', '%V', '%y', '%Y', '%j', '%D', '%h', '%n', '%r', '%R', '%t', '%T', '%%'); return str_replace($strftimeSymbols, $dateSymbols, $format); } } if (!function_exists('_')) { function _($string) { return $string; } function bindtextdomain() { } function textdomain() { } } --- NEW FILE: Variables.php --- * @author Chuck Hagenbuch * @package Horde_Util */ class Variables { var $_vars; var $_expectedVariables = array(); function Variables($vars = array()) { if (is_null($vars)) { require_once dirname(__FILE__) . '/../Util.php'; $vars = Util::dispelMagicQuotes($_REQUEST); } if (isset($vars['_formvars'])) { $this->_expectedVariables = @unserialize($vars['_formvars']); unset($vars['_formvars']); } $this->_vars = $vars; } function &getDefaultVariables() { require_once dirname(__FILE__) . '/Util.php'; return $ret = &new Variables(Util::dispelMagicQuotes($_REQUEST)); } function exists($varname) { if (count($this->_expectedVariables) && $this->_exists($this->_expectedVariables, $varname, false)) { return true; } return $this->_exists($this->_vars, $varname, false); } function get($varname) { $this->_getExists($this->_vars, $varname, $value); return $value; } function getExists($varname, &$exists) { $exists = $this->_getExists($this->_vars, $varname, $value); return $value; } function set($varname, $value) { $this->_vars[$varname] = $value; } function add($varname, $value) { if ($this->exists($varname)) { return false; } $this->_vars[$varname] = $value; } function remove($varname) { require_once 'Horde/Array.php'; Horde_Array::getArrayParts($varname, $base, $keys); if (!is_null($base)) { eval("unset(\$this->_vars['" . $base . "']['" . join("']['", $keys) . "']);"); } else { unset($this->_vars[$varname]); } } /** * Find out whether or not $varname was set in $array. * * @access private * * @param array $array The array to search in (usually * either $this->_vars or * $this->_expectedVariables). * @param string $varname The name of the variable to look for. * @param optional boolean $checkExpectedVariables If we don't find $varname, should we * check $this->_expectedVariables to see if it * should have existed (like a checkbox * or select multiple). * * @return Whether or not the variable was set (or, if we've checked * $this->_expectedVariables, should have been set). */ function _exists($array, $varname, $checkExpectedVariables = true) { return $this->_getExists($array, $varname, $value, $checkExpectedVariables); } /** * Fetch the requested variable ($varname) into $value, and return whether * or not the variable was set in $array. * * @access private * * @param array $array The array to search in (usually * either $this->_vars or * $this->_expectedVariables). * @param string $varname The name of the variable to look for. * @param mixed &$value $varname's value gets assigned to * this variable. * @param optional bool $checkExpectedVariables If we don't find $varname, should we * check $this->_expectedVariables to see if it * should have existed (like a checkbox * or select multiple). * * @return Whether or not the variable was set (or, if we've checked * $this->_expectedVariables, should have been set). */ function _getExists($array, $varname, &$value, $checkExpectedVariables = true) { require_once 'Horde/Array.php'; if (Horde_Array::getArrayParts($varname, $base, $keys)) { if (!isset($array[$base])) { $value = null; // If we're supposed to check $this->_expectedVariables, do so, // but make sure not to check it again. return $checkExpectedVariables ? $this->_exists($this->_expectedVariables, $varname, false) : false; } else { $searchspace = &$array[$base]; while (count($keys)) { $key = array_shift($keys); if (!isset($searchspace[$key])) { $value = null; // If we're supposed to check $this->_expectedVariables, // do so, but make sure not to check it again. return $checkExpectedVariables ? $this->_exists($this->_expectedVariables, $varname, false) : false; } $searchspace = &$searchspace[$key]; } $value = $searchspace; return true; } } else { $value = isset($array[$varname]) ? $array[$varname] : null; if (!is_null($value)) { return true; } elseif ($checkExpectedVariables) { // If we're supposed to check $this->_expectedVariables, do so, // but make sure not to check it again. return $this->_exists($this->_expectedVariables, $varname, false); } else { return false; } } } } --- NEW FILE: package.xml --- Horde_Util Horde Utility Libraries These classes provide functionality useful for all kind of applications. LGPL chuck lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org jan lead Jan Schneider jan@horde.org 0.0.1 alpha 2003-10-28 Initial release as a PEAR package 0.0.1 alpha 2003-10-28 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:36:59 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VC VC.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143317.20F98102BD6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/VC Added Files: VC.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: VC.php --- _sourceroot; } /** * Returns the location of the specified binary. * * @param string $binary An external program name. * * @return bool|string The location of the external program or false if * it wasn't specified. */ function getPath($binary) { if (isset($this->_paths[$binary])) { if (OS_WINDOWS) { return $this->_paths[$binary]; } else { return is_executable($this->_paths[$binary]) ? $this->_paths[$binary] : false; } } return false; } /** * Parse the users file, if present in the source root, and return * a hash containing the requisite information, keyed on the * username, and with the 'desc','name', and 'mail' values inside. * * @return bool|array false if the file is not present, otherwise * $this->_users populated with the data */ function getUsers($usersfile) { /* Check that we haven't already parsed users. */ if (isset($this->_users) && is_array($this->_users)) { return $this->_users; } if (!@is_file($usersfile) || !($fl = @fopen($usersfile, OS_WINDOWS ? 'rb' : 'r'))) { return false; } $this->_users = array(); /* Discard the first line, since it'll be the header info. */ fgets($fl, 4096); /* Parse the rest of the lines into a hash, keyed on * username. */ while ($line = fgets($fl, 4096)) { if (preg_match('/^\s*$/', $line)) continue; if (!preg_match('/^(\w+)\s+(.+)\s+([\w\.\-\_]+@[\w\.\-\_]+)\s+(.*)$/', $line, $regs)) continue; $this->_users[$regs[1]]['name'] = trim($regs[2]); $this->_users[$regs[1]]['mail'] = trim($regs[3]); $this->_users[$regs[1]]['desc'] = trim($regs[4]); } return $this->_users; } /** * Attempts to return a concrete VC instance based on $driver. * * @param mixed $driver The type of concrete VC subclass to return. * The code is dynamically included. * @param array $params A hash containing any additional configuration * or parameters a subclass might need. * * @return object VC The newly created concrete VC instance, * or PEAR_Error on failure. */ function &factory($driver, $params = array()) { include_once 'VC/' . $driver . '.php'; $class = 'VC_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError(sprintf(_("Class definition of %s not found."), $class)); } } /** * Attempts to return a reference to a concrete VC instance based * on $driver. It will only create a new instance if no VC * instance with the same parameters currently exists. * * This should be used if multiple types of file backends (and, * thus, multiple VC instances) are required. * * This method must be invoked as: $var = &VC::singleton() * * @param mixed $driver The type of concrete VC subclass to return. * The code is dynamically included. * @param array $params A hash containing any additional configuration * or parameters a subclass might need. * * @return object VC The concrete VC reference, or PEAR_Error on failure. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &VC::factory($driver, $params); } return $instances[$signature]; } } /** * @package VC */ class VC_Diff { /** * Obtain a tree containing information about the changes between * two revisions. * * @param array $raw An array of lines of the raw unified diff, * normally obtained through VC_Diff::get(). * * @return array * * @todo document this thoroughly, as the format is a bit complex. */ function humanReadable($raw) { $ret = array(); /* Hold the left and right columns of lines for change * blocks. */ $cols = array(array(), array()); $state = 'empty'; /* Iterate through every line of the diff. */ foreach ($raw as $line) { /* Look for a header which indicates the start of a diff * chunk. */ if (preg_match('/^@@ \-([0-9]+).*\+([0-9]+).*@@(.*)/', $line, $regs)) { /* Push any previous header information to the return * stack. */ if (isset($data)) { $ret[] = $data; } $data = array('type' => 'header', 'oldline' => $regs[1], 'newline' => $regs[2], 'contents'> array()); $data['function'] = isset($regs[3])?$regs[3]:''; $state = 'dump'; } elseif ($state != 'empty') { /* We are in a chunk, so split out the action (+/-) * and the line. */ preg_match('/^([\+\- ])(.*)/', $line, $regs); if (count($regs) > 2) { $action = $regs[1]; $content = $regs[2]; } else { $action = ' '; $content = ''; } if ($action == '+') { /* This is just an addition line. */ if ($state == 'dump' || $state == 'add') { /* Start adding to the addition stack. */ $cols[0][] = $content; $state = 'add'; } else { /* This is inside a change block, so start * accumulating lines. */ $state = 'change'; $cols[1][] = $content; } } elseif ($action == '-') { /* This is a removal line. */ $state = 'remove'; $cols[0][] = $content; } else { /* An empty block with no action. */ switch ($state) { case 'add': $data['contents'][] = array('type' => 'add', 'lines' => $cols[0]); break; case 'remove': /* We have some removal lines pending in our * stack, so flush them. */ $data['contents'][] = array('type' => 'remove', 'lines' => $cols[0] ); break; case 'change': /* We have both remove and addition lines, so * this is a change block. */ $data['contents'][] = array('type' => 'change', 'old' => $cols[0], 'new' => $cols[1]); break; } $cols = array(array(), array()); $data['contents'][] = array('type' => 'empty', 'line' => $content); $state = 'dump'; } } } /* Just flush any remaining entries in the columns stack. */ switch ($state) { case 'add': $data['contents'][] = array('type' => 'add', 'lines' => $cols[0]); break; case 'remove': /* We have some removal lines pending in our stack, so * flush them. */ $data['contents'][] = array('type' => 'remove', 'lines' => $cols[0] ); break; case 'change': /* We have both remove and addition lines, so this is a * change block. */ $data['contents'][] = array('type' => 'change', 'old' => $cols[0], 'new' => $cols[1]); break; } if (isset($data)) { $ret[] = $data; } return $ret; } } /** * @package VC */ class VC_File { var $rep; var $dir; var $name; var $logs; var $revs; var $head; var $quicklog; var $symrev; var $revsym; var $branches; function setRepository(&$rep) { $this->rep = &$rep; } } /** * VC revisions class. * * Copyright Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Revision { /** * Validation function to ensure that a revision number is of the * right form. * * @param string $val Value to check. * * @return boolean True if it is a revision number */ function valid($val) { return $val && preg_match('/^[\d\.]+$/' , $val); } /** * Given a revision number, remove a given number of portions from * it. For example, if we remove 2 portions of 1.2.3.4, we are * left with 1.2. * * @param string $val Input revision * @param int $amount Number of portions to strip * * @return string Stripped revision number */ function strip($val, $amount) { if (!VC_Revision::valid($val)) { return false; } $pos = 0; while ($amount-- > 0 && ($pos = strrpos($val, '.')) !== false) { $val = substr($val, 0, $pos); } return $pos !== false ? $val : false; } /** * The size of a revision number is the number of portions it has. * For example, 1,2.3.4 is of size 4. * * @param string $val Revision number to determine size of * * @return int Size of revision number */ function sizeof($val) { if (!VC_Revision::valid($val)) { return false; } return (substr_count($val, '.') + 1); } /** * Given a valid revision number, this will return the revision * number from which it branched. If it cannot be determined, then * false is returned. * * @param string $val Revision number * * @return string|bool Branch point revision, or false */ function branchPoint($val) { /* Check if we have a valid revision number */ if (!VC_Revision::valid($val)) { return false; } /* If its on the trunk, or is an odd size, ret false */ if (VC_Revision::sizeof($val) < 3 || (VC_Revision::sizeof($val) % 2)) { return false; } /* Strip off two revision portions, and return it */ return VC_Revision::strip($val, 2); } /** * Given two SVN revision numbers, this figures out which one is * greater than the other by stepping along the decimal points * until a difference is found, at which point a sign comparison * of the two is returned. * * @param string $rev1 Period delimited revision number * @param string $rev2 Second period delimited revision number * * @return int 1 if the first is greater, -1 if the second if greater, * and 0 if they are equal */ function cmp($rev1, $rev2) { return version_compare($rev1, $rev2); } /** * Return the logical revision before this one. Normally, this * will be the revision minus one, but in the case of a new * branch, we strip off the last two decimal places to return the * original branch point. * * @param string $rev Revision number to decrement * * @return string|bool Revision number, or false if none could be * determined */ function prev($rev) { $last_dot = strrpos($rev, '.'); $val = substr($rev, ++$last_dot); if (--$val > 0) { return substr($rev, 0, $last_dot) . $val; } else { $last_dot--; while (--$last_dot) { if ($rev[$last_dot] == '.') { return substr($rev, 0, $last_dot); } else if ($rev[$last_dot] == null) { return false; } } } } /** * Given a revision number of the form x.y.0.z, this remaps it * into the appropriate branch number, which is x.y.z * * @param string $rev Even-digit revision number of a branch * * @return string Odd-digit Branch number */ function toBranch($rev) { /* Check if we have a valid revision number */ if (!VC_Revision::valid($rev)) { return false; } if (($end = strrpos($rev, '.')) === false) { return false; } $rev[$end] = 0; if (($end2 = strrpos($rev, '.')) === false) { return substr($rev, ++$end); } return substr_replace($rev, '.', $end2, ($end-$end2+1)); } } --- NEW FILE: package.xml --- VC Version Control API LGPL This package provides a generalized API to multiple version control systems.a chagenbu lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org yunosh lead Jan Schneider jan@horde.org 0.0.1 alpha 2003-10-15 Initial VC package. VC.php pcre gettext Horde_Cache Horde_Util From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:02 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VC/VC cvs.php, NONE, 1.1 rcs.php, NONE, 1.1 svn.php, NONE, 1.1 Message-ID: <20051014143317.28A2F102C4F@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC/VC In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/VC/VC Added Files: cvs.php rcs.php svn.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: cvs.php --- * * $Horde: framework/VC/VC/cvs.php,v 1.22 2004/05/28 18:41:21 chuck Exp $ * * @author Anil Madhavapeddy * @version $Revision: 1.1 $ * @package VC */ class VC_cvs extends VC_rcs { /** * Constructor. [...1094 lines suppressed...] 'to' => $revs[1]); } break; } } return true; } /** * Return the fully qualified filename of this object. * * @return string Fully qualified filename of this object */ function getFullPath() { return $this->_dir . '/' . $this->_name; } } --- NEW FILE: rcs.php --- * * $Horde: framework/VC/VC/rcs.php,v 1.2 2004/04/17 15:14:48 jan Exp $ * * @author Jeff Schwentner * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @package VC */ class VC_rcs extends VC { /** * Checks an RCS file in with a specified change log. * * @param string $filepath Location of file to check in. * @param string $message Log of changes since last version. * @param string $user The user name to use for the check in. * @param boolean $newBinary Does the change involve binary data? * * @return string|object The new revision number on success, or a * PEAR_Error object on failure. */ function ci($filepath, $message, $user = null, $newBinary = false) { if ($user) { putenv('LOGNAME=' . $user); } else { putenv('LOGNAME=guest'); } $Q = 'OS_WINDOWS' ? '"' : "'" ; $ci_cmd = $this->getPath('ci') . ' ' . $Q . $filepath . $Q.' 2>&1'; $rcs_cmd = $this->getPath('rcs') . ' -i -kb ' . $Q . $filepath . $Q.' 2>&1'; $output = ''; $message_lines = explode("\n", $message); $pipe_def = array(0 => array("pipe", 'r'), 1 => array("pipe", 'w')); if ($newBinary) { $process = proc_open($rcs_cmd, $pipe_def, $pipes); } else { $process = proc_open($ci_cmd, $pipe_def, $pipes); } if (is_resource($process)) { foreach ($message_lines as $line) { if ($line == '.\n') { $line = '. \n'; } fwrite($pipes[0], $line); } fwrite($pipes[0], "\n.\n"); fclose($pipes[0]); while (!feof($pipes[1])) { $output .= fread($pipes[1], 8192); } fclose($pipes[1]); proc_close($process); } else { return PEAR::raiseError('Failed to open pipe in ci()'); } if ($newBinary) { exec($ci_cmd . ' 2>&1', $return_array, $retval); if ($retval) { return PEAR::raiseError("Unable to spawn ci on $filepath from ci()"); } else { foreach ($return_array as $line) { $output .= $line; } } } $rev_start = strpos($output, 'new revision: '); // If no new revision, see if this is an initial checkin. if ($rev_start === false) { $rev_start = strpos($output, 'initial revision: '); $rev_end = strpos($output, ' ', $rev_start); } else { $rev_end = strpos($output, ';', $rev_start); } if ($rev_start !== false && $rev_end !== false) { $rev_start += 14; return substr($output, $rev_start, $rev_end - $rev_start); } else { unlock($filepath); $temp_pos = strpos($output, 'file is unchanged'); if ($temp_pos !== false) { return PEAR::raiseError('Check-in Failure: ' . basename($filepath) . ' has not been modified'); } else { return PEAR::raiseError("Failed to checkin $filepath, $ci_cmd, $output"); } } } /** * Checks the locks on a CVS/RCS file. * * @param string $filepath Location of file. * @param string &$locked_by Returns the username holding the lock. * * @return bool|object True on success, or a PEAR_Error on failure. */ function isLocked($filepath, &$locked_by) { $rlog_cmd = $this->getPath('rlog'); $rlog_flag = ' -L '; $Q = OS_WINDOWS ? '"' : "'"; $cmd = $rlog_cmd . $rlog_flag . $Q . $filepath . $Q; exec($cmd.' 2>&1', $return_array, $retval); if ($retval) { return PEAR::raiseError("Unable to spawn rlog on $filepath from isLocked()"); } else { $output = ''; foreach ($return_array as $line) { $output .= $line; } $start_name = strpos($output, 'locked by: '); $end_name = strpos($output, ';', $start_name); if ($start_name !== false && $end_name !== false) { $start_name += 11; $locked_by = substr($output, $start_name, $end_name - $start_name); return true; } elseif (strlen($output) == 0) { return false; } else { return PEAR::raiseError('Failure running rlog in isLocked()'); } } } /** * Locks a CVS/RCS file. * * @param string $filepath Location of file. * @param string $user User name to lock the file with * * @return bool|object True on success, or a PEAR_Error on failure. */ function lock($filepath, $user = null) { // Get username for RCS tag. if ($user) { putenv('LOGNAME=' . $user); } else { putenv('LOGNAME=guest'); } $rcs_cmd = $this->getPath('rcs'); $rcs_flag = ' -l '; $Q = OS_WINDOWS ? '"' : "'" ; $cmd = $rcs_cmd . $rcs_flag . $Q . $filepath . $Q; exec($cmd.' 2>&1', $return_array, $retval); if ($retval) { return PEAR::raiseError('Failed to spawn rcs ("' . $cmd . '") on "' . $filepath . '" (returned ' . $retval . ')'); } else { $output = ''; foreach ($return_array as $line) { $output .= $line; } $locked_pos = strpos($output, 'locked'); if ($locked_pos !== false) { return true; } else { return PEAR::raiseError('Failed to lock "' . $filepath . '" (Ran "' . $cmd . '", got return code ' . $retval . ', output: ' . $output . ')'); } } } /** * Unlocks a CVS/RCS file. * * @param string $filepath Location of file. * @param string $user User name to unlock the file with * * @return bool|object True on success, or a PEAR_Error on failure. */ function unlock($filepath, $user = null) { // Get username for RCS tag. if ($user) { putenv('LOGNAME=' . $user); } else { putenv('LOGNAME=guest'); } $rcs_cmd = $this->getPath('rcs'); $rcs_flag = ' -u '; $Q = OS_WINDOWS ? '"' : "'" ; $cmd = $rcs_cmd . $rcs_flag . $Q . $filepath . $Q; exec($cmd . ' 2>&1', $return_array, $retval); if ($retval) { return PEAR::raiseError('Failed to spawn rcs ("' . $cmd . '") on "' . $filepath . '" (returned ' . $retval . ')'); } else { $output = ''; foreach ($return_array as $line) { $output .= $line; } $unlocked_pos = strpos($output, 'unlocked'); if ($unlocked_pos !== false) { return true; } else { // Already unlocked. return true; } } } } --- NEW FILE: svn.php --- * * $Horde: framework/VC/VC/svn.php,v 1.16 2004/05/28 18:51:29 chuck Exp $ * * @author Anil Madhavapeddy * @version $Revision: 1.1 $ * @since Horde 3.0 * @package VC */ class VC_svn extends VC { /** * Constructor. * * @param array $params Any parameter the class expects. * Current parameters: * 'sourceroot': The source root for this * repository * 'paths': Hash with the locations of all * necessary binaries: 'svn', 'diff' */ function VC_svn($params) { $this->_sourceroot = $params['sourceroot']; $this->_paths = $params['paths']; } function isFile($where) { return true; } function &queryDir($where) { return new VC_Directory_svn($this, $where); } function getCheckout($file, $rev) { return VC_Checkout_svn::get($this, $file->queryFullPath(), $rev); } function &getDiff(&$file, $rev1, $rev2, $type = 'context', $num = 3, $ws = true) { return VC_Diff_svn::get($this, $file, $rev1, $rev2, $type, $num, $ws); } function &getFileObject($filename, $cache = null, $quicklog = false) { return VC_File_svn::getFileObject($this, $filename, $cache, $quicklog); } function &getAnnotateObject($filename) { return new VC_Annotate_svn($this, $filename); } function &getPatchsetObject($filename, $cache = null) { return VC_Patchset_svn::getPatchsetObject($this, $filename, $cache); } } /** * VC_svn annotate class. * * Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Annotate_svn { var $file; var $SVN; var $tmpfile; function VC_Annotate_svn(&$rep, $file) { $this->SVN = &$rep; $this->file = &$file; } function doAnnotate($rev) { /* Make sure that the file values for this object is valid */ if (is_a($this->file, 'PEAR_Error')) { return false; } if (!VC_Revision::valid($rev)) { return false; } $pipe = popen($this->SVN->getPath('svn') . ' annotate -r 1:' . $rev . ' ' . $this->file->queryFullPath() . ' 2>&1', 'r'); $lines = array(); $lineno = 1; while (!feof($pipe)) { $line = fgets($pipe, 4096); if (preg_match('/^\s+(\d+)\s+(\w+)\s(.*)$/', $line, $regs)) { $entry = array(); $entry['rev'] = $regs[1]; $entry['author'] = $regs[2]; $entry['date'] = _("Not Implemented"); $entry['line'] = $regs[3]; $entry['lineno'] = $lineno++; $lines[] = $entry; } } pclose($pipe); return $lines; } } /** * VC_svn checkout class. * * Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Checkout_svn { /** * Static function which returns a file pointing to the head of the requested * revision of an RCS file. * @param fullname Fully qualified pathname of the desired RCS file to checkout * @param rev RCS revision number to check out * @return Either a PEAR_Error object, or a stream pointer to the head of the checkout */ function get(&$rep, $fullname, $rev) { if (!VC_Revision::valid($rev)) { return PEAR::raiseError(_("Invalid revision number")); } if (!($RCS = popen($rep->getPath('svn') . ' cat -r ' . $rev . ' ' . $fullname . ' 2>&1', 'r'))) { return PEAR::raiseError(_("Couldn't perform checkout of the requested file")); } return $RCS; } } /** * VC_svn diff class. * * Copyright Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Diff_svn { /** * Obtain the differences between two revisions within a file. * * @param file VC_File_svn object for the desired file * @param rev1 Original revision number to compare from * @param rev2 New revision number to compare against * @param type Constant which indicates the type of diff (e.g. unified) * @param num Number of lines to be used in context and unified diff * @param ws Show whitespace in the diff? * * @return false on failure, or a string containing the diff on success */ function get(&$rep, &$file, $rev1, $rev2, $type, $num, $ws = 'context', $num = 3, $ws = true) { /* Make sure that the file parameter is valid */ if (is_a($file, 'PEAR_Error')) { return false; } /* Check that the revision numbers are valid */ $rev1 = VC_Revision::valid($rev1) ? $rev1 : '0'; $rev2 = VC_Revision::valid($rev1) ? $rev2 : '0'; $fullName = $file->queryFullPath(); $diff = array(); $options = '-kk '; if (!$ws) { $opts = ' -bB '; $options .= $opts; } else { $opts = ''; } switch ($type) { case 'context': $options = $opts . '-p --context=' . $num; break; case 'unified': $options = $opts . '-p --unified=' . $num; break; case 'column': $options = $opts . '--side-by-side --width=120'; break; case 'ed': $options = $opts . '-e'; break; } // TODO: add options for $hr options - however these may not // be compatible with some diffs - avsm $command = $rep->getPath('svn') . " diff --diff-cmd " . $rep->getPath('diff') . " -r $rev1:$rev2 -x '$options' " . $file->queryFullPath() . ' 2>&1'; exec($command, $diff, $retval); return $diff; } } /** * VC_svn directory class. * * Copyright Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Directory_svn { var $rep; var $dirName; var $files; var $atticFiles; var $mergedFiles; var $dirs; var $parent; var $moduleName; /** * Create a SVN Directory object to store information about the * files in a single directory in the repository * * @param object VC_Repository_svn $rp The VC_Repository object this directory is part of. * @param string $dn Path to the directory. * @param object VC_Directory_svn $pn (optional) The parent VC_Directory to this one. */ function VC_Directory_svn(&$rep, $dn, $pn = '') { $this->rep = &$rep; $this->parent = &$pn; $this->moduleName = $dn; $this->dirName = "/$dn"; $this->files = array(); $this->dirs = array(); } /** * Return fully qualified pathname to this directory with no * trailing /. * * @return Pathname of this directory */ function queryDir() { return $this->dirName; } function &queryDirList() { reset($this->dirs); return $this->dirs; } function &queryFileList($showattic = false) { if ($showattic && isset($this->mergedFiles)) { return $this->mergedFiles; } else { return $this->files; } } /** * Tell the object to open and browse its current directory, and * retrieve a list of all the objects in there. It then populates * the file/directory stack and makes it available for retrieval. * * @return PEAR_Error object on an error, 1 on success. */ function browseDir($cache = null, $quicklog = true, $showattic = false) { $cmd = $this->rep->getPath('svn') . ' ls ' . $this->rep->sourceroot() . $this->queryDir() . ' 2>&1'; $dir = popen($cmd, 'r'); /* Create two arrays - one of all the files, and the other of * all the dirs. */ while (!feof($dir)) { $line = fgets($dir, 1024); $name = chop($line); if (strlen($name) != 0) { if (substr($name, -1) == '/') { $this->dirs[] = substr($name, 0, -1); } else { $this->files[] = &$this->rep->getFileObject($this->queryDir() . "/$name", $cache, $quicklog); } } } pclose($dir); return 1; } /** * Sort the contents of the directory in a given fashion and * order. * * @param $how Of the form VC_SORT_* where * can be: * NONE, NAME, AGE, REV for sorting by name, age or revision. * @param $dir Of the form VC_SORT_* where * can be: * ASCENDING, DESCENDING for the order of the sort. */ function applySort($how = VC_SORT_NONE, $dir = VC_SORT_ASCENDING) { /* TODO: this code looks very inefficient! optimise... - * avsm. */ // Assume by name for the moment. natcasesort($this->dirs); $this->doFileSort($this->files, $how, $dir); if (isset($this->atticFiles)) { $this->doFileSort($this->atticFiles, $how, $dir); } if (isset($this->mergedFiles)) { $this->doFileSort($this->mergedFiles, $how, $dir); } if ($dir == VC_SORT_DESCENDING) { $this->dirs = array_reverse($this->dirs); $this->files = array_reverse($this->files); if (isset($this->mergedFiles)) { $this->mergedFiles = array_reverse($this->mergedFiles); } } } function doFileSort(&$fileList, $how = VC_SORT_NONE, $dir = VC_SORT_ASCENDING) { switch ($how) { case VC_SORT_AGE: usort($fileList, array($this, 'fileAgeSort')); break; case VC_SORT_NAME: usort($fileList, array($this, 'fileNameSort')); break; case VC_SORT_AUTHOR: usort($fileList, array($this, 'fileAuthorSort')); break; case VC_SORT_REV: usort($fileList, array($this, 'fileRevSort')); break; case VC_SORT_NONE: default: break; } } /** * Sort function for ascending age. */ function fileAgeSort($a, $b) { $aa = $a->queryLastLog(); $bb = $b->queryLastLog(); if ($aa->queryDate() == $bb->queryDate()) { return 0; } else { return ($aa->queryDate() < $bb->queryDate()) ? 1 : -1; } } /** * Sort function by author name. */ function fileAuthorSort($a, $b) { $aa = $a->queryLastLog(); $bb = $b->queryLastLog(); if ($aa->queryAuthor() == $bb->queryAuthor()) { return 0; } else { return ($aa->queryAuthor() > $bb->queryAuthor()) ? 1 : -1; } } /** * Sort function for ascending filename. */ function fileNameSort($a, $b) { return strcasecmp($a->name, $b->name); } /** * Sort function for ascending revision. */ function fileRevSort($a, $b) { return VC_Revision::cmp($a->queryHead(), $b->queryHead()); } } /** * VC_svn file class. * * Copyright Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_File_svn extends VC_File { /** * Create a repository file object, and give it information about * what its parent directory and repository objects are. * * @param string $fl Full path to this file. */ function VC_File_svn(&$rep, $fl, $quicklog = false) { $this->rep = &$rep; $this->name = basename($fl); $this->dir = dirname($fl); $this->logs = array(); $this->quicklog = $quicklog; $this->revs = array(); $this->revsym = array(); $this->symrev = array(); $this->branches = array(); } function &getFileObject(&$rep, $filename, $cache = null, $quicklog = false) { /** * The version of the cached data. Increment this whenever the * internal storage format changes, such that we must * invalidate prior cached data. * * @var integer $_cacheVersion */ $_cacheVersion = 2; if ($cache) { $cacheId = $filename . '_f' . (int)$quicklog . '_v' . $_cacheVersion; // The file is cached for one hour no matter what, because // there is no way to determine with Subversion the time // the file last changed. $fileOb = unserialize($cache->getData($cacheId, "serialize(VC_File_svn::_getFileObject('$filename', '$quicklog'))", time() - 360)); } else { $fileOb = &VC_File_svn::_getFileObject($filename, $quicklog); } $fileOb->setRepository($rep); if (is_a(($result = $fileOb->getBrowseInfo()), 'PEAR_Error')) { return $result; } return $fileOb; } function &_getFileObject($filename, $quicklog = false) { $fileOb = &new VC_File_svn($rep, $filename, $quicklog); $fileOb->applySort(VC_SORT_AGE); return $fileOb; } /** * If this file is present in an Attic directory, this indicates * it. * * @return true if file is in the Attic, and false otherwise */ function isAtticFile() { // Not implemented yet return false; } /** * Returns the name of the current file as in the repository * * @return Filename (without the path) */ function queryRepositoryName() { return $this->name; } /** * Returns name of the current file without the repository * extensions (usually ,v) * * @return Filename without repository extension */ function queryName() { return preg_replace('/,v$/', '', $this->name); } /** * Return the last revision of the current file on the HEAD branch * * @return Last revision of the current file */ function queryRevision() { if (!isset($this->revs[0])) { return PEAR::raiseError(_("No revisions")); } return $this->revs[0]; } function queryPreviousRevision($rev) { $last = false; foreach ($this->revs as $entry) { if ($last) return $entry; if ($entry == $rev) $last = true; } return false; } /** * Return the HEAD (most recent) revision number for this file. * * @return HEAD revision number */ function queryHead() { return $this->queryRevision(); } /** * Return the last VC_Log object in the file. * * @return VC_Log of the last entry in the file */ function queryLastLog() { if (!isset($this->revs[0]) || !isset($this->logs[$this->revs[0]])) { return PEAR::raiseError(_("No revisions")); } return $this->logs[$this->revs[0]]; } /** * Sort the list of VC_Log objects that this file contains. * * @param how VC_SORT_REV (sort by revision), * VC_SORT_NAME (sort by author name), * VC_SORT_AGE (sort by commit date) */ function applySort($how = VC_SORT_REV) { switch ($how) { case VC_SORT_REV: $func = 'Revision'; break; case VC_SORT_NAME: $func = 'Name'; break; case VC_SORT_AGE: $func = 'Age'; break; default: $func = 'Revision'; } uasort($this->logs, array($this, "sortBy$func")); return true; } /** * The sortBy*() functions are internally used by applySort. */ function sortByRevision($a, $b) { return VC_Revision::cmp($b->rev, $a->rev); } function sortByAge($a, $b) { return $b->date - $a->date; } function sortByName($a, $b) { return strcmp($a->author, $b->author); } /** * Populate the object with information about the revisions logs * and dates of the file. * * @return PEAR_Error object on error, or true on success */ function getBrowseInfo() { /* XXX: $flag = ($this->quicklog ? '-r HEAD ' : ''; */ $flag = ''; $cmd = $this->rep->getPath('svn') . ' log -v ' . $flag . $this->queryFullPath() . ' 2>&1'; $pipe = popen($cmd, 'r'); fgets($pipe); while (!feof($pipe)) { $log = &new VC_Log_svn($this->rep, $this); $err = $log->processLog($pipe); if ($err) { $rev = $log->queryRevision(); $this->logs[$rev] = $log; $this->revs[] = $rev; } if ($this->quicklog) { break; } } pclose($pipe); return true; } /** * Return the fully qualified filename of this object. * * @return Fully qualified filename of this object */ function queryFullPath() { return $this->rep->sourceroot() . '/' . $this->queryModulePath(); } /** * Return the name of this file relative to its sourceroot. * * @return string Pathname relative to the sourceroot. */ function queryModulePath() { return $this->dir . '/' . $this->name; } } /** * VC_svn log class. * * Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Log_svn { var $rep, $file, $files, $tags, $rev, $date, $log, $author, $state, $lines, $branches; /** * */ function VC_Log_svn($rep, &$fl) { $this->rep = $rep; $this->file = &$fl; $this->branches = array(); } function processLog($pipe) { $line = fgets($pipe); if (feof($pipe)) { return false; } preg_match('/^r([0-9]*) \| ([^ ]*) \| (.*) \(.*\) \| ([0-9]*) lines?$/', $line, $matches); $this->rev = $matches[1]; $this->author = $matches[2]; $this->date = strtotime($matches[3]); $size = $matches[4]; fgets($pipe); $this->files = array(); while (($line = trim(fgets($pipe))) != '') { $this->files[] = $line; } for ($i = 0; $i != $size; ++$i) { $this->log = $this->log . chop(fgets($pipe)) . "\n"; } $this->log = chop($this->log); fgets($pipe); return true; } function queryDate() { return $this->date; } function queryRevision() { return $this->rev; } function queryAuthor() { return $this->author; } function queryLog() { return $this->log; } function queryChangedLines() { return isset($this->lines) ? ($this->lines) : ''; } /** * Given a branch revision number, this function remaps it * accordingly, and performs a lookup on the file object to * return the symbolic name(s) of that branch in the tree. * * @return hash of symbolic names => branch numbers */ function querySymbolicBranches() { $symBranches = array(); foreach ($this->branches as $branch) { $parts = explode('.', $branch); $last = array_pop($parts); $parts[] = '0'; $parts[] = $last; $rev = implode('.', $parts); if (isset($this->file->branches[$branch])) { $symBranches[$this->file->branches[$branch]] = $branch; } } return $symBranches; } } /** * VC_svn Patchset class. * * Copyright Anil Madhavapeddy, * * @author Anil Madhavapeddy * @package VC */ class VC_Patchset_svn { var $_rep; var $_file; var $_patchsets = array(); /** * Create a patchset object. * * @param string $file The filename to get patchsets for. */ function VC_Patchset_svn($file) { $this->_file = $file; } function &getPatchsetObject(&$rep, $filename, $cache = null) { /** * The version of the cached data. Increment this whenever the * internal storage format changes, such that we must * invalidate prior cached data. * * @var integer $_cacheVersion */ $_cacheVersion = 1; if ($cache) { $cacheId = $filename . '_f_v' . $_cacheVersion; // The file is cached for one hour no matter what, because there // is no way to determine with svn the time the file last changed. $psOb = unserialize($cache->getData($cacheId, "serialize(VC_Patchset_svn::_getPatchsetObject('$filename'))", time() - 360)); } else { $psOb = &VC_Patchset_svn::_getPatchsetObject($filename); } $psOb->_rep = &$rep; if (is_a(($result = $psOb->getPatchsets($rep)), 'PEAR_Error')) { return $result; } return $psOb; } function &_getPatchsetObject($filename) { return new VC_Patchset_svn($filename); } /** * Populate the object with information about the patchsets that * this file is involved in. * * @param string $repository The full repository location. * * @return mixed PEAR_Error object on error, or true on success. */ function getPatchsets($repository) { $fileOb = &new VC_File_svn($this->_rep, $this->_file); if (is_a(($result = $fileOb->getBrowseInfo()), 'PEAR_Error')) { return $result; } $this->_patchsets = array(); foreach ($fileOb->logs as $rev => $log) { $this->_patchsets[$rev] = array(); $this->_patchsets[$rev]['date'] = $log->queryDate(); $this->_patchsets[$rev]['author'] = $log->queryAuthor(); $this->_patchsets[$rev]['branch'] = ''; $this->_patchsets[$rev]['tag'] = ''; $this->_patchsets[$rev]['log'] = $log->queryLog(); $this->_patchsets[$rev]['members'] = array(); foreach ($log->files as $file) { $action = substr($file, 0, 1); $file = preg_replace('/.*?\s(.*?)(\s|$).*/', '\\1', $file); $to = $rev; if ($action == 'A') { $from = 'INITIAL'; } elseif ($action == 'D') { $from = $to; $to = '(DEAD)'; } else { // This technically isn't the previous revision, // but it works for diffing purposes. $from = $to - 1; } $this->_patchsets[$rev]['members'][] = array('file' => $file, 'from' => $from, 'to' => $to); } } return true; } } From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:04 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VC/docs TODO, NONE, 1.1 Message-ID: <20051014143317.2F470102CA5@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VC/docs In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/VC/docs Added Files: TODO Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: TODO --- From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:05 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VFS/scripts vfs.php, NONE, 1.1 Message-ID: <20051014143317.76135102C51@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS/scripts In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/VFS/scripts Added Files: vfs.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: vfs.php --- #!/usr/local/bin/php getMessage()); } array_shift($argv); $options = Console_Getopt::getopt2($argv, '', array()); if (is_a($options, 'PEAR_Error')) { usage($options->getMessage()); } /* Show help? */ if (!count($options[1]) || in_array('help', $options[1])) { usage(); } /* Get and execute the command. */ $command = array_shift($options[1]); switch ($command) { case 'ls': if (!count($options[1])) { usage($command); } $params = Console_Getopt::getopt2($options[1], 'alR'); if (is_a($params, 'PEAR_Error')) { usage($params->getMessage()); } $path = array_shift($params[1]); ls($path, mergeOptions($params[0]), $params[1]); } /** * Lists the contents of the specified directory. * * @param string $url The URL of the VFS backend * @param array $argv Additional options * @param string $filter Additional parameters */ function ls($url, $argv, $filter) { $params = url2params($url); $recursive = in_array('R', $argv); $vfs = &vfs($params); $list = $vfs->listFolder($params['path'], count($filter) ? $filter[0] : null, in_array('a', $argv)); if (is_a($list, 'PEAR_Error')) { usage($list); } $list = array_keys($list); $max = array_map(create_function('$a', 'return strlen($a);'), $list); $max = array_reduce($max, create_function('$a, $b', 'return max($a, $b);')); $max += 2; $line = ''; $dirs = array(); if ($recursive) { echo $params['path'] . ":\n"; } foreach ($list as $entry) { if ($vfs->isFolder($params['path'], $entry)) { $dirs[] = $entry; } $entry = sprintf('%-' . $max . 's', $entry); if (strlen($line . $entry) > 80 && !empty($line)) { echo $line . "\n"; $line = ''; } $line .= $entry; } if (!empty($line)) { echo $line . "\n"; } if ($recursive && count($dirs)) { foreach ($dirs as $dir) { echo "\n"; ls($url . '/' . $dir, $argv, $filter); } } } /** * Shows some error and usage information. * * @param object PEAR_Error $error If specified its error messages will be * displayed. */ function usage($error = null) { if (is_a($error, 'PEAR_Error')) { echo $error->getMessage() . "\n"; echo $error->getUserinfo() . "\n\n"; } echo << USAGE; exit; } /** * Returns a VFS instance. * * @param array $params A complete parameter set including the driver name * for the requested VFS instance. * * @return object VFS An instance of the requested VFS backend. */ function &vfs($params) { return VFS::factory($params['driver'], $params); } /** * Merges a set of options as returned by Console_Getopt::getopt2() into a * single array. * * @param array $options A two dimensional array with the options. * * @return array A flat array with the options. */ function mergeOptions($options) { $result = array(); foreach ($options as $param) { $result = array_merge($result, $param); } return $result; } /** * Parses a URL into a set of parameters that can be used to instantiate a * VFS object. * * @todo Document the possible URL formats. * * @param string $url A URL with all necessary information for a VFS driver. * * @return array A hash with the parsed information. */ function url2params($url) { $params = array(); $params['path'] = ''; $dsn = @DB::parseDSN($url); if ($dsn['phptype'] == 'ftp' || $dsn['phptype'] == 'file') { $url = @parse_url($url); if (!is_array($url)) { usage(PEAR::raiseError($php_errormsg)); } $params['driver'] = $url['scheme']; if (isset($url['host'])) { $params['hostspec'] = $url['host']; } if (isset($url['port'])) { $params['port'] = $url['port']; } if (isset($url['user'])) { $params['username'] = $url['user']; } if (isset($url['pass'])) { $params['password'] = $url['pass']; } if (isset($url['path'])) { $params['path'] = $url['path']; } if (isset($url['query'])) { $queries = explode('&', $url['query']); foreach ($queries as $query) { $pair = explode('=', $query); $params[$pair[0]] = isset($pair[1]) ? $pair[1] : true; } } } else { if (!isset($dsn['driver'])) { usage(PEAR::raiseError('If using one of the SQL drivers (sql, sql_file, musql), you have to specify the driver as parameter of the URL.')); } $params = array_merge($params, $dsn); } return $params; } From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:07 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/VFS VFS.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143317.5542B102CA6@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/VFS In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/VFS Added Files: VFS.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: VFS.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @package VFS * @since Horde 2.2 */ class VFS { /** * Hash containing connection parameters. * * @var array $_params */ var $_params = array(); /** * List of additional credentials required for this VFS backend * (example: For FTP, we need a username and password to log in to * the server with). * * @var array $_credentials */ var $_credentials = array(); /** * List of permissions and if they can be changed in this VFS * backend. * * @var array $_permissions */ var $_permissions = array( 'owner' => array('read' => false, 'write' => false, 'execute' => false), 'group' => array('read' => false, 'write' => false, 'execute' => false), 'all' => array('read' => false, 'write' => false, 'execute' => false)); /** * Constructs a new VFS object. * * @access public * * @param optional array $params A hash containing connection parameters. */ function VFS($params = array()) { if (empty($params['user'])) { $params['user'] = ''; } $this->_params = $params; } /** * Check the credentials that we have by calling _connect(), to * see if there is a valid login. * * @access public * * @return mixed True on success, PEAR_Error describing the problem * if the credentials are invalid. */ function checkCredentials() { return $this->_connect(); } /** * Set configuration parameters. * * @access public * * @param optional array $params An associative array: * KEY: param name, VAL: param value */ function setParams($params = array()) { foreach ($params as $name => $value) { $this->_params[$name] = $value; } } /** * Retrieve a file from the VFS. * * @access public * * @param string $path The pathname to the file. * @param string $name The filename to retrieve. * * @return string The file data. * * @abstract */ function read($path, $name) { return PEAR::raiseError(_("Not supported.")); } /** * Store a file in the VFS. * * @access public * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $tmpFile The temporary file containing the * data to be stored. * @param optional boolean $autocreate Automatically create directories? * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function write($path, $name, $tmpFile, $autocreate = false) { return PEAR::raiseError(_("Not supported.")); } /** * Moves a file through the backend. * * @access public * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function move($path, $name, $dest) { return PEAR::raiseError(_("Not supported.")); } /** * Copies a file through the backend. * * @access public * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $dest The destination of the file. * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function copy($path, $name, $dest) { return PEAR::raiseError(_("Not supported.")); } /** * Store a file in the VFS from raw data. * * @access public * * @param string $path The path to store the file in. * @param string $name The filename to use. * @param string $data The file data. * @param optional boolean $autocreate Automatically create directories? * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function writeData($path, $name, $data, $autocreate = false) { return PEAR::raiseError(_("Not supported.")); } /** * Delete a file from the VFS. * * @access public * * @param string $path The path to store the file in. * @param string $name The filename to use. * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function deleteFile($path, $name) { return PEAR::raiseError(_("Not supported.")); } /** * Rename a file in the VFS. * * @access public * * @param string $oldpath The old path to the file. * @param string $oldname The old filename. * @param string $newpath The new path of the file. * @param string $newname The new filename. * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function rename($oldpath, $oldname, $newpath, $newname) { return PEAR::raiseError(_("Not supported.")); } /** * Check if a given file/folder exists in a folder. * * @access public * * @param string $path The path to the folder. * @param string $name The file/folder name. * * @return boolean True if it exists, false otherwise. */ function exists($path, $name) { $list = $this->listFolder($path); return isset($list[$name]); } /** * Create a folder in the VFS. * * @access public * * @param string $path The path to the folder. * @param string $name The name of the new folder. * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function createFolder($path, $name) { return PEAR::raiseError(_("Not supported.")); } /** * Automatically create any necessary parent directories in the * specified $path. * * @access public * * @param string $path The VFS path to autocreate. */ function autocreatePath($path) { $dirs = explode('/', $path); if (is_array($dirs)) { $cur = ''; foreach ($dirs as $dir) { if (!$this->isFolder($cur, $dir)) { $result = $this->createFolder($cur, $dir); if (is_a($result, 'PEAR_Error')) { return $result; } } if (!empty($cur)) { $cur .= '/'; } $cur .= $dir; } } return true; } /** * Check if a given pathname is a folder. * * @access public * * @param string $path The path to the folder. * @param string $name The file/folder name. * * @return boolean True if it is a folder, false otherwise. */ function isFolder($path, $name) { $folderList = $this->listFolder($path, null, true, true); return isset($folderList[$name]); } /** * Deletes a folder from the VFS. * * @access public * * @param string $path The path of the folder to delete. * @param string $name The name of the folder to delete. * @param optional boolean $recursive Force a recursive delete? * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function deleteFolder($path, $name, $recursive = false) { return PEAR::raiseError(_("Not supported.")); } /** * Removes recursively all files and subfolders from the given folder. * * @access public * * @param string $path The path of the folder to empty. * * @return mixed True on success or a PEAR_Error object on failure. */ function emptyFolder($path) { // Get and delete the subfolders. $list = $this->listFolder($path, null, true, true); if (is_a($list, 'PEAR_Error')) { return $list; } foreach ($list as $folder) { $result = $this->deleteFolder($path, $folder['name'], true); if (is_a($result, 'PEAR_Error')) { return $result; } } // Only files are left, get and delete them. $list = $this->listFolder($path); if (is_a($list, 'PEAR_Error')) { return $list; } foreach ($list as $file) { $result = $this->deleteFile($path, $file['name']); if (is_a($result, 'PEAR_Error')) { return $result; } } } /** * Returns a file list of the directory passed in. * * @access public * * @param string $path The path of the directory. * @param optional mixed $filter String/hash to filter file/dirname * on. * @param optional boolean $dotfiles Show dotfiles? * @param optional boolean $dironly Show only directories? * * @return array File list on success. * Returns PEAR_Error on failure. * * @abstract */ function listFolder($path, $filter = null, $dotfiles = true, $dironly = false) { return PEAR::raiseError(_("Not supported.")); } /** * Returns the current working directory of the VFS backend. * * @access public * * @return string The current working directory. */ function getCurrentDirectory() { return ''; } /** * Returns a boolean indicating whether or not the filename * matches any filter element. * * @access private * * @param mixed $filter String/hash to build the regular expression * from. * @param string $filename String containing the filename to match. * * @return boolean True on match, false on no match. */ function _filterMatch($filter, $filename) { $namefilter = null; // Build a regexp based on $filter. if ($filter !== null) { $namefilter = '/'; if (is_array($filter)) { $once = false; foreach ($filter as $item) { if ($once !== true) { $namefilter .= '('; $once = true; } else { $namefilter .= '|('; } $namefilter .= $item . ')'; } } else { $namefilter .= '(' . $filter . ')'; } $namefilter .= '/'; } $match = false; if ($namefilter !== null) { $match = preg_match($namefilter, $filename); } return $match; } /** * Changes permissions for an Item on the VFS. * * @access public * * @param string $path Holds the path of directory of the Item. * @param string $name Holds the name of the Item. * * @return mixed True on success or a PEAR_Error object on failure. * * @abstract */ function changePermissions($path, $name, $permission) { return PEAR::raiseError(_("Not supported.")); } /** * Returns a sorted list of folders in specified directory. * * @access public * * @param optional string $path The path of the directory to get * the directory list for. * @param optional mixed $filter Hash of items to filter based on * folderlist. * @param optional boolean $dotfolders Include dotfolders? * * @return mixed Folder list on success or a PEAR_Error object on failure. * * @abstract */ function listFolders($path = '', $filter = null, $dotfolders = true) { return PEAR::raiseError(_("Not supported.")); } /** * Return the list of additional credentials required, if any. * * @access public * * @return array Credential list. */ function getRequiredCredentials() { return array_diff($this->_credentials, array_keys($this->_params)); } /** * Return the array specificying what permissions are * changeable for this implementation. * * @access public * * @return array Changeable permisions. */ function getModifiablePermissions() { return $this->_permissions; } /** * Close any resources that need to be closed. * * @access private */ function _disconnect() { } /** * Converts a string to all lowercase characters ignoring the * current locale. * * @access public * * @param string $string The string to be lowercased * * @return string The string with lowercase characters */ function strtolower($string) { $language = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'en'); $string = strtolower($string); setlocale(LC_CTYPE, $language); return $string; } /** * Returns the character (not byte) length of a string. * * @access public * * @param string $string The string to return the length of. * @param string $charset The charset to use when calculating the * string's length. * * @return string The string's length. */ function strlen($string, $charset = null) { if (extension_loaded('mbstring')) { if (is_null($charset)) { $charset = 'ISO-8859-1'; } $ret = @mb_strlen($string, $charset); if (!empty($ret)) { return $ret; } } return strlen($string); } /** * Attempts to return a concrete VFS instance based on $driver. * * @access public * * @param mixed $driver The type of concrete VFS subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object VFS The newly created concrete VFS instance, * or a PEAR_Error on an error. */ function &factory($driver, $params = array()) { include_once 'VFS/' . $driver . '.php'; $class = 'VFS_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError(sprintf(_("Class definition of %s not found."), $class)); } } /** * Attempts to return a reference to a concrete VFS instance * based on $driver. It will only create a new instance if no * VFS instance with the same parameters currently exists. * * This should be used if multiple types of file backends (and, * thus, multiple VFS instances) are required. * * This method must be invoked as: $var = &VFS::singleton() * * @access public * * @param mixed $driver The type of concrete VFS subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object VFS The concrete VFS reference, or a PEAR_Error on an * error. */ function &singleton($driver, $params = array()) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &VFS::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- VFS Virtual File System API This package provides a Virtual File System API, with backends for: * SQL * FTP * Local filesystems * Hybrid SQL and filesystem ... and more planned. Reading/writing/listing of files are all supported, and there are both object-based and array-based interfaces to directory listings. LGPL chagenbu lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org yunosh lead Jan Schneider jan@horde.org jellybob developer Jon Wood jon@jellybob.co.uk 0.0.6 beta 2003-99-99 * Add a CLI script for accessing and modifying VFS backends. * Added the getCurrentDirectory() function. * phpdoc has been updated and should now generate correctly in all files. * Return error if trying to copy a file onto itself with the file driver (http://bugs.horde.org/details.php?id=168). gettext 0.0.1 alpha 2002-09-24 Initial release as a PEAR package 0.0.2 alpha 2002-10-22 Added an ObjectVFS wrapper class, returns a ListItem on each call to listFolder, until no items are left. 0.0.3 beta 2003-07-03 Added a class for providing garbage collection; removed all Horde dependancies. 0.0.4 beta 2003-09-09 * Default ftp driver to port 21. * Distinguish between connection and authentication errors in the ftp driver. * Clean up temporary files if the FTP driver wasn't able to retrieve a file. * Add exists() method. * Add emptyFolder() method. * Add $recursive parameter to all deleteFolder() implementations. * Add FTPS support. 0.0.5 beta 2003-99-99 * Fix typo that prevented the sql_file driver to load its parameters. * PHP 5 compatibility fixes. * Add 'pasv' parameter for FTP driver. * Add writeData() method to sql_file driver. * Support ~/path when a 'home' parameter is defined. From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:09 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_RAX RAX.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143317.9AFB2102CA7@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_RAX In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/XML_RAX Added Files: RAX.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: RAX.php --- _opened) { return false; } $this->_xml = $xml; $this->_opened = true; } function openfile($filename) { if ($this->_opened) { return false; } $fp = fopen($filename, 'r'); if ($fp) { $this->_xmlFp = $fp; $this->_opened = true; return true; } return false; } function parse() { if (!$this->_opened) { return false; } if ($this->_finished) { return false; } if (!$this->_initialized) { if (!$this->_init()) { return false; } } if ($this->_xmlFp) { $buffer = fread($this->_xmlFp, 4096); if ($buffer) { xml_parse($this->_parser, $buffer, feof($this->_xmlFp)); } else { $this->_finished = true; } } else { xml_parse($this->_parser, $this->_xml, 1); $this->_finished = true; } return true; } function setRecord($record) { if ($this->_initialized) { return false; } $this->_record = $record; return true; } function readRecord() { while (!count($this->_records) && !$this->_finished) { $this->parse(); } return array_shift($this->_records); } function _init() { $this->_parser = xml_parser_create(); xml_set_object($this->_parser, $this); xml_set_element_handler($this->_parser, '_start', '_end'); xml_set_character_data_handler($this->_parser, '_data'); xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, 0); if (xml_parse($this->_parser, '')) { $this->_initialized = true; return true; } return false; } function _start($parser, $name, $attrs) { array_push($this->_tags, $name); if (!$this->_inRecord && !strcmp($name, $this->_record)) { $this->_inRecord = 1; $this->_rec_lvl = count($this->_tags); $this->_field_lvl = $this->_rec_lvl + 1; } elseif ($this->_inRecord && count($this->_tags) == $this->_field_lvl) { $this->_inField = 1; } } function _end($parser, $name) { array_pop($this->_tags); if ($this->_inRecord) { if (count($this->_tags) < $this->_rec_lvl) { $this->_inRecord = 0; array_push($this->_records, new XML_RAX_Record($this->_fields)); $this->_fields = array(); } elseif (count($this->_tags) < $this->_field_lvl) { $this->_inField = 0; $this->_fields[$name] = $this->_fieldData; $this->_fieldData = ''; } } } function _data($parser, $data) { if ($this->_inField) { $this->_fieldData .= $data; } } } class XML_RAX_Record { var $_fields; function XML_RAX_Record($fields) { $this->_fields = $fields; } function getFieldnames() { return array_keys($this->_fields); } function getField($field) { return isset($this->_fields[$field]) ? trim($this->_fields[$field]) : null; } function getFields() { return array_values($this->_fields); } function getRow() { return $this->_fields; } } --- NEW FILE: package.xml --- XML_RAX Record-oriented API for XML Record-oriented API for XMLRecord-oriented API for XML LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2004-01-19 Initial Release. 0.0.1 alpha 2004-01-19 Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:10 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF/fonts courier.php, NONE, 1.1 helvetica.php, NONE, 1.1 helveticab.php, NONE, 1.1 helveticabi.php, NONE, 1.1 helveticai.php, NONE, 1.1 symbol.php, NONE, 1.1 times.php, NONE, 1.1 timesb.php, NONE, 1.1 timesbi.php, NONE, 1.1 timesi.php, NONE, 1.1 zapfdingbats.php, NONE, 1.1 Message-ID: <20051014143306.80990102C26@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF/fonts In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/File_PDF/PDF/fonts Added Files: courier.php helvetica.php helveticab.php helveticabi.php helveticai.php symbol.php times.php timesb.php timesbi.php timesi.php zapfdingbats.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: courier.php --- 278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); --- NEW FILE: helveticab.php --- 278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); --- NEW FILE: helveticabi.php --- 278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); --- NEW FILE: helveticai.php --- 278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); --- NEW FILE: symbol.php --- 250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); --- NEW FILE: times.php --- 250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); --- NEW FILE: timesb.php --- 250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); --- NEW FILE: timesbi.php --- 250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); --- NEW FILE: timesi.php --- 250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); --- NEW FILE: zapfdingbats.php --- 0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); From cvs at intevation.de Fri Oct 14 16:33:06 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:13 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Editor Editor.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143306.67C53102BDA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Editor In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Editor Added Files: Editor.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Editor.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Nuno Loureiro * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Editor */ class Horde_Editor { /** * Attempts to return a concrete Horde_Editor instance based on * $driver. * * @access public * * @param mixed $driver The type of concrete Horde_Editor subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. If $driver is an * array, then we will look in * $driver[0]/lib/Driver/ for the subclass * implementation named $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @return object Horde_Editor The newly created concrete Horde_Editor instance, * or false on error. */ function &factory($driver, $params = null) { if (is_array($driver)) { $app = $driver[0]; $driver = $driver[1]; } $driver = basename($driver); if (empty($driver) || $driver == 'none') { return $ret = &new Horde_Editor($params); } if (is_null($params) && class_exists('Horde')) { $params = Horde::getDriverConfig('editor', $driver); } if (!empty($app)) { global $registry; require_once $registry->getParam('fileroot', $app) . '/lib/Editor/' . $driver . '.php'; } elseif (@file_exists(dirname(__FILE__) . '/Editor/' . $driver . '.php')) { require_once dirname(__FILE__) . '/Editor/' . $driver . '.php'; } else { @include_once 'Horde/Editor/' . $driver . '.php'; } $class = 'Horde_Editor_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { return PEAR::raiseError('Class definition of ' . $class . ' not found.'); } } /** * Attempts to return a reference to a concrete Horde_Editor * instance based on $driver. It will only create a new instance * if no Horde_Editor instance with the same parameters currently * exists. * * This should be used if multiple cache backends (and, thus, * multiple Horde_Editor instances) are required. * * This method must be invoked as: * $var = &Horde_Editor::singleton() * * @access public * * @param mixed $driver The type of concrete Horde_Editor subclass to * return. This is based on the storage * driver ($driver). The code is * dynamically included. If $driver is an * array, then we will look in * $driver[0]/lib/Editor/ for the subclass * implementation named $driver[1].php. * @param optional array $params A hash containing any additional * configuration or connection parameters a * subclass might need. * * @since Horde 2.2 * * @return object Horde_Editor The concrete Horde_Editor reference, * or false on error. */ function &singleton($driver, $params = null) { static $instances; if (!isset($instances)) { $instances = array(); } if (is_null($params) && class_exists('Horde')) { $params = Horde::getDriverConfig('cache', $driver); } $signature = serialize(array($driver, $params)); if (!array_key_exists($signature, $instances)) { $instances[$signature] = &Horde_Editor::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Horde_Editor Horde Editor API TODO LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2004-02-11 Initial packaging Horde_Util 0.0.1 2004-02-11 alpha Initial packaging From cvs at intevation.de Fri Oct 14 16:33:07 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:15 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Image/Image Decorator.php, NONE, 1.1 gd.php, NONE, 1.1 im.php, NONE, 1.1 png.php, NONE, 1.1 rgb.php, NONE, 1.1 svg.php, NONE, 1.1 swf.php, NONE, 1.1 Message-ID: <20051014143307.95512102C57@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Image/Image In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Image/Image Added Files: Decorator.php gd.php im.php png.php rgb.php svg.php swf.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Decorator.php --- * @package Horde_Image */ class Horde_Image_Decorator { /** * Decorator parameters. * * @var array $_params */ var $_params = array(); /** * Decorator constructor. * * @param array $params (optional) Any parameters for the decoration. * Parameters are documented in each subclass. */ function Horde_Image_Decorator($params = array()) { foreach ($params as $key => $val) { $this->_params[$key] = $val; } } } --- NEW FILE: gd.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Image */ class Horde_Image_gd extends Horde_Image { /** * Capabilites of this driver. * @var array $_capabilities */ var $_capabilities = array('resize', 'crop', 'rotate', 'flip', 'mirror', 'grayscale', 'sepia', 'yellowize', 'watermark', 'canvas', ); /** * What kind of images should GD generate? Defaults to 'png'. * @var string $_type */ var $_type = 'png'; /** * GD Image resource for the current image data. * @var resource $_im */ var $_im; /** * String identifier of the current image. New image data will not * be loaded if the same id is already loaded. * @var string $_id */ var $_id = ''; function Horde_Image_gd($params) { parent::Horde_Image($params); if (!empty($params['type'])) { $this->_type = $params['type']; } if (!empty($params['width'])) { $this->_im = @imageCreateTrueColor($this->_width, $this->_height); if (!is_resource($this->_im)) { $this->_im = imageCreate($this->_width, $this->_height); } imageFill($this->_im, 0, 0, $this->allocateColor($this->_background)); } } function getContentType() { return 'image/' . $this->_type; } /** * Display the current image. */ function display() { $this->headers(); $function = 'image' . $this->_type; $function($this->_im); } /** * Return the raw data for this image. * * @return string The raw image data. */ function raw() { return Util::bufferOutput('image' . $this->_type, $this->_im); } /** * Reset the image data. */ function reset() { parent::reset(); @imageDestroy($this->_im); } /** * Get the height and width of the current image. * * @return array An hash with 'width' containing the width, * 'height' containing the height of the image. */ function getDimensions() { if ($this->_im) { return array('width' => imageSX($this->_im), 'height' => imageSY($this->_im)); } else { return array('width' => 0, 'height' => 0); } } /** * Creates a color that can be accessed in this object. When a * color is set, the integer resource of it is returned. * * @param string $name The name of the color. * * @return integer The resource of the color that can be passed to GD. */ function allocateColor($name) { static $colors = array(); if (empty($colors[$name])) { list($r, $g, $b) = $this->getRGB($name); $colors[$name] = imageColorAllocate($this->_im, $r, $g, $b); } return $colors[$name]; } function getFont($font) { switch ($font) { case 'tiny': return 1; case 'medium': return 3; case 'large': return 4; case 'giant': return 5; case 'small': default: return 2; } } /** * Load the image data from a string. * * @access public * * @params string $id An arbitrary id for the image. * @params string $image_data The data to use for the image. */ function loadString($id, $image_data) { if ($id != $this->_id) { if ($this->_im) { $this->reset(); } $this->_im = @imageCreateFromString($image_data); $this->_id = $id; } } /** * Load the image data from a file. * * @access public * * @params string $filename The full path and filename to the file to load * the image data from. The filename will also be * used for the image id. * * @return mixed PEAR Error if file does not exist or could not be loaded * otherwise NULL if successful or already loaded. */ function loadFile($filename) { $this->reset(); $info = getimagesize($filename); if (is_array($info)) { switch ($info[2]) { case 1: if (function_exists('imagecreatefromgif')) { $this->_im = @imagecreatefromgif($filename); } break; case 2: $this->_im = @imagecreatefromjpeg($filename); break; case 3: $this->_im = @imagecreatefrompng($filename); break; case 15: if (function_exists('imagecreatefromgwbmp')) { $this->_im = @imagecreatefromgwbmp($filename); } break; case 16: $this->_im = @imagecreatefromxbm($filename); break; } } if (is_resource($this->_im)) { return; } $result = parent::loadFile($filename); if (is_a($result, 'PEAR_Error')) { return $result; } $this->_im = @imageCreateFromString($this->_data); } /** * Resize the current image. * * @param integer $width The new width. * @param integer $height The new height. * @param boolean $ratio Maintain original aspect ratio. */ function resize($width, $height, $ratio = true) { /* Abort if we're asked to divide by zero, or truncate the * image completely in either direction. */ if (!$width || !$height) { return; } if ($ratio) { if ($width / $height > imageSX($this->_im) / imageSY($this->_im)) { $width = $height * imageSX($this->_im) / imageSY($this->_im); } else { $height = $width * imageSY($this->_im) / imageSX($this->_im); } } $im = $this->_im; $this->_im = @imageCreateTrueColor($width, $height); if (!is_resource($this->_im)) { $this->_im = imageCreate($width, $height); } imageFill($this->_im, 0, 0, imageColorAllocate($this->_im, 255, 255, 255)); if (!@imageCopyResampled($this->_im, $im, 0, 0, 0, 0, $width, $height, imageSX($im), imageSY($im))) { imageCopyResized($this->_im, $im, 0, 0, 0, 0, $width, $height, imageSX($im), imageSY($im)); } } /** * Crop the current image. * * @param integer $x1 The top left corner of the cropped image. * @param integer $y1 The top right corner of the cropped image. * @param integer $x2 The bottom left corner of the cropped image. * @param integer $y2 The bottom right corner of the cropped image. */ function crop($x1, $y1, $x2, $y2) { $im = $this->_im; $this->_im = @imageCreateTrueColor($x2 - $x1, $y2 - $y1); if (!is_resource($this->_im)) { $this->_im = imageCreate($x2 - $x1, $y2 - $y1); } imageCopy($this->_im, $im, 0, 0, $x1, $y1, $x2 - $x1, $y2 - $y1); } /** * Rotate the current image. * * @param integer $angle The angle to rotate the image by, * in the clockwise direction * @param integer $background The background color to fill any triangles */ function rotate($angle, $background = 'white') { if (!function_exists('imagerotate')) { return; } $background = $this->allocateColor($background); switch ($angle) { case '90': $x = imageSX($this->_im); $y = imageSY($this->_im); $xymax = max($x, $y); $im = @imageCreateTrueColor($xymax, $xymax); if (!is_resource($im)) { $im = imageCreate($xymax, $xymax); } imageCopy($im, $this->_im, 0, 0, 0, 0, $x, $y); $im = imageRotate($im, 270, $background); $this->_im = $im; $im = @imageCreateTrueColor($y, $x); if (!is_resource($im)) { $im = imageCreate($y, $x); } if ($x < $y) { imageCopy($im, $this->_im, 0, 0, 0, 0, $xymax, $xymax); } elseif ($x > $y) { imageCopy($im, $this->_im, 0, 0, $xymax - $y, $xymax - $x, $xymax, $xymax); } $this->_im = $im; break; default: $this->_im = imageRotate($this->_im, 360 - $angle, $background); break; } } /** * Flip the current image. */ function flip() { $x = imageSX($this->_im); $y = imageSY($this->_im); $im = @imageCreateTrueColor($x, $y); if (!is_resource($im)) { $im = imageCreate($x, $y); } for ($curY = 0; $curY < $y; $curY++) { imageCopy($im, $this->_im, 0, $y - ($curY + 1), 0, $curY, $x, 1); } $this->_im = $im; } /** * Mirror the current image. */ function mirror() { $x = imageSX($this->_im); $y = imageSY($this->_im); $im = @imageCreateTrueColor($x, $y); if (!is_resource($im)) { $im = imageCreate($x, $y); } for ($curX = 0; $curX < $x; $curX++) { imageCopy($im, $this->_im, $x - ($curX + 1), 0, $curX, 0, 1, $y); } $this->_im = $im; } /** * Convert the current image to grayscale. */ function grayscale() { $rateR = .229; $rateG = .587; $rateB = .114; $whiteness = 3; if (function_exists('imageistruecolor') && imageIsTrueColor($this->_im)) { @imageTrueColorToPalette($this->_im, true, 256); } $colors = min(256, imageColorsTotal($this->_im)); for ($x = 0; $x < $colors; $x++) { $src = imageColorsForIndex($this->_im, $x); $new = min(255, abs($src['red'] * $rateR + $src['green'] * $rateG + $src['blue'] * $rateB) + $whiteness); imageColorSet($this->_im, $x, $new, $new, $new); } } /** * Sepia filter. * * Basically turns the image to grayscale and then adds some * defined tint on it (R += 30, G += 43, B += -23) so it will * appear to be a very old picture. */ function sepia() { $tintR = 80; $tintG = 43; $tintB = -23; $rateR = .229; $rateG = .587; $rateB = .114; $whiteness = 3; if (imageIsTrueColor($this->_im)) { imageTrueColorToPalette($this->_im, true, 256); } $colors = max(256, imageColorsTotal($this->_im)); for ($x = 0; $x < $colors; $x++) { $src = imageColorsForIndex($this->_im, $x); $new = min(255, abs($src['red'] * $rateR + $src['green'] * $rateG + $src['blue'] * $rateB) + $whiteness); $r = min(255, $new + $tintR); $g = min(255, $new + $tintG); $b = min(255, $new + $tintB); imageColorSet($this->_im, $x, $r, $g, $b); } } /** * Yellowize filter. * * Adds a layer of yellow that can be transparent or solid. If * $intensityA is 255 the image will be 0% transparent (solid). * * @param integer $intensityY How strong should the yellow (red and green) be? (0-255) * @param integer $intensityB How weak should the blue be? (>= 2, in the positive limit it will be make BLUE 0) */ function yellowize($intensityY = 50, $intensityB = 3) { if (imageIsTrueColor($this->_im)) { imageTrueColorToPalette($this->_im, true, 256); } $colors = max(256, imageColorsTotal($this->_im)); for ($x = 0; $x < $colors; $x++) { $src = imageColorsForIndex($this->_im, $x); $r = min($src['red'] + $intensityY, 255); $g = min($src['green'] + $intensityY, 255); $b = max(($r + $g) / max($intensityB, 2), 0); imageColorSet($this->_im, $x, $r, $g, $b); } } function watermark($text, $halign = 'right', $valign = 'bottom', $font = 'small') { $color = imageColorClosest($this->_im, 255, 255, 255); $shadow = imageColorClosest($this->_im, 0, 0, 0); // Shadow offset in pixels. $drop = 1; // Maximum text width. $maxwidth = 200; // Amount of space to leave between the text and the image // border. $padding = 10; $f = $this->getFont($font); $fontwidth = imageFontWidth($f); $fontheight = imageFontHeight($f); // So that shadow is not off the image with right align and // bottom valign. $margin = floor($padding + $drop) / 2; if ($maxwidth) { $maxcharsperline = floor(($maxwidth - ($margin * 2)) / $fontwidth); $text = wordwrap($text, $maxcharsperline, "\n", 1); } // Split $text into individual lines. $lines = explode("\n", $text); switch ($valign){ case 'center': $y = (imageSY($this->_im) - ($fontheight * count($lines))) / 2; break; case 'bottom': $y = imageSY($this->_im) - (($fontheight * count($lines)) + $margin); break; default: $y = $margin; break; } switch ($halign) { case 'right': foreach ($lines as $line) { imageString($this->_im, $f, (imageSX($this->_im) - $fontwidth * strlen($line)) - $margin + $drop, ($y + $drop), $line, $shadow); imageString($this->_im, $f, (imageSX($this->_im) - $fontwidth * strlen($line)) - $margin, $y, $line, $color); $y += $fontheight; } break; case 'center': foreach ($lines as $line) { imageString($this->_im, $f, floor((imageSX($this->_im) - $fontwidth * strlen($line)) / 2) + $drop, ($y + $drop), $line, $shadow); imageString($this->_im, $f, floor((imageSX($this->_im) - $fontwidth * strlen($line)) / 2), $y, $line, $color); $y += $fontheight; } break; default: foreach ($lines as $line) { imageString($this->_im, $f, $margin + $drop, ($y + $drop), $line, $shadow); imageString($this->_im, $f, $margin, $y, $line, $color); $y += $fontheight; } break; } } /** * Draws a text string on the image in a specified location, with * the specified style information. * * @param string $text The text to draw. * @param integer $x The left x coordinate of the start of the text string. * @param integer $y The top y coordinate of the start of the text string. * @param string $font The font identifier you want to use for the text. * @param string $color The color that you want the text displayed in. * @param integer $direction An integer that specifies the orientation of the text. */ function text($string, $x, $y, $font = 'monospace', $color = 'black', $direction = 0) { $c = $this->allocateColor($color); $f = $this->getFont($font); switch ($direction) { case -90: case 270: imageStringUp($this->_im, $f, $x, $y, $string, $c); break; case 0: default: imageString($this->_im, $f, $x, $y, $string, $c); } } /** * Draw a circle. * * @param integer $x The x co-ordinate of the centre. * @param integer $y The y co-ordinate of the centre. * @param integer $r The radius of the circle. * @param string $color The line color of the circle. * @param string $fill (optional) The color to fill the circle. */ function circle($x, $y, $r, $color, $fill = null) { $c = $this->allocateColor($color); if (is_null($fill)) { imageEllipse($this->_im, $x, $y, $r * 2, $r * 2, $c); } else { if ($fill !== $color) { $fillColor = $this->allocateColor($fill); imageFilledEllipse($this->_im, $x, $y, $r * 2, $r * 2, $fillColor); imageEllipse($this->_im, $x, $y, $r * 2, $r * 2, $c); } else { imageFilledEllipse($this->_im, $x, $y, $r * 2, $r * 2, $c); } } } /** * Draw a polygon based on a set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the polygon with. * @param string $fill (optional) The color to fill the polygon. */ function polygon($verts, $color, $fill = 'none') { $vertices = array(); foreach ($verts as $vert) { $vertices[] = $vert['x']; $vertices[] = $vert['y']; } if ($fill != 'none') { $f = $this->allocateColor($fill); imageFilledPolygon($this->_im, $vertices, count($verts), $f); } if ($fill == 'none' || $fill != $color) { $c = $this->allocateColor($color); imagePolygon($this->_im, $vertices, count($verts), $c); } } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color (optional) The line color of the rectangle. Defaults to black. * @param string $fill (optional) The color to fill the rectangle with. Defaults to none. */ function rectangle($x, $y, $width, $height, $color = 'black', $fill = 'none') { if ($fill != 'none') { $f = $this->allocateColor($fill); imageFilledRectangle($this->_im, $x, $y, $x + $width, $y + $height, $f); } if ($fill == 'none' || $fill != $color) { $c = $this->allocateColor($color); imageRectangle($this->_im, $x, $y, $x + $width, $y + $height, $c); } } /** * Draw a rounded rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param integer $round The width of the corner rounding. * @param string $color (optional) The line color of the rectangle. Defaults to black. * @param string $fill (optional) The color to fill the rounded rectangle with. Defaults to none. */ function roundedRectangle($x, $y, $width, $height, $round, $color = 'black', $fill = 'none') { if ($round <= 0) { // Optimize out any calls with no corner rounding. return $this->rectangle($x, $y, $width, $height, $color, $fill); } $c = $this->allocateColor($color); // Set corner points to avoid lots of redundant math. $x1 = $x + $round; $y1 = $y + $round; $x2 = $x + $width - $round; $y2 = $y + $round; $x3 = $x + $width - $round; $y3 = $y + $height - $round; $x4 = $x + $round; $y4 = $y + $height - $round; $r = $round * 2; // Calculate the upper left arc. $p1 = $this->_arcPoints($round, 180, 225); $p2 = $this->_arcPoints($round, 225, 270); // Calculate the upper right arc. $p3 = $this->_arcPoints($round, 270, 315); $p4 = $this->_arcPoints($round, 315, 360); // Calculate the lower right arc. $p5 = $this->_arcPoints($round, 0, 45); $p6 = $this->_arcPoints($round, 45, 90); // Calculate the lower left arc. $p7 = $this->_arcPoints($round, 90, 135); $p8 = $this->_arcPoints($round, 135, 180); // Draw the corners - upper left, upper right, lower right, // lower left. imageArc($this->_im, $x1, $y1, $r, $r, 180, 270, $c); imageArc($this->_im, $x2, $y2, $r, $r, 270, 360, $c); imageArc($this->_im, $x3, $y3, $r, $r, 0, 90, $c); imageArc($this->_im, $x4, $y4, $r, $r, 90, 180, $c); // Draw the connecting sides - top, right, bottom, left. imageLine($this->_im, $x1 + $p2['x2'], $y1 + $p2['y2'], $x2 + $p3['x1'], $y2 + $p3['y1'], $c); imageLine($this->_im, $x2 + $p4['x2'], $y2 + $p4['y2'], $x3 + $p5['x1'], $y3 + $p5['y1'], $c); imageLine($this->_im, $x3 + $p6['x2'], $y3 + $p6['y2'], $x4 + $p7['x1'], $y4 + $p7['y1'], $c); imageLine($this->_im, $x4 + $p8['x2'], $y4 + $p8['y2'], $x1 + $p1['x1'], $y1 + $p1['y1'], $c); if ($fill != 'none') { $f = $this->allocateColor($fill); imageFillToBorder($this->_im, $x + ($width / 2), $y + ($height / 2), $c, $f); } } /** * Draw a line. * * @param integer $x0 The x co-ordinate of the start. * @param integer $y0 The y co-ordinate of the start. * @param integer $x1 The x co-ordinate of the end. * @param integer $y1 The y co-ordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. */ function line($x1, $y1, $x2, $y2, $color = 'black', $width = 1) { $c = $this->allocateColor($color); // Don't need to do anything special for single-width lines. if ($width == 1) { imageLine($this->_im, $x1, $y1, $x2, $y2, $c); } elseif ($x1 == $x2) { // For vertical lines, we can just draw a vertical // rectangle. $left = $x1 - floor(($width - 1) / 2); $right = $x1 + floor($width / 2); imageFilledRectangle($this->_im, $left, $y1, $right, $y2, $c); } elseif ($y1 == $y2) { // For horizontal lines, we can just draw a horizontal // filled rectangle. $top = $y1 - floor($width / 2); $bottom = $y1 + floor(($width - 1) / 2); imageFilledRectangle($this->_im, $x1, $top, $x2, $bottom, $c); } else { // Angled lines. // Make sure that the end points of the line are // perpendicular to the line itself. $a = atan2($y1 - $y2, $x2 - $x1); $dx = (sin($a) * $width / 2); $dy = (cos($a) * $width / 2); $verts = array($x2 + $dx, $y2 + $dy, $x2 - $dx, $y2 - $dy, $x1 - $dx, $y1 - $dy, $x1 + $dx, $y1 + $dy); imageFilledPolygon($this->_im, $verts, count($verts) / 2, $c); } } /** * Draw a dashed line. * * @param integer $x0 The x co-ordinate of the start. * @param integer $y0 The y co-ordinate of the start. * @param integer $x1 The x co-ordinate of the end. * @param integer $y1 The y co-ordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. * @param integer $dash_length The length of a dash on the dashed line * @param integer $dash_space The length of a space in the dashed line */ function dashedLine($x1, $y1, $x2, $y2, $color = 'black', $width = 1, $dash_length = 2, $dash_space = 2) { $c = $this->allocateColor($color); $w = $this->allocateColor('white'); // Set up the style array according to the $dash_* parameters. $style = array(); for ($i = 0; $i < $dash_length; $i++) { $style[] = $c; } for ($i = 0; $i < $dash_space; $i++) { $style[] = $w; } imageSetStyle($this->_im, $style); imageSetThickness($this->_im, $width); imageLine($this->_im, $x1, $y1, $x2, $y2, IMG_COLOR_STYLED); } /** * Draw a polyline (a non-closed, non-filled polygon) based on a * set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the line with. * @param string $width (optional) The width of the line. */ function polyline($verts, $color, $width = 1) { $first = true; foreach ($verts as $vert) { if (!$first) { $this->line($lastX, $lastY, $vert['x'], $vert['y'], $color, $width); } else { $first = false; } $lastX = $vert['x']; $lastY = $vert['y']; } } /** * Draw an arc. * * @param integer $x The x co-ordinate of the centre. * @param integer $y The y co-ordinate of the centre. * @param integer $r The radius of the arc. * @param integer $start The start angle of the arc. * @param integer $end The end angle of the arc. * @param string $color The line color of the arc. * @param string $fill The fill color of the arc (defaults to none). */ function arc($x, $y, $r, $start, $end, $color = 'black', $fill = null) { $c = $this->allocateColor($color); if (is_null($fill)) { imageArc($this->_im, $x, $y, $r * 2, $r * 2, $start, $end, $c); } else { if ($fill !== $color) { $f = $this->allocateColor($fill); imageFilledArc($this->_im, $x, $y, $r * 2, $r * 2, $start, $end, $f, IMG_ARC_PIE); imageFilledArc($this->_im, $x, $y, $r * 2, $r * 2, $start, $end, $c, IMG_ARC_EDGED | IMG_ARC_NOFILL); } else { imageFilledArc($this->_im, $x, $y, $r * 2, $r * 2, $start, $end, $c, IMG_ARC_PIE); } } } } --- NEW FILE: im.php --- * Copyright 2003-2004 Mike Cochrane * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Image */ class Horde_Image_im extends Horde_Image { /** * Capabilites of this driver. * @var array $_capabilities */ var $_capabilities = array('resize', 'crop', 'rotate', 'grayscale', 'flip', 'mirror', 'sepia', 'canvas' ); /** * What kind of images should ImageMagick generate? Defaults to * 'png'. * @var string $_type */ var $_type = 'png'; /** * Operations to be performed. * @var array $_operations */ var $_operations = array(); /** * Current stroke color; cached so we don't issue more -stroke * commands than necessary. * @var string $_strokeColor */ var $_strokeColor = null; /** * Current stroke width; cached so we don't issue more -strokewidth * commands than necessary. * @var string $_strokeWidth */ var $_strokeWidth = null; /** * Current fill color; cached so we don't issue more -fill * commands than necessary. * @var string $_fillColor */ var $_fillColor = null; /** * Constructor. */ function Horde_Image_im($params) { parent::Horde_Image($params); if (!empty($params['type'])) { $this->_type = $params['type']; } // Make sure we start with a white background to be consistent // with other drivers. if (!empty($params['background'])) { $bg = $params['background']; } else { $bg = 'white'; } $this->rectangle(0, 0, $this->_width, $this->_height, $bg, $bg); } /** * Return the content type for this image. * * @return string The content type for this image. */ function getContentType() { return 'image/' . $this->_type; } /** * Return the raw data for this image. * * @return string The raw image data. */ function raw() { global $conf; if (!empty($this->_data)) { // If there are no operations, and we already have data, // don't bother writing out files, just return the current // data. if (!count($this->_operations)) { return $this->_data; } $tmpin = $this->toFile($this->_data); } else { // Create an empty PPM file to load. $tmpin = Util::getTempFile('img', false, $this->_tmpdir); $fp = fopen($tmpin, 'wb'); fwrite($fp, sprintf("P3\n%d %d\n255\n ", $this->_width, $this->_height)); fclose($fp); } $tmpout = Util::getTempFile('img', false, $this->_tmpdir); $command = $conf['image']['convert']; $command .= ' ' . implode(' ', $this->_operations); $command .= ' "' . $tmpin . '" +profile "*" ' . $this->_type . ':"' . $tmpout . '" 2>&1'; exec($command, $output, $retval); $fp = fopen($tmpout, 'rb'); $this->_data = fread($fp, filesize($tmpout)); fclose($fp); @unlink($tmpin); @unlink($tmpout); return $this->_data; } /** * Reset the image data. */ function reset() { parent::reset(); $this->_operations = array(); } /** * Resize the current image. * * @param integer $width The new width. * @param integer $height The new height. * @param boolean $ratio Maintain original aspect ratio. */ function resize($width, $height, $ratio = true) { if ($ratio) { $this->_operations[] = "-resize {$width}x{$height}"; } else { $this->_operations[] = "-resize {$width}x{$height}!"; } } /** * Crop the current image. * * @param integer $x1 The top left corner of the cropped image. * @param integer $y1 The top right corner of the cropped image. * @param integer $x2 The bottom left corner of the cropped image. * @param integer $y2 The bottom right corner of the cropped image. */ function crop($x1, $y1, $x2, $y2) { $line = ($x2 - $x1) . 'x' . ($y2 - $y1) . '+' . $x1 . '+' . $y2; $this->_operations[] = '-crop ' . $line; } /** * Rotate the current image. * * @param integer $angle The angle to rotate the image by, * in the clockwise direction. * @param integer $background The background color to fill any triangles. */ function rotate($angle, $background = 'white') { $this->_operations[] = "-rotate {$angle} -background $background"; } /** * Flip the current image. */ function flip() { $this->_operations[] = '-flip'; } /** * Mirror the current image. */ function mirror() { $this->_operations[] = '-flop'; } /** * Convert the current image to grayscale. */ function grayscale() { $this->_operations[] = '-colorspace GRAY -colors 256'; } /** * Sepia filter. */ function sepia() { $this->_operations[] = '-modulate 110 -colorspace GRAY -colors 256 -gamma 1.25/1/0.66'; } /** * Draws a text string on the image in a specified location, with * the specified style information. * * @param string $text The text to draw. * @param integer $x The left x coordinate of the start of the text string. * @param integer $y The top y coordinate of the start of the text string. * @param string $font The font identifier you want to use for the text. * @param string $color The color that you want the text displayed in. * @param integer $direction An integer that specifies the orientation of the text. */ function text($string, $x, $y, $font = '_sans', $color = 'black', $direction = 0) { $this->setStrokeColor($color); $this->setStrokeWidth(1); $string = addslashes('"' . $string . '"'); $y = $y + 12; $this->_operations[] = "-draw \"text $x,$y $string\""; } /** * Draw a circle. * * @param integer $x The x coordinate of the centre. * @param integer $y The y coordinate of the centre. * @param integer $r The radius of the circle. * @param string $color The line color of the circle. * @param string $fill (optional) The color to fill the circle. */ function circle($x, $y, $r, $color, $fill = 'none') { $this->setStrokeColor($color); $this->setFillColor($fill); $xMax = $x + $r; $this->_operations[] = "-draw \"circle $x,$y $xMax,$y\""; } /** * Draw a polygon based on a set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the polygon with. * @param string $fill (optional) The color to fill the polygon. */ function polygon($verts, $color, $fill = 'none') { $this->setStrokeColor($color); $this->setFillColor($fill); $command = ''; foreach ($verts as $vert) { $command .= sprintf(' %d,%d', $vert['x'], $vert['y']); } $this->_operations[] = "-draw \"polygon $command\""; } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color The line color of the rectangle. * @param string $fill (optional) The color to fill the rectangle. */ function rectangle($x, $y, $width, $height, $color, $fill = 'none') { $this->setStrokeColor($color); $this->setFillColor($fill); $xMax = $x + $width; $yMax = $y + $height; $this->_operations[] = "-draw \"rectangle $x,$y $xMax,$yMax\""; } /** * Draw a rounded rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param integer $round The width of the corner rounding. * @param string $color The line color of the rectangle. * @param string $fill The color to fill the rounded rectangle with. */ function roundedRectangle($x, $y, $width, $height, $round, $color, $fill) { $this->setStrokeColor($color); $this->setFillColor($fill); $x1 = $x + $width; $y1 = $y + $height; $this->_operations[] = "-draw \"roundRectangle $x,$y $x1,$y1, $round,$round\""; } /** * Draw a line. * * @param integer $x0 The x coordinate of the start. * @param integer $y0 The y coordinate of the start. * @param integer $x1 The x coordinate of the end. * @param integer $y1 The y coordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. */ function line($x0, $y0, $x1, $y1, $color = 'black', $width = 1) { $this->setStrokeColor($color); $this->setStrokeWidth($width); $this->_operations[] = "-draw \"line $x0,$y0 $x1,$y1\""; } /** * Draw a polyline (a non-closed, non-filled polygon) based on a * set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the line with. * @param string $width (optional) The width of the line. */ function polyline($verts, $color, $width = 1) { $this->setStrokeColor($color); $this->setStrokeWidth($width); $this->setFillColor('none'); $command = ''; foreach ($verts as $vert) { $command .= sprintf(' %d,%d', $vert['x'], $vert['y']); } $this->_operations[] = "-draw \"polyline $command\""; } /** * Draw an arc. * * @param integer $x The x coordinate of the centre. * @param integer $y The y coordinate of the centre. * @param integer $r The radius of the arc. * @param integer $start The start angle of the arc. * @param integer $end The end angle of the arc. * @param string $color The line color of the arc. * @param string $fill The fill color of the arc (defaults to none). */ function arc($x, $y, $r, $start, $end, $color = 'black', $fill = 'none') { $this->setStrokeColor($color); $this->setFillColor($fill); // Split up arcs greater than 180 degrees into two pieces. $mid = round(($start + $end) / 2); if ($mid > 90) { $this->_operations[] = "-draw \"ellipse $x,$y $r,$r $start,$mid\""; $this->_operations[] = "-draw \"ellipse $x,$y $r,$r $mid,$end\""; } else { $this->_operations[] = "-draw \"ellipse $x,$y $r,$r $start,$end\""; } // If filled, draw the outline. if (!empty($fill)) { list($x1, $y1) = $this->_circlePoint($start, $r * 2); list($x2, $y2) = $this->_circlePoint($mid, $r * 2); list($x3, $y3) = $this->_circlePoint($end, $r * 2); // This seems to result in slightly better placement of // pie slices. $x++; $y++; $verts = array(array('x' => $x + $x3, 'y' => $y + $y3), array('x' => $x, 'y' => $y), array('x' => $x + $x1, 'y' => $y + $y1)); if ($mid > 90) { $verts1 = array(array('x' => $x + $x2, 'y' => $y + $y2), array('x' => $x, 'y' => $y), array('x' => $x + $x1, 'y' => $y + $y1)); $verts2 = array(array('x' => $x + $x3, 'y' => $y + $y3), array('x' => $x, 'y' => $y), array('x' => $x + $x2, 'y' => $y + $y2)); $this->polygon($verts1, $fill, $fill); $this->polygon($verts2, $fill, $fill); } else { $this->polygon($verts, $fill, $fill); } $this->polyline($verts, $color); } } /** * Change the current stroke color. Will only affect the command * string if $stroke is different from the previous stroke color * (stored in $this->_strokeColor). * * @access private * @see $_strokeColor * * @param string $color The new stroke color. */ function setStrokeColor($color) { if ($color != $this->_strokeColor) { $this->_operations[] = "-stroke $color"; $this->_strokeColor = $color; } } /** * Change the current stroke width. Will only affect the command * string if $width is different from the previous stroke width * (stored in $this->_strokeWidth). * * @access private * @see $_stroke * * @param string $width The new stroke width. */ function setStrokeWidth($width) { if ($width != $this->_strokeWidth) { $this->_operations[] = "-strokewidth $width"; $this->_strokeWidth = $width; } } /** * Change the current fill color. Will only affect the command * string if $color is different from the previous fill color * (stored in $this->_fillColor). * * @access private * @see $_fill * * @param string $color The new fill color. */ function setFillColor($color) { if ($color != $this->_fillColor) { $this->_operations[] = "-fill $color"; $this->_fillColor = $color; } } } --- NEW FILE: png.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Mike Cochrane * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Image */ class Horde_Image_png extends Horde_Image { /** * The array of pixel data. * @var array $_img */ var $_img = array(); /** * Color depth (only 8 and 16 implemented). * @var integer $_colorDepth */ var $_colorDepth = 8; /** * Color type (only 2 (true color) implemented). * @var integer $_colorType */ var $_colorType = 2; /** * Compression method (0 is the only current valid value). * @var integer $_compressionMethod */ var $_compressionMethod = 0; /** * Filter method (0 is the only current valid value). * @var integer $_filterMethod */ var $_filterMethod = 0; /** * Interlace method (only 0 (no interlace) implemented). * @var integer $_interlaceMethod */ var $_interlaceMethod = 0; /** * PNG image constructor. */ function Horde_Image_png($params) { parent::Horde_Image($params); if (!empty($params['width'])) { $this->rectangle(0, 0, $params['width'], $params['height'], $this->_background, $this->_background); } } function getContentType() { return 'image/png'; } /** * Return the raw data for this image. * * @return string The raw image data. */ function raw() { return $this->_header() . $this->_IHDR() . /* Say what created the image file. */ $this->_tEXt('Software', 'Horde Framework Image_png Class') . /* Set the last modified date/time. */ $this->_tIME() . $this->_IDAT() . $this->_IEND(); } /** * Reset the image data. */ function reset() { parent::reset(); $this->_img = array(); } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color (optional) The line color of the rectangle. Defaults to black. * @param string $fill (optional) The color to fill the rectangle with. Defaults to none. */ function rectangle($x, $y, $width, $height, $color = 'black', $fill = 'none') { list($r, $g, $b) = $this->getRGB($color); if ($fill != 'none') { list($fR, $fG, $fB) = $this->getRGB($fill); } $x2 = $x + $width; $y2 = $y + $height; for ($h = $y; $h <= $y2; $h++) { for ($w = $x; $w <= $x2; $w++) { // See if we're on an edge. if ($w == $x || $h == $y || $w == $x2 || $h == $y2) { $this->_img[$h][$w] = array('r' => $r, 'g' => $g, 'b' => $b); } elseif ($fill != 'none') { $this->_img[$h][$w] = array('r' => $fR, 'g' => $fG, 'b' => $fB); } } } } /** * Create the PNG file header. */ function _header() { return pack('CCCCCCCC', 137, 80, 78, 71, 13, 10, 26, 10); } /** * Create Image Header block. */ function _IHDR() { $data = pack('a4NNCCCCC', 'IHDR', $this->_width, $this->_height, $this->_colorDepth, $this->_colorType, $this->_compressionMethod, $this->_filterMethod, $this->_interlaceMethod); return pack('Na' . strlen($data) . 'N', strlen($data) - 4, $data, crc32($data)); } /** * Create IEND block. */ function _IEND() { $data = 'IEND'; return pack('Na' . strlen($data) . 'N', strlen($data) - 4, $data, crc32($data)); } /** * Create Image Data block. */ function _IDAT() { $data = ''; $prevscanline = null; $filter = 0; for ($i = 0; $i < $this->_height; $i++) { $scanline = array(); $data .= chr($filter); for ($j = 0; $j < $this->_width; $j++) { if ($this->_colorDepth == 8) { $scanline[$j] = pack('CCC', $this->_img[$i][$j]['r'], $this->_img[$i][$j]['g'], $this->_img[$i][$j]['b']); } elseif ($this->_colorDepth == 16) { $scanline[$j] = pack('nnn', $this->_img[$i][$j]['r'] << 8, $this->_img[$i][$j]['g'] << 8 , $this->_img[$i][$j]['b'] << 8 ); } if ($filter == 0) { /* No Filter. */ $data .= $scanline[$j]; } elseif ($filter == 2) { /* Up Filter. */ $pixel = $scanline[$j] - $prevscanline[$j]; if ($this->_colorDepth == 8) { $data .= pack('CCC', $pixel >> 16, ($pixel >> 8) & 0xFF, $pixel & 0xFF); } elseif ($this->_colorDepth == 16) { $data .= pack('nnn', ($pixel >> 32), ($pixel >> 16) & 0xFFFF , $pixel & 0xFFFF); } } } $prevscanline = $scanline; } $compressed = gzdeflate($data, 9); $data = 'IDAT' . pack('CCa' . strlen($compressed) . 'a4', 0x78, 0x01, $compressed, $this->_Adler32($data)); return pack('Na' . strlen($data) . 'N', strlen($data) - 4, $data, crc32($data)); } /** * Create tEXt block. */ function _tEXt($keyword, $text) { $data = 'tEXt' . $keyword . "\0" . $text; return pack('Na' . strlen($data) . 'N', strlen($data) - 4, $data, crc32($data)); } /** * Create last modified time block. */ function _tIME($date = null) { if (is_null($date)) { $date = time(); } $data = 'tIME' . pack('nCCCCC', intval(date('Y', $date)), intval(date('m', $date)), intval(date('j', $date)), intval(date('G', $date)), intval(date('i', $date)), intval(date('s', $date))); return pack('Na' . strlen($data) . 'N', strlen($data) - 4, $data, crc32($data)); } /** * Calculate an Adler32 checksum for a string. */ function _Adler32($input) { $s1 = 1; $s2 = 0; $iMax = strlen($input); for ($i = 0; $i < $iMax; $i++) { $s1 = ($s1 + ord($input[$i])) % 0xFFF1; $s2 = ($s2 + $s1) % 0xFFF1; } return pack('N', (($s2 << 16) | $s1)); } } --- NEW FILE: rgb.php --- array(0, 255, 255), 'lime' => array(0, 255, 0), 'teal' => array(0, 128, 128), 'whitesmoke' => array(245, 245, 245), 'gainsboro' => array(220, 220, 220), 'oldlace' => array(253, 245, 230), 'linen' => array(250, 240, 230), 'antiquewhite' => array(250, 235, 215), 'papayawhip' => array(255, 239, 213), 'blanchedalmond' => array(255, 235, 205), 'bisque' => array(255, 228, 196), 'peachpuff' => array(255, 218, 185), 'navajowhite' => array(255, 222, 173), 'moccasin' => array(255, 228, 181), 'cornsilk' => array(255, 248, 220), 'ivory' => array(255, 255, 240), 'lemonchiffon' => array(255, 250, 205), 'seashell' => array(255, 245, 238), 'mintcream' => array(245, 255, 250), 'azure' => array(240, 255, 255), 'aliceblue' => array(240, 248, 255), 'lavender' => array(230, 230, 250), 'lavenderblush' => array(255, 240, 245), 'mistyrose' => array(255, 228, 225), 'white' => array(255, 255, 255), 'black' => array(0, 0, 0), 'darkslategray' => array(47, 79, 79), 'dimgray' => array(105, 105, 105), 'slategray' => array(112, 128, 144), 'lightslategray' => array(119, 136, 153), 'gray' => array(190, 190, 190), 'lightgray' => array(211, 211, 211), 'midnightblue' => array(25, 25, 112), 'navy' => array(0, 0, 128), 'cornflowerblue' => array(100, 149, 237), 'darkslateblue' => array(72, 61, 139), 'slateblue' => array(106, 90, 205), 'mediumslateblue' => array(123, 104, 238), 'lightslateblue' => array(132, 112, 255), 'mediumblue' => array(0, 0, 205), 'royalblue' => array(65, 105, 225), 'blue' => array(0, 0, 255), 'dodgerblue' => array(30, 144, 255), 'deepskyblue' => array(0, 191, 255), 'skyblue' => array(135, 206, 235), 'lightskyblue' => array(135, 206, 250), 'steelblue' => array(70, 130, 180), 'lightred' => array(211, 167, 168), 'lightsteelblue' => array(176, 196, 222), 'lightblue' => array(173, 216, 230), 'powderblue' => array(176, 224, 230), 'paleturquoise' => array(175, 238, 238), 'darkturquoise' => array(0, 206, 209), 'mediumturquoise' => array(72, 209, 204), 'turquoise' => array(64, 224, 208), 'cyan' => array(0, 255, 255), 'lightcyan' => array(224, 255, 255), 'cadetblue' => array(95, 158, 160), 'mediumaquamarine' => array(102, 205, 170), 'aquamarine' => array(127, 255, 212), 'darkgreen' => array(0, 100, 0), 'darkolivegreen' => array(85, 107, 47), 'darkseagreen' => array(143, 188, 143), 'seagreen' => array(46, 139, 87), 'mediumseagreen' => array(60, 179, 113), 'lightseagreen' => array(32, 178, 170), 'palegreen' => array(152, 251, 152), 'springgreen' => array(0, 255, 127), 'lawngreen' => array(124, 252, 0), 'green' => array(0, 255, 0), 'chartreuse' => array(127, 255, 0), 'mediumspringgreen' => array(0, 250, 154), 'greenyellow' => array(173, 255, 47), 'limegreen' => array(50, 205, 50), 'yellowgreen' => array(154, 205, 50), 'forestgreen' => array(34, 139, 34), 'olivedrab' => array(107, 142, 35), 'darkkhaki' => array(189, 183, 107), 'khaki' => array(240, 230, 140), 'palegoldenrod' => array(238, 232, 170), 'lightgoldenrodyellow' => array(250, 250, 210), 'lightyellow' => array(255, 255, 200), 'yellow' => array(255, 255, 0), 'gold' => array(255, 215, 0), 'lightgoldenrod' => array(238, 221, 130), 'goldenrod' => array(218, 165, 32), 'darkgoldenrod' => array(184, 134, 11), 'rosybrown' => array(188, 143, 143), 'indianred' => array(205, 92, 92), 'saddlebrown' => array(139, 69, 19), 'sienna' => array(160, 82, 45), 'peru' => array(205, 133, 63), 'burlywood' => array(222, 184, 135), 'beige' => array(245, 245, 220), 'wheat' => array(245, 222, 179), 'sandybrown' => array(244, 164, 96), 'tan' => array(210, 180, 140), 'chocolate' => array(210, 105, 30), 'firebrick' => array(178, 34, 34), 'brown' => array(165, 42, 42), 'darksalmon' => array(233, 150, 122), 'salmon' => array(250, 128, 114), 'lightsalmon' => array(255, 160, 122), 'orange' => array(255, 165, 0), 'darkorange' => array(255, 140, 0), 'coral' => array(255, 127, 80), 'lightcoral' => array(240, 128, 128), 'tomato' => array(255, 99, 71), 'orangered' => array(255, 69, 0), 'red' => array(255, 0, 0), 'hotpink' => array(255, 105, 180), 'deeppink' => array(255, 20, 147), 'pink' => array(255, 192, 203), 'lightpink' => array(255, 182, 193), 'palevioletred' => array(219, 112, 147), 'maroon' => array(176, 48, 96), 'mediumvioletred' => array(199, 21, 133), 'violetred' => array(208, 32, 144), 'magenta' => array(255, 0, 255), 'violet' => array(238, 130, 238), 'plum' => array(221, 160, 221), 'orchid' => array(218, 112, 214), 'mediumorchid' => array(186, 85, 211), 'darkorchid' => array(153, 50, 204), 'darkviolet' => array(148, 0, 211), 'blueviolet' => array(138, 43, 226), 'purple' => array(160, 32, 240), 'mediumpurple' => array(147, 112, 219), 'thistle' => array(216, 191, 216), 'snow1' => array(255, 250, 250), 'snow2' => array(238, 233, 233), 'snow3' => array(205, 201, 201), 'snow4' => array(139, 137, 137), 'seashell1' => array(255, 245, 238), 'seashell2' => array(238, 229, 222), 'seashell3' => array(205, 197, 191), 'seashell4' => array(139, 134, 130), 'AntiqueWhite1' => array(255, 239, 219), 'AntiqueWhite2' => array(238, 223, 204), 'AntiqueWhite3' => array(205, 192, 176), 'AntiqueWhite4' => array(139, 131, 120), 'bisque1' => array(255, 228, 196), 'bisque2' => array(238, 213, 183), 'bisque3' => array(205, 183, 158), 'bisque4' => array(139, 125, 107), 'peachPuff1' => array(255, 218, 185), 'peachpuff2' => array(238, 203, 173), 'peachpuff3' => array(205, 175, 149), 'peachpuff4' => array(139, 119, 101), 'navajowhite1' => array(255, 222, 173), 'navajowhite2' => array(238, 207, 161), 'navajowhite3' => array(205, 179, 139), 'navajowhite4' => array(139, 121, 94), 'lemonchiffon1' => array(255, 250, 205), 'lemonchiffon2' => array(238, 233, 191), 'lemonchiffon3' => array(205, 201, 165), 'lemonchiffon4' => array(139, 137, 112), 'ivory1' => array(255, 255, 240), 'ivory2' => array(238, 238, 224), 'ivory3' => array(205, 205, 193), 'ivory4' => array(139, 139, 131), 'honeydew' => array(193, 205, 193), 'lavenderblush1' => array(255, 240, 245), 'lavenderblush2' => array(238, 224, 229), 'lavenderblush3' => array(205, 193, 197), 'lavenderblush4' => array(139, 131, 134), 'mistyrose1' => array(255, 228, 225), 'mistyrose2' => array(238, 213, 210), 'mistyrose3' => array(205, 183, 181), 'mistyrose4' => array(139, 125, 123), 'azure1' => array(240, 255, 255), 'azure2' => array(224, 238, 238), 'azure3' => array(193, 205, 205), 'azure4' => array(131, 139, 139), 'slateblue1' => array(131, 111, 255), 'slateblue2' => array(122, 103, 238), 'slateblue3' => array(105, 89, 205), 'slateblue4' => array(71, 60, 139), 'royalblue1' => array(72, 118, 255), 'royalblue2' => array(67, 110, 238), 'royalblue3' => array(58, 95, 205), 'royalblue4' => array(39, 64, 139), 'dodgerblue1' => array(30, 144, 255), 'dodgerblue2' => array(28, 134, 238), 'dodgerblue3' => array(24, 116, 205), 'dodgerblue4' => array(16, 78, 139), 'steelblue1' => array(99, 184, 255), 'steelblue2' => array(92, 172, 238), 'steelblue3' => array(79, 148, 205), 'steelblue4' => array(54, 100, 139), 'deepskyblue1' => array(0, 191, 255), 'deepskyblue2' => array(0, 178, 238), 'deepskyblue3' => array(0, 154, 205), 'deepskyblue4' => array(0, 104, 139), 'skyblue1' => array(135, 206, 255), 'skyblue2' => array(126, 192, 238), 'skyblue3' => array(108, 166, 205), 'skyblue4' => array(74, 112, 139), 'lightskyblue1' => array(176, 226, 255), 'lightskyblue2' => array(164, 211, 238), 'lightskyblue3' => array(141, 182, 205), 'lightskyblue4' => array(96, 123, 139), 'slategray1' => array(198, 226, 255), 'slategray2' => array(185, 211, 238), 'slategray3' => array(159, 182, 205), 'slategray4' => array(108, 123, 139), 'lightsteelblue1' => array(202, 225, 255), 'lightsteelblue2' => array(188, 210, 238), 'lightsteelblue3' => array(162, 181, 205), 'lightsteelblue4' => array(110, 123, 139), 'lightblue1' => array(191, 239, 255), 'lightblue2' => array(178, 223, 238), 'lightblue3' => array(154, 192, 205), 'lightblue4' => array(104, 131, 139), 'lightcyan1' => array(224, 255, 255), 'lightcyan2' => array(209, 238, 238), 'lightcyan3' => array(180, 205, 205), 'lightcyan4' => array(122, 139, 139), 'paleturquoise1' => array(187, 255, 255), 'paleturquoise2' => array(174, 238, 238), 'paleturquoise3' => array(150, 205, 205), 'paleturquoise4' => array(102, 139, 139), 'cadetblue1' => array(152, 245, 255), 'cadetblue2' => array(142, 229, 238), 'cadetblue3' => array(122, 197, 205), 'cadetblue4' => array(83, 134, 139), 'turquoise1' => array(0, 245, 255), 'turquoise2' => array(0, 229, 238), 'turquoise3' => array(0, 197, 205), 'turquoise4' => array(0, 134, 139), 'cyan1' => array(0, 255, 255), 'cyan2' => array(0, 238, 238), 'cyan3' => array(0, 205, 205), 'cyan4' => array(0, 139, 139), 'darkslategray1' => array(151, 255, 255), 'darkslategray2' => array(141, 238, 238), 'darkslategray3' => array(121, 205, 205), 'darkslategray4' => array(82, 139, 139), 'aquamarine1' => array(127, 255, 212), 'aquamarine2' => array(118, 238, 198), 'aquamarine3' => array(102, 205, 170), 'aquamarine4' => array(69, 139, 116), 'darkseagreen1' => array(193, 255, 193), 'darkseagreen2' => array(180, 238, 180), 'darkseagreen3' => array(155, 205, 155), 'darkseagreen4' => array(105, 139, 105), 'seagreen1' => array(84, 255, 159), 'seagreen2' => array(78, 238, 148), 'seagreen3' => array(67, 205, 128), 'seagreen4' => array(46, 139, 87), 'palegreen1' => array(154, 255, 154), 'palegreen2' => array(144, 238, 144), 'palegreen3' => array(124, 205, 124), 'palegreen4' => array(84, 139, 84), 'springgreen1' => array(0, 255, 127), 'springgreen2' => array(0, 238, 118), 'springgreen3' => array(0, 205, 102), 'springgreen4' => array(0, 139, 69), 'chartreuse1' => array(127, 255, 0), 'chartreuse2' => array(118, 238, 0), 'chartreuse3' => array(102, 205, 0), 'chartreuse4' => array(69, 139, 0), 'olivedrab1' => array(192, 255, 62), 'olivedrab2' => array(179, 238, 58), 'olivedrab3' => array(154, 205, 50), 'olivedrab4' => array(105, 139, 34), 'darkolivegreen1' => array(202, 255, 112), 'darkolivegreen2' => array(188, 238, 104), 'darkolivegreen3' => array(162, 205, 90), 'darkolivegreen4' => array(110, 139, 61), 'khaki1' => array(255, 246, 143), 'khaki2' => array(238, 230, 133), 'khaki3' => array(205, 198, 115), 'khaki4' => array(139, 134, 78), 'lightgoldenrod1' => array(255, 236, 139), 'lightgoldenrod2' => array(238, 220, 130), 'lightgoldenrod3' => array(205, 190, 112), 'lightgoldenrod4' => array(139, 129, 76), 'yellow1' => array(255, 255, 0), 'yellow2' => array(238, 238, 0), 'yellow3' => array(205, 205, 0), 'yellow4' => array(139, 139, 0), 'gold1' => array(255, 215, 0), 'gold2' => array(238, 201, 0), 'gold3' => array(205, 173, 0), 'gold4' => array(139, 117, 0), 'goldenrod1' => array(255, 193, 37), 'goldenrod2' => array(238, 180, 34), 'goldenrod3' => array(205, 155, 29), 'goldenrod4' => array(139, 105, 20), 'darkgoldenrod1' => array(255, 185, 15), 'darkgoldenrod2' => array(238, 173, 14), 'darkgoldenrod3' => array(205, 149, 12), 'darkgoldenrod4' => array(139, 101, 8), 'rosybrown1' => array(255, 193, 193), 'rosybrown2' => array(238, 180, 180), 'rosybrown3' => array(205, 155, 155), 'rosybrown4' => array(139, 105, 105), 'indianred1' => array(255, 106, 106), 'indianred2' => array(238, 99, 99), 'indianred3' => array(205, 85, 85), 'indianred4' => array(139, 58, 58), 'sienna1' => array(255, 130, 71), 'sienna2' => array(238, 121, 66), 'sienna3' => array(205, 104, 57), 'sienna4' => array(139, 71, 38), 'burlywood1' => array(255, 211, 155), 'burlywood2' => array(238, 197, 145), 'burlywood3' => array(205, 170, 125), 'burlywood4' => array(139, 115, 85), 'wheat1' => array(255, 231, 186), 'wheat2' => array(238, 216, 174), 'wheat3' => array(205, 186, 150), 'wheat4' => array(139, 126, 102), 'tan1' => array(255, 165, 79), 'tan2' => array(238, 154, 73), 'tan3' => array(205, 133, 63), 'tan4' => array(139, 90, 43), 'chocolate1' => array(255, 127, 36), 'chocolate2' => array(238, 118, 33), 'chocolate3' => array(205, 102, 29), 'chocolate4' => array(139, 69, 19), 'firebrick1' => array(255, 48, 48), 'firebrick2' => array(238, 44, 44), 'firebrick3' => array(205, 38, 38), 'firebrick4' => array(139, 26, 26), 'brown1' => array(255, 64, 64), 'brown2' => array(238, 59, 59), 'brown3' => array(205, 51, 51), 'brown4' => array(139, 35, 35), 'salmon1' => array(255, 140, 105), 'salmon2' => array(238, 130, 98), 'salmon3' => array(205, 112, 84), 'salmon4' => array(139, 76, 57), 'lightsalmon1' => array(255, 160, 122), 'lightsalmon2' => array(238, 149, 114), 'lightsalmon3' => array(205, 129, 98), 'lightsalmon4' => array(139, 87, 66), 'orange1' => array(255, 165, 0), 'orange2' => array(238, 154, 0), 'orange3' => array(205, 133, 0), 'orange4' => array(139, 90, 0), 'darkorange1' => array(255, 127, 0), 'darkorange2' => array(238, 118, 0), 'darkorange3' => array(205, 102, 0), 'darkorange4' => array(139, 69, 0), 'coral1' => array(255, 114, 86), 'coral2' => array(238, 106, 80), 'coral3' => array(205, 91, 69), 'coral4' => array(139, 62, 47), 'tomato1' => array(255, 99, 71), 'tomato2' => array(238, 92, 66), 'tomato3' => array(205, 79, 57), 'tomato4' => array(139, 54, 38), 'orangered1' => array(255, 69, 0), 'orangered2' => array(238, 64, 0), 'orangered3' => array(205, 55, 0), 'orangered4' => array(139, 37, 0), 'deeppink1' => array(255, 20, 147), 'deeppink2' => array(238, 18, 137), 'deeppink3' => array(205, 16, 118), 'deeppink4' => array(139, 10, 80), 'hotpink1' => array(255, 110, 180), 'hotpink2' => array(238, 106, 167), 'hotpink3' => array(205, 96, 144), 'hotpink4' => array(139, 58, 98), 'pink1' => array(255, 181, 197), 'pink2' => array(238, 169, 184), 'pink3' => array(205, 145, 158), 'pink4' => array(139, 99, 108), 'lightpink1' => array(255, 174, 185), 'lightpink2' => array(238, 162, 173), 'lightpink3' => array(205, 140, 149), 'lightpink4' => array(139, 95, 101), 'palevioletred1' => array(255, 130, 171), 'palevioletred2' => array(238, 121, 159), 'palevioletred3' => array(205, 104, 137), 'palevioletred4' => array(139, 71, 93), 'maroon1' => array(255, 52, 179), 'maroon2' => array(238, 48, 167), 'maroon3' => array(205, 41, 144), 'maroon4' => array(139, 28, 98), 'violetred1' => array(255, 62, 150), 'violetred2' => array(238, 58, 140), 'violetred3' => array(205, 50, 120), 'violetred4' => array(139, 34, 82), 'magenta1' => array(255, 0, 255), 'magenta2' => array(238, 0, 238), 'magenta3' => array(205, 0, 205), 'magenta4' => array(139, 0, 139), 'mediumred' => array(140, 34, 34), 'orchid1' => array(255, 131, 250), 'orchid2' => array(238, 122, 233), 'orchid3' => array(205, 105, 201), 'orchid4' => array(139, 71, 137), 'plum1' => array(255, 187, 255), 'plum2' => array(238, 174, 238), 'plum3' => array(205, 150, 205), 'plum4' => array(139, 102, 139), 'mediumorchid1' => array(224, 102, 255), 'mediumorchid2' => array(209, 95, 238), 'mediumorchid3' => array(180, 82, 205), 'mediumorchid4' => array(122, 55, 139), 'darkorchid1' => array(191, 62, 255), 'darkorchid2' => array(178, 58, 238), 'darkorchid3' => array(154, 50, 205), 'darkorchid4' => array(104, 34, 139), 'purple1' => array(155, 48, 255), 'purple2' => array(145, 44, 238), 'purple3' => array(125, 38, 205), 'purple4' => array(85, 26, 139), 'mediumpurple1' => array(171, 130, 255), 'mediumpurple2' => array(159, 121, 238), 'mediumpurple3' => array(137, 104, 205), 'mediumpurple4' => array(93, 71, 139), 'thistle1' => array(255, 225, 255), 'thistle2' => array(238, 210, 238), 'thistle3' => array(205, 181, 205), 'thistle4' => array(139, 123, 139), 'gray1' => array(10, 10, 10), 'gray2' => array(40, 40, 30), 'gray3' => array(70, 70, 70), 'gray4' => array(100, 100, 100), 'gray5' => array(130, 130, 130), 'gray6' => array(160, 160, 160), 'gray7' => array(190, 190, 190), 'gray8' => array(210, 210, 210), 'gray9' => array(240, 240, 240), 'darkgray' => array(100, 100, 100), 'darkblue' => array(0, 0, 139), 'darkcyan' => array(0, 139, 139), 'darkmagenta' => array(139, 0, 139), 'darkred' => array(139, 0, 0), 'silver' => array(192, 192, 192), 'eggplant' => array(144, 176, 168), 'lightgreen' => array(144, 238, 144) ); --- NEW FILE: svg.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Image */ class Horde_Image_svg extends Horde_Image { var $_svg; /** * Capabilites of this driver. * @var array $_capabilities */ var $_capabilities = array('canvas'); function Horde_Image_svg($params) { parent::Horde_Image($params); $this->_svg = &new XML_SVG_Document(array('width' => $this->_width, 'height' => $this->_height)); } function getContentType() { return 'image/svg+xml'; } function getLink($url, $title = '') { } function display() { $this->_svg->printElement(); } /** * Return the raw data for this image. * * @return string The raw image data. */ function raw() { return $this->_svg->bufferObject(); } function getFont($font) { return $font; } function _createSymbol($s, $id) { $s->setParam('id', $id); $defs = &new XML_SVG_Defs(); $defs->addChild($s); $this->_svg->addChild($defs); } function _createDropShadow($id = 'dropShadow') { $defs = &new XML_SVG_Defs(); $filter = &new XML_SVG_Filter(array('id' => $id)); $filter->addPrimitive('GaussianBlur', array('in' => 'SourceAlpha', 'stdDeviation' => 2, 'result' => 'blur')); $filter->addPrimitive('Offset', array('in' => 'blur', 'dx' => 4, 'dy' => 4, 'result' => 'offsetBlur')); $merge = &new XML_SVG_FilterPrimitive('Merge'); $merge->addMergeNode('offsetBlur'); $merge->addMergeNode('SourceGraphic'); $filter->addChild($merge); $defs->addChild($filter); $this->_svg->addChild($defs); } /** * Draws a text string on the image in a specified location, with * the specified style information. * * @param string $text The text to draw. * @param integer $x The left x coordinate of the start of the text string. * @param integer $y The top y coordinate of the start of the text string. * @param string $font The font identifier you want to use for the text. * @param string $color The color that you want the text displayed in. * @param integer $direction An integer that specifies the orientation of the text. */ function text($string, $x, $y, $font = 'monospace', $color = 'black', $direction = 0) { $height = 12; $style = 'font-family:' . $font . ';font-height:' . $height . 'px;fill:' . $this->getHexColor($color) . ';text-anchor:start;'; $transform = 'rotate(' . $direction . ',' . $x . ',' . $y . ')'; $this->_svg->addChild(new XML_SVG_Text(array('text' => $string, 'x' => (int)$x, 'y' => (int)$y + $height, 'transform' => $transform, 'style' => $style))); } /** * Draw a circle. * * @param integer $x The x coordinate of the centre. * @param integer $y The y coordinate of the centre. * @param integer $r The radius of the circle. * @param string $color The line color of the circle. * @param string $fill (optional) The color to fill the circle. */ function circle($x, $y, $r, $color, $fill = null) { if (!empty($fill)) { $style = 'fill:' . $this->getHexColor($fill) . '; '; } else { $style = 'fill:none;'; } $style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1'; $this->_svg->addChild(new XML_SVG_Circle(array('cx' => $x, 'cy' => $y, 'r' => $r, 'style' => $style))); } /** * Draw a polygon based on a set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the polygon with. * @param string $fill (optional) The color to fill the polygon. */ function polygon($verts, $color, $fill = null) { if (!empty($fill)) { $style = 'fill:' . $this->getHexColor($fill) . '; '; } else { $style = 'fill:none;'; } $style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1'; $points = ''; foreach ($verts as $v) { $points .= $v['x'] . ',' . $v['y'] . ' '; } $points = trim($points); $this->_svg->addChild(new XML_SVG_Polygon(array('points' => $points, 'style' => $style))); } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color The line color of the rectangle. * @param string $fill (optional) The color to fill the rectangle. */ function rectangle($x, $y, $width, $height, $color, $fill = null) { if (!empty($fill)) { $style = 'fill:' . $this->getHexColor($fill) . '; '; } else { $style = 'fill:none;'; } $style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1'; $this->_svg->addChild(new XML_SVG_Rect(array('x' => $x, 'y' => $y, 'width' => $width, 'height' => $height, 'style' => $style))); } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param integer $round The width of the corner rounding. * @param string $color The line color of the rectangle. * @param string $fill The color to fill the rectangle. */ function roundedRectangle($x, $y, $width, $height, $round, $color, $fill) { if (!empty($fill)) { $style = 'fill:' . $this->getHexColor($fill) . '; '; } else { $style = 'fill:none;'; } $style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1'; $this->_svg->addChild(new XML_SVG_Rect(array('x' => $x, 'y' => $y, 'rx' => $round, 'ry' => $round, 'width' => $width, 'height' => $height, 'style' => $style))); } /** * Draw a line. * * @param integer $x0 The x coordinate of the start. * @param integer $y0 The y coordinate of the start. * @param integer $x1 The x coordinate of the end. * @param integer $y1 The y coordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. */ function line($x1, $y1, $x2, $y2, $color = 'black', $width = 1) { $style = 'stroke:' . $this->getHexColor($color) . '; stroke-width:' . (int)$width; $this->_svg->addChild(new XML_SVG_Line(array('x1' => $x1, 'y1' => $y1, 'x2' => $x2, 'y2' => $y2, 'style' => $style))); } /** * Draw a dashed line. * * @param integer $x0 The x coordinate of the start. * @param integer $y0 The y coordinate of the start. * @param integer $x1 The x coordinate of the end. * @param integer $y1 The y coordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. * @param integer $dash_length The length of a dash on the dashed line * @param integer $dash_space The length of a space in the dashed line */ function dashedLine($x1, $y1, $x2, $y2, $color = 'black', $width = 1, $dash_length = 2, $dash_space = 2) { $style = 'stroke:' . $this->getHexColor($color) . '; stroke-width:' . (int)$width . '; stroke-dasharray:' . $dash_length . ',' . $dash_space . ';'; $this->_svg->addChild(new XML_SVG_Line(array('x1' => $x1, 'y1' => $y1, 'x2' => $x2, 'y2' => $y2, 'style' => $style))); } /** * Draw a polyline (a non-closed, non-filled polygon) based on a * set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the line with. * @param string $width (optional) The width of the line. */ function polyline($verts, $color, $width = 1) { $style = 'stroke:' . $this->getHexColor($color) . '; stroke-width:' . $width . ';fill:none;'; // Calculate the path entry. $path = ''; $first = true; foreach ($verts as $vert) { if ($first) { $first = false; $path .= 'M ' . $vert['x'] . ',' . $vert['y']; } else { $path .= ' L ' . $vert['x'] . ',' . $vert['y']; } } $this->_svg->addChild(new XML_SVG_Path(array('d' => $path, 'style' => $style))); } /** * Draw an arc. * * @param integer $x The x coordinate of the centre. * @param integer $y The y coordinate of the centre. * @param integer $r The radius of the arc. * @param integer $start The start angle of the arc. * @param integer $end The end angle of the arc. * @param string $color The line color of the arc. * @param string $fill The fill color of the arc (defaults to none). */ function arc($x, $y, $r, $start, $end, $color = 'black', $fill = null) { if (!empty($fill)) { $style = 'fill:' . $this->getHexColor($fill) . '; '; } else { $style = 'fill:none;'; } $style .= 'stroke:' . $this->getHexColor($color) . '; stroke-width:1'; $mid = round(($start + $end) / 2); // Calculate the path entry. $path = ''; // If filled, draw the outline. if (!empty($fill)) { // Start at the center of the ellipse the arc is on. $path .= "M $x,$y "; // Draw out to ellipse edge. list($arcX, $arcY) = $this->_circlePoint($start, $r * 2); $path .= 'L ' . round($x + $arcX) . ',' . round($y + $arcY) . ' '; } // Draw arcs. list($arcX, $arcY) = $this->_circlePoint($mid, $r * 2); $path .= "A $r,$r 0 0 1 " . round($x + $arcX) . ',' . round($y + $arcY) . ' '; list($arcX, $arcY) = $this->_circlePoint($end, $r * 2); $path .= "A $r,$r 0 0 1 " . round($x + $arcX) . ',' . round($y + $arcY) . ' '; // If filled, close the outline. if (!empty($fill)) { $path .= 'Z'; } $path = trim($path); $this->_svg->addChild(new XML_SVG_Path(array('d' => $path, 'style' => $style))); } } --- NEW FILE: swf.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Image */ class Horde_Image_swf extends Horde_Image { /** * Capabilites of this driver. * @var array $_capabilities */ var $_capabilities = array('canvas'); /** * SWF root movie. * @var resource $_movie */ var $_movie; function Horde_Image_swf($params) { parent::Horde_Image($params); $this->_movie = &new SWFMovie(); $this->_movie->setDimension($this->_width, $this->_height); // FIXME: honor the 'background' parameter here. $this->_movie->setBackground(0xff, 0xff, 0xff); $this->_movie->setRate(30); } function getContentType() { return 'application/x-shockwave-flash'; } /** * Display the movie. */ function display() { $this->headers(); $this->_movie->output(); } /** * Return the raw data for this image. * * @return string The raw image data. */ function raw() { ob_start(); $this->_movie->output(); $data = ob_get_contents(); ob_end_clean(); return $data; } /** * Creates a color that can be accessed in this object. When a * color is set, the rgba values are returned in an array. * * @param string $name The name of the color. * * @return array The red, green, blue, alpha values of the color. */ function allocateColor($name) { list($r, $g, $b) = $this->getRGB($name); return array('red' => $r, 'green' => $g, 'blue' => $b, 'alpha' => 255); } function getFont($font) { switch ($font) { case 'sans-serif': return '_sans'; case 'serif': return '_serif'; case 'monospace': return '_typewriter'; default: return $font; } } /** * Draws a text string on the image in a specified location, with * the specified style information. * * @param string $text The text to draw. * @param integer $x The left x coordinate of the start of the text string. * @param integer $y The top y coordinate of the start of the text string. * @param string $font The font identifier you want to use for the text. * @param string $color The color that you want the text displayed in. * @param integer $direction An integer that specifies the orientation of the text. */ function text($string, $x, $y, $font = 'monospace', $color = 'black', $direction = 0) { $color = $this->allocateColor($color); if (substr(PHP_OS, 0, 3) == 'WIN') { $text = &new SWFTextField(SWFTEXTFIELD_NOEDIT); } else { $text = &new SWFText(); } $text->setColor($color['red'], $color['green'], $color['blue'], $color['alpha']); $text->addString($string); $text->setFont(new SWFFont($this->getFont($font))); $t = $this->_movie->add($text); $t->moveTo($x, $y); $t->rotate($direction); return $t; } /** * Draw a circle. * * @param integer $x The x co-ordinate of the centre. * @param integer $y The y co-ordinate of the centre. * @param integer $r The radius of the circle. * @param string $color The line color of the circle. * @param string $fill (optional) The color to fill the circle. */ function circle($x, $y, $r, $color, $fill = 'none') { $s = &new SWFShape(); $color = $this->allocateColor($color); $s->setLine(1, $color['red'], $color['green'], $color['blue'], $color['alpha']); if ($fill != 'none') { $fillColor = $this->allocateColor($fill); $f = $s->addFill($fillColor['red'], $fillColor['green'], $fillColor['blue'], $fillColor['alpha']); $s->setRightFill($f); } $a = $r * 0.414213562; // = tan(22.5 deg) $b = $r * 0.707106781; // = sqrt(2)/2 = sin(45 deg) $s->movePenTo($x + $r, $y); $s->drawCurveTo($x + $r, $y - $a, $x + $b, $y - $b); $s->drawCurveTo($x + $a, $y - $r, $x, $y - $r); $s->drawCurveTo($x - $a, $y - $r, $x - $b, $y - $b); $s->drawCurveTo($x - $r, $y - $a, $x - $r, $y); $s->drawCurveTo($x - $r, $y + $a, $x - $b, $y + $b); $s->drawCurveTo($x - $a, $y + $r, $x, $y + $r); $s->drawCurveTo($x + $a, $y + $r, $x + $b, $y + $b); $s->drawCurveTo($x + $r, $y + $a, $x + $r, $y); return $this->_movie->add($s); } /** * Draw a polygon based on a set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the polygon with. * @param string $fill (optional) The color to fill the polygon. */ function polygon($verts, $color, $fill = 'none') { $color = $this->allocateColor($color); if (is_array($color) && is_array($verts) && (sizeof($verts) > 2)) { $shape = &new SWFShape(); $shape->setLine(1, $color['red'], $color['green'], $color['blue'], $color['alpha']); if ($fill != 'none') { $fillColor = $this->allocateColor($fill); $f = $shape->addFill($fillColor['red'], $fillColor['green'], $fillColor['blue'], $fillColor['alpha']); $shape->setRightFill($f); } $first_done = false; foreach ($verts as $value) { if (!$first_done) { $shape->movePenTo($value['x'], $value['y']); $first_done = true; $first_x = $value['x']; $first_y = $value['y']; } $shape->drawLineTo($value['x'], $value['y']); } $shape->drawLineTo($first_x, $first_y); return $this->_movie->add($shape); } else { // If the color is an array and the vertices is a an array // of more than 2 points. return false; } } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color The line color of the rectangle. * @param string $fill (optional) The color to fill the rectangle. */ function rectangle($x, $y, $width, $height, $color, $fill = 'none') { $verts[0] = array('x' => $x, 'y' => $y); $verts[1] = array('x' => $x + $width, 'y' => $y); $verts[2] = array('x' => $x + $width, 'y' => $y + $height); $verts[3] = array('x' => $x, 'y' => $y + $height); return $this->polygon($verts, $color, $fill); } /** * Draw a rectangle. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param integer $round The width of the corner rounding. * @param string $color (optional) The line color of the rectangle. Defaults to black. * @param string $fill (optional) The color to fill the rectangle. Defaults to none. */ function roundedRectangle($x, $y, $width, $height, $round, $color = 'black', $fill = 'none') { if ($round <= 0) { // Optimize out any calls with no corner rounding. return $this->rectangle($x, $y, $width, $height, $color, $fill); } $s = &new SWFShape(); $color = $this->allocateColor($color); $s->setLine(1, $color['red'], $color['green'], $color['blue'], $color['alpha']); if ($fill != 'none') { $fillColor = $this->allocateColor($fill); $f = $s->addFill($fillColor['red'], $fillColor['green'], $fillColor['blue'], $fillColor['alpha']); $s->setRightFill($f); } // Set corner points to avoid lots of redundant math. $x1 = $x + $round; $y1 = $y + $round; $x2 = $x + $width - $round; $y2 = $y + $round; $x3 = $x + $width - $round; $y3 = $y + $height - $round; $x4 = $x + $round; $y4 = $y + $height - $round; // Start in the upper left. $p1 = $this->_arcPoints($round, 180, 225); $p2 = $this->_arcPoints($round, 225, 270); // Start at the lower left corner of the top left curve. $s->movePenTo($x1 + $p1['x1'], $y1 + $p1['y1']); // Draw the upper left corner. $s->drawCurveTo($x1 + $p1['x3'], $y1 + $p1['y3'], $x1 + $p1['x2'], $y1 + $p1['y2']); $s->drawCurveTo($x1 + $p2['x3'], $y1 + $p2['y3'], $x1 + $p2['x2'], $y1 + $p2['y2']); // Calculate the upper right points. $p3 = $this->_arcPoints($round, 270, 315); $p4 = $this->_arcPoints($round, 315, 360); // Connect the top left and right curves. $s->drawLineTo($x2 + $p3['x1'], $y2 + $p3['y1']); // Draw the upper right corner. $s->drawCurveTo($x2 + $p3['x3'], $y2 + $p3['y3'], $x2 + $p3['x2'], $y2 + $p3['y2']); $s->drawCurveTo($x2 + $p4['x3'], $y2 + $p4['y3'], $x2 + $p4['x2'], $y2 + $p4['y2']); // Calculate the lower right points. $p5 = $this->_arcPoints($round, 0, 45); $p6 = $this->_arcPoints($round, 45, 90); // Connect the top right and lower right curves. $s->drawLineTo($x3 + $p5['x1'], $y3 + $p5['y1']); // Draw the lower right corner. $s->drawCurveTo($x3 + $p5['x3'], $y3 + $p5['y3'], $x3 + $p5['x2'], $y3 + $p5['y2']); $s->drawCurveTo($x3 + $p6['x3'], $y3 + $p6['y3'], $x3 + $p6['x2'], $y3 + $p6['y2']); // Calculate the lower left points. $p7 = $this->_arcPoints($round, 90, 135); $p8 = $this->_arcPoints($round, 135, 180); // Connect the bottom right and bottom left curves. $s->drawLineTo($x4 + $p7['x1'], $y4 + $p7['y1']); // Draw the lower left corner. $s->drawCurveTo($x4 + $p7['x3'], $y4 + $p7['y3'], $x4 + $p7['x2'], $y4 + $p7['y2']); $s->drawCurveTo($x4 + $p8['x3'], $y4 + $p8['y3'], $x4 + $p8['x2'], $y4 + $p8['y2']); // Close the shape. $s->drawLineTo($x1 + $p1['x1'], $y1 + $p1['y1']); return $this->_movie->add($s); } /** * Draw a line. * * @param integer $x0 The x co-ordinate of the start. * @param integer $y0 The y co-ordinate of the start. * @param integer $x1 The x co-ordinate of the end. * @param integer $y1 The y co-ordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. */ function line($x1, $y1, $x2, $y2, $color = 'black', $width = 1) { $color = $this->allocateColor($color); if (is_array($color)) { $shape = &new SWFShape(); $shape->setLine($width, $color['red'], $color['green'], $color['blue'], $color['alpha']); $shape->movePenTo($x1, $y1); $shape->drawLineTo($x2, $y2); return $this->_movie->add($shape); } else { return false; } } /** * Draw a dashed line. * * @param integer $x0 The x co-ordinate of the start. * @param integer $y0 The y co-ordinate of the start. * @param integer $x1 The x co-ordinate of the end. * @param integer $y1 The y co-ordinate of the end. * @param string $color (optional) The line color. * @param string $width (optional) The width of the line. * @param integer $dash_length The length of a dash on the dashed line * @param integer $dash_space The length of a space in the dashed line */ function dashedLine($x0, $y0, $x1, $y1, $color = 'black', $width = 1, $dash_length = 2, $dash_space = 2) { // Get the length of the line in pixels. $line_length = max(ceil(sqrt(pow(($x1 - $x0), 2) + pow(($y1 - $y0), 2))), 2); $cosTheta = ($x1 - $x0) / $line_length; $sinTheta = ($y1 - $y0) / $line_length; $lastx = $x0; $lasty = $y0; // Draw the dashed line. for ($i = 0; $i < $line_length; $i += ($dash_length + $dash_space)) { $x = ($dash_length * $cosTheta) + $lastx; $y = ($dash_length * $sinTheta) + $lasty; $this->line($lastx, $lasty, $x, $y, $color); $lastx = $x + ($dash_space * $cosTheta); $lasty = $y + ($dash_space * $sinTheta); } } /** * Draw a polyline (a non-closed, non-filled polygon) based on a * set of vertices. * * @param array $vertices An array of x and y labeled arrays * (eg. $vertices[0]['x'], $vertices[0]['y'], ...). * @param string $color The color you want to draw the line with. * @param string $width (optional) The width of the line. */ function polyline($verts, $color, $width = 1) { $color = $this->allocateColor($color); $shape = &new SWFShape(); $shape->setLine($width, $color['red'], $color['green'], $color['blue'], $color['alpha']); $first_done = false; foreach ($verts as $value) { if (!$first_done) { $shape->movePenTo($value['x'], $value['y']); $first_done = true; } $shape->drawLineTo($value['x'], $value['y']); } return $this->_movie->add($shape); } /** * Draw an arc. * * @param integer $x The x co-ordinate of the centre. * @param integer $y The y co-ordinate of the centre. * @param integer $r The radius of the arc. * @param integer $start The start angle of the arc. * @param integer $end The end angle of the arc. * @param string $color (optional) The line color of the arc (defaults to black). * @param string $fill (optional) The fill color of the arc (defaults to none). */ function arc($x, $y, $r, $start, $end, $color = 'black', $fill = 'none') { $s = &new SWFShape(); $color = $this->allocateColor($color); $s->setLine(1, $color['red'], $color['green'], $color['blue'], $color['alpha']); if ($fill != 'none') { $fillColor = $this->allocateColor($fill); $f = $s->addFill($fillColor['red'], $fillColor['green'], $fillColor['blue'], $fillColor['alpha']); $s->setRightFill($f); } if ($end - $start <= 45) { $pts = $this->_arcPoints($r, $start, $end); $s->movePenTo($x, $y); $s->drawLineTo($pts['x1'] + $x, $pts['y1'] + $y); $s->drawCurveTo($pts['x3'] + $x, $pts['y3'] + $y, $pts['x2'] + $x, $pts['y2'] + $y); $s->drawLineTo($x, $y); } else { $sections = ceil(($end - $start) / 45); for ($i = 0; $i < $sections; $i++) { $pts = $this->_arcPoints($r, $start + ($i * 45), ($start + (($i + 1) * 45) > $end) ? $end : ($start + (($i + 1) * 45))); // If we are on the first section, move the pen to the // centre and draw out to the edge. if ($i == 0 && $fill != 'none') { $s->movePenTo($x, $y); $s->drawLineTo($pts['x1'] + $x, $pts['y1'] + $y); } else { $s->movePenTo($pts['x1'] + $x, $pts['y1'] + $y); } // Draw the arc. $s->drawCurveTo($pts['x3'] + $x, $pts['y3'] + $y, $pts['x2'] + $x, $pts['y2'] + $y); } if ($fill != 'none') { // Draw a line from the edge back to the centre to close // off the segment. $s->drawLineTo($x, $y); } } return $this->_movie->add($s); } /** * Draw a rectangle filled with a gradient from $color1 to * $color2. * * @param integer $x The left x-coordinate of the rectangle. * @param integer $y The top y-coordinate of the rectangle. * @param integer $width The width of the rectangle. * @param integer $height The height of the rectangle. * @param string $color The outline color of the rectangle. * @param string $fill1 The name of the start color for the gradient. * @param string $fill2 The name of the end color for the gradient. */ function gradientRectangle($x, $y, $width, $height, $color = 'black', $fill1 = 'black', $fill2 = 'white') { $s = &new SWFShape(); if ($color != 'none') { $color = $this->allocateColor($color); $s->setLine(1, $color['red'], $color['green'], $color['blue'], $color['alpha']); } $fill1 = $this->allocateColor($fill1); $fill2 = $this->allocateColor($fill2); $gradient = &new SWFGradient(); $gradient->addEntry(0.0, $fill1['red'], $fill1['green'], $fill1['blue'], $fill1['alpha']); $gradient->addEntry(1.0, $fill2['red'], $fill2['green'], $fill2['blue'], $fill2['alpha']); $f = $s->addFill($gradient, SWFFILL_LINEAR_GRADIENT); $f->scaleTo($width / $this->_width); $f->moveTo($x, $y); $s->setRightFill($f); $verts[0] = array('x' => $x, 'y' => $y); $verts[1] = array('x' => $x + $width, 'y' => $y); $verts[2] = array('x' => $x + $width, 'y' => $y + $height); $verts[3] = array('x' => $x, 'y' => $y + $height); $first_done = false; foreach ($verts as $vert) { if (!$first_done) { $s->movePenTo($vert['x'], $vert['y']); $first_done = true; $first_x = $vert['x']; $first_y = $vert['y']; } $s->drawLineTo($vert['x'], $vert['y']); } $s->drawLineTo($first_x, $first_y); return $this->_movie->add($s); } } From cvs at intevation.de Fri Oct 14 16:33:10 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:18 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Net_IMSP IMSP.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143310.B80A5102C04@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Net_IMSP In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Net_IMSP Added Files: IMSP.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: IMSP.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @version $Revision: 1.1 $ * @author Michael Rubinsky * @package Net_IMSP */ class Net_IMSP { /** * String containing name/IP address of imsp host. * @var string $imsp_server */ var $imsp_server = 'localhost'; /** * String containing port for imsp server. * @var string $imsp_port */ var $imsp_port = '406'; /** * Boolean to set if we should write to a log, if one is set up. * @var boolean $logEnabled */ var $logEnabled = true; // Private Declarations var $_commandPrefix = 'A'; var $_commandCount = 1; var $_tag = ''; var $_stream = null; var $_lastCommandTag = 'undefined'; var $_logger = null; var $_logSet = null; var $_logLevel = PEAR_LOG_INFO; var $_logBuffer = array(); /** * Constructor function. * * @access public * @param array $params Hash containing server parameters. */ function Net_IMSP($params) { if (is_array($params) && !empty($params['server'])) { $this->imsp_server = $params['server']; } if (is_array($params) && !empty($params['port'])) { $this->imsp_port = $params['port']; } } /** * Initialization function to be called after object is returned. This * allows errors to occur and not break the script. * * @access public * @return mixed True on success PEAR_Error on connection failure. */ function init() { $result = $this->imspOpen(); if (is_a($result, 'PEAR_Error')) { return $result; } $this->writeToLog('Initializing Net_IMSP object.', __FILE__, __LINE__, PEAR_LOG_DEBUG); return true; } /** * Logs out of the server and closes the IMSP stream * *@access public */ function logout() { $this->writeToLog('Closing Connection.'); $command_string = 'LOGOUT'; $result = $this->imspSend($command_string); if (is_a($result, 'PEAR_Error')) { fclose($this->_stream); return $result; } else { fclose($this->_stream); return true; } } /** * Returns the raw capability response from the server. * * @access public * @return string The raw capability response. */ function capability() { $command_string = 'CAPABILITY'; $result = $this->imspSend($command_string); if (is_a($result, 'PEAR_Error')) { return $result; } else { $server_response = $this->imspReceive(); if (preg_match(IMSP_CAPABILITY_RESPONSE, $server_response)) { $capability = preg_replace(IMSP_CAPABILITY_RESPONSE, '', $server_response); $server_response = $this->imspReceive(); //OK if (!$server_response == 'OK') { return $this->imspError(IMSP_UNEXPECTED_RESPONSE, __FILE__,__LINE__); } else { $this->writeToLog('CAPABILITY completed OK'); return $capability; } } } } /** * Attempts to open an IMSP socket with the server. * * @access public * @return mixed True on success PEAR_Error on failure. */ function imspOpen() { $fp = @fsockopen($this->imsp_server, $this->imsp_port); // Check for failure if (!$fp) { return $this->imspError(IMSP_CONNECTION_FAILURE, __FILE__, __LINE__); } $this->_stream = $fp; $server_response = $this->imspReceive(); if (!preg_match(IMSP_CONNECTION_OK, $server_response)) { fclose($fp); return $this->imspError(IMSP_UNEXPECTED_RESPONSE,__FILE__,__LINE__); } return true; } /** * Attempts to send a command to the server. * * @access public * @param string $commandText Text to send to the server. * @param boolean $includeTag Determines if command tag is prepended. * @param boolean $sendCRLF Determines if CRLF is appended. * @return mixed True on success PEAR_Error on failure. */ function imspSend($commandText, $includeTag=true, $sendCRLF=true) { $command_text = ''; if (!$this->_stream){ return $this->imspError(IMSP_CONNECTION_FAILURE,__FILE__,__LINE__); } if ($includeTag) { $this->_tag = $this->_getNextCommandTag(); $command_text = "$this->_tag "; } $command_text .= $commandText; if ($sendCRLF) { $command_text .= IMSP_CRLF; } $this->writeToLog('To: ' . $command_text, __FILE__, __LINE__,PEAR_LOG_DEBUG); if (!fputs($this->_stream, $command_text)) { return $this->imspError(IMSP_CONNECTION_FAILURE,__FILE__,__LINE__); } else { return true; } } /** * Receives a single CRLF terminated server response string * * @access public * @return mixed 'NO', 'BAD', 'OK', raw response or PEAR_Error. */ function imspReceive() { if (!$this->_stream){ return $this->imspError(IMSP_CONNECTION_FAILURE,__FILE__,__LINE__); } $result = fgets($this->_stream, IMSP_DEFAULT_RESPONSE_LENGTH); if (!$result) { return $this->imspError(IMSP_UNEXPECTED_RESPONSE, __FILE__,__LINE__); } $server_response = trim($result); $this->writeToLog('From: ' . $server_response, __FILE__, __LINE__, PEAR_LOG_DEBUG); /** * Parse out the response: * First make sure that this is not for a previous command. * If it is, it means we did not read all the server responses from * the last command...read them now, but throw an error. */ while (preg_match("/^" . $this->_lastCommandTag ."/", $server_response)) { $server_response = trim(fgets($this->_stream,IMSP_DEFAULT_RESPONSE_LENGTH)); $this->imspError(IMSP_UNEXPECTED_RESPONSE . ": $server_response", __FILE__,__LINE__); } $currentTag = $this->_tag; if (preg_match("/^" . $currentTag . " NO/", $server_response)) { return 'NO'; } if (preg_match("/^" . $currentTag . " BAD/", $server_response)) { $this->imspError(IMSP_SYNTAX_ERROR,__FILE__,__LINE__); return 'BAD'; } if (preg_match("/^" . $currentTag . " OK/", $server_response)) { return 'OK'; } /** * If it was not a 'NO', 'BAD' or 'OK' response, * then it's up to the calling function to decide * what to do with it. */ return $server_response; } /** * Retrieves CRLF terminated response from server and splits it into * an array delimited by a . * * @access public * @return array result from split(). */ function getServerResponseChunks() { $server_response = trim(fgets($this->_stream,IMSP_DEFAULT_RESPONSE_LENGTH)); $chunks = split(' ', $server_response); return $chunks; } /* * Receives fixed number of bytes from imsp socket. Used when * server returns a string literal. * * @access public * @param int $length Number of bytes to read from socket. * @return string Text of string literal. */ function receiveStringLiteral($length) { $temp = trim(fread($this->_stream, $length)); $this->writeToLog('From{}: ' . $temp, __FILE__, __LINE__, PEAR_LOG_DEBUG); return $temp; } /** * Increments the imsp command tag token. * * @access private * @return string Next command tag. */ function _getNextCommandTag() { $this->_lastCommandTag = $this->_tag ? $this->_tag : 'undefined'; return $this->_commandPrefix . sprintf('%04d', $this->_commandCount++); } /** * Determines if a string needs to be quoted before sending to the * server. * * @access public * @param string $string String to be tested. * @return string Original string quoted if needed. */ function quoteSpacedString($string) { if (strstr($string, ' ')) { return '"' . $string . '"'; } else { return $string; } } /** * Raises an 'imsp' error. Basically, only writes * error out to the horde logfile and returns PEAR_Error * * * @param string $err Either a PEAR_Error object or * text to write to log. * @param string $file File name where error occured. * @param int $line Line number where error occured. */ function imspError($err = '', $file=__FILE__, $line=__LINE__) { if (is_a($err, 'PEAR_Error')) { $log_text = $err->getMessage(); } else { $log_text = $err; } $this->writeToLog($log_text, $file, $line, PEAR_LOG_ERR); if (is_a($err, 'PEAR_Error')) { return $err; } else { return PEAR::raiseError($err); } } /** * Writes a message to the imsp logfile. * * @access public * @param string $message Text to write. */ function writeToLog($message, $file=__FILE__, $line=__LINE__, $priority=PEAR_LOG_INFO) { if (($this->logEnabled) && ($this->_logSet)) { if ($priority > $this->_logLevel) { return; } $logMessage = '[imsp] ' . $message . ' [on line ' . $line . ' of "' . $file . '"]'; $this->_logger->log($logMessage, $priority); } elseif ((!$this->_logSet) && ($this->logEnabled)) { $this->_logBuffer[] = array('message' => $message, 'priority' => $priority, 'file' => $file, 'line' => $line ); } } /** * Creates a new Log object based on $params * * @access public * @param array $params Log object parameters. * @return mixed True on success or PEAR_Error on failure. */ function setLogger($params) { $this->_logLevel = $params['priority']; $logger = &Log::singleton($params['type'], $params['name'], $params['ident'], $params['params']); $this->_logSet = true; if (is_a($logger, 'PEAR_Error')) { $this->logEnabled = false; return $logger; } else { $this->_logger = &$logger; $this->logEnabled = true; $this->_writeLogBuffer(); return true; } } /** * Writes out contents of $_logBuffer to log file. Allows messages * to be logged during initialization of object before Log object is * instantiated. * * @access private */ function _writeLogBuffer() { for ($i = 0; $i < count($this->_logBuffer); $i++) { $this->writeToLog($this->_logBuffer[$i]['message'], $this->_logBuffer[$i]['file'], $this->_logBuffer[$i]['line'], $this->_logBuffer[$i]['priority']); } } /** * Attempts to create a Net_IMSP object based on $driver. * Must be called as $imsp = &Net_IMSP::factory($driver, $params); * * @access public * @param string $driver Type of Net_IMSP object to return. * @param mixed $params Any parameters needed by the Net_IMSP object. * @return mixed The requested Net_IMSP object or PEAR_Error on failure. */ function &factory($driver, $params) { $driver = basename($driver); if (empty($driver) || $driver == 'none') { return $dvr = &new Net_IMSP($params); } include_once dirname(__FILE__) . '/IMSP/' . $driver . '.php'; $class = 'Net_IMSP_' . $driver; if (class_exists($class)) { return $ret = &new $class($params); } else { Horde::fatal(PEAR::raiseError(sprintf(_("Unable to load the definition of %s."), $class)), __FILE__, __LINE__); } } /** * Attempts to return a Net_IMSP object based on $driver. Only * creates a new object if one with the same parameters already * doesn't exist. * Must be called as $imsp = &Net_IMSP::singleton($driver, $params); * * @param string $driver Type of Net_IMSP object to return. * @params mixed $params Any parameters needed by the Net_IMSP object. * @return mixed Reference to the Net_IMSP object or PEAR_Error on failure. */ function &singleton($driver, $params) { static $instances; if (!isset($instances)) { $instances = array(); } $signature = serialize(array($driver, $params)); if (!isset($instances[$signature])) { $instances[$signature] = &Net_IMSP::factory($driver, $params); } return $instances[$signature]; } } --- NEW FILE: package.xml --- Net_IMSP IMSP API Provides an API into an IMSP server for Addressbooks and Options LGPL mike lead Michael Rubinsky mike@theupstairsroom.com 0.0.1 alpha 2004-02-05 Initial packaging and release of code 0.0.1 alpha 2004-02-05 Initial packaging and release of code From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:20 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Prefs/Prefs CategoryManager.php, NONE, 1.1 UI.php, NONE, 1.1 imsp.php, NONE, 1.1 ldap.php, NONE, 1.1 session.php, NONE, 1.1 sql.php, NONE, 1.1 Message-ID: <20051014143312.6C4F0102C16@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Prefs/Prefs In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Prefs/Prefs Added Files: CategoryManager.php UI.php imsp.php ldap.php session.php sql.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: CategoryManager.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_Prefs */ class Prefs_CategoryManager { /** * Get all categories. */ function get() { global $prefs; $string = $prefs->getValue('categories'); if (empty($string)) { return array(); } $categories = explode('|', $string); asort($categories); return $categories; } function getSelect($id, $current = null) { global $prefs; $html = ''; return $html; } function getJavaScript($formname, $elementname) { $prompt = addslashes(_("Please type the new category name:")); $error = addslashes(_("You must type a new category name.")); return << JAVASCRIPT; } /** * Add a new category. * * @param string $category The name of the category to add. * * @return mixed False on failure, or the new category's name. */ function add($category) { global $prefs; if ($prefs->isLocked('categories') || empty($category)) { return false; } $categories = $this->get(); if (in_array($category, $categories)) { return false; } $categories[] = $category; $prefs->setValue('categories', implode('|', $categories)); return $category; } /** * Delete a category. * * @param string $category The category to remove. * * @return boolean True on success, false on failure. */ function remove($category) { global $prefs; if ($prefs->isLocked('categories')) { return false; } $categories = $this->get(); $key = array_search($category, $categories); if ($key === false) { return $key; } unset($categories[$key]); $prefs->setValue('categories', implode('|', $categories)); // Remove any color settings for $category. $colors = $this->colors(); unset($colors[$category]); $this->setColors($colors); return true; } /** * Returns the color for each of the user's categories. * * @return array A list of colors, key is the category name, * value is the HTML color code. */ function colors() { global $prefs; /* Default values that can be overridden but must always be * present. */ $colors['_default_'] = '#FFFFFF'; $colors['_unfiled_'] = '#DDDDDD'; $pairs = explode('|', $prefs->getValue('category_colors')); foreach ($pairs as $pair) { if (!empty($pair)) { list($category, $color) = explode(':', $pair); $colors[$category] = $color; } } $colors[''] = $colors['_unfiled_']; return $colors; } function setColor($category, $color) { $colors = $this->colors(); $colors[$category] = $color; $this->setColors($colors); } function setColors($colors) { global $prefs; $pairs = array(); foreach ($colors as $category => $color) { if (!empty($category)) { $pairs[] = "$category:$color"; } } $prefs->setValue('category_colors', implode('|', $pairs)); } } --- NEW FILE: UI.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 2.1 * @package Horde_Prefs */ class Prefs_UI { /** * Determine whether or not a preferences group is editable. * * @access public * * @param string $group The preferences group to check. * * @return boolean Whether or not the group is editable. */ function groupIsEditable($group) { global $prefs, $prefGroups; static $results; if (!isset($results)) { $results = array(); } if (!isset($results[$group])) { if (!empty($group['url'])) { $results[$group] = true; } else { $results[$group] = false; if (isset($prefGroups[$group]['members'])) { foreach ($prefGroups[$group]['members'] as $pref) { if (!$prefs->isLocked($pref)) { $results[$group] = true; return true; } } } } } return $results[$group]; } /** * Handle a preferences form submission if there is one, updating * any preferences which have been changed. * * @param string $group The preferences group that was edited. * @param object $save The object where the changed values are * saved. Must implement setValue(string, string). * * @return boolean Whether preferences have been updated. */ function handleForm(&$group, &$save) { global $prefs, $prefGroups, $_prefs, $notification, $registry; $updated = false; /* Run through the action handlers */ if (Util::getFormData('actionID') == 'update_prefs') { if (isset($group) && Prefs_UI::groupIsEditable($group)) { $updated = false; foreach ($prefGroups[$group]['members'] as $pref) { if (!$prefs->isLocked($pref) || ($_prefs[$pref]['type'] == 'special')) { switch ($_prefs[$pref]['type']) { /* These either aren't set or are set in other parts of the UI. */ case 'implicit': case 'link': break; case 'select': case 'text': case 'textarea': case 'password': $updated = $updated | $save->setValue($pref, Util::getFormData($pref)); break; case 'enum': $val = Util::getFormData($pref); if (isset($_prefs[$pref]['enum'][$val])) { $updated = $updated | $save->setValue($pref, $val); } else { $notification->push(_("An illegal value was specified."), 'horde.error'); } break; case 'multienum': $vals = Util::getFormData($pref); $set = array(); $invalid = false; if (is_array($vals)) { foreach ($vals as $val) { if (isset($_prefs[$pref]['enum'][$val])) { $set[] = $val; } else { $invalid = true; continue; } } } if ($invalid) { $notification->push(_("An illegal value was specified."), 'horde.error'); } else { $updated = $updated | $save->setValue($pref, @serialize($set)); } break; case 'number': $num = Util::getFormData($pref); if (intval($num) != $num) { $notification->push(_("This value must be a number."), 'horde.error'); } elseif ($num == 0) { $notification->push(_("This number must be at least one."), 'horde.error'); } else { $updated = $updated | $save->setValue($pref, $num); } break; case 'checkbox': $val = Util::getFormData($pref); $updated = $updated | $save->setValue($pref, isset($val) ? 1 : 0); break; case 'special': /* Code for special elements must be * written specifically for each * application. */ if (function_exists('handle_' . $pref)) { $updated = $updated | call_user_func('handle_' . $pref, $updated); } break; } } } /* Do anything that we need to do as a result of * certain preferences changing. */ if ($prefs->isDirty('language')) { NLS::setLang($prefs->getValue('language')); NLS::setTextdomain($registry->getApp(), $registry->getParam('fileroot') . '/locale', NLS::getCharset()); String::setDefaultCharset(NLS::getCharset()); } if ($prefs->isDirty('language') || $prefs->isDirty('theme') || $prefs->isDirty('menu_view')) { $notification->push('if (window.parent.frames.horde_menu) window.parent.frames.horde_menu.location.reload();', 'javascript'); } if ($updated) { if (function_exists('prefs_callback')) { prefs_callback(); } $notification->push(_("Your options have been updated."), 'horde.message'); $group = null; } } } return $updated; } /** * Generate the UI for the preferences interface, either for a * specific group, or the group selection interface. * * @access public * * @param optional string $group The group to generate the UI for. */ function generateUI($group = null) { global $browser, $conf, $prefs, $prefGroups, $_prefs, $registry, $app; /* Show the header. */ Prefs_UI::generateHeader($group); /* Assign variables to hold select lists. */ if (!$prefs->isLocked('language')) { $GLOBALS['language_options'] = &$GLOBALS['nls']['languages']; } if (!empty($group) && Prefs_UI::groupIsEditable($group)) { foreach ($prefGroups[$group]['members'] as $pref) { if (!$prefs->isLocked($pref)) { /* Get the help link. */ if (isset($_prefs[$pref]['help']) && $_prefs[$pref]['help'] && $conf['user']['online_help'] && $browser->hasFeature('javascript')) { $helplink = Help::link(!empty($_prefs[$pref]['shared']) ? 'horde' : $registry->getApp(), $_prefs[$pref]['help']); } else { $helplink = null; } switch ($_prefs[$pref]['type']) { case 'implicit': break; case 'special': require $registry->getParam('templates', !empty($_prefs[$pref]['shared']) ? 'horde' : $registry->getApp()) . "/prefs/$pref.inc"; break; default: require $registry->getParam('templates', 'horde') . '/prefs/' . $_prefs[$pref]['type'] . '.inc'; break; } } } require $registry->getParam('templates', 'horde') . '/prefs/end.inc'; } else { $columns = array(); if (is_array($prefGroups)) { foreach ($prefGroups as $group => $gvals) { $col = $gvals['column']; unset($gvals['column']); $columns[$col][$group] = $gvals; } $span = round(100 / count($columns)); } else { $span = 100; } require $registry->getParam('templates', 'horde') . '/prefs/overview.inc'; } } /** * Generates the the full header of a preference screen including * menu and navigation bars. * * @access public * * @param optional string $group The group to generate the header for. */ function generateHeader($group = null) { global $registry, $prefGroups, $app, $menu, $perms; $title = _("User Options"); require $registry->getParam('templates', $app) . '/common-header.inc'; if (isset($menu) && is_a($menu, 'Menu')) { /* App has a defined menu object and can return a menu * array. */ $menu = $menu->getMenu(); /* Use the default menu template to output this menu array. */ require $registry->getParam('templates', 'horde') . '/menu/menu.inc'; } else { /* App has no menu object so is probably using a ::menu() * function. */ call_user_func(array($app, 'menu')); } if (is_callable(array($app, 'status'))) { call_user_func(array($app, 'status')); } else { $GLOBALS['notification']->notify(array('listeners' => 'status')); } /* Get list of accessible applications. */ $apps = array(); foreach ($registry->applications as $application => $params) { if ($application == 'problem' || $application == 'logout' || $params['status'] == 'heading') { continue; } /* Check if the current user has permisson to see this * application, and if the application is active. * Administrators always see all applications. */ if ((Auth::isAdmin() && ($params['status'] != 'inactive')) || (($perms->exists($application) ? $perms->hasPermission($application, Auth::getAuth(), PERMS_READ) : Auth::getAuth()) && ($params['status'] == 'active' || $params['status'] == 'notoolbar'))) { $apps[$application] = _($params['name']); } } asort($apps); /* Show the current application and a form for switching * applications. */ require $registry->getParam('templates', 'horde') . '/prefs/app.inc'; if (!empty($group) && Prefs_UI::groupIsEditable($group)) { require $registry->getParam('templates', 'horde') . '/prefs/begin.inc'; } } /** * Generate the content of the title bar navigation cell (previous * | next option group). * * @access public * * @param string $group Current option group. * @param optional string $attributes The optional attributes. */ function generateNavigationCell($group, $attributes = 'class="header" align="right"') { global $prefGroups, $registry, $app; // Search for previous and next groups. $previous = null; $next = null; $last = null; $first = null; $found = false; $finish = false; foreach ($prefGroups as $pgroup => $gval) { if (Prefs_UI::groupIsEditable($pgroup)) { if (!$first) { $first = $pgroup; } if (!$found) { if ($pgroup == $group) { $previous = $last; $found = true; } } else { if (!$finish) { $finish = true; $next = $pgroup; } } $last = $pgroup; } } if (!$previous) { $previous = $last; } if (!$next) { $next = $first; } /* Don't loop if there's only one group. */ if ($next == $previous) { return; } echo ""; if (!empty($prefGroups[$previous]['url'])) { echo Horde::link(Horde::applicationUrl($prefGroups[$previous]['url']), _("Previous options"), 'menuitem'); echo '<< ' . $prefGroups[$previous]['label']; } else { echo Horde::link(Util::addParameter(Horde::url($registry->getParam('webroot', 'horde') . '/services/prefs.php'), array('group' => $previous, 'app' => $app)), _("Previous options"), 'menuitem'); echo '<< ' . $prefGroups[$previous]['label']; } echo ' | '; if (!empty($prefGroups[$next]['url'])) { echo Horde::link(Horde::applicationUrl($prefGroups[$next]['url']), _("Next options"), 'menuitem'); echo $prefGroups[$next]['label'] . ' >>'; } else { echo Horde::link(Util::addParameter(Horde::url($registry->getParam('webroot', 'horde') . '/services/prefs.php'), array('group' => $next, 'app' => $app)), _("Next options"), 'menuitem'); echo $prefGroups[$next]['label'] . ' >>'; } echo ''; } /** * Get the default application to show preferences for. Defaults * to 'horde'. */ function getDefaultApp() { global $registry; $applications = $registry->listApps(null, true, PERMS_READ); $default = isset($applications['horde']) ? 'horde' : array_shift($applications); while ($default == 'logout' || $default == 'problem') { /* FIXME: We should probably have a better way of filtering stuff * like this out. */ $default = array_shift($applications); } return $default; } } --- NEW FILE: imsp.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @version $Revision: 1.1 $ * @author Michael Rubinsky * @package Horde_Prefs */ class Prefs_imsp extends Prefs { /** * Constructor function. * $params must contain: * 'auth_method', 'server', 'port' * * @param string $user Username of current user. * @param string $password Password for current user. * @param string $scope The scope for these preferences. * @param array $params The parameters needed for this object. * @param boolean $caching are we using session cache? */ function Prefs_imsp($user, $password = '', $scope = '', $params = null, $caching = true) { global $conf; parent::Prefs(); require_once 'Net/IMSP.php'; $this->_scope = $scope; $this->_caching = $caching; $this->_user = $user; $this->params = $params; if (preg_match('/(^.*)@/', $user, $matches)) { $this->params['username'] = $matches[1]; } else { $this->params['username'] = $user; } $this->params['password'] = $password; $this->_imsp = &Net_IMSP::singleton('Options', $this->params); $result = $this->_imsp->init(); if (is_a($result,'PEAR_Error')) { Horde::fatal($result, __FILE__, __LINE__); } $this->_imsp->setLogger($conf['log']); } /** * Retrieves the requested set of preferences from the IMSP server. * * @access public * @return mixed True on success or a PEAR_Error object on failure. */ function retrieve() { // Get the defaults. parent::retrieve(); // Get the shared prefs and remove the scope value from the // string. $global_prefs = $this->_imsp->get('horde.*'); if (is_a($global_prefs, 'PEAR_Error')) { return $global_prefs; } foreach ($global_prefs as $key => $val) { $newKey = str_replace('horde.', '', $key); if ($val == '-') { $val = $this->getDefault($newKey); } if (isset($this->_prefs[$newKey])) { $this->setValue($newKey, $val); } else { $this->add($newKey, $val, _PREF_SHARED); } // Don't forget to clean it. $this->setDirty($newKey, false); } // Now the app specific prefs. $local_prefs = $this->_imsp->get($this->_scope . '.*'); if (is_a($local_prefs, 'PEAR_Error')) { return $local_prefs; } foreach ($local_prefs as $key => $val) { $newKey = str_replace($this->_scope . '.' , '', $key); if ($val == '-') { $val = $this->getDefault($newKey); } if (isset($this->_prefs[$newKey])) { $this->setValue($newKey, $val); } else { $this->add($newKey, $val, 0); } // Clean the pref. $this->setDirty($newKey, false); } $_SESSION['prefs_cache']['_filled']['horde'] = true; $_SESSION['prefs_cache']['_filled'][$this->_scope] = true; $this->_callHooks(); $this->cacheUpdate(); return true; } /** * Stores all dirty prefs to IMSP server. * * @access public * @return mixed True on success or a PEAR_Error object on failure. */ function store() { $dirty_prefs = $this->_dirtyPrefs(); if (!count($dirty_prefs)) { return true; } foreach ($dirty_prefs as $name) { $scope = $this->getScope($name); $value = $this->getValue($name); if (empty($value)) { $value = '-'; } $result = $this->_imsp->set($scope . '.' . $name, $value); if (is_a($result, 'PEAR_Error')) { $GLOBALS['notification']->push("There was a problem saving the prefrences"); return $result; } // Clean the pref since it was just saved. $this->setDirty($name, false); } $this->cacheUpdate(); return true; } } --- NEW FILE: ldap.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Prefs */ class Prefs_ldap extends Prefs { /** * Hash containing connection parameters. * * @var array $params */ var $_params = array(); /** * Handle for the current LDAP connection. * * @var integer $connection */ var $_connection; /** * Boolean indicating whether or not we're connected to the LDAP server. * * @var boolean $_connected */ var $_connected = false; /** * String holding the user's DN. * * @var string $dn */ var $_dn = ''; /** * Constructs a new LDAP preferences object. * * @access public * * @param string $user The user who owns these preferences. * @param string $password The password associated with $user. * @param string $scope The current application scope. * @param array $params A hash containing connection * parameters. * @param optional boolean $caching Should caching be used? */ function Prefs_ldap($user, $password, $scope = '', $params = array(), $caching = false) { if (!Util::extensionExists('ldap')) { Horde::fatal(PEAR::raiseError(_("Prefs_ldap: Required LDAP extension not found."), __FILE__, __LINE__)); } $this->_user = $user; $this->_scope = $scope; $this->_params = $params; $this->_caching = $caching; /* If a valid server port has not been specified, set the default. */ if (!isset($this->_params['port']) || !is_int($this->_params['port'])) { $this->_params['port'] = 389; } /* If $params['rootdn'] is empty, authenticate as the current user. Note: This assumes the user is allowed to modify their own LDAP entry. */ if (empty($this->_params['username']) && empty($this->_params['rootdn'])) { $this->_params['username'] = $user; $this->_params['password'] = $password; } parent::Prefs(); } /** * Opens a connection to the LDAP server. * * @access private * * @return mixed True on success or a PEAR_Error object on failure. */ function _connect() { /* Return if already connected. */ if ($this->_connected) { return true; } Horde::assertDriverConfig($this->_params, 'prefs', array('hostspec', 'basedn', 'uid', 'rootdn', 'password'), 'preferences LDAP'); /* Connect to the LDAP server anonymously. */ $conn = ldap_connect($this->_params['hostspec'], $this->_params['port']); if (!$conn) { Horde::logMessage( sprintf('Failed to open an LDAP connection to %s.', $this->_params['hostspec']), __FILE__, __LINE__); return false; } /* Set the LDAP protocol version. */ if (isset($this->_params['version'])) { if (!ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, $this->_params['version'])) { Horde::logMessage( sprintf('Set LDAP protocol version to %d failed: [%d] %s', $this->_params['version'], ldap_errno($this->_connection), ldap_error($this->_connection)), __FILE__, __LINE__); } } /* Register our callback function to handle referrals. */ if (function_exists('ldap_set_rebind_proc') && !ldap_set_rebind_proc($conn, array($this, '_rebindProc'))) { Horde::logMessage( sprintf('Set rebind proc failed: [%d] %s', ldap_errno($this->_connection), ldap_error($this->_connection)), __FILE__, __LINE__); return false; } /* Define the DN of the current user */ $this->_dn = sprintf('%s=%s,%s', $this->_params['uid'], $this->_user, $this->_params['basedn']); /* And the DN of the authenticating user (may be the same as above) */ if (!empty($this->_params['rootdn'])) { $bind_dn = $this->_params['rootdn']; } else { $bind_dn = sprintf('%s=%s,%s', $this->_params['uid'], $this->_params['username'], $this->_params['basedn']); } /* Store the connection handle at the instance level. */ $this->_connection = $conn; $this->_connected = true; /* Bind to the LDAP server as the authenticating user. */ $bind = @ldap_bind($this->_connection, $bind_dn, $this->_params['password']); if (!$bind) { Horde::logMessage( sprintf('Bind to server %s:%d with DN %s failed: [%d] %s', $this->_params['hostspec'], $this->_params['port'], $bind_dn, ldap_errno($this->_connection), ldap_error($this->_connection)), __FILE__, __LINE__); return false; } /* Search for the user's full DN. */ $search = ldap_search($this->_connection, $this->_params['basedn'], $this->_params['uid'] . '=' . $this->_user, array('dn')); if ($search) { $result = ldap_get_entries($this->_connection, $search); if ($result && !empty($result[0]['dn'])) { $this->_dn = $result[0]['dn']; } } else { Horde::logMessage( sprintf('Failed to retrieve user\'s DN: [%d] %s', ldap_errno($this->_connection), ldap_error($this->_connection)), __FILE__, __LINE__); return false; } return true; } /** * Disconnect from the LDAP server and clean up the connection. * * @access private * * @return boolean True on success, false on failure. */ function _disconnect() { if ($this->_connected) { $this->_dn = ''; $this->_connected = false; return ldap_close($this->_connection); } else { return true; } } /** * Callback function for LDAP referrals. This function is called when an * LDAP operation returns a referral to an alternate server. * * @access private * * @return integer 1 on error, 0 on success. * * @since Horde 2.1 */ function _rebindProc($conn, $who) { /* Strip out the hostname we're being redirected to. */ $who = preg_replace(array('|^.*://|', '|:\d*$|'), '', $who); /* Figure out the DN of the authenticating user. */ if (!empty($this->_params['rootdn'])) { $bind_dn = $this->_params['rootdn']; } else { $bind_dn = sprintf('%s=%s,%s', $this->_params['uid'], $this->_params['username'], $this->_params['basedn']); } /* Make sure the server we're being redirected to is in our list of valid servers. */ if (!strstr($this->_params['hostspec'], $who)) { Horde::logMessage( sprintf('Referral target %s for DN %s is not in the authorized server list!', $who, $bind_dn), __FILE__, __LINE__); return 1; } /* Bind to the new server. */ $bind = @ldap_bind($conn, $bind_dn, $this->_params['password']); if (!$bind) { Horde::logMessage( sprintf('Rebind to server %s:%d with DN %s failed: [%d] %s', $this->_params['hostspec'], $this->_params['port'], $bind_dn, ldap_errno($this->_connection), ldap_error($this->_connection)), __FILE__, __LINE__); } return 0; } /** * Retrieves the requested set of preferences from the user's LDAP * entry. * * @access public * * @return mixed True on success or a PEAR_Error object on failure. */ function retrieve() { /* Attempt to pull the values from the session cache first. */ if ($this->cacheLookup()) { return true; } /* Load defaults to make sure we have all preferences. */ parent::retrieve(); /* Make sure we are connected. */ $this->_connect(); /* Only fetch the fields for the attributes we need. */ $attrs = array('hordePrefs'); if (strcmp($this->_scope, 'horde') != 0) { array_push($attrs, $this->_scope . 'Prefs'); } /* Search for the multi-valued field containing the array of preferences. */ $search = ldap_search($this->_connection, $this->_params['basedn'], $this->_params['uid'] . '=' . $this->_user, $attrs); if ($search) { $result = ldap_get_entries($this->_connection, $search); } else { Horde::logMessage('Failed to connect to LDAP preferences server.', __FILE__, __LINE__); } /* ldap_get_entries() converts attribute indexes to lowercase. */ $field = String::lower($this->_scope . 'prefs'); if (isset($result)) { /* Set the requested values in the $this->_prefs hash based on the contents of the LDAP result. Preferences are stored as colon-separated name:value pairs. Each pair is stored as its own attribute off of the multi- value attribute named in: $this->_scope . 'Prefs' Note that Prefs::setValue() can't be used here because of the check for the "changeable" bit. We want to override that check when populating the $this->_prefs hash from the LDAP server. */ $prefs = array(); /* If hordePrefs exists, merge them as the base of the prefs. */ if (isset($result[0]['hordeprefs'])) { $prefs = array_merge($prefs, $result[0]['hordeprefs']); } /* If this scope's prefs are available, merge them as will. Give * them a higher precedence than hordePrefs. */ if (strcmp($this->_scope, 'horde') != 0) { if (isset($result[0][$field])) { $prefs = array_merge($prefs, $result[0][$field]); } } foreach ($prefs as $prefstr) { /* If the string doesn't contain a colon delimiter, skip it. */ if (substr_count($prefstr, ':') == 0) { continue; } /* Split the string into its name:value components. */ list($pref, $val) = split(':', $prefstr, 2); /* Retrieve this preference. */ if (isset($this->_prefs[$pref])) { $this->_setValue($pref, base64_decode($val), false); $this->setDefault($pref, false); } else { $this->add($pref, base64_decode($val), _PREF_SHARED); } } /* Make sure we know that we've loaded these * preferences. */ $_SESSION['prefs_cache']['_filled']['horde'] = true; $_SESSION['prefs_cache']['_filled'][$this->_scope] = true; /* Call hooks. */ $this->_callHooks(); } else { Horde::logMessage('No preferences were retrieved.', __FILE__, __LINE__); return; } /* Update the session cache. */ $this->cacheUpdate(); return true; } /** * Stores preferences to the LDAP server. * * @access public * * @return mixed True on success or a PEAR_Error object on failure. */ function store() { $updated = true; /* Check for any "dirty" preferences. If no "dirty" * preferences are found, there's no need to update the LDAP * server. Exit successfully. */ $dirty_prefs = $this->_dirtyPrefs(); if (!count($dirty_prefs)) { return true; } /* Make sure we are connected. */ $this->_connect(); /* Build a hash of the preferences and their values that need * to be stored in the LDAP server. Because we have to update * all of the values of a multi-value entry wholesale, we * can't just pick out the dirty preferences; we must update * everything. */ $new_values = array(); foreach (array_keys($this->_prefs) as $pref) { // Don't store locked preferences. if (!$this->isLocked($pref)) { $entry = $pref . ':' . base64_encode($this->getValue($pref)); $field = $this->getScope($pref) . 'Prefs'; $new_values[$field][] = $entry; } } /* Entries must have the objectclasses 'top' and 'hordeperson' * to successfully store LDAP prefs. Check for both of them, * and add them if necessary. */ $search = ldap_search($this->_connection, $this->_params['basedn'], $this->_params['uid'] . '=' . $this->_user, array('objectclass')); if ($search) { $result = ldap_get_entries($this->_connection, $search); if ($result) { $top = false; $hordeperson = false; for ($i = 0; $i < $result[0]['objectclass']['count']; $i++) { if ($result[0]['objectclass'][$i] == 'top') { $top = true; } elseif ($result[0]['objectclass'][$i] == 'hordePerson') { $hordeperson = true; } } /* Add any missing objectclasses. */ if (!$top) { ldap_mod_add($this->_connection, $this->_dn, array('objectclass' => 'top')); } if (!$hordeperson) { ldap_mod_add($this->_connection, $this->_dn, array('objectclass' => 'hordePerson')); } } } /* Send the hash to the LDAP server. */ if (ldap_mod_replace($this->_connection, $this->_dn, $new_values)) { foreach ($dirty_prefs as $pref) { $this->setDirty($pref, false); } } else { Horde::logMessage( sprintf('Unable to modify preferences: [%d] %s', ldap_errno($this->_connection), ldap_error($this->_connection)), __FILE__, __LINE__); $updated = false; } /* Attempt to cache the preferences in the session. */ $this->cacheUpdate(); return $updated; } /** * Perform cleanup operations. * * @access public * * @param optional boolean $all Cleanup all Horde preferences. */ function cleanup($all = false) { /* Close the LDAP connection. */ $this->_disconnect(); parent::cleanup($all); } } --- NEW FILE: session.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3.4 * @package Horde_Prefs */ class Prefs_session extends Prefs { /** * Constructs a new session preferences object. * * @access public * * @param string $user The user who owns these preferences. (Unused) * @param string $password The password associated with $user. (Unused) * @param string $scope The current preferences scope. * @param array $params (optional) A hash containing connection * parameters. (Unused) * @param boolean $caching (optional) Should caching be used? (Unused) * */ function Prefs_session($user, $password = '', $scope = '', $params = null, $caching = true) { if (!Util::extensionExists('session')) { Horde::fatal(PEAR::raiseError(_("Prefs_session: Required session extension not found."), __FILE__, __LINE__)); } $this->_scope = $scope; parent::Prefs(); } /** * Retrieves the requested set of preferences from the current session. * * @access public * * @return mixed True on success or a PEAR_Error object on failure. */ function retrieve() { /* Load defaults to make sure we have all preferences. */ parent::retrieve(); $global_prefs = array(); $local_prefs = array(); /* Retrieve global and local preferences from the session variable. */ if (isset($_SESSION['horde_prefs']['horde'])) { $global_prefs = $_SESSION['horde_prefs']['horde']; } if (isset($_SESSION['horde_prefs'][$this->_scope])) { $local_prefs = $_SESSION['horde_prefs'][$this->_scope]; } /* Retrieve and store the local and global preferences. */ $this->_prefs = array_merge($this->_prefs, $global_prefs, $local_prefs); /* Call hooks. */ $this->_callHooks(); return true; } /** * Stores preferences in the current session. * * @access public * * @param optional array $prefs An array listing the preferences to be * stored. If not specified, store all the * preferences listed in the $prefs hash. * * @return mixed True on success or a PEAR_Error object on failure. */ function store($prefs = array()) { /* Create and register the preferences array, if necessary. */ if (!isset($_SESSION['horde_prefs'])) { $_SESSION['horde_prefs'] = array(); } /* Copy the current preferences into the session variable. */ foreach ($this->_prefs as $name => $pref) { $scope = $this->getScope($name); $_SESSION['horde_prefs'][$scope][$name] = $pref; } return true; } /** * Perform cleanup operations. * * @access public * * @param optional boolean $all Cleanup all Horde preferences. */ function cleanup($all = false) { /* Perform a Horde-wide cleanup? */ if ($all) { unset($_SESSION['horde_prefs']); } else { unset($_SESSION['horde_prefs'][$this->_scope]); $_SESSION['horde_prefs']['_filled'] = false; } parent::cleanup($all); } } --- NEW FILE: sql.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jon Parise * @version $Revision: 1.1 $ * @since Horde 1.3 * @package Horde_Prefs */ class Prefs_sql extends Prefs { /** * Hash containing connection parameters. * * @var array $params */ var $_params = array(); /** * Handle for the current database connection. * * @var object DB $db */ var $_db; /** * Boolean indicating whether or not we're connected to the SQL server. * * @var boolean $_connected */ var $_connected = false; /** * Constructs a new SQL preferences object. * * @access public * * @param string $user The user who owns these preferences. * @param string $password The password associated with $user. * (Unused) * @param string $scope The current preferences scope. * @param array $params A hash containing connection * parameters. * @param optional boolean $caching Should caching be used? */ function Prefs_sql($user, $password = '', $scope = '', $params = array(), $caching = false) { $this->_user = $user; $this->_scope = $scope; $this->_params = $params; $this->_caching = $caching; parent::Prefs(); } /** * Returns the charset used by the concrete preference backend. * * @access public * * @return string The preference backend's charset. */ function getCharset() { return $this->_params['charset']; } /** * Retrieves the requested set of preferences from the user's database * entry. * * @access public * * @param optional array $prefs An array listing the preferences to * retrieve. If not specified, retrieve all * of the preferences listed in the $prefs * hash. * * @return mixed True on success or a PEAR_Error object on failure. */ function retrieve($prefs = array()) { /* Attempt to pull the values from the session cache first. */ if ($this->cacheLookup()) { return true; } /* Load defaults to make sure we have all preferences. */ parent::retrieve(); /* Make sure we're connected. */ $this->_connect(); /* Build the SQL query. */ $query = 'SELECT pref_scope, pref_name, pref_value FROM '; $query .= $this->_params['table'] . ' '; $query .= 'WHERE pref_uid = ' . $this->_db->quote($this->_user); $query .= ' AND (pref_scope = ' . $this->_db->quote($this->_scope); $query .= " OR pref_scope = 'horde') ORDER BY pref_scope"; Horde::logMessage(sprintf('SQL Query by Prefs_sql::retrieve(): %s', $query), __FILE__, __LINE__, PEAR_LOG_DEBUG); /* Execute the query. */ $result = $this->_db->query($query); if (isset($result) && !is_a($result, 'PEAR_Error')) { $row = $result->fetchRow(DB_FETCHMODE_ASSOC); if (is_a($row, 'PEAR_Error')) { Horde::logMessage($row, __FILE__, __LINE__, PEAR_LOG_ERR); return; } /* Set the requested values in the $this->_prefs hash based on the contents of the SQL result. Note that Prefs::setValue() can't be used here because of the check for the "changeable" bit. We want to override that check when populating the $this->_prefs hash from the SQL server. */ while ($row && !is_a($row, 'PEAR_Error')) { $name = trim($row['pref_name']); if (isset($this->_prefs[$name])) { $this->_setValue($name, $this->_convertFromDriver($row['pref_value']), false); $this->setDirty($name, false); } else { $this->add($name, $this->_convertFromDriver($row['pref_value']), $row['pref_scope'] == 'horde' ? _PREF_SHARED : 0); } $row = $result->fetchRow(DB_FETCHMODE_ASSOC); } /* Make sure we know that we've loaded these * preferences. */ $_SESSION['prefs_cache']['_filled']['horde'] = true; $_SESSION['prefs_cache']['_filled'][$this->_scope] = true; /* Call hooks. */ $this->_callHooks(); } else { Horde::logMessage('No preferences were retrieved.', __FILE__, __LINE__, PEAR_LOG_DEBUG); return; } /* Update the session cache. */ $this->cacheUpdate(); return true; } /** * Stores preferences to SQL server. * * @access public * * @return mixed True on success or a PEAR_Error object on failure. */ function store() { /* Check for any "dirty" preferences. If no "dirty" preferences are found, there's no need to update the SQL server. Exit successfully. */ $dirty_prefs = $this->_dirtyPrefs(); if (!count($dirty_prefs)) { return true; } /* Make sure we're connected. */ $this->_connect(); /* Loop through the "dirty" preferences. If a row already exists for this preference, attempt to update it. Otherwise, insert a new row. */ foreach ($dirty_prefs as $name) { // Don't store locked preferences. if ($this->isLocked($name)) { continue; } $scope = $this->getScope($name); /* Does an entry already exist for this preference? */ $query = 'SELECT 1 FROM '; $query .= $this->_params['table'] . ' '; $query .= 'WHERE pref_uid = ' . $this->_db->quote($this->_user); $query .= ' AND pref_name = ' . $this->_db->quote($name); $query .= ' AND (pref_scope = ' . $this->_db->quote($scope); $query .= " OR pref_scope = 'horde')"; /* Execute the query. */ $check = $this->_db->getOne($query); /* Return an error if the query fails. */ if (is_a($check, 'PEAR_Error')) { Horde::logMessage('Failed retrieving prefs for ' . $this->_user, __FILE__, __LINE__, PEAR_LOG_ERR); return PEAR::raiseError(_("Failed retrieving preferences.")); } /* Is there an existing row for this preference? */ if (!empty($check)) { /* Update the existing row. */ $query = 'UPDATE ' . $this->_params['table'] . ' '; $query .= 'SET pref_value = ' . $this->_db->quote($this->_convertToDriver((string)$this->getValue($name))); $query .= ' WHERE pref_uid = ' . $this->_db->quote($this->_user); $query .= ' AND pref_name = ' . $this->_db->quote($name); $query .= ' AND pref_scope = ' . $this->_db->quote($scope); $result = $this->_db->query($query); /* Return an error if the update fails. */ if (is_a($result, 'PEAR_Error')) { Horde::fatal($result, __FILE__, __LINE__); } } else { /* Insert a new row. */ $query = 'INSERT INTO ' . $this->_params['table'] . ' '; $query .= '(pref_uid, pref_scope, pref_name, pref_value) VALUES'; $query .= '(' . $this->_db->quote($this->_user) . ', '; $query .= $this->_db->quote($scope) . ', ' . $this->_db->quote($name) . ', '; $query .= $this->_db->quote($this->_convertToDriver((string)$this->getValue($name))) . ')'; $result = $this->_db->query($query); /* Return an error if the insert fails. */ if (is_a($result, 'PEAR_Error')) { Horde::fatal($result, __FILE__, __LINE__); } } /* Mark this preference as "clean" now. */ $this->setDirty($name, false); } /* Update the session cache. */ $this->cacheUpdate(); return true; } /** * Perform cleanup operations. * * @access public * * @param optional boolean $all Cleanup all Horde preferences. */ function cleanup($all = false) { /* Close the database connection. */ $this->_disconnect(); parent::cleanup($all); } /** * Attempts to open a persistent connection to the SQL server. * * @access private * * @return mixed True on success or a PEAR_Error object on failure. */ function _connect() { /* Check to see if we are already connected. */ if ($this->_connected) { return true; } Horde::assertDriverConfig($this->_params, 'prefs', array('phptype', 'hostspec', 'username', 'database', 'charset'), 'preferences SQL'); if (!isset($this->_params['table'])) { $this->_params['table'] = 'horde_prefs'; } if (!isset($this->_params['password'])) { $this->_params['password'] = ''; } /* Connect to the SQL server using the supplied parameters. */ require_once 'DB.php'; $this->_db = &DB::connect($this->_params, array('persistent' => !empty($this->_params['persistent']))); if (is_a($this->_db, 'PEAR_Error')) { Horde::fatal($this->_db, __FILE__, __LINE__); } /* Enable the "portability" option. */ $this->_db->setOption('optimize', 'portability'); $this->_connected = true; return true; } /** * Disconnect from the SQL server and clean up the connection. * * @access private * * @return boolean True on success, false on failure. */ function _disconnect() { if ($this->_connected) { $this->_connected = false; return $this->_db->disconnect(); } else { return true; } } /** * Converts a value from the driver's charset to the default charset. * * @param mixed $value A value to convert. * @return mixed The converted value. */ function _convertFromDriver($value) { return String::convertCharset($value, $this->_params['charset'], NLS::getCharset()); } /** * Converts a value from the default charset to the driver's charset. * * @param mixed $value A value to convert. * @return mixed The converted value. */ function _convertToDriver($value) { return String::convertCharset($value, NLS::getCharset(), $this->_params['charset']); } } From cvs at intevation.de Fri Oct 14 16:33:12 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:22 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/RPC/RPC soap.php, NONE, 1.1 syncml.php, NONE, 1.1 syncml_wbxml.php, NONE, 1.1 webdav.php, NONE, 1.1 xmlrpc.php, NONE, 1.1 Message-ID: <20051014143312.9D28F102C79@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/RPC/RPC In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/RPC/RPC Added Files: soap.php syncml.php syncml_wbxml.php webdav.php xmlrpc.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: soap.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_RPC */ class Horde_RPC_soap extends Horde_RPC { /** * Resource handler for the RPC server. * @var object $_server */ var $_server; /** * Hash holding all methods' signatures. * @var array $__dispatch_map */ var $__dispatch_map = array(); /** * SOAP server constructor * * @access private * @return object An RPC server instance */ function Horde_RPC_soap() { parent::Horde_RPC(); global $registry; require_once 'SOAP/Server.php'; $this->_server = &new SOAP_Server(); $this->_server->_auto_translation = true; } /** * Fills a hash that is used by the SOAP server with the signatures of * all available methods. */ function _setupDispatchMap() { global $registry; $methods = $registry->listMethods(); foreach ($methods as $method) { $signature = $registry->getSignature($method); if (!is_array($signature)) { continue; } $method = str_replace('/', '.', $method); $this->__dispatch_map[$method] = array( 'in' => $signature[0], 'out' => array('output' => $signature[1]) ); } $this->__typedef = $registry->listTypes(); } /** * Returns the signature of a method. * Internally used by the SOAP server. * * @param string $method A method name. * * @return array An array describing the method's signature. */ function __dispatch($method) { global $registry; $method = str_replace('.', '/', $method); $signature = $registry->getSignature($method); if (!is_array($signature)) { return null; } return array('in' => $signature[0], 'out' => array('output' => $signature[1])); } /** * Will be registered as the handler for all methods called in the * SOAP server and will call the appropriate function through the registry. * * @access private * * @param string $method The name of the method called by the RPC request. * @param array $params The passed parameters. * @param mixed $data Unknown. * * @return mixed The result of the called registry method. */ function _dispatcher($method, $params) { global $registry; $method = str_replace('.', '/', $method); if (!$registry->hasMethod($method)) { return sprintf(_("Method '%s' is not defined"), $method); } return $registry->call($method, $params); } /** * Takes an RPC request and returns the result. * * @param string The raw request string. * @param string (optional) String specifying what kind of data to * return. Defaults to SOAP request. Possible other values: * "wdsl" and "disco". * * @return string The XML encoded response from the server. */ function getResponse($request, $params = null) { $this->_server->addObjectMap($this, 'urn:horde'); if (!$params) { $this->_server->setCallHandler(array($this, '_dispatcher')); /* We can't use Util::bufferOutput() here for some reason. */ ob_start(); $this->_server->service($request); $output = ob_get_contents(); ob_end_clean(); } else { require_once 'SOAP/Disco.php'; $disco = new SOAP_DISCO_Server($this->_server, 'horde'); if ($params == 'wsdl') { $this->_setupDispatchMap(); $output = $disco->getWSDL(); } else { $output = $disco->getDISCO(); } } return $output; } /** * Builds an SOAP request and sends it to the SOAP server. * * This statically called method is actually the SOAP client. * * @param string $url The path to the SOAP server on the called host. * @param string $method The method to call. * @param array $params (optional) A hash containing any necessary * parameters for the method call. * @param $options Optional associative array of parameters which can be: * user - Basic Auth username * pass - Basic Auth password * proxy_host - Proxy server host * proxy_port - Proxy server port * proxy_user - Proxy auth username * proxy_pass - Proxy auth password * timeout - Connection timeout in seconds. * allowRedirects - Whether to follow redirects or not * maxRedirects - Max number of redirects to follow * namespace * soapaction * from - SMTP, from address * transfer-encoding - SMTP, sets the * Content-Transfer-Encoding header * subject - SMTP, subject header * headers - SMTP, array-hash of extra smtp * headers * * @return mixed The returned result from the method or a PEAR * error object on failure. */ function request($url, $method, $params = null, $options = array()) { if (!isset($options['timeout'])) { $options['timeout'] = 5; } if (!isset($options['allowRedirects'])) { $options['allowRedirects'] = true; $options['maxRedirects'] = 3; } require_once 'SOAP/Client.php'; $soap = &new SOAP_Client($url, false, false, $options); return $soap->call($method, $params, $options['namespace']); } } --- NEW FILE: syncml.php --- , Anthony Mills * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_RPC */ class Horde_RPC_syncml extends Horde_RPC { /** * Output ContentHandler used to output XML events. * @var object $_output */ var $_output; /** * @var integer $_xmlStack */ var $_xmlStack = 0; /** * Debug directory, if set will store copies of all packets. */ var $_debugDir = '/tmp/sync'; /** * Default character set. Only supports UTF-8(ASCII?). */ var $_charset = 'UTF-8'; /** * SyncML handles authentication internally, so bypass the * system-level auth check by just returning true here. */ function authorize() { return true; } /** * Sends an RPC request to the server and returns the result. * * @param string $request The raw request string. * * @return string The XML encoded response from the server. */ function getResponse($request) { // Very useful for debugging. Logs the xml packets to $this->_debugDir if (isset($this->_debugDir)) { $packetNum = @intval(file_get_contents($this->_debugDir . '/syncml.packetnum')); if (!isset($packetNum)) { $packetNum = 0; } $f = @fopen($this->_debugDir . '/syncml_client_' . $packetNum . '.xml', 'wb'); if ($f) { fwrite($f, $request); fclose($f); } } // $this->_output can be already set by a subclass. // The subclass can use it's own ContentHandler and bypass // this classes use of the ContentHandler. In this case // no output is return from this method, instead the output // comes from the subclasses ContentHandler // We may need to add this code back when we get to the content //if (!isset($this->_output)) { include_once 'XML/WBXML/ContentHandler.php'; $this->_output = &new XML_WBXML_ContentHandler(); //} $this->_parse($request); $xmlinput = $this->_output->getOutput(); // Very useful for debugging. if (isset($this->_debugDir)) { $f = @fopen($this->_debugDir . '/syncml_server_' . $packetNum . '.xml', 'wb'); if ($f) { fwrite($f, $xmlinput); fclose($f); } $packetNum++; $f = @fopen($this->_debugDir . '/syncml.packetnum', 'wb'); if ($f) { fwrite($f, $packetNum); fclose($f); } } return $xmlinput; } function _parse($xml) { // Create the XML parser and set method references. $this->_parser = xml_parser_create_ns($this->_charset); xml_set_object($this->_parser, $this); xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler($this->_parser, '_startElement', '_endElement'); xml_set_character_data_handler($this->_parser, '_characters'); xml_set_processing_instruction_handler($this->_parser, ''); xml_set_external_entity_ref_handler($this->_parser, ''); if (!xml_parse($this->_parser, $xml)) { return $this->raiseError(sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($this->_parser)), xml_get_current_line_number($this->_parser))); } xml_parser_free($this->_parser); } function _startElement($parser, $tag, $attributes) { list($uri, $name) = $this->_splitURI($tag); $this->startElement($uri, $name, $attributes); } function _characters($parser, $chars) { $this->characters($chars); } function _endElement($parser, $tag) { list($uri, $name) = $this->_splitURI($tag); $this->endElement($uri, $name); } function _splitURI($tag) { $parts = explode(':', $tag); $name = array_pop($parts); $uri = implode(':', $parts); return array($uri, $name); } /** * Get the Content-Type of the response. * * @return string The MIME Content-Type of the RPC response. */ function getResponseContentType() { return 'application/vnd.syncml+xml'; } function startElement($uri, $element, $attrs) { $this->_xmlStack++; switch ($this->_xmlStack) { case 1: // // Defined in SyncML Representation Protocol, version 1.1 5.2.1 $this->_output->startElement($uri, $element, $attrs); break; case 2: // Either or if (!isset($this->_contentHandler)) { // If not defined then create SyncHdr. $this->_contentHandler = &new Horde_SyncML_SyncmlHdr(); $this->_contentHandler->setOutput($this->_output); } $this->_contentHandler->startElement($uri, $element, $attrs); break; default: if (isset($this->_contentHandler)) { $this->_contentHandler->startElement($uri, $element, $attrs); } break; } } function endElement($uri, $element) { switch ($this->_xmlStack) { case 1: // // Defined in SyncML Representation Protocol, version 1.1 5.2.1 $this->_output->endElement($uri, $element); break; case 2: // Either or if ($element == 'SyncHdr') { // Then we get the state from SyncMLHdr, and create a // new SyncMLBody. $this->_contentHandler->endElement($uri, $element); unset($this->_contentHandler); $this->_contentHandler = &new Horde_SyncML_SyncmlBody(); $this->_contentHandler->setOutput($this->_output); } else { // No longer used. $this->_contentHandler->endElement($uri, $element); unset($this->_contentHandler); } break; default: // or if (isset($this->_contentHandler)) { $this->_contentHandler->endElement($uri, $element); } break; } if (isset($this->_chars)) { unset($this->_chars); } $this->_xmlStack--; } function characters($str) { if (isset($this->_contentHandler)) { $this->_contentHandler->characters($str); } } function raiseError($str) { Horde::logMEssage($str, __FILE__, __LINE__, PEAR_LOG_ERR); } } --- NEW FILE: syncml_wbxml.php --- , Anthony Mills * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @author Anthony Mills * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_RPC */ class Horde_RPC_syncml_wbxml extends Horde_RPC_syncml { /** * Sends an RPC request to the server and returns the result. * * @param string $request The raw request string. * * @return string The WBXML encoded response from the server (binary). */ function getResponse($request) { // Very useful for debugging. Logs the wbxml packets to $this->_debugDir if (isset($this->_debugDir)) { $packetNum = @intval(file_get_contents($this->_debugDir . '/syncml_wbxml.packetnum')); if (!isset($packetNum)) { $packetNum = 0; } $fp = fopen($this->_debugDir . '/syncml_client_' . $packetNum . '.wbxml', 'wb'); fwrite($fp, $request); fclose($fp); } $decoder = &new XML_WBXML_Decoder(); $xmlinput = $decoder->decode($request); if (is_a($xmlinput, 'PEAR_Error')) { return ''; } $xmloutput = parent::getResponse($xmlinput); $encoder = &new XML_WBXML_Encoder(); $encoder->setVersion($decoder->getVersion()); $encoder->setCharset($decoder->getCharsetStr()); $wbxmloutput = $encoder->encode($xmloutput); if (isset($this->_debugDir)) { $fp = fopen($this->_debugDir . '/syncml_server_' . $packetNum . '.wbxml', 'wb'); fwrite($fp, $wbxmloutput); fclose($fp); $packetNum++; $f = fopen($this->_debugDir . '/syncml_wbxml.packetnum', 'wb'); fwrite($f, $packetNum); fclose($f); } return $wbxmloutput; } /** * Get the Content-Type of the response. * * @return string The MIME Content-Type of the RPC response. */ function getResponseContentType() { return 'application/vnd.syncml+wbxml'; } } --- NEW FILE: webdav.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Chuck Hagenbuch * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_RPC */ class Horde_RPC_webdav extends Horde_RPC { /** * Resource handler for the WebDAV server. * @var object HTTP_WebDAV_Server_Horde $_server */ var $_server; /** * WebDav server constructor. * * @access private * @return object An RPC server instance */ function Horde_RPC_xmlrpc() { parent::Horde_RPC(); $this->_server = &new HTTP_WebDAV_Server_Horde(); } /** * Sends an RPC request to the server and returns the result. * * @param string The raw request string. * * @return string The XML encoded response from the server. */ function getResponse($request) { $this->_server->ServeRequest(); exit; } /** * WebDAV handles authentication internally, so bypass the * system-level auth check by just returning true here. */ function authorize() { return true; } } /** * Horde extension of the base HTTP_WebDAV_Server class. * * @package Horde_RPC */ class HTTP_WebDAV_Server_Horde extends HTTP_WebDAV_Server { /** * GET implementation. * * @param array &$params Array of input and output parameters. *
    input
      *
    • path - *
    *
    output
      *
    • size - *
    * * @return integer HTTP-Statuscode. */ function GET(&$params) { return true; } /** * Check authentication. We always return true here since we * handle permissions based on the resource that's requested, but * we do record the authenticated user for later use. * * @param string $type Authentication type, e.g. "basic" or "digest" * @param string $username Transmitted username. * @param string $password Transmitted password. * * @return boolean Authentication status. Always true. */ function check_auth($type, $username, $password) { $auth = &Auth::singleton($GLOBALS['conf']['auth']['driver']); $auth->authenticate($username, array('password' => $password)); return true; } } --- NEW FILE: xmlrpc.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jan Schneider * @version $Revision: 1.1 $ * @since Horde 3.0 * @package Horde_RPC */ class Horde_RPC_xmlrpc extends Horde_RPC { /** * Resource handler for the XMLRPC server. * @var object $_server */ var $_server; /** * XMLRPC server constructor * * @access private * @return object A RPC server instance */ function Horde_RPC_xmlrpc() { parent::Horde_RPC(); $this->_server = xmlrpc_server_create(); foreach ($GLOBALS['registry']->listMethods() as $method) { xmlrpc_server_register_method($this->_server, str_replace('/', '.', $method), array('Horde_RPC_xmlrpc', '_dispatcher')); } } /** * Cleans up the RPC server. */ function shutdown() { xmlrpc_server_destroy($this->_server); } /** * Sends an RPC request to the server and returns the result. * * @param string The raw request string. * * @return string The XML encoded response from the server. */ function getResponse($request) { $response = null; return xmlrpc_server_call_method($this->_server, $request, $response); } /** * Will be registered as the handler for all available methods * and will call the appropriate function through the registry. * * @access private * * @param string $method The name of the method called by the RPC request. * @param array $params The passed parameters. * @param mixed $data Unknown. * * @return mixed The result of the called registry method. */ function _dispatcher($method, $params, $data) { global $registry; $method = str_replace('.', '/', $method); if (!$registry->hasMethod($method)) { return sprintf(_("Method '%s' is not defined"), $method); } return $registry->call($method, $params); } /** * Builds an XMLRPC request and sends it to the XMLRPC server. * * This statically called method is actually the XMLRPC client. * * @param string $url The path to the XMLRPC server on the called host. * @param string $method The method to call. * @param array $params (optional) A hash containing any necessary * parameters for the method call. * @param $options Optional associative array of parameters which can be: * user - Basic Auth username * pass - Basic Auth password * proxy_host - Proxy server host * proxy_port - Proxy server port * proxy_user - Proxy auth username * proxy_pass - Proxy auth password * timeout - Connection timeout in seconds. * allowRedirects - Whether to follow redirects or not * maxRedirects - Max number of redirects to follow * * @return mixed The returned result from the method or a PEAR * error object on failure. */ function request($url, $method, $params = null, $options = array()) { $options['method'] = 'POST'; $language = isset($GLOBALS['language']) ? $GLOBALS['language'] : (isset($_SERVER['LANG']) ? $_SERVER['LANG'] : ''); if (!isset($options['timeout'])) { $options['timeout'] = 5; } if (!isset($options['allowRedirects'])) { $options['allowRedirects'] = true; $options['maxRedirects'] = 3; } require_once 'HTTP/Request.php'; $http = &new HTTP_Request($url, $options); if (!empty($language)) { $http->addHeader('Accept-Language', $language); } $http->addHeader('User-Agent', 'Horde RPC client'); $http->addHeader('Content-Type', 'text/xml'); $http->addRawPostData(xmlrpc_encode_request($method, $params)); $result = $http->sendRequest(); if (is_a($result, 'PEAR_Error')) { return $result; } elseif ($http->getResponseCode() != 200) { return PEAR::raiseError(_("Request couldn't be answered. Returned errorcode: ") . $http->getResponseCode(), 'horde.error'); } elseif (!strstr($http->getResponseBody(), 'getResponseBody()); } else { $response = @xmlrpc_decode(substr($http->getResponseBody(), strpos($http->getResponseBody(), ' Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_Diff/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Text_Diff/tests Added Files: .cvsignore 1.txt 2.txt diff.phpt unified.phpt Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: .cvsignore --- *.diff *.exp *.log *.out --- NEW FILE: 1.txt --- This line is the same. This line is different in 1.txt This line is the same. --- NEW FILE: 2.txt --- This line is the same. This line is different in 2.txt This line is the same. --- NEW FILE: diff.phpt --- --TEST-- Text_Diff: Basic diff operation --FILE-- Array ( [0] => text_diff_op_copy Object ( [orig] => Array ( [0] => This line is the same. ) [final] => Array ( [0] => This line is the same. ) ) [1] => text_diff_op_delete Object ( [orig] => Array ( [0] => This line is different in 1.txt ) [final] => ) [2] => text_diff_op_add Object ( [orig] => [final] => Array ( [0] => This line is different in 2.txt ) ) [3] => text_diff_op_copy Object ( [orig] => Array ( [0] => This line is the same. ) [final] => Array ( [0] => This line is the same. ) ) ) ) --- NEW FILE: unified.phpt --- --TEST-- Text_Diff: Unified renderer --FILE-- render($diff); --EXPECT-- @@ -1,3 +1,3 @@ This line is the same. -This line is different in 1.txt +This line is different in 2.txt This line is the same. From cvs at intevation.de Fri Oct 14 16:33:15 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:26 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST/Formatter html.php, NONE, 1.1 Message-ID: <20051014143315.A0959102C9C@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST/Formatter In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Text_reST/reST/Formatter Added Files: html.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: html.php --- * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jason M. Felice * @version $Revision: 1.1 $ * @package Text_reST */ class Text_reST_Formatter_html extends Text_reST_Formatter { /** The current output charset. */ var $_charset = null; function format(&$node, $charset = null) { if (!isset($charset)) { $charset = $this->_charset; } if (is_string($node)) { if (isset($charset)) { return @htmlspecialchars($node, ENT_QUOTES, $charset); } else { return htmlspecialchars($node, ENT_QUOTES); } } switch ($node->_type) { case 'Document': return $this->_children($node); case 'Heading': $level = $node->getProperty('level'); return '' . $this->_children($node) . ''; case 'Link': return '' . $this->_children($node) . ''; case 'Literal-Block': list($text) = $node->_children; return '
    ' . (isset($charset) ?
                                  @htmlspecialchars($text, ENT_QUOTES, $charset) :
                                  htmlspecialchars($text, ENT_QUOTES)) . '
    '; case 'Paragraph': return "

    " . $this->_children($node) . "

    "; case 'Interpreted-Text': switch ($node->getProperty('role')) { case 'emphasis': return '' . $this->_children($node) . ''; case 'literal': return '' . $this->_children($node) . ''; case 'strong': return '' . $this->_children($node) . ''; case 'superscript': return '' . $this->_children($node) . ''; case 'subscript': return '' . $this->_children($node) . ''; case 'title-reference': return '' . $this->_children($node) . ''; default: // XXX: Issue a warning. return $this->_children($node); } case 'Paragraph': return "

    " . $this->_children($node) . "

    "; case 'Section': return $this->_children($node); } } function _children(&$node) { $result = ''; foreach ($node->_children as $child) { $result .= $this->format($child); } return $result; } } From cvs at intevation.de Fri Oct 14 16:33:15 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:28 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST Formatter.php, NONE, 1.1 Parser.php, NONE, 1.1 Message-ID: <20051014143315.6DAEE102C9B@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/reST In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Text_reST/reST Added Files: Formatter.php Parser.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: Formatter.php --- * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jason M. Felice * @version $Revision: 1.1 $ * @package Text_reST */ class Text_reST_Formatter { /** * Array of driver-specific parameters for formatting. * * @var array $_args */ var $_args; /** * Construct a new formatter. * * @access protected * * @param optional array $args Arguments specific to this formatter. */ function Text_reST_Formatter($args = array()) { $this->_args = $args; } /** * Construct a new formatter. * * @access public * * @param string $driver This is the name of the formatting * driver to construct. * @param optional array $args This is an array of driver-specific * parameters. * @return object Text_reST_Formatter the formatter */ function &factory($driver, $args = array()) { if (is_array($driver)) { list($path, $driver) = $driver; } else { $path = dirname(__FILE__) . '/Formatter/'; } $class = 'Text_reST_Formatter_' . $driver; require_once $path . $driver . '.php'; return new $class($args); } /** * Render the document. * * @abstract * * @param object Text_reST $document This is the document * we will render. * @param string $charset (optional) The output charset. */ function format(&$document, $charset = null) { } } --- NEW FILE: Parser.php --- * * See the enclosed file COPYING for license information (LGPL). If you did not * receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @author Jason M. Felice * @version $Revision: 1.1 $ * @package Text_reST */ class Text_reST_Parser { /** * The parse tree. * * @var object Text_reST $_document */ var $_document; /** * This is a hash of adornment levels. The keys are one-character or * two-character strings. The one-character strings represent underline * adornments of the specified character, and the double-character keys * are the underline-and-overline styles. The values associated with the * keys are integers representing the adornment's heading level. * * @var array $_adornmentLevels */ var $_adornmentLevels = array(); /** * Construct a new reStructuredText parser. * * @access public */ function Text_reST_Parser() { } /** * Create and return a parse tree representing a document. * * @param string $text This is the text of the * document to parse. * @return object Text_reST The parse tree. */ function &parse($text) { $this->_text = $text; require_once dirname(__FILE__) . '/../reST.php'; $this->_document = &new Text_reST('Document'); $this->_pushState($this->_document, 'Section', 0); while ($this->_next()) { // // Parse a `..' directive. We rewrite an `__' directive to a // `.. __: ' directive here. // if (preg_match('/^(\.\.|__)\s+(.*?)\s*$/', $this->_lineBuffer[0], $m)) { if ($m[1] == '__') { $text = '__: ' . $m[2]; } else { $text = $m[2]; } while ($this->_ensureLines(2) && preg_match('/^ ([^\s].*?)\s*$/', $this->_lineBuffer[1], $m)) { $text .= ' '.$m[1]; $this->_next(); } $this->_parseDirective($text); continue; } // // Look for overline-and-underline headings. // if ($this->_ensureLines(3) && preg_match('/^(.+?)\s*$/', $this->_lineBuffer[1], $lineMatch) && $this->_checkAdornment(array(0, 2), strlen($lineMatch[1]))) { $adornmentType = $this->_lineBuffer[0]{0}; $adornmentType .= $adornmentType; $this->_next(); $this->_next(); if (isset($this->_adornmentLevels[$adornmentType])) { $newLevel = $this->_adornmentLevels[$adornmentType]; $this->_popToLevel('Section', $newLevel - 1); } else { $newLevel = $this->_getStateLevel('Section') + 1; $this->_adornmentLevels[$adornmentType] = $newLevel; } $node = &$this->_makeNode($this->_currentNode, 'Section', array('level' => $newLevel)); $this->_pushState($node, 'Section', $newLevel); preg_match('/^\s*(.*?)\s*$/', $lineMatch[1], $lineMatch); $this->_makeNode($this->_currentNode, 'Heading', array('level' => $newLevel), $lineMatch[1]); continue; } // // Look for underline headings. // if ($this->_ensureLines(2) && preg_match('/^([^\s].*?)\s*$/', $this->_lineBuffer[0], $lineMatch) && $this->_checkAdornment(array(1), strlen($lineMatch[1]))) { $adornmentType = $this->_lineBuffer[1]{0}; $this->_next(); if (isset($this->_adornmentLevels[$adornmentType])) { $newLevel = $this->_adornmentLevels[$adornmentType]; $this->_popToLevel('Section', $newLevel - 1); } else { $newLevel = $this->_getStateLevel('Section') + 1; $this->_adornmentLevels[$adornmentType] = $newLevel; } $node = &$this->_makeNode($this->_currentNode, 'Section', array('level' => $newLevel)); $this->_pushState($node, 'Section', $newLevel); $this->_makeNode($this->_currentNode, 'Heading', array('level' => $newLevel), $lineMatch[1]); continue; } // // Parse a `::' paragraph. // if (preg_match('/^\s*::\s*$/', $this->_lineBuffer[0])) { $this->_next(); $this->_parseLiteralBlock(); continue; } // // Parse a paragraph. We end the paragraph when we return to // a lower indentation level or encounter a blank line. // if (preg_match('/^(\s*)([^\s].*?)\s*$/', $this->_lineBuffer[0], $m)) { $text = $m[2]; $level = strlen($m[1]); while ($this->_ensureLines(2) && preg_match('/^(\s*)([^\s].*?)\s*$/', $this->_lineBuffer[1], $m)) { if (strlen($m[1]) < $level) { break; } $text .= ' ' . $m[2]; $this->_next(); } $trailingLiteral = false; if (preg_match('/^(.*[^\s]:):\s*$/', $text, $m)) { $text = $m[1]; $trailingLiteral = true; } elseif (preg_match('/^(.*?)\s*::\s*$/', $text, $m)) { $text = $m[1]; $trailingLiteral = true; } $this->_makeNode($this->_currentNode, 'Paragraph', array(), $text); if ($trailingLiteral) { $this->_next(); $this->_parseLiteralBlock(); } continue; } // XXX: Handle garbage line. }; return $this->_document; } function &_makeNode(&$parent, $type, $props = array(), $childText = null) { $node = &new Text_reST($type); foreach ($props as $name => $value) { $node->setProperty($name, $value); } if (!is_null($parent)) { $parent->appendChild($node); } if (!is_null($childText)) { $this->_parseInline($node, $childText); } return $node; } /** * Check multiple adornemnt lines in the line buffer and make sure they * are adornments and that all are identical adornments. * * @access private * * @param optional array $lines An array of line numbers to check * if they are adornments. * @param optional int $minLength The minimum length for this * adornment. The default is 1. * @return bool whether this line is an adornment which matches the above * criteria. */ function _checkAdornment($lines = array(0), $minLength = 1) { $chr = null; foreach ($lines as $i) { if (!preg_match('/^([^a-zA-Z0-9\x7f-\xff\s]+)\s*$/', $this->_lineBuffer[$i], $m)) { return false; } if (is_null($chr)) { if (strlen($m[1]) < $minLength) { return false; } $chr = $m[1]{0}; } else { if (strlen($m[1]) != $minLength) { return false; } } $minLength = strlen($m[1]); for ($j = 0; $j < strlen($m[1]); $j++) { if ($m[1]{$j} != $chr) { return false; } } } return true; } function &_parseInline(&$node, $text) { static $aliases = array('sup' => 'superscript', 'sub' => 'subscript'); static $schemas = array('http', 'https', 'ftp', 'irc', 'telnet', 'news'); while (strlen($text) > 0) { if (preg_match('/^\*\*((?:\\\\.|[^\\\\])*?)\*\*(.*)$/', $text, $m)) { $this->_makeNode($node, 'Interpreted-Text', array('role' => 'strong'), $m[1]); $text = $m[2]; } elseif (preg_match('/^\*((?:\\\\.|[^\\\\])*?)\*(.*)$/', $text, $m)) { $this->_makeNode($node, 'Interpreted-Text', array('role' => 'emphasis'), $m[1]); $text = $m[2]; } elseif (preg_match('/^``(.*?)``(.*)$/', $text, $m)) { $sub = &$this->_makeNode($node, 'Interpreted-Text', array('role' => 'literal')); $sub->appendChild($m[1]); $text = $m[2]; } elseif (preg_match('/^:([a-z-]+):`((?:\\\\.|[^\\\\])*?)`(.*)$/', $text, $m)) { $role = $m[1]; if (isset($aliases[$m[1]])) { $role = $aliases[$m[1]]; } $sub = &$this->_makeNode($node, 'Interpreted-Text', array('role' => $role)); if ($role == 'literal') { $sub->appendChild($m[2]); } else { $this->_parseInline($sub, $m[2]); } $text = $m[3]; } elseif (preg_match('/^`((?:\\\\.|[^\\\\])*?)`:([a-z-]+):(.*)$/', $text, $m)) { $role = $m[2]; if (isset($aliases[$m[2]])) { $role = $aliases[$m[2]]; } $sub = &$this->_makeNode($node, 'Interpreted-Text', array('role' => $role)); if ($role == 'literal') { $sub->appendChild($m[1]); } else { $this->_parseInline($sub, $m[1]); } $text = $m[3]; } elseif (preg_match('/^`((?:\\\\.|[^\\\\])*?)`__(.*)$/', $text, $m)) { $this->_parseLink($node, $m[1], true); $text = $m[2]; } elseif (preg_match('/^`((?:\\\\.|[^\\\\])*?)`_(.*)$/', $text, $m)) { $this->_parseLink($node, $m[1], false); $text = $m[2]; } elseif (preg_match('/^`((?:\\\\.|[^\\\\])*?)`(.*)$/', $text, $m)) { $this->_makeNode($node, 'Interpreted-Text', array('role' => 'title-reference'), $m[1]); $text = $m[2]; } elseif (preg_match('/^((?:' . join('|', $schemas) . '):\/\/[-0-9a-z#%&+.\/:;?_\\~]+[-0-9a-z#%&+\/_\\~])(.*)$/i', $text, $m)) { $sub = &$this->_makeNode($node, 'Link', array('href' => $m[1])); $sub->appendChild($m[1]); $text = $m[2]; } elseif (preg_match('/^([a-z0-9-]+@[a-z0-9-\.]+\.[a-z0-9-]+)(.*)$/i', $text, $m)) { $sub = &$this->_makeNode($node, 'Link', array('href' => 'mailto:' . $m[1])); $sub->appendChild($m[1]); $text = $m[2]; } elseif (preg_match('/^(\w+)_\b(.*)$/', $text, $m)) { $this->_parseLink($node, $m[1], false); $text = $m[2]; } elseif (preg_match('/^\\\\\s(.*)$/', $text, $m)) { // Backslash-escaped whitespace characters are removed from // the document. $text = $m[1]; } elseif (preg_match('/^\\\\(.)(.*)$/', $text, $m)) { $c = $m[1]; $text = $m[2]; $node->appendChild($c); } else { // XXX: We should try to use a regexp to grab as much text as // possible, then fall through to the single-character case // if we can't get anything. $c = substr($text, 0, 1); $text = substr($text, 1); $node->appendChild($c); } } return $body; } /** * Parse an anonymous or named link. * * @access private * * @param object Text_reST This is the parent node for the * link. * @param string $text The text to parse. * @param bool $anonymous Whether this is an anonymous link. * @return object Text_reST the new link node. */ function &_parseLink(&$node, $text, $anonymous = false) { $link = &$this->_makeNode($node, 'Link'); if (preg_match('/<(.*)>/', $text, $m)) { $link->setProperty('href', $m[1]); if (preg_match('/^([^<]+?)\s*appendChild($m[1]); if (!$anonymous) { $link->setProperty('name', $this->_normalizeName($m[1])); } } } else { if (!$anonymous) { $link->setProperty('name', $this->_normalizeName($text)); } $link->appendChild($text); } if ($anonymous && is_null($link->getProperty('href'))) { $this->_queueAnonymousReference($link, 'link'); } elseif (!$anonymous && !is_null($link->getProperty('name'))) { $this->_putNamedReference($link, 'link'); } return $link; } /** * Normalize an object name. This means that we lowercase it and * normalize any whitespace in it. * * @param string $name This is the name to normalize. * @return string the normalized name. */ function _normalizeName($name) { return preg_replace('/\s+/', ' ', strtolower($name)); } /** * Parse and execute a `..' directive. * * @access private * * @param string $text The directive to execute, less the * leading `.. '. */ function _parseDirective($text) { if (preg_match('/^__:\s*(.*?)\s*$/', $text, $m)) { // // Anonymous link definition // $defn = &new Text_reST('Link'); if (preg_match('/^[a-z0-9-]+@[a-z0-9-\.]+\.[a-z0-9-]+$/i', $m[1])) { $m[1] = 'mailto:' . $m[1]; } $defn->setProperty('href', $m[1]); $this->_queueAnonymousDefinition($defn, 'link'); } elseif (preg_match('/^\s*_(.*?):\s*(.*?)\s*$/', $text, $m)) { // // Named link definition // $defn = &new Text_reST('Link'); $defn->setProperty('name', $this->_normalizeName($m[1])); if (preg_match('/^[a-z0-9-]+@[a-z0-9-\.]+\.[a-z0-9-]+$/i', $m[2])) { $m[2] = 'mailto:' . $m[2]; } $defn->setProperty('href', $m[2]); $this->_putNamedDefinition($defn, 'link'); } } /** * Skip blank lines until we find one we can get the indentation level * from, then, gather lines until we have a different level. */ function _parseLiteralBlock() { if (!$this->_ensureLines(1)) { return false; } while (preg_match('/^\s*$/', $this->_lineBuffer[0])) { if (!$this->_next()) { return false; } } if (!preg_match('/^(\s+)(.*?)\s*$/', $this->_lineBuffer[0], $m)) { return false; } $level = strlen($m[1]); $text = $m[2]; if ($this->_next()) { $re = '/^(?: {' . $level . '}(.*?)|())\s*$/'; while (preg_match($re, $this->_lineBuffer[0], $m)) { $text .= "\n" . $m[1]; if (!$this->_next()) { break; } } } $l = &$this->_makeNode($this->_currentNode, 'Literal-Block', array()); $l->appendChild(preg_replace('/\s+$/s', '', $text)); // XXX: Dirty hack! array_unshift($this->_lineBuffer, ''); } //---- // Line-reading members //---- /** * This is the remainder of the text we are parsing. It is modified by * _getLine() and _next(). * * @access private * @var string $_text */ var $_text; /** * This is an array of the lines we have peeked at. $this->_lineBuffer[0] * is the line we are currently working with and so on. * * @access private * @var string $_lineBuffer */ var $_lineBuffer = array(); /** * Retreive the next line from a block of text. We replace tabs with * 8 spaces. * * @access private */ function _getLine() { if (strlen($this->_text) == 0) { return null; } $i = strpos($this->_text, "\n"); if ($i !== false) { $line = substr($this->_text, 0, $i); $this->_text = substr($this->_text, $i + 1); } else { $line = $this->_text; $this->_text = ''; } return preg_replace('/\t/', ' ', $line); } /** * Bump to the next line in the input. * * @access private */ function _next() { // Special case the first time 'round. if (count($this->_lineBuffer) == 0) { return $this->_ensureLines(1); } if (!$this->_ensureLines(2)) { return false; } array_shift($this->_lineBuffer); return true; } /** * Make sure there is some number of lines in the line buffer. * * @access private * * @param optional $count This is the number of lines which must be * in the buffer. * @return bool whether or not we succeeded. We can fail at end-of-file. */ function _ensureLines($count = 1) { while (count($this->_lineBuffer) < $count) { $line = $this->_getLine(); if (is_null($line)) { return false; } $this->_lineBuffer[] = $line; } return true; } //---- // Anonymous references and definitions //---- var $_anonymousReferences = array(); var $_anonymousDefinitions = array(); /** * Since anonymous references and definitions (e.g. footnotes, links) do * not need to be defined "in lockstep" according to the spec, we create * the partial parse node in both places and use this nifty system to * queue or merge in each place. Note that the reference is the "master" * node. The definition gets thrown away since it really isn't in the * parse tree anyway. * * @access private * * @param object &$node The node to queue or merge to. * @param string $type The type of anonymous object. */ function _queueAnonymousReference(&$node, $type) { if (!array_key_exists($type, $this->_anonymousDefinitions)) { $this->_anonymousDefinitions[$type] = array(); } if (count($this->_anonymousDefinitions[$type]) > 0) { $defn = &$this->_anonymousDefinitions[$type][0]; array_shift($this->_anonymousDefinitions[$type]); $this->_mergeNodeProperties($node, $defn); } else { $this->_anonymousReferences[$type][] = &$node; } } /** * Handle an anonymous definition. * * @access private * * @param object &$node The node to queue or merge from. * @param string $type The type of anonymous object. */ function _queueAnonymousDefinition(&$node, $type) { if (!array_key_exists($type, $this->_anonymousReferences)) { $this->_anonymousReferences[$type] = array(); } if (count($this->_anonymousReferences[$type]) > 0) { $ref = &$this->_anonymousReferences[$type][0]; array_shift($this->_anonymousReferences[$type]); $this->_mergeNodeProperties($ref, $node); } else { $this->_anonymousDefinitions[$type][] = &$node; } } /** * Merge the properties from each node into the other node. The node * type is not changed (for the case where we have a footnote reference * and a footnote definition), but both nodes will have all properties. * * @access private * * @param object &$node The reference node. * @param object &$defn The definition node. */ function _mergeNodeProperties(&$node, &$defn) { // XXX: We should make sure there is no collision. foreach ($defn->_properties as $name => $value) { $node->setProperty($name, $value); } foreach ($node->_properties as $name => $value) { $defn->setProperty($name, $value); } } //---- // Named references and definitions //---- var $_namedReferences = array(); var $_namedDefinitions = array(); /** * Stores a named reference parse node in a hash so we can later merge * properties with a definition. If we already have a definition, do * the merge now. * * @access private * * @param object Text_reST &$node The parse tree node. * @param string $type The type of named reference. * @return bool whether or not we successfully added the reference. */ function _putNamedReference(&$node, $type) { $name = $node->getProperty('name'); if (isset($this->_namedReferences[$type][$name])) { return false; } $this->_namedReferences[$type][$name] = &$node; if (isset($this->_namedDefinitions[$type][$name])) { $defn = &$this->_namedDefinitions[$type][$name]; $this->_mergeNodeProperties($node, $defn); } return true; } /** * This is the inverse of _putNamedReference(). * * @access private */ function _putNamedDefinition(&$node, $type) { $name = $node->getProperty('name'); if (isset($this->_namedDefinitions[$type][$name])) { return false; } $this->_namedDefinitions[$type][$name] = &$node; if (isset($this->_namedReferences[$type][$name])) { $ref = &$this->_namedReferences[$type][$name]; $this->_mergeNodeProperties($ref, $node); } return true; } //---- // State stack management //---- /** * This is our state stack. It is used to keep track of nested body- * level elements and how they might end. * * @var array $_stack */ var $_stateStack = array(); var $_currentNode; function _pushState(&$node, $stateType, $level) { $state = &new Text_reST_Parser_state($node, $stateType, $level); $this->_stateStack[] = &$state; $this->_currentNode = &$node; } function _getStateLevel($stateType) { for ($i = count($this->_stateStack) - 1; $i >= 0; $i--) { if ($this->_stateStack[$i]->stateType == $stateType) { return $this->_stateStack[$i]->level; } } return 0; } function _popToLevel($stateType, $level) { while ($this->_getStateLevel($stateType) > $level) { $this->_pop(); } } function _pop() { array_pop($this->_stateStack); if (count($this->_stateStack)) { $state = &$this->_stateStack[count($this->_stateStack)-1]; $this->_currentNode = &$state->node; } } } /** * This class represents a node on the parser's state stack. */ class Text_reST_Parser_state { var $node; var $stateType; var $level; /** * Construct a new state node. * * @param object &$node This is the parse node associated with * this state. Block-level elements parsed * in this state will be children of this * node. * @param string $stateType Currently only 'Section'. * @param mixed $level This is the nesting level of this state * type. */ function Text_reST_Parser_state(&$node, $stateType, $level) { $this->node = &$node; $this->stateType = $stateType; $this->level = $level; } } From cvs at intevation.de Fri Oct 14 16:33:15 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:30 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Text_reST/tests headings.phpt, NONE, 1.1 lblocks.phpt, NONE, 1.1 links.phpt, NONE, 1.1 roles.phpt, NONE, 1.1 Message-ID: <20051014143315.A7522102C9D@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Text_reST/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Text_reST/tests Added Files: headings.phpt lblocks.phpt links.phpt roles.phpt Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: headings.phpt --- --TEST-- Text_reST_Parser:: heading/section parsing --FILE-- dump(); --EXPECT-- Document:: Section:: level="1" Heading:: level="1" "Document Title" Paragraph:: "Here is a paragraph." Section:: level="2" Heading:: level="2" "Sub-heading 1" Paragraph:: "Another paragraph." Section:: level="3" Heading:: level="3" "Sub-sub-heading 1" Paragraph:: "another paragraph." Section:: level="3" Heading:: level="3" "Sub-sub-heading 2" Paragraph:: "another paragraph." Section:: level="2" Heading:: level="2" "Sub-heading 2" Paragraph:: "another paragraph" --- NEW FILE: lblocks.phpt --- --TEST-- Text_reST_Parser:: text role parsing --FILE-- dump(); --EXPECT-- Document:: Literal-Block:: "if ($foo) { ... }" Paragraph:: "Here is another paragraph:" Literal-Block:: "while (true) { }" Paragraph:: "And another." Literal-Block:: "do { if (...) { break; } } while (false);" --- NEW FILE: links.phpt --- --TEST-- Text_reST_Parser:: link parsing --FILE-- `__. Here's the `Horde dev site`__. Here's `another link`__. __ http://example.com/ Here's one for Python_. Here's one for `verified voting`_. .. _Python: http://www.python.org/ .. _verified voting: http://www.verifiedvoting.org/ Here's a `named email address`_. .. _named email address: foo@example.com "); $document->dump(); --EXPECT-- Document:: Paragraph:: "Test link: " Link:: href="http://www.horde.org/" "http://www.horde.org/" ". Test email: " Link:: href="mailto:foo@example.com" "foo@example.com" ". An anonymous link to " Link:: href="http://slashdot.org/" "Slashdot" ". Here's the " Link:: href="http://dev.horde.org/" "Horde dev site" ". Here's " Link:: href="http://example.com/" "another link" "." Paragraph:: "Here's one for " Link:: href="http://www.python.org/" name="python" "Python" ". Here's one for " Link:: href="http://www.verifiedvoting.org/" name="verified voting" "verified voting" "." Paragraph:: "Here's a " Link:: href="mailto:foo@example.com" name="named email address" "named email address" "." --- NEW FILE: roles.phpt --- --TEST-- Text_reST_Parser:: text role parsing --FILE-- dump(); --EXPECT-- Document:: Paragraph:: "This is a test paragraph. It has " Interpreted-Text:: role="emphasis" "italics" " and " Interpreted-Text:: role="strong" "bold" ", " Interpreted-Text:: role="literal" "literal text" ", " Interpreted-Text:: role="title-reference" "A title reference" " another " Interpreted-Text:: role="title-reference" "title reference" ". It has some " Interpreted-Text:: role="superscript" "superscript" " and some " Interpreted-Text:: role="subscript" "subscript" "." From cvs at intevation.de Fri Oct 14 16:33:16 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:32 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/Util/tests String.phpt, NONE, 1.1 String2.phpt, NONE, 1.1 utf-8.phpt, NONE, 1.1 Message-ID: <20051014143316.DF13E102BD9@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Util/tests In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Util/tests Added Files: String.phpt String2.phpt utf-8.phpt Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: String.phpt --- --TEST-- Simple String:: tests --FILE-- --EXPECT-- 7 7 ABCDEFG abcdefg ABCDEFG abcdefg --- NEW FILE: String2.phpt --- --TEST-- zh_TW String:: tests --FILE-- --EXPECT-- 7 4 --- NEW FILE: utf-8.phpt --- --TEST-- UTF-8 String:: tests --FILE-- and the Kermit Project * (http://www.columbia.edu/kermit/). The original page is located at * http://www.columbia.edu/kermit/utf8.html */ // French 50 echo String::length('Je peux manger du verre, ça ne me fait pas de mal.', 'UTF-8') . "\n"; // Spanish 36 echo String::length('Puedo comer vidrio, no me hace daño.', 'UTF-8') . "\n"; // Portuguese 34 echo String::length('Posso comer vidro, não me faz mal.', 'UTF-8') . "\n"; // Brazilian Portuguese 34 echo String::length('Posso comer vidro, não me machuca.', 'UTF-8') . "\n"; // Italian 41 echo String::length('Posso mangiare il vetro e non mi fa male.', 'UTF-8') . "\n"; // English 39 echo String::length('I can eat glass and it doesn\'t hurt me.', 'UTF-8') . "\n"; // Norsk/Norwegian/Nynorsk 33 echo String::length('Eg kan eta glas utan å skada meg.', 'UTF-8') . "\n"; // Svensk/Swedish 36 echo String::length('Jag kan äta glas utan att skada mig.', 'UTF-8') . "\n"; // Dansk/Danish 45 echo String::length('Jeg kan spise glas, det gør ikke ondt på mig.', 'UTF-8') . "\n"; // Deutsch/German 41 echo String::length('Ich kann Glas essen, ohne mir weh zu tun.', 'UTF-8') . "\n"; // Russian 38 echo String::length('Я могу есть стекло, оно мне не вредит.', 'UTF-8') . "\n"; ?> --EXPECT-- 50 36 34 34 41 39 33 36 45 41 38 From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:34 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_SVG SVG.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143317.A5AAA102CA8@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_SVG In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/XML_SVG Added Files: SVG.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: SVG.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @package XML_SVG */ class XML_SVG { function example() { // Create an instance of XML_SVG_Document. All other objects // will be added to this instance for printing. Set the height // and width of the viewport. $svg = &new XML_SVG_Document(array('width' => 400, 'height' => 200)); // Create an instance of XML_SVG_Group. Set the style, // transforms for child objects. $g = &new XML_SVG_Group(array('style' => 'stroke:black', 'transform' => 'translate(200 100)')); // Add a parent to the g instance. $g->addParent($svg); // The same results can be accomplished by making g a child of the svg. // $svg->addChild($g); // Create and animate a circle. $circle = &new XML_SVG_Circle(array('cx' => 0, 'cy' => 0, 'r' => 100, 'style' => 'stroke-width:3')); $circle->addChild(new XML_SVG_Animate(array('attributeName' => 'r', 'attributeType' => 'XML', 'from' => 0, 'to' => 75, 'dur' => '3s', 'fill' => 'freeze'))); $circle->addChild(new XML_SVG_Animate(array('attributeName' => 'fill', 'attributeType' => 'CSS', 'from' => 'green', 'to' => 'red', 'dur' => '3s', 'fill' => 'freeze'))); // Make the circle a child of g. $g->addChild($circle); // Create and animate some text. $text = &new XML_SVG_Text(array('text' => 'SVG chart!', 'x' => 0, 'y' => 0, 'style' => 'font-size:20;text-anchor:middle;')); $text->addChild(new XML_SVG_Animate(array('attributeName' => 'font-size', 'attributeType' => 'auto', 'from' => 0, 'to' => 20, 'dur' => '3s', 'fill' => 'freeze'))); // Make the text a child of g. $g->addChild($text); // Send a message to the svg instance to start printing. $svg->printElement(); } } /** * XML_SVG_Element * * This is the base class for the different SVG Element * Objects. Extend this class to create a new SVG Element. * * @package XML_SVG */ class XML_SVG_Element { var $_elements = null; var $_style = null; var $_transform = null; var $_id = null; // The constructor. function XML_SVG_Element($params = array()) { foreach ($params as $p => $v) { $param = '_' . $p; $this->$param = $v; } } // Most SVG elements can contain child elements. This method calls the // printElement method of any child element added to this object by use // of the addChild method. function printElement() { // Loop and call if (is_array($this->_elements)) { foreach ($this->_elements as $child) { $child->printElement(); } } } // This method adds an object reference (or value, if $copy is // true) to the _elements array. function addChild(&$element, $copy = false) { if ($copy) { $this->_elements[] = $element; } else { $this->_elements[] = &$element; } } // This method sends a message to the passed element requesting to be // added as a child. function addParent(&$parent) { if (is_subclass_of($parent, 'XML_SVG_Element')) { $parent->addChild($this); } } function copy() { return $this; } // Print each of the passed parameters, if they are set. function printParams() { foreach (func_get_args() as $param) { $_param = '_' . $param; if (isset($this->$_param)) { switch ($param) { case 'filter': echo ' filter="url(#' . $this->$_param . ')"'; break; default: echo ' ' . str_replace('_', '-', $param) . '="' . $this->$_param . '"'; break; } } } } // Set any named attribute of an element to a value. function setParam($param, $value) { $attr = '_' . $param; $this->$attr = $value; } // Get any named attribute of an element. function getParam($param) { $attr = '_' . $param; if (isset($this->$attr)) { return $this->$attr; } else { return null; } } // Print out the object for debugging. function debug() { echo '
    '; var_dump($this); echo '
    '; } } /** * XML_SVG_Fragment * * @package XML_SVG */ class XML_SVG_Fragment extends XML_SVG_Element { var $_width; var $_height; var $_viewBox; var $_x; var $_y; function printElement() { echo 'printParams('id', 'width', 'height', 'x', 'y', 'viewBox', 'style'); echo ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">' . "\n"; parent::printElement(); echo "\n"; } function bufferObject() { ob_start(); $this->printElement(); $output = ob_get_contents(); ob_end_clean(); return $output; } } /** * XML_SVG_Document * * This extends the XML_SVG_Fragment class. It wraps the XML_SVG_Frament output * with a content header, xml definition and doctype. * * @package XML_SVG */ class XML_SVG_Document extends XML_SVG_Fragment { function printElement() { header('Content-Type: image/svg+xml'); print(''."\n"); print('' . "\n"); parent::printElement(); } } /** * XML_SVG_Group * * @package XML_SVG */ class XML_SVG_Group extends XML_SVG_Element { function printElement() { echo 'printParams('id', 'style', 'transform', 'filter'); print(">\n"); parent::printElement(); print("\n"); } } /** * XML_SVG_Textpath * * @package XML_SVG */ class XML_SVG_Textpath extends XML_SVG_Element { var $_text; var $_x; var $_y; var $_dx; var $_dy; var $_rotate; var $_textLength; var $_lengthAdjust; function printElement($element = 'textpath') { echo '<' . $element; $this->printParams('id', 'x', 'y', 'dx', 'dy', 'rotate', 'textLength', 'lengthAdjust', 'style', 'transform'); echo '>' . htmlentities($this->_text); parent::printElement(); echo "\n"; } function setShape($x, $y, $text) { $this->_x = $x; $this->_y = $y; $this->_text = $text; } } /** * XML_SVG_Text * * @package XML_SVG */ class XML_SVG_Text extends XML_SVG_Textpath { function printElement() { parent::printElement('text'); } function setShape($x, $y, $text) { $this->_x = $x; $this->_y = $y; $this->_text = $text; } } /** * XML_SVG_Tspan * * @package XML_SVG */ class XML_SVG_Tspan extends XML_SVG_Element { var $_text; var $_x; var $_y; var $_dx; var $_dy; var $_rotate; var $_textLength; var $_lengthAdjust; function printElement() { echo 'printParams('id', 'x', 'y', 'dx', 'dy', 'rotate', 'textLength', 'lengthAdjust', 'style', 'transform'); echo '>' . $this->_text; if (is_array($this->_elements)) { parent::printElement(); } echo "\n"; } function setShape($x, $y, $text) { $this->_x = $x; $this->_y = $y; $this->_text = $text; } } /** * XML_SVG_Circle * * @package XML_SVG */ class XML_SVG_Circle extends XML_SVG_Element { var $_cx; var $_cy; var $_r; function printElement() { echo 'printParams('id', 'cx', 'cy', 'r', 'style', 'transform'); if (is_array($this->_elements)) { // Print children, start and end tag. echo ">\n"; parent::printElement(); echo "\n"; } else { // Print short tag. echo "/>\n"; } } function setShape($cx, $cy, $r) { $this->_cx = $cx; $this->_cy = $cy; $this->_r = $r; } } /** * XML_SVG_Line * * @package XML_SVG */ class XML_SVG_Line extends XML_SVG_Element { var $_x1; var $_y1; var $_x2; var $_y2; function printElement() { echo 'printParams('id', 'x1', 'y1', 'x2', 'y2', 'style'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { // Print short tag. print("/>\n"); } } function setShape($x1, $y1, $x2, $y2) { $this->_x1 = $x1; $this->_y1 = $y1; $this->_x2 = $x2; $this->_y2 = $y2; } } /** * XML_SVG_Rect * * @package XML_SVG */ class XML_SVG_Rect extends XML_SVG_Element { var $_x; var $_y; var $_width; var $_height; var $_rx; var $_ry; function printElement() { echo 'printParams('id', 'x', 'y', 'width', 'height', 'rx', 'ry', 'style'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { // Print short tag. print("/>\n"); } } function setShape($x, $y, $width, $height) { $this->_x = $x; $this->_y = $y; $this->_width = $width; $this->_height = $height; } } /** * XML_SVG_Ellipse * * @package XML_SVG */ class XML_SVG_Ellipse extends XML_SVG_Element { var $_cx; var $_cy; var $_rx; var $_ry; function printElement() { echo 'printParams('id', 'cx', 'cy', 'rx', 'ry', 'style', 'transform'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { // Print short tag. print(" />\n"); } } function setShape($cx, $cy, $rx, $ry) { $this->_cx = $cx; $this->_cy = $cy; $this->_rx = $rx; $this->_ry = $ry; } } /** * XML_SVG_Polyline * * @package XML_SVG */ class XML_SVG_Polyline extends XML_SVG_Element { var $_points; function printElement() { echo 'printParams('id', 'points', 'style', 'transform'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { // Print short tag. print("/>\n"); } } function setShape($points) { $this->_points = $points; } } /** * XML_SVG_Polygon * * @package XML_SVG */ class XML_SVG_Polygon extends XML_SVG_Element { var $_points; function printElement() { echo 'printParams('id', 'points', 'style', 'transform'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { // Print short tag. print("/>\n"); } } function setShape($points) { $this->_points = $points; } } /** * XML_SVG_Path * * @package XML_SVG */ class XML_SVG_Path extends XML_SVG_Element { var $_d; function printElement() { echo 'printParams('id', 'd', 'style', 'transform'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { // Print short tag. print("/>\n"); } } function setShape($d) { $this->_d = $d; } } /** * XML_SVG_Image * * @package XML_SVG */ class XML_SVG_Image extends XML_SVG_Element { var $_x; var $_y; var $_width; var $_height; var $_href; function printElement() { echo 'printParams('id', 'x', 'y', 'width', 'height', 'style'); if (!empty($this->_href)) { echo ' xlink:href="' . $this->_href . '"'; } if (is_array($this->_elements)) { // Print children, start and end tag. echo ">\n"; parent::printElement(); echo "\n"; } else { // Print short tag. echo " />\n"; } } function setShape($x, $y, $width, $height) { $this->_x = $x; $this->_y = $y; $this->_width = $width; $this->_height = $height; } } /** * XML_SVG_Animate * * @package XML_SVG */ class XML_SVG_Animate extends XML_SVG_Element { var $_attributeName; var $_attributeType; var $_from; var $_to; var $_begin; var $_dur; var $_fill; function printElement() { echo 'printParams('id', 'attributeName', 'attributeType', 'from', 'to', 'begin', 'dur', 'fill'); if (is_array($this->_elements)) { // Print children, start and end tag. echo ">\n"; parent::printElement(); echo "\n"; } else { echo " />\n"; } } function setShape($attributeName, $attributeType = '', $from = '', $to = '', $begin = '', $dur = '', $fill = '') { $this->_attributeName = $attributeName; $this->_attributeType = $attributeType; $this->_from = $from; $this->_to = $to; $this->_begin = $begin; $this->_dur = $dur; $this->_fill = $fill; } } /** * XML_SVG_Filter * * @package XML_SVG */ class XML_SVG_Filter extends XML_SVG_Element { function printElement() { echo 'printParams('id'); if (is_array($this->_elements)) { // Print children, start and end tag. echo ">\n"; parent::printElement(); echo "\n"; } else { echo " />\n"; } } function addPrimitive($primitive, $params) { $this->addChild(new XML_SVG_FilterPrimitive($primitive, $params)); } } /** * XML_SVG_FilterPrimitive * * @package XML_SVG */ class XML_SVG_FilterPrimitive extends XML_SVG_Element { var $_primitives = array('Blend', 'ColorMatrix', 'ComponentTransfer', 'Composite', 'ConvolveMatrix', 'DiffuseLighting', 'DisplacementMap', 'Flood', 'GaussianBlur', 'Image', 'Merge', 'Morphology', 'Offset', 'SpecularLighting', 'Tile', 'Turbulence'); var $_primitive; var $_in; var $_in2; var $_result; var $_x; var $_y; var $_dx; var $_dy; var $_width; var $_height; var $_mode; var $_type; var $_values; var $_operator; var $_k1; var $_k2; var $_k3; var $_k4; var $_surfaceScale; var $_diffuseConstant; var $_kernelUnitLength; var $_floor_color; var $_flood_opacity; function XML_SVG_FilterPrimitive($primitive, $params = array()) { parent::XML_SVG_Element($params); $this->_primitive = $primitive; } function printElement() { $name = 'fe' . $this->_primitive; echo '<' . $name; $this->printParams('id', 'x', 'y', 'dx', 'dy', 'width', 'height', 'in', 'in2', 'result', 'mode', 'type', 'values', 'operator', 'k1', 'k2', 'k3', 'k4', 'surfaceScale', 'stdDeviation', 'diffuseConstant', 'kernelUnitLength', 'flood_color', 'flood_opacity'); if (is_array($this->_elements)) { // Print children, start and end tag. echo ">\n"; parent::printElement(); echo ''; } else { echo '/>'; } } /** * For feMerge elements. */ function addMergeNode($in) { $this->addChild(new XML_SVG_FilterMergeNode(array('in' => $in))); } } /** * XML_SVG_FilterMergeNode * * @package XML_SVG */ class XML_SVG_FilterMergeNode extends XML_SVG_Element { var $_in; function printElement() { echo 'printParams('in'); echo '/>'; } } /** * XML_SVG_Use * * @package XML_SVG */ class XML_SVG_Use extends XML_SVG_Element { var $_symbol; function XML_SVG_Use($symbol, $params = array()) { parent::XML_SVG_Element($params); $this->_symbol = $symbol; } function printElement() { echo ''; } } /** * XML_SVG_Defs * * @package XML_SVG */ class XML_SVG_Defs extends XML_SVG_Element { function printElement() { echo 'printParams('id', 'style', 'transform'); echo ">\n"; parent::printElement(); echo "\n"; } } /** * XML_SVG_Marker * * @package XML_SVG */ class XML_SVG_Marker extends XML_SVG_Element { var $_refX; var $_refY; var $_markerUnits; var $_markerWidth; var $_markerHeight; var $_orient; function printElement() { echo 'printParams('id', 'refX', 'refY', 'markerUnits', 'markerWidth', 'markerHeight', 'orient'); if (is_array($this->_elements)) { // Print children, start and end tag. print(">\n"); parent::printElement(); print("\n"); } else { print("/>\n"); } } function setShape($refX = '', $refY = '', $markerUnits = '', $markerWidth = '', $markerHeight = '', $orient = '') { $this->_refX = $refX; $this->_refY = $refY; $this->_markerUnits = $markerUnits; $this->_markerWidth = $markerWidth; $this->_markerHeight = $markerHeight; $this->_orient = $orient; } } /** * XML_SVG_Title * * @package XML_SVG */ class XML_SVG_Title extends XML_SVG_Element { var $_title; function printElement() { echo 'printParams('id', 'style'); print(">\n"); print($this->_title); parent::printElement(); print("\n"); } } /** * XML_SVG_Desc * * @package XML_SVG */ class XML_SVG_Desc extends XML_SVG_Element { var $_desc; function printElement() { echo 'printParams('id', 'style'); echo '>' . $this->_desc; parent::printElement(); echo "\n"; } } /** * XML_SVG_Tref * * @package XML_SVG */ class XML_SVG_Tref extends XML_SVG_Element { var $_text; var $_x; var $_y; var $_dx; var $_dy; var $_rotate; var $_textLength; var $_lengthAdjust; function printElement() { echo 'printParams('id', 'x', 'y', 'dx', 'dy', 'rotate', 'textLength', 'lengthAdjust', 'style'); echo '>' . $this->_text; parent::printElement(); echo "\n"; } } --- NEW FILE: package.xml --- XML_SVG XML_SVG API This package provides an object-oriented API for building SVG documents. LGPL chagenbu lead Chuck Hagenbuch chuck@horde.org jon lead Jon Parise jon@horde.org yunosh lead Jan Schneider jan@horde.org 0.0.3 2003-12-17 stable Updated stable release for the package system. 0.0.2 2003-07-07 stable Stable release into the PEAR XML hierarchy. 0.0.1 2002-12-29 alpha Initial release as a PEAR package From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:36 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML WBXML.php, NONE, 1.1 package.xml, NONE, 1.1 Message-ID: <20051014143317.AC041102CAA@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/XML_WBXML Added Files: WBXML.php package.xml Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: WBXML.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * $Horde: framework/XML_WBXML/WBXML.php,v 1.13 2004/02/27 15:14:59 chuck Exp $ * * @package XML_WBXML */ class XML_WBXML { /** * Decoding Multi-byte Integers from Section 5.1 * * Use long because it is unsigned. */ function MBUInt32ToInt($in, &$pos) { $val = 0; do { $b = ord($in[$pos++]); $val <<= 7; // Bitshift left 7 bits. $val += ($b & 127); } while (($b & 128) != 0); return $val; } /** * Encoding Multi-byte Integers from Section 5.1 */ function intToMBUInt32(&$out, $i) { if ($i > 268435455) { $bytes0 = 0 | XML_WBXML::getBits(0, $i); $bytes1 = 128 | XML_WBXML::getBits(1, $i); $bytes2 = 128 | XML_WBXML::getBits(2, $i); $bytes3 = 128 | XML_WBXML::getBits(3, $i); $bytes4 = 128 | XML_WBXML::getBits(4, $i); $out .= chr($bytes4); $out .= chr($bytes3); $out .= chr($bytes2); $out .= chr($bytes1); $out .= chr($bytes0); } elseif ($i > 2097151) { $bytes0 = 0 | XML_WBXML::getBits(0, $i); $bytes1 = 128 | XML_WBXML::getBits(1, $i); $bytes2 = 128 | XML_WBXML::getBits(2, $i); $bytes3 = 128 | XML_WBXML::getBits(3, $i); $out .= chr($bytes3); $out .= chr($bytes2); $out .= chr($bytes1); $out .= chr($bytes0); } elseif ($i > 16383) { $bytes0 = 0 | XML_WBXML::getBits(0, $i); $bytes1 = 128 | XML_WBXML::getBits(1, $i); $bytes2 = 128 | XML_WBXML::getBits(2, $i); $out .= chr($bytes2); $out .= chr($bytes1); $out .= chr($bytes0); } elseif ($i > 127) { $bytes0 = 0 | XML_WBXML::getBits(0, $i); $bytes1 = 128 | XML_WBXML::getBits(1, $i); $out .= chr($bytes1); $out .= chr($bytes0); } else { $bytes0 = 0 | XML_WBXML::getBits(0, $i); $out .= chr($bytes0); } } function getBits($num, $l) { switch ($num) { case 0: return $l & 127; // 0x7F case 1: return ($l >> 7) & 127; // 0x7F case 2: return ($l >> 14) & 127; // 0x7F case 3: return ($l >> 21) & 127; // 0x7F case 4: return ($l >> 28) & 127; // 0x7F } return 0; } function getDPIString($i) { /** * ADD CHAPTER * @var array $_DPIString */ $DPIString = array(2 => DPI_DTD_WML_1_0, 3 => DPI_DTD_WTA_1_0, 4 => DPI_DTD_WML_1_1, 5 => DPI_DTD_SI_1_1, 6 => DPI_DTD_SL_1_0, 7 => DPI_DTD_CO_1_0, 8 => DPI_DTD_CHANNEL_1_1, 9 => DPI_DTD_WML_1_2, 10 => DPI_DTD_WML_1_3, 11 => DPI_DTD_PROV_1_0, 12 => DPI_DTD_WTA_WML_1_2, 13 => DPI_DTD_CHANNEL_1_2, // Not all SyncML clients know this, so we // should use the string table. // 0xFD1 => DPI_DTD_SYNCML_1_1, // 0xFD2 => DPI_DTD_DEVINF_1_1, ); return isset($DPIString[$i]) ? $DPIString[$i] : null; } function getDPIInt($dpi) { /** * ADD CHAPTER * @var array $_DPIInt */ $DPIInt = array(DPI_DTD_WML_1_0 => 2, DPI_DTD_WTA_1_0 => 3, DPI_DTD_WML_1_1 => 4, DPI_DTD_SI_1_1 => 5, DPI_DTD_SL_1_0 => 6, DPI_DTD_CO_1_0 => 7, DPI_DTD_CHANNEL_1_1 => 8, DPI_DTD_WML_1_2 => 9, DPI_DTD_WML_1_3 => 10, DPI_DTD_PROV_1_0 => 11, DPI_DTD_WTA_WML_1_2 => 12, DPI_DTD_CHANNEL_1_2 => 13, // Not all SyncML clients know this, so we // should use the string table. // DPI_DTD_SYNCML_1_1 => 0xFD1, // DPI_DTD_DEVINF_1_1 => 0xFD2, ); return isset($DPIInt[$dpi]) ? $DPIInt[$dpi] : 0; } /** * Returns the character encoding. * only default character encodings from J2SE are supported * from http://www.iana.org/assignments/character-sets * and http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html */ function getCharsetString($cs) { /** * From http://www.iana.org/assignments/character-sets * @var array $_charsetString */ $charsetString = array(3 => 'US-ASCII', 4 => 'ISO-8859-1', 106 => 'UTF-8', 1013 => 'UTF-16BE', 1014 => 'UTF-16LE', 1015 => 'UTF-16'); return isset($charsetString[$cs]) ? $charsetString[$cs] : null; } /** * Returns the character encoding. * * Only default character encodings from J2SE are supported. * * From http://www.iana.org/assignments/character-sets and * http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html */ function getCharsetInt($cs) { /** * From http://www.iana.org/assignments/character-sets * @var array $_charsetInt */ $charsetInt = array('US-ASCII' => 3, 'ISO-8859-1' => 4, 'UTF-8' => 106, 'UTF-16BE' => 1013, 'UTF-16LE' => 1014, 'UTF-16' => 1015); return isset($charsetInt[$cs]) ? $charsetInt[$cs] : null; } } /** * @package XML_WBXML */ class XML_WBXML_HashTable { var $_h; function set($k, $v) { $this->_h[$k] = $v; } function get($k) { return isset($this->_h[$k]) ? $this->_h[$k] : null; } } --- NEW FILE: package.xml --- XML_WBXML XML_WBXML:: provides an API for encoding and decoding WBXML documents used in SyncML and other wireless applications. This package provides encoding and decoding of WBXML (Wireless Binary XML) documents. WBXML is used in SyncML for transferring smaller amounts of data with wireless devices. LGPL chuck lead Chuck Hagenbuch chuck@horde.org 0.0.1 alpha 2003-11-25 Initial implementation. Horde_Util 0.0.1 2003-11-25 alpha Initial release as a package From cvs at intevation.de Fri Oct 14 16:33:17 2005 From: cvs at intevation.de (cvs@intevation.de) Date: Fri Oct 14 16:37:37 2005 Subject: steffen: server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML ContentHandler.php, NONE, 1.1 DTD.php, NONE, 1.1 DTDManager.php, NONE, 1.1 Decoder.php, NONE, 1.1 Encoder.php, NONE, 1.1 Message-ID: <20051014143317.E245C102C55@lists.intevation.de> Author: steffen Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/XML_WBXML/WBXML Added Files: ContentHandler.php DTD.php DTDManager.php Decoder.php Encoder.php Log Message: Separated Horde Framework from kolab-resource-handlers --- NEW FILE: ContentHandler.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * From Binary XML Content Format Specification Version 1.3, 25 July * 2001 found at http://www.wapforum.org * * @package XML_WBXML */ class XML_WBXML_ContentHandler { var $_currentUri; var $_indent = 0; var $_output = ''; var $_opaqueHandler; /** * Charset. */ var $_charset = 'UTF-8'; /** * WBXML Version. * 1, 2, or 3 supported */ var $_wbxmlVersion = 2; function XML_WBXML_ContentHandler() { $this->_currentUri = &new XML_WBXML_LifoQueue(); } function raiseError($error) { include_once 'PEAR.php'; return PEAR::raiseError($error); } function getCharsetStr() { return $this->_charset; } function setCharset($cs) { $this->_charset = $cs; } function getVersion() { return $this->_wbxmlVersion; } function setVersion($v) { $this->_wbxmlVersion = 2; } function getOutput() { return $this->_output; } function startElement($uri, $element, $attrs) { $this->_padspaces(); $this->_output .= '<' . $element; $currentUri = $this->_currentUri->top(); if ((!$currentUri) || ($currentUri != $uri)) { $this->_output .= ' xmlns="' . $uri . '"'; } $this->_currentUri->push($uri); foreach ($attrs as $attr) { $this->_output .= ' ' . $attr['attiribute'] . '="' . $attr['value'] . '"'; } $this->_output .= ">\n"; $this->_indent++; } function endElement($uri, $element) { $this->_indent--; $this->_padspaces(); $this->_output .= '\n"; $this->_currentUri->pop(); } function characters($str) { $this->_padspaces(); $this->_output .= $str . "\n"; } function opaque($o) { //I can check the first chanracter and see if it is WBXML if (ord($o[0]) < 10) { //should decode this, I really need a call back function } else { $this->_output .= $o . "\n"; } } /** * Padding to make it easier to read. */ function _padspaces() { if ($this->_indent > 0) { $this->_output .= str_repeat(' ', $this->_indent); } } function setOpaqueHandler($opaqueHandler) { $this->_opaqueHandler = $opaqueHandler; } function removeOpaqueHandler() { unset($this->_opaqueHandler); } } class XML_WBXML_LifoQueue { var $_queue = array(); function XML_WBXML_LifoQueue() { } function push($obj) { array_push($this->_queue, $obj); } function pop() { if (count($this->_queue)) { return array_pop($this->_queue); } else { return null; } } function top() { if ($count = count($this->_queue)) { return $this->_queue[$count - 1]; } else { return null; } } } --- NEW FILE: DTD.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * @package XML_WBXML */ class XML_WBXML_DTD { var $version; var $intTags; var $intAttributes; var $strTags; var $strAttributes; var $intCodePages; var $strCodePages; var $strCodePagesURI; var $URI; var $XMLNS; var $DPI; function XML_WBXML_DTD($v) { $this->version = $v; $this->init(); } function init() { } function setAttribute($intAttribute, $strAttribute) { $this->strAttributes[$strAttribute] = $intAttribute; $this->intAttributes[$intAttribute] = $strAttribute; } function setTag($intTag, $strTag) { $this->strTags[$strTag] = $intTag; $this->intTags[$intTag] = $strTag; } function setCodePage($intCodePage, $strCodePage, $strCodePageURI) { $this->strCodePagesURI[$strCodePageURI] = $intCodePage; $this->strCodePages[$strCodePage] = $intCodePage; $this->intCodePages[$intCodePage] = $strCodePage; } function toTagStr($tag) { return isset($this->intTags[$tag]) ? $this->intTags[$tag] : false; } function toAttributeStr($attribute) { return isset($this->intTags[$attribute]) ? $this->intTags[$attribute] : false; } function toCodePageStr($codePage) { return isset($this->intCodePages[$codePage]) ? $this->intCodePages[$codePage] : false; } function toTagInt($tag) { return isset($this->strTags[$tag]) ? $this->strTags[$tag] : false; } function toAttributeInt($attribute) { return isset($this->strAttributes[$attribute]) ? $this->strAttributes[$attribute] : false; } function toCodePageInt($codePage) { return isset($this->strCodePages[$codePage]) ? $this->strCodePages[$codePage] : false; } function toCodePageURI($uri) { $uri = strtolower($uri); $ret = isset($this->strCodePagesURI[$uri]) ? $this->strCodePagesURI[$uri] : false; return $ret; } /** * Getter for property version. * @return Value of property version. */ function getVersion() { return $this->version; } /** * Setter for property version. * @param integer $v New value of property version. */ function setVersion($v) { $this->version = $v; } /** * Getter for property URI. * @return Value of property URI. */ function getURI() { return $this->URI; } /** * Setter for property URI. * @param string $u New value of property URI. */ function setURI($u) { $this->URI = $u; } /** * Getter for property DPI. * @return Value of property DPI. */ function getDPI() { return $this->DPI; } /** * Setter for property DPI. * @param DPI New value of property DPI. */ function setDPI($d) { $this->DPI = $d; } } --- NEW FILE: DTDManager.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * From Binary XML Content Format Specification Version 1.3, 25 July * 2001 found at http://www.wapforum.org * * @package XML_WBXML */ class XML_WBXML_DTDManager { var $_strDTD = array(); var $_strDTDURI = array(); function XML_WBXML_DTDManager() { $this->registerDTD('-//SYNCML//DTD SyncML 1.0//EN', 'syncml:syncml', new XML_WBXML_DTD_SyncML(0)); $this->registerDTD('-//SYNCML//DTD SyncML 1.1//EN', 'syncml:syncml1.1', new XML_WBXML_DTD_SyncML(1)); $this->registerDTD('-//SYNCML//DTD MetInf 1.0//EN', 'syncml:metinf', new XML_WBXML_DTD_SyncMLMetInf(0)); $this->registerDTD('-//SYNCML//DTD MetInf 1.1//EN', 'syncml:metinf1.1', new XML_WBXML_DTD_SyncMLMetInf(1)); $this->registerDTD('-//SYNCML//DTD DevInf 1.0//EN', 'syncml:devinf', new XML_WBXML_DTD_SyncMLDevInf(0)); $this->registerDTD('-//SYNCML//DTD DevInf 1.1//EN', 'syncml:devinf1.1', new XML_WBXML_DTD_SyncMLDevInf(1)); } function getInstance($publicIdentifier) { return isset($this->_strDTD[$publicIdentifier]) ? $this->_strDTD[$publicIdentifier] : null; } function getInstanceURI($uri) { $uri = strtolower($uri); return isset($this->_strDTDURI[$uri]) ? $this->_strDTDURI[$uri] : null; } function registerDTD($publicIdentifier, $uri, &$dtd) { $dtd->setDPI($publicIdentifier); $this->_strDTD[$publicIdentifier] = $dtd; $this->_strDTDURI[$uri] = $dtd; } } --- NEW FILE: Decoder.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * From Binary XML Content Format Specification Version 1.3, 25 July * 2001 found at http://www.wapforum.org * * @package XML_WBXML */ class XML_WBXML_Decoder extends XML_WBXML_ContentHandler { /** * Document Public Identifier type * 1 mb_u_int32 well known type * 2 string table * from spec but converted into a string. * * Document Public Identifier * Used with dpiType. */ var $_dpi; /** * String table as defined in 5.7 */ var $_stringTable = array(); /** * Content handler. * Currently just outputs raw XML. */ var $_ch; var $_tagDTD; var $_prevAttributeDTD; var $_attributeDTD; /** * State variables. */ var $_tagStack = array(); var $_isAttribute; var $_isData = false; /** * The DTD Manager. * @var object XML_WBXML_DTDManager $dtdManager */ var $_dtdManager; /** * The string position. * @var integer string position */ var $_strpos; /** * Use wbxml2xml from libwbxml. * @var String */ var $_wbxml2xml = '/usr/bin/wbxml2xml -o '; /** * Constructor. */ function XML_WBXML_Decoder() { $this->_dtdManager = &new XML_WBXML_DTDManager(); } /** * Return one byte from the input stream. */ function getByte($input) { return ord($input[$this->_strpos++]); } function decode($input) { if (isset($this->_wbxml2xml)) { $tmp_id = mt_rand(); $tmp_file = '/tmp/wbxml_decoder_' . $tmp_id; $fp = fopen($tmp_file . '.wbxml', 'wb'); fwrite($fp, $input); fclose($fp); exec($this->_wbxml2xml . $tmp_file . '.xml ' . $tmp_file . '.wbxml'); $ret = file_get_contents($tmp_file . '.xml'); unlink($tmp_file . '.xml'); unlink($tmp_file . '.wbxml'); return $ret; } else { $this->_strpos = 0; // Get Version Number from Section 5.4 // version = u_int8 // currently 1, 2 or 3 $this->_wbxmlVersion = $this->getVersionNumber($input); // Get Document Public Idetifier from Section 5.5 // publicid = mb_u_int32 | (zero index) // zero = u_int8 // Containing the value zero (0) // The actual DPI is determined after the String Table is read. $dpiStruct = $this->getDocumentPublicIdentifier($input); // Get Charset from 5.6 // charset = mb_u_int32 $this->_charset = $this->getCharset($input); // Get String Table from 5.7 // strb1 = length *byte $this->_stringTable = $this->getStringTable($input, $this->_charset); // Get Document Public Idetifier from Section 5.5. $this->_dpi = $this->getDocumentPublicIdentifierImpl($dpiStruct['dpiType'], $dpiStruct['dpiNumber'], $this->_stringTable); // Now the real fun begins. // from Sections 5.2 and 5.8 // Default content handler. $this->_ch = &new XML_WBXML_ContentHandler(); // Default content handler. $this->_dtdManager = &new XML_WBXML_DTDManager(); // Get the starting DTD. $this->_tagDTD = $this->_dtdManager->getInstance($this->_dpi); if (!$this->_tagDTD) { return $this->raiseError('No DTD found for ' . $this->_dpi); } $this->_attributeDTD = $this->_tagDTD; while ($this->_strpos < strlen($input)) { $this->_decode($input); } return $this->_ch->getOutput(); } } function getVersionNumber($input) { return $this->getByte($input); } function getDocumentPublicIdentifier($input) { // 'dpiType' 'dpiNumber' $dpistruct = array(); $i = XML_WBXML::MBUInt32ToInt($input, $this->_strpos); if ($i == 0) { $dpiStruct['dpiType'] = 2; $dpiStruct['dpiNumber'] = $this->getByte($input); } else { $dpiStruct['dpiType'] = 1; $dpiStruct['dpiNumber'] = $i; } return $dpiStruct; } function getDocumentPublicIdentifierImpl($dpiType, $dpiNumber, $st) { if ($dpiType == 1) { return XML_WBXML::getDPIString($dpiNumber); } else { return isset($st[$dpiNumber]) ? $st[$dpiNumber] : null; } } /** * Returns the character encoding. Only default character * encodings from J2SE are supported. From * http://www.iana.org/assignments/character-sets and * http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html */ function getCharset($input) { $cs = XML_WBXML::MBUInt32ToInt($input, $this->_strpos); return $charset = XML_WBXML::getCharsetString($cs); } /** * @TODO needs to be fixed. Does this still really need to be * fixed? */ function getStringTable($input, $cs) { $stringTable = array(); $size = XML_WBXML::MBUInt32ToInt($input, $this->_strpos); // A hack to make it work with arrays. // How/why is this necessary? $str = 'j'; $numstr = 0; $start = 0; $j = 0; for ($i = 0; $i < $size; $i++ ) { /* May need to fix the null detector for more than single * byte charsets like ASCII, UTF-8, etc. */ $ch = $input[$this->_strpos++]; if (ord($ch) == 0) { $stringTable[$numstr++] = $str; $str = '#'; $start = $i + 1; } else { $str[$j++] = $ch; } } if ($start < $size) { $stringTable[$numstr++] = $str; } return $stringTable; } function _decode($input) { $token = $this->getByte($input); $str = ''; switch ($token) { case XML_WBXML_GLOBAL_TOKEN_STR_I: // Section 5.8.4.1 $str = $this->termstr($input); $this->_ch->characters($str); break; case XML_WBXML_GLOBAL_TOKEN_STR_T: // Section 5.8.4.1 $str = $this->_stringTable[XML_WBXML::MBUInt32ToInt($intput)]; $this->_ch->characters($str); break; case XML_WBXML_GLOBAL_TOKEN_EXT_I_0: case XML_WBXML_GLOBAL_TOKEN_EXT_I_1: case XML_WBXML_GLOBAL_TOKEN_EXT_I_2: // Section 5.8.4.2 $str = $this->termstr($input); $this->_ch->characters($str); break; case XML_WBXML_GLOBAL_TOKEN_EXT_T_0: case XML_WBXML_GLOBAL_TOKEN_EXT_T_1: case XML_WBXML_GLOBAL_TOKEN_EXT_T_2: // Section 5.8.4.2 $str = $this->_stringTable[XML_WBXML::MBUInt32ToInt($intput)]; $this->_ch->characters($str); break; case XML_WBXML_GLOBAL_TOKEN_EXT_0: case XML_WBXML_GLOBAL_TOKEN_EXT_1: case XML_WBXML_GLOBAL_TOKEN_EXT_2: // Section 5.8.4.2 $extension = $this->getByte($input); $this->_ch->characters($extension); break; case XML_WBXML_GLOBAL_TOKEN_ENTITY: // Section 5.8.4.3 // UCS-4 chracter encoding? $entity = $this->entity(XML_WBXML::MBUInt32ToInt($input, $this->_strpos)); $this->_ch->characters('&#' . $entity . ';'); break; case XML_WBXML_GLOBAL_TOKEN_PI: // Section 5.8.4.4 // throw new IOException("WBXML global token processing instruction(PI, " + token + ") is unsupported!"); break; case XML_WBXML_GLOBAL_TOKEN_LITERAL: // Section 5.8.4.5 $str = $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; $this->parseTag($input, $str, false, false); break; case XML_WBXML_GLOBAL_TOKEN_LITERAL_A: // Section 5.8.4.5 $str = $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; $this->parseTag($input, $str, true, false); break; case XML_WBXML_GLOBAL_TOKEN_LITERAL_AC: // Section 5.8.4.5 $str = $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; $this->parseTag($input, $string, true, true); break; case XML_WBXML_GLOBAL_TOKEN_LITERAL_C: // Section 5.8.4.5 $str = $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; $this->parseTag($input, $str, false, true); break; case XML_WBXML_GLOBAL_TOKEN_OPAQUE: // Section 5.8.4.6 $size = XML_WBXML::MBUInt32ToInt($input, $this->_strpos); $b = substr($input, $this->_strpos, $this->_strpos + $size); $this->_strpos += $size; $this->_ch->opaque($b); // FIXME Opaque is used by SYNCML. Opaque data that depends on the context // if (contentHandler instanceof OpaqueContentHandler) { // ((OpaqueContentHandler)contentHandler).opaque(b); // } else { // String str = new String(b, 0, size, charset); // char[] chars = str.toCharArray(); // contentHandler.characters(chars, 0, chars.length); // } // This can cause some problems. We may have to use a // event based decoder. break; case XML_WBXML_GLOBAL_TOKEN_END: // Section 5.8.4.7.1 $str = $this->endTag(); break; case XML_WBXML_GLOBAL_TOKEN_SWITCH_PAGE: // Section 5.8.4.7.2 $codePage = $this->getByte($input); $this->switchElementCodePage($codePage); break; default: // Section 5.8.2 // Section 5.8.3 $hasAttributes = (($token & 0x80) != 0); $hasContent = (($token & 0x40) != 0); $realToken = $token & 0x3F; $str = $this->getTag($realToken); $this->parseTag($input, $str, $hasAttributes, $hasContent); if ($realToken == 0x0f) { // FIXME Don't remember this one. $this->_isData = true; } break; } } function parseTag($input, $tag, $hasAttributes, $hasContent) { $attrs = array(); if ($hasAttributes) { $attrs = $this->getAttributes($input); } $this->_ch->startElement($this->getCurrentURI(), $tag, $attrs); if ($hasContent) { // FIXME I forgot what does this does. Not sure if this is // right? $this->_tagStack[] = $tag; } else { $this->_ch->endElement($this->getCurrentURI(), $tag); } } function endTag() { if (count($this->_tagStack)) { $tag = array_pop($this->_tagStack); } else { $tag = 'Unknown'; } if ($tag == 'Data') { $this->_isData = false; } $this->_ch->endElement($this->getCurrentURI(), $tag); return $tag; } function getAttributes($input) { $this->startGetAttributes(); $hasMoreAttributes = true; $attrs = array(); $attr = null; $value = null; $token = null; while ($hasMoreAttributes) { $token = $this->getByte($input); switch ($token) { // Attribute specified. case XML_WBXML_GLOBAL_TOKEN_LITERAL: // Section 5.8.4.5 if (isset($attr)) { $attrs[] = array('attribute' => $attr, 'value' => $value); } $attr = $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; break; // Value specified. case XML_WBXML_GLOBAL_TOKEN_EXT_I_0: case XML_WBXML_GLOBAL_TOKEN_EXT_I_1: case XML_WBXML_GLOBAL_TOKEN_EXT_I_2: // Section 5.8.4.2 $value .= $this->termstr($input); break; case XML_WBXML_GLOBAL_TOKEN_EXT_T_0: case XML_WBXML_GLOBAL_TOKEN_EXT_T_1: case XML_WBXML_GLOBAL_TOKEN_EXT_T_2: // Section 5.8.4.2 $value .= $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; break; case XML_WBXML_GLOBAL_TOKEN_EXT_0: case XML_WBXML_GLOBAL_TOKEN_EXT_1: case XML_WBXML_GLOBAL_TOKEN_EXT_2: // Section 5.8.4.2 $value .= $input[$this->_strpos++]; break; case XML_WBXML_GLOBAL_TOKEN_ENTITY: // Section 5.8.4.3 $value .= $this->entity(XML_WBXML::MBUInt32ToInt($input, $this->_strpos)); break; case XML_WBXML_GLOBAL_TOKEN_STR_I: // Section 5.8.4.1 $value .= $this->termstr($input); break; case XML_WBXML_GLOBAL_TOKEN_STR_T: // Section 5.8.4.1 $value .= $this->_stringTable[XML_WBXML::MBUInt32ToInt($input, $this->_strpos)]; break; case XML_WBXML_GLOBAL_TOKEN_OPAQUE: // Section 5.8.4.6 $size = XML_WBXML::MBUInt32ToInt($input, $this->_strpos); $b = substr($input, $this->_strpos, $this->_strpos + $size); $this->_strpos += $size; $value .= $b; break; case XML_WBXML_GLOBAL_TOKEN_END: // Section 5.8.4.7.1 $hasMoreAttributes = false; if (isset($attr)) { $attrs[] = array('attribute' => $attr, 'value' => $value); } break; case XML_WBXML_GLOBAL_TOKEN_SWITCH_PAGE: // Section 5.8.4.7.2 $codePage = $this->getByte($input); if (!$this->_prevAttributeDTD) { $this->_prevAttributeDTD = $this->_attributeDTD; } $this->switchAttributeCodePage($codePage); break; default: if ($token > 128) { if (isset($attr)) { $attrs[] = array('attribute' => $attr, 'value' => $value); } $attr = $this->_attributeDTD->toAttribute($token); } else { // Value. $value .= $this->_attributeDTD->toAttribute($token); } break; } } if (!$this->_prevAttributeDTD) { $this->_attributeDTD = $this->_prevAttributeDTD; $this->_prevAttributeDTD = false; } $this->stopGetAttributes(); } function startGetAttributes() { $this->_isAttribute = true; } function stopGetAttributes() { $this->_isAttribute = false; } function getCurrentURI() { if ($this->_isAttribute) { return $this->_tagDTD->getURI(); } else { return $this->_attributeDTD->getURI(); } } function writeString($str) { $this->_ch->characters($str); } function getTag($tag) { // Should know which state it is in. return $this->_tagDTD->toTagStr($tag); } function getAttribute($attribute) { // Should know which state it is in. $this->_attributeDTD->toAttributeInt($attribute); } function switchElementCodePage($codePage) { $this->_tagDTD = &$this->_dtdManager->getInstance($this->_tagDTD->toCodePageStr($codePage)); $this->switchAttributeCodePage($codePage); } function switchAttributeCodePage($codePage) { $this->_attributeDTD = &$this->_dtdManager->getInstance($this->_attributeDTD->toCodePageStr($codePage)); } /** * Return the hex version of the base 10 $entity. */ function entity($entity) { return dechex($entity); } /** * @TODO FIXME reads a null terminated string. */ function termstr($input) { $str = '#'; $i = 0; $ch = $input[$this->_strpos++]; while (ord($ch) != 0) { $str[$i++] = $ch; $ch = $input[$this->_strpos++]; } return $str; } /** * For debugging. */ function dumpStringTable($st) { echo 'String Table: '; foreach ($st as $s) { echo $s . ', '; } echo "\n"; } } --- NEW FILE: Encoder.php --- * * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * * From Binary XML Content Format Specification Version 1.3, 25 July * 2001 found at http://www.wapforum.org * * @package XML_WBXML */ class XML_WBXML_Encoder extends XML_WBXML_ContentHandler { var $_strings = array(); var $_stringTable; var $_hasWrittenHeader = false; var $_dtd; var $_output; var $_uris = array(); var $_uriNums = array(); var $_currentURI; var $_subParser; var $_subParserStack; /** * These will store the startElement params to see if we should * call startElementImp or startEndElementImp. */ var $_storeURI; var $_storeName; var $_storeAttributes; /** * The XML parser. * @var resource $_parser */ var $_parser; /** * The DTD Manager. * @var object XML_WBXML_DTDManager $dtdManager */ var $_dtdManager; var $_indent = 0; /** * Use wbxml2xml from libwbxml. * @var String */ var $_xml2wbxml = '/usr/bin/xml2wbxml -n -v 1.2 -o '; /** * Constructor. */ function XML_WBXML_Encoder() { $this->_stringTable = &new XML_WBXML_HashTable(); $this->_dtdManager = &new XML_WBXML_DTDManager(); $this->_hasWrittenHeader = false; $this->_subParser = null; $this->_subParserStack = 0; $this->_output = ''; } /** * Take the input $xml and turn it into WBXML, which gets sent to * $this->_output. */ function encode($xml) { if (isset($this->_xml2wbxml)) { $tmp_id = mt_rand(); $tmp_file = '/tmp/wbxml_encoder_' . $tmp_id; $fp = fopen($tmp_file . '.xml', 'wb'); fwrite($fp, $xml); fclose($fp); exec($this->_xml2wbxml . $tmp_file . '.wbxml ' . $tmp_file . '.xml'); $ret = file_get_contents($tmp_file . '.wbxml'); unlink($tmp_file . '.wbxml'); unlink($tmp_file . '.xml'); return $ret; } else { // Create the XML parser and set method references. $this->_parser = xml_parser_create_ns($this->_charset); xml_set_object($this->_parser, $this); xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler($this->_parser, '_startElement', '_endElement'); xml_set_character_data_handler($this->_parser, '_characters'); xml_set_default_handler($this->_parser, 'defaultHandler'); xml_set_processing_instruction_handler($this->_parser, ''); xml_set_external_entity_ref_handler($this->_parser, ''); if (!xml_parse($this->_parser, $xml)) { return $this->raiseError(sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($this->_parser)), xml_get_current_line_number($this->_parser))); } xml_parser_free($this->_parser); return $this->_output; } } /** * This will write the correct headers. */ function writeHeader($uri) { $this->_dtd = &$this->_dtdManager->getInstanceURI($uri); $dpiString = $this->_dtd->getDPI(); // Set Version Number from Section 5.4 // version = u_int8 // currently 1, 2 or 3 $this->writeVersionNumber($this->_wbxmlVersion); // Set Document Public Idetifier from Section 5.5 // publicid = mb_u_int32 | ( zero index ) // zero = u_int8 // containing the value zero (0) // The actual DPI is determined after the String Table is read. $this->writeDocumentPublicIdentifier($dpiString, $this->_strings); // Set Charset from 5.6 // charset = mb_u_int32 $this->writeCharset($this->_charset); // Set String Table from 5.7 // strb1 = length *byte $this->writeStringTable($this->_strings, $this->_charset, $this->_stringTable); $this->_currentURI = $uri; $this->_hasWrittenHeader = true; } function writeVersionNumber($version) { $this->_output.= chr($version); } function writeDocumentPublicIdentifier($dpiString, &$strings) { $i = XML_WBXML::getDPIInt($dpiString); if ($i == 0) { $strings[0] = $dpiString; $this->_output .= chr(0); $this->_output .= chr(0); } else { XML_WBXML::intToMBUInt32($this->_output, $i); } } function writeCharset($charset) { $cs = XML_WBXML::getCharsetInt($charset); if ($cs == 0) { return $this->raiseError('Unsupported Charset: ' . $charset); } else { XML_WBXML::intToMBUInt32($this->_output, $cs); } } function writeStringTable($strings, $charset, $stringTable) { $stringBytes = array(); $count = 0; foreach ($strings as $str) { $bytes = $this->_getBytes($str, $charset); $stringBytes = array_merge($stringBytes, $bytes); $nullLength = $this->_addNullByte($bytes); $this->_stringTable->set($str, $count); $count += count($bytes) + $nullLength; } XML_WBXML::intToMBUInt32($this->_output, count($stringBytes)); $this->_output.= implode('', $stringBytes); } function writeString($str, $cs) { $bytes = $this->_getBytes($str, $cs); $this->_output.= implode('', $bytes); $this->writeNull($cs); } function writeNull($charset) { $this->_output.= chr(0); return 1; } function _addNullByte(&$bytes) { $bytes[] = chr(0); return 1; } function _getBytes($string, $cs) { $string = String::convertCharset($string, $cs, 'utf-8'); $nbytes = strlen($string); $bytes = array(); for ($i = 0; $i < $nbytes; $i++) { $bytes[] = $string{$i}; } return $bytes; } function _splitURI($tag) { $parts = explode(':', $tag); $name = array_pop($parts); $uri = implode(':', $parts); return array($uri, $name); } /** * Has no content, 64. */ function startEndElementImp($uri, $name, $attributes) { if (!$this->_hasWrittenHeader) { $this->writeHeader($uri); } $this->writeTag($name, $attributes, false, $this->_charset); } function startElementImp($uri, $name, $attributes) { if (!$this->_hasWrittenHeader) { $this->writeHeader($uri); } if ($this->_currentURI != $uri) { $this->changecodepage($uri); $this->_currentURI != $uri; } $this->writeTag($name, $attributes, true, $this->_charset); } function writeStartElement($isEnd) { if ($this->_storeName != null) { if ($isEnd) { $this->startEndElementImp($this->_storeURI, $this->_storeName, $this->_storeAttributes); }