[vhffs-dev] [1926] fixed \r in object description |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1926
Author: gradator
Date: 2012-01-23 00:40:11 +0100 (Mon, 23 Jan 2012)
Log Message:
-----------
fixed \r in object description
Modified Paths:
--------------
trunk/TODO
trunk/vhffs-api/src/Vhffs/Object.pm
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2012-01-22 22:57:56 UTC (rev 1925)
+++ trunk/TODO 2012-01-22 23:40:11 UTC (rev 1926)
@@ -4,6 +4,4 @@
tester les tags
-clean description new object (\r)
-
corriger tableau ACL
Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm 2012-01-22 22:57:56 UTC (rev 1925)
+++ trunk/vhffs-api/src/Vhffs/Object.pm 2012-01-22 23:40:11 UTC (rev 1926)
@@ -95,7 +95,7 @@
bless($self, $class);
- return undef unless(defined $main);
+ return undef unless(defined $main);
$self->{main} = $main;
$self->{db} = $main->get_db_object;
@@ -106,8 +106,8 @@
$self->{description} = $description;
$self->{refuse_reason} = $refuse_reason;
$self->{state} = $state;
- $self->{type} = $type;
-
+ $self->{type} = $type;
+
return $self;
}
@@ -175,7 +175,8 @@
sub create {
my ($vhffs, $owner_uid, $owner_gid, $description, $state, $type) = @_;
- $description = '' unless (defined $description);
+ $description = '' unless defined $description;
+ $description =~ s/\r\n/\n/g;
$state = ($vhffs->get_config->get_moderation ? Vhffs::Constants::WAITING_FOR_VALIDATION : Vhffs::Constants::WAITING_FOR_CREATION) unless defined $state;
my $sth = $vhffs->get_db_object->prepare('INSERT INTO vhffs_object(owner_uid, owner_gid, date_creation, state, description, type) VALUES ( ?, ?, ?, ?, ?, ?)');
$sth->execute($owner_uid, $owner_gid, time(), $state, $description, $type) or return undef;
@@ -358,7 +359,6 @@
sub set_description
{
my ($self , $value) = @_;
- $value =~ s/\?/ \?/g;
$value =~ s/\r\n/\n/g;
$self->{'description'} = $value ;
}