--- loncom/lonsql 2006/02/08 21:17:53 1.74 +++ loncom/lonsql 2006/05/11 17:53:22 1.77 @@ -3,7 +3,7 @@ # The LearningOnline Network # lonsql - LON TCP-MySQL-Server Daemon for handling database requests. # -# $Id: lonsql,v 1.74 2006/02/08 21:17:53 www Exp $ +# $Id: lonsql,v 1.77 2006/05/11 17:53:22 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -102,6 +102,7 @@ the database. use strict; use lib '/home/httpd/lib/perl/'; +use LONCAPA; use LONCAPA::Configuration; use LONCAPA::lonmetadata(); @@ -444,7 +445,13 @@ sub make_new_child { $locresult = &localenroll::fetch_enrollment($dom,\%affiliates,\%replies); } elsif ($query eq 'institutionalphotos') { my $crs = &unescape($arg2); - $locresult = &localenroll::institutional_photos($dom,$crs,\%affiliates,\%replies,'update'); + eval { + local($SIG{__DIE__})='DEFAULT'; + $locresult = &localenroll::institutional_photos($dom,$crs,\%affiliates,\%replies,'update'); + }; + if ($@) { + $locresult = 'error'; + } } $result = &escape($locresult.':'); if ($locresult) { @@ -718,52 +725,6 @@ sub reply { } ######################################################## -######################################################## - -=pod - -=item &escape - -Escape special characters in a string. - -Inputs: string to escape - -Returns: The input string with special characters escaped. - -=cut - -######################################################## -######################################################## -sub escape { - my $str=shift; - $str =~ s/(\W)/"%".unpack('H2',$1)/eg; - return $str; -} - -######################################################## -######################################################## - -=pod - -=item &unescape - -Unescape special characters in a string. - -Inputs: string to unescape - -Returns: The input string with special characters unescaped. - -=cut - -######################################################## -######################################################## -sub unescape { - my $str=shift; - $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; - return $str; -} - -######################################################## ######################################################## =pod