[system] / trunk / webwork-modperl / lib / WeBWorK / DB.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/DB.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 6287 Revision 6288
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System> 2# WeBWorK Online Homework Delivery System>
3# Copyright 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork2/lib/WeBWorK/DB.pm,v 1.110 2009/01/25 22:11:07 gage Exp $ 4# $CVSHeader: webwork2/lib/WeBWorK/DB.pm,v 1.111 2010/05/19 01:44:05 gage Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
1782 1782
1783# versioned analog of countUserProblems 1783# versioned analog of countUserProblems
1784sub countProblemVersions { return scalar shift->listProblemVersions(@_) } 1784sub countProblemVersions { return scalar shift->listProblemVersions(@_) }
1785 1785
1786# versioned analog of listUserProblems 1786# versioned analog of listUserProblems
1787# for consistency, we should name this "listProblemVersions", but that is
1788# confusing, as that sounds as if we're listing the versions of a problem.
1789# however, that's nonsensical, so we appropriate it here and don't worry
1790# about the confusion.
1791sub listProblemVersions { 1787sub listProblemVersions {
1792 my ($self, $userID, $setID, $versionID) = shift->checkArgs(\@_, qw/user_id set_id version_id/); 1788 my ($self, $userID, $setID, $versionID) = shift->checkArgs(\@_, qw/user_id set_id version_id/);
1793 my $where = [user_id_eq_set_id_eq_version_id_eq => $userID,$setID,$versionID]; 1789 my $where = [user_id_eq_set_id_eq_version_id_eq => $userID,$setID,$versionID];
1794 if (wantarray) { 1790 if (wantarray) {
1795 return map { @$_ } $self->{problem_version}->get_fields_where(["problem_id"], $where); 1791 return map { @$_ } $self->{problem_version}->get_fields_where(["problem_id"], $where);
1943 croak "invalid characters in '$keyfield' field: '$value' (valid characters are [0-9])" 1939 croak "invalid characters in '$keyfield' field: '$value' (valid characters are [0-9])"
1944 unless $value =~ m/^[0-9]*$/; 1940 unless $value =~ m/^[0-9]*$/;
1945 } elsif ($versioned and $keyfield eq "set_id") { 1941 } elsif ($versioned and $keyfield eq "set_id") {
1946 croak "invalid characters in '$keyfield' field: '$value' (valid characters are [-a-zA-Z0-9_.,])" 1942 croak "invalid characters in '$keyfield' field: '$value' (valid characters are [-a-zA-Z0-9_.,])"
1947 unless $value =~ m/^[-a-zA-Z0-9_.,]*$/; 1943 unless $value =~ m/^[-a-zA-Z0-9_.,]*$/;
1948 } elsif ($versioned and $keyfield eq "user_id") { 1944 # } elsif ($versioned and $keyfield eq "user_id") {
1945 } elsif ($keyfield eq "user_id") {
1949 check_user_id($value); # (valid characters are [-a-zA-Z0-9_.,]) see above. 1946 check_user_id($value); # (valid characters are [-a-zA-Z0-9_.,]) see above.
1950 } elsif ($keyfield eq "ip_mask") { 1947 } elsif ($keyfield eq "ip_mask") {
1951 croak "invalid characters in '$keyfield' field: '$value' (valid characters are [-a-fA-F0-9_.:/])" 1948 croak "invalid characters in '$keyfield' field: '$value' (valid characters are [-a-fA-F0-9_.:/])"
1952 unless $value =~ m/^[-a-fA-F0-9_.:\/]*$/; 1949 unless $value =~ m/^[-a-fA-F0-9_.:\/]*$/;
1953 1950

Legend:
Removed from v.6287  
changed lines
  Added in v.6288

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9