[vhffs-dev] [2013] Latest (ahah!) code cleaning of all Vhffs depth one modules, sed powered |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 2013
Author: gradator
Date: 2012-02-17 21:23:45 +0100 (Fri, 17 Feb 2012)
Log Message:
-----------
Latest (ahah!) code cleaning of all Vhffs depth one modules, sed powered
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Acl.pm
trunk/vhffs-api/src/Vhffs/Broadcast.pm
trunk/vhffs-api/src/Vhffs/Conf.pm
trunk/vhffs-api/src/Vhffs/Constants.pm
trunk/vhffs-api/src/Vhffs/Functions.pm
trunk/vhffs-api/src/Vhffs/Group.pm
trunk/vhffs-api/src/Vhffs/Listengine.pm
trunk/vhffs-api/src/Vhffs/Main.pm
trunk/vhffs-api/src/Vhffs/Object.pm
trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
trunk/vhffs-api/src/Vhffs/Robots.pm
trunk/vhffs-api/src/Vhffs/Stats.pm
trunk/vhffs-api/src/Vhffs/Tag.pm
trunk/vhffs-api/src/Vhffs/User.pm
Modified: trunk/vhffs-api/src/Vhffs/Acl.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Acl.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Acl.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
#Vhffs::ACL written by sod` <dieu AT gunnm DOT org>
@@ -75,14 +75,14 @@
$perm = Vhffs::Constants::ACL_DENIED unless defined $perm;
$perm = Vhffs::Constants::ACL_VIEW if $user->is_moderator and (not defined $perm or $perm < Vhffs::Constants::ACL_VIEW);
- return $perm;
+ return $perm;
}
=pod
=head2 add_acl
- die("Unable to add ACL\n") if Vhffs::Acl::add_acl($vhffs, $granted_object, $target_object, $perm) < 0;
+ die("Unable to add ACL\n") if Vhffs::Acl::add_acl($vhffs, $granted_object, $target_object, $perm) < 0;
Grant permission C<$perm> to user or group C<$granted_object> on service C<$target_object>.
@@ -106,7 +106,7 @@
=head2 add_acl_oid
- die("Unable to add ACL\n") if Vhffs::Acl::add_acl($vhffs, $granted_oid, $target_oid, $perm) < 0;
+ die("Unable to add ACL\n") if Vhffs::Acl::add_acl($vhffs, $granted_oid, $target_oid, $perm) < 0;
Grant permission $perm to user or group OID $granted_oid on service OID $target_oid.
@@ -125,7 +125,7 @@
=head2 update_acl
- my $ret = Vhffs::Acl::update_acl($vhffs, $target_oid , $granted_oid, $perm);
+ my $ret = Vhffs::Acl::update_acl($vhffs, $target_oid , $granted_oid, $perm);
Update the ACL between $target_oid and $granted_oid.
@@ -145,7 +145,7 @@
=head2 del_acl
- my $ret = Vhffs::Acl::del_acl($vhffs, $target_oid , $granted_oid);
+ my $ret = Vhffs::Acl::del_acl($vhffs, $target_oid , $granted_oid);
Delete the ACL between $target_oid and $granted_oid.
@@ -162,7 +162,7 @@
my $sql = 'DELETE FROM vhffs_acl WHERE granted_oid=? AND target_oid=?';
my $sth = $dbh->prepare( $sql );
$sth->execute( $granted_oid, $target_oid ) or return -1;
-
+
$sql = 'SELECT COUNT(*) FROM vhffs_acl WHERE perm>=? AND target_oid=?';
$sth = $dbh->prepare( $sql );
$sth->execute(Vhffs::Constants::ACL_MANAGEACL, $target_oid) or return -1;
@@ -182,9 +182,9 @@
=head2 add_update_or_del_acl
- my $ret = Vhffs::Acl::add_update_or_del_acl($vhffs, $target_oid , $granted_oid, $perm);
+ my $ret = Vhffs::Acl::add_update_or_del_acl($vhffs, $target_oid , $granted_oid, $perm);
-This is the magic function. It deletes the ACL entry if $perm equals Vhffs::Constants::ACL_UNDEFINED or
+This is the magic function. It deletes the ACL entry if $perm equals Vhffs::Constants::ACL_UNDEFINED or
creates the ACL entry if necessary or update the ACL entry if the ACL entry already exists.
Returns 1 if acl has been added, 2 if acl has been updated, 3 if acl has been deleted, -1 is something went wrong.
@@ -208,14 +208,14 @@
=head2 get_object_acl
- my $rights = Vhffs::Acl::get_object_acl($vhffs, $object);
+ my $rights = Vhffs::Acl::get_object_acl($vhffs, $object);
Returns an array of hashref with keys 'granted_oid, name, perm'.
A NULL perm is a non existing ACL.
A NULL name is the default ACL.
Example:
- granted_oid | name | perm
+ granted_oid | name | perm
-------------+----------+------
3 | | 0 <== default ACL
1 | user1 | 10
Modified: trunk/vhffs-api/src/Vhffs/Broadcast.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Broadcast.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Broadcast.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -2,37 +2,37 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
# This file is a part of the VHFFS plateform
# Please respect the entire licence of VHFFS
-#
+#
# Author : Julien Delange < dieu at gunnm dot org >
package Vhffs::Broadcast;
@@ -65,10 +65,10 @@
=cut
sub add_broadcast {
- my $vhffs = shift;
+ my $vhffs = shift;
my $subject = shift;
my $message = shift;
-
+
return -1 unless defined $vhffs;
$message =~ s/\r\n/\n/g;
@@ -102,7 +102,7 @@
my $request = $vhffs->{'db'}->prepare( $query );
$request->execute( @params ) or return undef;
-
+
my $rows = $request->fetchall_hashref( 'id_mailing' );
return $rows;
}
@@ -119,7 +119,7 @@
=cut
sub del_broadcast {
- my $vhffs = shift;
+ my $vhffs = shift;
my $id = shift;
my $db = $vhffs->get_db_object;
@@ -140,12 +140,12 @@
=cut
sub get_broadcast {
- my $vhffs = shift;
+ my $vhffs = shift;
my $id = shift;
my $db = $vhffs->get_db_object;
return undef unless defined $id;
-
+
my $query = 'SELECT id_mailing,subject,message,date,state FROM vhffs_mailings WHERE id_mailing=?';
my $request = $db->prepare( $query );
$request->execute( $id ) or return -2;
Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,32 +1,32 @@
-#!%PERL% -w
+#!%PERL% -w
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
package Vhffs::Conf;
@@ -52,14 +52,14 @@
my $conf = new Vhffs::Conf( $filename );
-Returns a Vhffs::Conf object
+Returns a Vhffs::Conf object
=cut
sub new {
my ( $this, $filename ) = @_;
my $class = ref($this) || $this;
- my $conf = new Config::General(
+ my $conf = new Config::General(
-ConfigFile => $filename,
-DefaultConfig => {
'global' => {
@@ -94,7 +94,7 @@
push @entries, $_;
} else {
s/\\#/#/g if defined $_;
- }
+ }
}
}
@@ -211,7 +211,7 @@
my $available = $conf->get_service_availability( $servicename );
-Get availability of a service (return 1 if open, 0 if closed or unknown).
+Get availability of a service (return 1 if open, 0 if closed or unknown).
=cut
sub get_service_availability {
@@ -435,7 +435,7 @@
=cut
sub get_moderation {
- my $self = shift;
+ my $self = shift;
return $self->{'global'}{'moderation'};
}
Modified: trunk/vhffs-api/src/Vhffs/Constants.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Constants.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Constants.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -35,19 +35,19 @@
MODIFICATION_ERROR => 10,
MODIFICATION_APPLIED => 11,
TO_DELETE => 12,
-
+
ACL_UNDEFINED => -1,
ACL_DENIED => 0,
ACL_VIEW => 2,
ACL_MODIFY => 4,
ACL_MANAGEACL => 8,
ACL_DELETE => 10,
-
+
USER_NORMAL => 0,
USER_ADMIN => 1,
USER_MODERATOR => 2,
-
- ML_RIGHT_SUB_WAITING_FOR_REPLY => 2,
+
+ ML_RIGHT_SUB_WAITING_FOR_REPLY => 2,
ML_RIGHT_SUB_WAITING_FOR_VALIDATION => 3,
ML_RIGHT_SUB => 4,
ML_RIGHT_ADMIN => 10,
@@ -80,7 +80,7 @@
TYPE_MAIL => 60,
TYPE_ML => 61,
TYPE_CRON => 70,
-
+
# Tags visibility MUST BE ORDERED BY PRIVILEGE LEVEL!
TAG_VISIBILITY_GROUP_CREATION => 10,
TAG_VISIBILITY_PUBLIC => 20,
Modified: trunk/vhffs-api/src/Vhffs/Functions.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Functions.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Functions.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
=pod
Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Group.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
package Vhffs::Group;
@@ -156,9 +156,9 @@
my $parent = Vhffs::Object::create($main, $owner_uid, $gid, $description, undef, Vhffs::Constants::TYPE_GROUP);
die('Unable to create parent object') unless(defined $parent);
-
+
my $quota = $groupconf->{default_quota} || 10;
-
+
my $query = 'INSERT INTO vhffs_groups(gid, groupname, realname, passwd, quota, quota_used, object_id) VALUES(?, ?, ?, NULL, ?, 0, ?)';
my $sth = $dbh->prepare( $query );
$sth->execute($gid, $groupname, $realname, $quota, $parent->get_oid);
@@ -205,9 +205,9 @@
my $name = shift;
my $db = $vhffs->get_db_object;
- my @result;
+ my @result;
my $query = 'SELECT groupname FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id=o.object_id LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL ';
-
+
$query .= " AND o.state=$state " if( defined $state );
$query .= " AND g.groupname LIKE '%".$name."%' " if( defined $name );
@@ -217,7 +217,7 @@
my $rows = $request->execute;
return undef if( $rows <= 0 );
-
+
my $names = $request->fetchall_arrayref;
my $group;
@@ -249,7 +249,7 @@
my @result;
my $query = 'SELECT groupname FROM vhffs_groups g INNER JOIN vhffs_object o ON g.object_id=o.object_id LEFT OUTER JOIN vhffs_users u ON u.username = g.groupname WHERE u.username IS NULL AND g.groupname LIKE ?';
$query .= "AND o.state=$state " if( defined $state );
-
+
my $request = $db->prepare( $query );
return undef if( ! $request->execute( $letter ) );
@@ -282,7 +282,7 @@
g.quota_used, o.date_creation, o.description, o.state
FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id
WHERE (g.quota_used / g.quota) >= 0.9 ORDER BY g.quota_used DESC LIMIT ?};
-
+
my $dbh = $vhffs->get_db_object;
my $sth = $dbh->prepare($sql);
$sth->execute($limit) or return undef;
@@ -440,7 +440,7 @@
$request = $self->{'db'}->prepare('DELETE FROM vhffs_groups WHERE gid=?');
$request->execute($self->{'gid'}) or return -1;
-
+
$self->SUPER::delete;
return 1;
Modified: trunk/vhffs-api/src/Vhffs/Listengine.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Listengine.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Listengine.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -2,31 +2,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
package Vhffs::Listengine;
@@ -67,7 +67,7 @@
push( @result , gettext("user info user\@domain.tld\t\t - show user information\n") );
push( @result , "\n" );
-
+
return( \@result );
}
@@ -76,14 +76,14 @@
my $from = shift;
my $pass = shift;
my @result;
-
+
push( @result , sprintf( "You sent a request to be subscribed to the following mailing list:\n %s\n\nWith the following email:\n %s\n\n" , $list->get_listname , $from ) );
push( @result , gettext( "You must confirm your request by sending a confirmation email\n") );
push( @result , sprintf( gettext( "This mail must have the following subject : \"confirm subscribe %s\"\nOn most clients it should work by just replying this email\n") , $pass ) );
push( @result , "\n" );
push( @result , gettext( "If you don't asked to be subscribed to this mailing list,\njust forget this email\n" ) );
push( @result , "\n" );
-
+
return( \@result );
}
@@ -92,7 +92,7 @@
my $from = shift;
my $hash = shift;
my @result;
-
+
push( @result , sprintf( "You asked to be removed from the following list:\n\n%s\n\n" , $list->get_listname) );
push( @result , gettext( "You must confirm your request by sending a confirmation email\n") );
push( @result , sprintf( gettext( "This mail must contains the following subject : \"confirm unsubscribe %s\"\n") , $hash ) );
@@ -107,7 +107,7 @@
my $list = shift;
my $from = shift;
my @result;
-
+
push( @result , sprintf( gettext( "You asked to be subscribed to the following list:\n\n%s\n\n" ) , $list->get_listname) );
push( @result , sprintf( gettext( "However you are (%s) already subscribed to this list.\n") , $from ) );
push( @result , "\n" );
@@ -123,7 +123,7 @@
my @result;
push( @result , sprintf( gettext( "Subscription to the following list is forbidden:\n %s\n\nHave a nice day.\n" ) , $list->get_listname) );
-
+
return( \@result );
}
@@ -137,7 +137,7 @@
push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n") , $list->get_localpart , $list->get_domain ) );
push( @result , "\n" );
-
+
return( \@result );
}
@@ -154,7 +154,7 @@
push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n") , $list->get_localpart , $list->get_domain ) );
push( @result , "\n" );
-
+
return( \@result );
}
@@ -164,7 +164,7 @@
my @result;
push( @result , sprintf( gettext( "You have been successfully removed from the following list:\n %s\n" ) , $list->get_listname) );
-
+
return( \@result );
}
@@ -177,62 +177,62 @@
push( @result , gettext("The confirmation code was wrong\n" ));
push( @result , gettext("Please try again !\n" ));
push( @result , "\n" );
-
+
return( \@result );
}
sub mail_sub_not_exist {
my $list = shift;
my $from = shift;
-
+
my @result;
-
+
push( @result , sprintf( gettext( "The following address %s is not on the following mailing list:\n %s\n" ) , $from , $list->get_listname) );
push( @result , gettext("You demand was refused\n" ));
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_error_unsub {
my $list = shift;
my $from = shift;
-
+
my @result;
-
+
push( @result , sprintf( gettext( "You cannot unsubscribe from the list %s\n" ) , $list->get_listname) );
push( @result , gettext("You are not a subscriber on this list.\n" ));
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_error_unsub_hash {
my $list = shift;
my @result;
-
+
push( @result , sprintf( gettext( "Unsubscribe for the list %s was not complete.\n" ) , $list->get_listname) );
push( @result , gettext("Confirmation code was wrong.\n" ));
push( @result , gettext("Please try again.\n" ));
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_unsub_success {
my $list = shift;
my @result;
-
+
push( @result , sprintf( gettext( "You have been successfully removed from the list %s.\n" ) , $list->get_listname) );
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
@@ -241,12 +241,12 @@
my $from = shift;
my $lang = shift;
my @result;
-
+
push( @result , sprintf( gettext( "The listengine language preference was changed for the following address %s.\n" ) , $from) );
push( @result , sprintf( gettext( "New language is: %s\n" ) , $lang) );
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
@@ -255,18 +255,18 @@
my $from = shift;
my $lang = shift;
my @result;
-
+
push( @result , sprintf( gettext( "An error occured while updating language for the following address: %s.\n" ) , $from) );
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_unknown_command {
my $list = shift;
my @result;
-
+
push( @result , gettext( "Unknow command\n\n" ) );
push( @result , gettext( "Please read help of listengine\n" ) );
push( @result , gettext( "Send an email with the subject \"help\" to the following address: \n" ) );
@@ -274,8 +274,8 @@
push( @result , "\n" );
push( @result , "---\n" );
push( @result , "Listengine 4.0\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_refuse_error {
@@ -306,7 +306,7 @@
push( @result , "\n" );
push( @result , "---\n" );
push( @result , "Listengine 4.0\n" );
-
+
return( \@result );
}
@@ -339,7 +339,7 @@
push( @result , "---\n" );
push( @result , "Listengine 4.0\n" );
- return( \@result );
+ return( \@result );
}
sub mail_not_allowed {
@@ -347,11 +347,11 @@
my $from = shift;
my @result;
-
+
push( @result , sprintf( gettext( "The following address %s is not allowed to execute commands on the list %s\n") , $from , $list->get_listname ) );
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_moderate_message {
@@ -360,14 +360,14 @@
my $from = shift;
my $subject = shift;
my @result;
-
+
push( @result , sprintf( gettext( "A mail to moderate is on the following mailing list:\n %s\n\n" ) , $list->get_listname) );
push( @result , sprintf( gettext( "This mail was sent by %s with the following subject:\n %s\n\n" ) , $from, $subject) );
push( @result , sprintf( gettext( "To put this post on the list, send a message to:\n %s-request\@%s\n" ) , $list->get_localpart , $list->get_domain) );
push( @result , sprintf( gettext( "with the following subject :\n \"moderate %s\" \n" ) , $hash) );
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_moderate_subscriber {
@@ -375,7 +375,7 @@
my $from = shift;
my $pass = shift;
my @result;
-
+
push( @result , sprintf( gettext( "A new person wants to subscribe to the following mailing list:\n %s\n\n" ) , $list->get_listname) );
push( @result , sprintf( gettext( "His email address is:\n %s\n" ) , $from) );
push( @result , "\n" );
@@ -385,8 +385,8 @@
push( @result , gettext( "To refuse this subscriber, send a message to\n" ) );
push( @result , sprintf( gettext( " %s-request\@%s\nwith the following subject :\n \"subscription refuse %s %s\" \n" ) , $list->get_localpart , $list->get_domain , $from, $pass) );
push( @result , "\n" );
-
- return( \@result );
+
+ return( \@result );
}
sub mail_moderate_subscription_accepted {
@@ -399,7 +399,7 @@
push( @result , gettext( "You may get some help on listengine by sending an email to\n") );
push( @result , sprintf( gettext( "%s-request\@%s with subject \"help\"\n") , $list->get_localpart , $list->get_domain ) );
push( @result , "\n" );
-
+
return( \@result );
}
@@ -410,7 +410,7 @@
push( @result , sprintf( gettext( "We confirm that you accepted the subscription of:\n %s\n\nto the following mailing list:\n %s\n\n") , $subscriber, $list->get_listname ) );
- return( \@result );
+ return( \@result );
}
sub mail_moderate_subscription_refused {
@@ -419,7 +419,7 @@
my @result;
push( @result , sprintf( gettext( "Your subscription was refused to the following mailing list:\n %s\n\nHave a nice day.\n" ) , $list->get_listname) );
-
+
return( \@result );
}
@@ -429,7 +429,7 @@
my @result;
push( @result , sprintf( gettext( "We confirm that you REFUSED the subscription of:\n %s\n\nto the following mailing list:\n %s\n\n") , $subscriber, $list->get_listname ) );
-
+
return( \@result );
}
@@ -439,7 +439,7 @@
my @result;
push( @result , sprintf( gettext( "An error occured during your approval of subscription of:\n %s\ninto the following mailing list:\n %s\n\n" ) , $subscriber, $list->get_listname) );
-
+
return( \@result );
}
Modified: trunk/vhffs-api/src/Vhffs/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Main.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Main.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
package Vhffs::Main;
Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Object.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
use strict;
@@ -462,7 +462,7 @@
$self = shift;
$value = shift;
$self->{'state'} = $value;
-
+
if( $value == Vhffs::Constants::TO_DELETE ) {
$self->add_history( "Will be deleted" );
}
@@ -484,8 +484,8 @@
elsif( $value == Vhffs::Constants::ACTIVATED ) {
$self->add_history( "Is now active for production");
}
-
-
+
+
}
=pod
Modified: trunk/vhffs-api/src/Vhffs/ObjectFactory.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/ObjectFactory.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/ObjectFactory.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -54,7 +54,7 @@
=head2 fetch_object
- my $obj = Vhffs::ObjectFactory::fetch_object($vhffs, $oid);
+ my $obj = Vhffs::ObjectFactory::fetch_object($vhffs, $oid);
Returns the object whose oid is C<$oid>. Actually the returned entity is a
subclass of Vhffs::Object, allowing use of polymorphism (eg. calling get_label
@@ -66,7 +66,7 @@
my $obj = Vhffs::Object::get_by_oid($vhffs, $oid);
return undef unless defined $obj;
my $class = Vhffs::Functions::type_class_from_type_id($obj->get_type);
- $obj = $class->fill_object($obj) if defined $class;
+ $obj = $class->fill_object($obj) if defined $class;
return $obj;
}
Modified: trunk/vhffs-api/src/Vhffs/Robots.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Robots.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
package Vhffs::Robots;
@@ -161,7 +161,7 @@
return 1 if $group->get_main->get_config->use_vhffsfs;
return -1 unless symlink( $dir , $group->get_dir.'/'.$linkname );
-
+
return 1;
}
@@ -182,7 +182,7 @@
return 1 if $group->get_main->get_config->use_vhffsfs;
return -1 unless unlink( $group->get_dir.'/'.$linkname );
-
+
return 1;
}
@@ -215,7 +215,7 @@
$label =~ s/\//_/g; # workaround for SCM which use / in object name
my $tarfile = $robotconf->{'archive_deleted_path'}.'/'.time().'_'.$object->get_group->get_groupname.'_'.Vhffs::Functions::type_string_fs_from_type_id( $object->get_type ).'_'.$label.( defined $namepart ? '_'.join('_', @$namepart) : '' ).'.tar.gz';
my $childpid = open( my $output, '-|', 'tar', 'czf', $tarfile, '.' );
- if($childpid) {
+ if($childpid) {
# read process output then discard
while(<$output>) {}
@@ -231,7 +231,7 @@
$ret = $? >> 8 if $?;
}
- chdir($oldcwd);
+ chdir($oldcwd);
return not defined $ret and -f $tarfile ? 1 : undef;
}
@@ -297,12 +297,12 @@
# rotate it
rename $logfile.'.'.$i, $logfile.'.'.($i+1);
-
+
# compress it if compression is enabled
if ( $compress ) {
my $childpid = open( my $output, '-|', 'gzip', $logfile.'.'.($i+1) );
- if($childpid) {
+ if($childpid) {
# read process output then discard
while(<$output>) {}
@@ -323,7 +323,7 @@
# decompress it if compression is disabled
unless( $compress ) {
my $childpid = open( my $output, '-|', 'gzip', '-d', $logfile.'.'.($i+1).'.gz' );
- if($childpid) {
+ if($childpid) {
# read process output then discard
while(<$output>) {}
Modified: trunk/vhffs-api/src/Vhffs/Stats.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Stats.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Stats.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
@@ -70,7 +70,7 @@
=cut
sub new {
my ( $class, $main ) = @_;
-
+
my $this = {};
$this->{main} = $main;
$this->{flushed} = time();
Modified: trunk/vhffs-api/src/Vhffs/Tag.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Tag.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/Tag.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
=head1 NAME
@@ -57,11 +57,11 @@
=cut
sub _new {
my ($class, $main, $tag_id, $label, $description, $updated, $updater_id, $category_id) = @_;
-
+
my $self = {};
-
+
bless($self, $class);
-
+
$self->{main} = $main;
$self->{tag_id} = $tag_id;
$self->{label} = $label;
@@ -69,7 +69,7 @@
$self->{updated} = $updated;
$self->{updater_id} = $updater_id;
$self->{category_id} = $category_id;
-
+
return $self;
}
@@ -99,13 +99,13 @@
sub create {
my ($main, $label, $description, $creator, $category, $created) = @_;
$created = time() unless(defined $created);
-
+
my $dbh = $main->get_db_object();
-
+
my $sql = q{INSERT INTO vhffs_tag(label, description, updated, category_id, updater_id) VALUES(?, ?, ?, ?, ?)};
my $sth = $dbh->prepare($sql);
$sth->execute($label, $description, $created, $category->{category_id}, $creator->get_uid);
-
+
my $tag_id = $dbh->last_insert_id(undef, undef, 'vhffs_tag', undef);
return get_by_tag_id($main, $tag_id);
}
@@ -121,17 +121,17 @@
=cut
sub get_by_tag_id {
my($main, $tag_id) = @_;
-
+
my $sql = q{SELECT tag_id, label, description, updated, updater_id, category_id FROM vhffs_tag WHERE tag_id = ?};
my $dbh = $main->get_db_object();
-
+
my $sth = $dbh->prepare($sql);
$sth->execute($tag_id) or return undef;
my @results = $sth->fetchrow_array();
return undef unless @results;
-
+
my $tag = _new Vhffs::Tag($main, @results);
-
+
return $tag;
}
@@ -146,7 +146,7 @@
=cut
sub get_all {
my ($main) = @_;
-
+
return _fetch_tags($main, q{SELECT tag_id, label, description, updated, updater_id, category_id
FROM vhffs_tag ORDER BY label});
}
@@ -162,7 +162,7 @@
=cut
sub get_by_category_id {
my ($main, $category_id) = @_;
-
+
return _fetch_tags($main, q{SELECT tag_id, label, description, updated, updater_id, category_id
FROM vhffs_tag WHERE category_id = ? ORDER BY label}, $category_id);
}
@@ -186,13 +186,13 @@
=cut
sub get_most_popular_tags {
use POSIX; # ceil
-
+
my ($main, $visibility) = @_;
$visibility = Vhffs::Constants::TAG_VISIBILITY_PUBLIC unless(defined $visibility);
my $tags = [];
-
+
my $dbh = $main->get_db_object();
-
+
my $sql = q{SELECT MAX(c) AS max_count FROM
(SELECT COUNT(*) AS c
FROM vhffs_object_tag ot
@@ -203,7 +203,7 @@
my $sth = $dbh->prepare($sql);
return undef unless($sth->execute($visibility));
my $max_count = $sth->fetchrow_hashref()->{max_count};
-
+
$sql = q{SELECT c.tag_category_id AS category_id, c.label AS category_label, c.description AS category_description,
t.tag_id AS tag_id, t.label AS tag_label, t.description AS tag_description, COUNT(*) AS object_count
FROM vhffs_tag t
@@ -241,13 +241,13 @@
=cut
sub get_random_tags {
use POSIX; # ceil
-
+
my ($main, $visibility) = @_;
$visibility = Vhffs::Constants::TAG_VISIBILITY_PUBLIC unless(defined $visibility);
my $tags = [];
-
+
my $dbh = $main->get_db_object();
-
+
my $sql = q{SELECT MAX(c) AS max_count FROM
(SELECT COUNT(*) AS c
FROM vhffs_object_tag ot
@@ -258,7 +258,7 @@
my $sth = $dbh->prepare($sql);
return undef unless($sth->execute($visibility));
my $max_count = $sth->fetchrow_hashref()->{max_count};
-
+
$sql = q{SELECT c.tag_category_id AS category_id, c.label AS category_label, c.description AS category_description,
t.tag_id AS tag_id, t.label AS tag_label, t.description AS tag_description, COUNT(*) AS object_count
FROM vhffs_tag t
@@ -289,18 +289,18 @@
=cut
sub _fetch_tags {
my ($main, $sql, @params) = @_;
-
+
my $tags = [];
-
+
my $dbh = $main->get_db_object();
-
+
my $sth = $dbh->prepare($sql);
$sth->execute(@params) or return undef;
-
+
while(my $t = $sth->fetchrow_arrayref()) {
push @$tags, _new Vhffs::Tag($main, @$t);
}
-
+
return $tags;
}
@@ -319,7 +319,7 @@
=cut
sub get_updater {
my ($self) = @_;
-
+
unless( defined $self->{updater} ) {
$self->{updater} = Vhffs::User::get_by_uid($self->{main}, $self->{updater_id});
}
@@ -337,11 +337,11 @@
=cut
sub get_category {
my ($self) = @_;
-
+
unless( defined $self->{category} ) {
$self->{category} = Vhffs::Tag::Category::get_by_category_id($self->{main}, $self->{category_id});
}
-
+
return $self->{category}
}
@@ -373,7 +373,7 @@
=cut
sub save {
my ($self) = @_;
-
+
my $sql = q{UPDATE vhffs_tag SET category_id = ?, label = ?, description = ?, updated = ?, updater_id = ? WHERE tag_id = ?};
my $dbh = $self->{main}->get_db_object();
return $dbh->do($sql, undef, $self->{category_id}, $self->{label}, $self->{description}, $self->{updated}, $self->{updater_id}, $self->{tag_id});
@@ -388,7 +388,7 @@
=head2 get_tags
- my $tags = $o->get_tags($access_level);
+ my $tags = $o->get_tags($access_level);
Returns an array of all tag categories for an object. Each
element contains {label, tags}, tags is an array containing
all tags of the given category for this object ({tag_id, label}).
@@ -396,20 +396,20 @@
=cut
sub get_tags {
my ($o, $visibility) = @_;
-
+
my $dbh = $o->get_db_object();
my $tags = [];
-
+
my $sql = q{SELECT t.tag_id, t.label as tag_label, c.label as cat_label
FROM vhffs_tag t INNER JOIN vhffs_tag_category c ON c.tag_category_id = t.category_id
INNER JOIN vhffs_object_tag ot ON ot.tag_id = t.tag_id
WHERE ot.object_id = ? AND visibility <= ? ORDER BY c.label, t.label};
-
+
my $sth = $dbh->prepare($sql);
$sth->execute($o->get_oid(), $visibility) or return undef;
my $cat = undef;
-
+
while(my $t = $sth->fetchrow_hashref()) {
if( (!defined $cat) || ($cat->{label} ne $t->{cat_label}) ) {
$cat = {
@@ -424,7 +424,7 @@
};
push @{$cat->{tags}}, $tag;
}
-
+
return $tags;
}
@@ -447,13 +447,13 @@
=cut
sub add_tag {
my ($o, $tag, $updater, $updated) = @_;
-
+
my $dbh = $o->get_db_object();
$updated = time() unless($updated);
-
+
# Don't fill error log with useless error messages.
local $dbh->{PrintError} = 0;
-
+
return $dbh->do(q{INSERT INTO vhffs_object_tag(object_id, tag_id, updated, updater_id) VALUES(?, ?, ?, ?)},
undef, $o->get_oid(), $tag->{tag_id}, $updated, $updater->get_uid());
}
@@ -473,9 +473,9 @@
=cut
sub delete_tag {
my ($o, $tag) = @_;
-
+
my $dbh = $o->get_db_object();
-
+
return $dbh->do(q{DELETE FROM vhffs_object_tag WHERE object_id = ? AND tag_id = ?}, undef,
$o->get_oid(), $tag->{tag_id});
}
Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm 2012-02-16 23:55:06 UTC (rev 2012)
+++ trunk/vhffs-api/src/Vhffs/User.pm 2012-02-17 20:23:45 UTC (rev 2013)
@@ -1,31 +1,31 @@
# Copyright (c) vhffs project and its contributors
# All rights reserved.
#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
+# 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
+# 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
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
# distribution.
-#3. Neither the name of vhffs nor the names of its contributors
-# may be used to endorse or promote products derived from this
+#3. Neither the name of vhffs nor the names of its contributors
+# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
-#COPYRIGHT OWNER 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
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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
+#COPYRIGHT OWNER 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.
package Vhffs::User;
@@ -156,10 +156,10 @@
# so we have to tell pg that constraints shouldn't be checked before the end
# of transaction
$dbh->do('SET CONSTRAINTS ALL DEFERRED');
-
+
my ($uid) = $dbh->selectrow_array('SELECT nextval(\'vhffs_users_uid_seq\')');
my ($gid) = $dbh->selectrow_array('SELECT nextval(\'vhffs_groups_gid_seq\')');
-
+
# Create corresponding object
# -- TODO, user moderation (easy to do now)
my $parent = Vhffs::Object::create($main, $uid, $gid, '', Vhffs::Constants::WAITING_FOR_CREATION, Vhffs::Constants::TYPE_USER);
@@ -172,7 +172,7 @@
my $sth = $dbh->prepare('INSERT INTO vhffs_users (uid, gid, username, shell, passwd, homedir, admin, firstname, lastname, address, zipcode, city, country, mail, gpg_key, note, language, theme, lastloginpanel, object_id) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, NULL, NULL, ?)');
$sth->execute($uid, $gid, $username, $userconf->{'default_shell'}, Vhffs::Functions::password_encrypt($password), $homedir, $admin, $firstname, $lastname, $address, $zipcode, $city, $country, $mail, $gpg_key, $main->get_config->get_default_language, $parent->get_oid);
-
+
my $group = Vhffs::Group::create($main, $username, undef, $uid, $gid);
die('Error creating group') unless (defined $group);
$group->set_status(Vhffs::Constants::ACTIVATED);
@@ -238,9 +238,9 @@
push @params, $name, $name, $name;
}
(push(@params, $state), $query.= ' AND o.state=?') if( defined $state );
-
+
$query .= 'ORDER BY username';
-
+
my $request = $vhffs->{'db'}->prepare( $query );
$request->execute(@params);
while( my ($name) = $request->fetchrow_array ) {
@@ -471,7 +471,7 @@
my $dbpass = $self->get_password;
return 1 if( $dbpass eq unix_md5_crypt($clearpass, $dbpass) );
- return 0;
+ return 0;
}
=pod
@@ -926,7 +926,7 @@
=cut
sub set_password {
use Vhffs::Functions;
-
+
my $self = shift;
my $value = shift;
$self->{'passwd'} = Vhffs::Functions::password_encrypt( $value );