replaced return; with return undef;

This commit is contained in:
JT Smith 2008-01-24 21:58:15 +00:00
parent ffa90c5fbd
commit fa09c41598
113 changed files with 287 additions and 286 deletions

View file

@ -374,7 +374,7 @@ sub getNextInstance {
return $instance;
}
$self->debug("Didn't see any workflow instances to run.");
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -76,9 +76,9 @@ sub create {
my $class = shift;
my $session = shift;
my $properties = shift || {};
return unless $properties->{name};
return undef unless $properties->{name};
my $test = $class->newByName($session, $properties->{name});
return if defined $test;
return undef if defined $test;
my $id = $session->db->setRow("adSpace","adSpaceId",{adSpaceId=>"new"});
my $self = $class->new($session, $id);
$self->set($properties);
@ -236,7 +236,7 @@ sub new {
my $session = shift;
my $id = shift;
my $properties = $session->db->getRow("adSpace","adSpaceId",$id);
return unless $properties->{adSpaceId};
return undef unless $properties->{adSpaceId};
bless {_session=>$session, _properties=>$properties}, $class;
}
@ -261,7 +261,7 @@ sub newByName {
my $session = shift;
my $name = shift;
my $properties = $session->db->getRow("adSpace","name",$name);
return unless $properties->{adSpaceId};
return undef unless $properties->{adSpaceId};
bless {_session=>$session, _properties=>$properties}, $class;
}

View file

@ -156,7 +156,7 @@ sub new {
my $session = shift;
my $id = shift;
my $properties = $session->db->getRow("advertisement","adId",$id);
return unless $properties->{adId};
return undef unless $properties->{adId};
bless {_session=>$session, _properties=>$properties}, $class;
}

View file

@ -91,7 +91,7 @@ The missing URL.
sub addMissing {
my $self = shift;
my $assetUrl = shift;
return unless ($self->session->var->isAdminOn);
return undef unless ($self->session->var->isAdminOn);
my $ac = $self->getAdminConsole;
my $i18n = WebGUI::International->new($self->session, "Asset");
my $output = $i18n->get("missing page query");
@ -314,7 +314,7 @@ sub checkView {
return $notFound->www_view;
}
$self->logView();
return;
return undef;
}
#-------------------------------------------------------------------
@ -1179,7 +1179,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
return unless $self->canEdit;
return undef unless $self->canEdit;
return $self->{_toolbar} if (exists $self->{_toolbar});
my $userUiLevel = $self->session->user->profileField("uiLevel");
my $uiLevels = $self->session->config->get("assetToolbarUiLevel");
@ -1337,7 +1337,7 @@ sub getValue {
}
return $self->{_propertyDefinitions}{$key}{defaultValue};
}
return;
return undef;
}
@ -1371,7 +1371,7 @@ sub loadModule {
return $className;
}
$session->errorHandler->error("Couldn't compile asset package: ".$className.". Root cause: ".$@);
return;
return undef;
}
#-------------------------------------------------------------------
@ -1389,7 +1389,7 @@ sub logView {
WebGUI::PassiveProfiling::add($self->session,$self->getId);
WebGUI::PassiveProfiling::addPage($self->session,$self->getId) if ($self->get("className") eq "WebGUI::Asset::Wobject::Layout");
}
return;
return undef;
}
@ -1593,7 +1593,7 @@ sub manageAssets {
</div>
';
$self->session->output->print($output);
return;
return undef;
}
#-------------------------------------------------------------------
@ -1620,7 +1620,7 @@ sub manageAssetsSearch {
$output .= WebGUI::Form::formFooter($self->session);
$self->session->output->print($output);
$output = '';
return unless ($self->session->form->get("doit") && ($self->session->form->get("keywords") ne "" || $self->session->form->get("class") ne "any"));
return undef unless ($self->session->form->get("doit") && ($self->session->form->get("keywords") ne "" || $self->session->form->get("class") ne "any"));
my $class = $self->session->form->process("class","className") eq "any" ? undef : $self->session->form->process("class","className");
my $assets = WebGUI::Search->new($self->session,0)->search({
keywords=>$self->session->form->get("keywords"),
@ -1685,7 +1685,7 @@ sub manageAssetsSearch {
//]]>
</script> <div class="adminConsoleSpacer"> &nbsp;</div>';
$self->session->output->print($output);
return;
return undef;
}
#-------------------------------------------------------------------
@ -1722,22 +1722,22 @@ sub new {
unless (defined $assetId) {
$session->errorHandler->error("Asset constructor new() requires an assetId.");
return;
return undef;
}
return unless ($revisionDate);
return undef unless ($revisionDate);
unless ($class ne 'WebGUI::Asset' or defined $className) {
($className) = $session->db->quickArray("select className from asset where assetId=?", [$assetId]);
unless ($className) {
$session->errorHandler->error("Couldn't instantiate asset: ".$assetId. ": couldn't find class name");
return;
return undef;
}
}
if ($className) {
$class = $class->loadModule($session, $className);
return unless (defined $class);
return undef unless (defined $class);
}
my $cache = WebGUI::Cache->new($session, ["asset",$assetId,$revisionDate]);
@ -1749,7 +1749,7 @@ sub new {
$properties = WebGUI::Asset->assetDbProperties($session, $assetId, $class, $revisionDate);
unless (exists $properties->{assetId}) {
$session->errorHandler->error("Asset $assetId $class $revisionDate is missing properties. Consult your database tables for corruption. ");
return;
return undef;
}
$cache->set($properties,60*60*24);
}
@ -1759,7 +1759,7 @@ sub new {
return $object;
}
$session->errorHandler->error("Something went wrong trying to instanciate a '$className' with assetId '$assetId', but I don't know what!");
return;
return undef;
}
#-------------------------------------------------------------------
@ -1794,7 +1794,7 @@ sub newByDynamicClass {
# confess "newByDynamicClass requires assetId"
# unless $assetId;
# So just return instead
return unless ( $session && blessed $session eq 'WebGUI::Session' )
return undef unless ( $session && blessed $session eq 'WebGUI::Session' )
&& $assetId;
# Cache the className lookup
@ -1813,7 +1813,7 @@ sub newByDynamicClass {
unless ( $className ) {
$session->errorHandler->error("Couldn't find className for asset '$assetId'");
return;
return undef;
}
return WebGUI::Asset->new($session,$assetId,$className,$revisionDate);
@ -1840,10 +1840,10 @@ sub newByPropertyHashRef {
my $class = shift;
my $session = shift;
my $properties = shift;
return unless defined $properties;
return unless exists $properties->{className};
return undef unless defined $properties;
return undef unless exists $properties->{className};
my $className = $class->loadModule($session, $properties->{className});
return unless (defined $className);
return undef unless (defined $className);
bless {_session=>$session, _properties => $properties}, $className;
}
@ -1884,7 +1884,7 @@ sub newByUrl {
return WebGUI::Asset->new($session,$id, $class, $revisionDate);
} else {
$session->errorHandler->warn("The URL $url was requested, but does not exist in your asset tree.");
return;
return undef;
}
}
return WebGUI::Asset->getDefault($session);
@ -1948,7 +1948,7 @@ sub processPropertiesFromFormPost {
$self->session->db->beginTransaction;
$self->update(\%data);
$self->session->db->commit;
return;
return undef;
}
@ -2282,7 +2282,7 @@ sub www_add {
my $self = shift;
my %prototypeProperties;
my $class = $self->loadModule($self->session, $self->session->form->process("class","className"));
return unless (defined $class);
return undef unless (defined $class);
return $self->session->privilege->insufficient() unless ($class->canAdd($self->session));
if ($self->session->form->process('prototype')) {
my $prototype = WebGUI::Asset->new($self->session, $self->session->form->process("prototype"),$class);
@ -2380,7 +2380,7 @@ sub www_changeUrlConfirm {
return 'redirect';
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -2564,7 +2564,7 @@ sub www_view {
return $check if (defined $check);
$self->prepareView;
$self->session->output->print($self->view);
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -298,7 +298,7 @@ sub getDateTimeStart {
#$self->session->errorHandler->warn($self->getId.":: Date: $date -- Time: $time");
if (!$date) {
$self->session->errorHandler->warn("Event::getDateTimeStart -- This event (".$self->get("assetId").") has no start date.");
return;
return undef;
}
if ($time) {
@ -337,7 +337,7 @@ sub getDateTimeEnd {
#$self->session->errorHandler->warn($self->getId.":: Date: $date -- Time: $time");
if (!$date) {
$self->session->errorHandler->warn("Event::getDateTimeEnd -- This event (".$self->get("assetId").") has no end date.");
return;
return undef;
}
if ($time) {
@ -405,7 +405,7 @@ sub getEventNext {
});
return unless $events->[0];
return undef unless $events->[0];
return WebGUI::Asset->newByDynamicClass($self->session,$events->[0]);
}
@ -461,7 +461,7 @@ sub getEventPrev {
limit => 1,
});
return unless $events->[0];
return undef unless $events->[0];
return WebGUI::Asset->newByDynamicClass($self->session,$events->[0]);
}
@ -711,7 +711,7 @@ sub getRecurrenceDates {
my %date;
my $recur = {$self->getRecurrence};
return unless $recur->{recurType};
return undef unless $recur->{recurType};
my %dayNames = (
monday => "m",
@ -1650,7 +1650,7 @@ sub processPropertiesFromFormPost {
delete $self->{_storageLocation};
$self->requestAutoCommit;
return;
return undef;
}
#-------------------------------------------------------------------
@ -1691,7 +1691,7 @@ sub setRecurrence {
my $self = shift;
my $vars = shift;
my $type = $vars->{recurType} || return;
my $type = $vars->{recurType} || return undef;
my $pattern;
if ($type eq "daily" || $type eq "weekday") {
@ -1794,7 +1794,7 @@ sub setRelatedLinks {
}
}
return;
return undef;
}
####################################################################

View file

@ -230,7 +230,7 @@ sub getFileUrl {
#-------------------------------------------------------------------
sub getFileIconUrl {
my $self = shift;
return unless $self->get("filename"); ## Why do I have to do this when creating new Files?
return undef unless $self->get("filename"); ## Why do I have to do this when creating new Files?
return $self->getStorageLocation->getFileIconUrl($self->get("filename"));
}
@ -337,7 +337,7 @@ sub processPropertiesFromFormPost {
$storage->delete;
}
return;
return undef;
}
@ -483,7 +483,7 @@ sub updatePropertiesFromStorage {
$self->update({
filename => $filename,
});
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -208,7 +208,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
return if ($self->getToolbarState);
return undef if ($self->getToolbarState);
return $self->SUPER::getToolbar();
}

View file

@ -677,7 +677,7 @@ sub updateExifDataFromFile {
my $self = shift;
my $storage = $self->getStorageLocation;
return;
return undef;
my $info = ImageInfo( $storage->getPath( $self->get('filename') ) );
use Data::Dumper; $self->session->errorHandler->info( Dumper $info );
$self->update({

View file

@ -167,20 +167,20 @@ sub processPropertiesFromFormPost {
my $file = $self->get("filename");
#return unless $file;
#return undef unless $file;
my $i18n = WebGUI::International->new($self->session, 'Asset_ZipArchive');
unless ($self->session->form->process("showPage")) {
$storage->delete;
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
$self->session->scratch->set("za_error",$i18n->get("za_show_error"));
return;
return undef;
}
unless ($file =~ m/\.tar/i || $file =~ m/\.zip/i) {
$storage->delete;
$self->session->db->write("update FileAsset set filename=NULL where assetId=".$self->session->db->quote($self->getId));
$self->session->scratch->set("za_error",$i18n->get("za_error"));
return;
return undef;
}
unless ($self->unzip($storage,$self->get("filename"))) {

View file

@ -48,7 +48,7 @@ sub addChild {
my @other = @_;
if ($properties->{className} ne "WebGUI::Asset::Post") {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return;
return undef;
}
return $self->SUPER::addChild($properties, @other);
}
@ -371,7 +371,7 @@ sub getEditUrl {
#-------------------------------------------------------------------
sub getImageUrl {
my $self = shift;
return if ($self->get("storageId") eq "");
return undef if ($self->get("storageId") eq "");
my $storage = $self->getStorageLocation;
my $url;
foreach my $filename (@{$storage->getFiles}) {
@ -578,7 +578,7 @@ sub getThread {
#-------------------------------------------------------------------
sub getThumbnailUrl {
my $self = shift;
return if ($self->get("storageId") eq "");
return undef if ($self->get("storageId") eq "");
my $storage = $self->getStorageLocation;
my $url;
foreach my $filename (@{$storage->getFiles}) {
@ -663,8 +663,8 @@ An integer indicating either thumbss up (+1) or thumbs down (-1)
sub insertUserPostRating {
my $self = shift;
my $rating = shift;
return unless ($rating == -1 || $rating == 1);
return if $self->hasRated;
return undef unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated;
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values (?,?,?,?,?)",
[$self->getId,
$self->session->user->userId,
@ -914,8 +914,8 @@ An integer indicating either thumbss up (+1) or thumbs down (-1)
sub rate {
my $self = shift;
my $rating = shift;
return unless ($rating == -1 || $rating == 1);
return if $self->hasRated;
return undef unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated;
$self->insertUserPostRating($rating);
$self->recalculatePostRating();
$self->getThread->updateThreadRating();

View file

@ -86,7 +86,7 @@ sub duplicateBranch {
#-------------------------------------------------------------------
sub createSubscriptionGroup {
my $self = shift;
return if ($self->get("subscriptionGroupId"));
return undef if ($self->get("subscriptionGroupId"));
my $group = WebGUI::Group->new($self->session, "new");
$group->name($self->getId);
$group->description("The group to store subscriptions for the thread ".$self->getId);
@ -167,7 +167,7 @@ sub definition {
sub DESTROY {
my $self = shift;
return unless defined $self;
return undef unless defined $self;
$self->{_next}->DESTROY if (defined $self->{_next});
$self->{_previous}->DESTROY if (defined $self->{_previous});
$self->SUPER::DESTROY;
@ -594,8 +594,8 @@ An integer between 1 and 5 (5 being best) to rate this post with.
sub rate {
my $self = shift;
my $rating = shift;
return unless ($rating == -1 || $rating == 1);
return if $self->hasRated;
return undef unless ($rating == -1 || $rating == 1);
return undef if $self->hasRated;
$self->SUPER::rate($rating);
##Thread specific karma adjustment for CS

View file

@ -144,7 +144,7 @@ sub processPropertiesFromFormPost {
$self->_ensureRssFromParentAbsent;
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -159,7 +159,7 @@ if there is no such feed.
sub getRssUrl {
my $self = shift;
my $rssFromParentId = $self->get('rssCapableRssFromParentId');
return unless defined $rssFromParentId;
return undef unless defined $rssFromParentId;
WebGUI::Asset->newByDynamicClass($self->session, $rssFromParentId)->getUrl;
}

View file

@ -422,7 +422,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
return if ($self->getToolbarState);
return undef if ($self->getToolbarState);
return $self->SUPER::getToolbar();
}

View file

@ -365,7 +365,7 @@ sub getOverridesList {
$output .= '<table cellspacing="0" cellpadding="3" border="1">';
$output .= '<tr class="tableHeader"><td>'.$i18n->get('fieldName').'</td><td>'.$i18n->get('edit delete fieldname').'</td><td>'.$i18n->get('Original Value').'</td><td>'.$i18n->get('New value').'</td><td>'.$i18n->get('Replacement value').'</td></tr>';
my $shortcut = $self->getShortcutOriginal;
return unless defined $shortcut;
return undef unless defined $shortcut;
foreach my $definition (@{$shortcut->definition($self->session)}) {
foreach my $prop (keys %{$definition->{properties}}) {
next if $definition->{properties}{$prop}{fieldType} eq 'hidden';

View file

@ -117,7 +117,7 @@ Returns a toolbar with a set of icons that hyperlink to functions that delete, e
sub getToolbar {
my $self = shift;
return if ($self->getToolbarState);
return undef if ($self->getToolbarState);
return '<p>'.$self->SUPER::getToolbar().'</p>';
}

View file

@ -27,7 +27,7 @@ You can't add children to a wiki page.
=cut
sub addChild {
return;
return undef;
}
#-------------------------------------------------------------------
@ -185,7 +185,7 @@ sub getEditForm {
sub getWiki {
my $self = shift;
my $parent = $self->getParent;
return unless defined $parent and $parent->isa('WebGUI::Asset::Wobject::WikiMaster');
return undef unless defined $parent and $parent->isa('WebGUI::Asset::Wobject::WikiMaster');
return $parent;
}

View file

@ -267,7 +267,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Event") {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return;
return undef;
}
return $self->SUPER::addChild($properties, @other);
@ -360,7 +360,7 @@ sub createSubscriptionGroup {
groupIdSubscription => $group->getId
});
return;
return undef;
}
@ -579,7 +579,7 @@ this Calendar.
sub getEvent {
my $self = shift;
my $assetId = shift;
# Warn and return if no assetId
# Warn and return undef if no assetId
$self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEvent :: No asset ID."), return
unless $assetId;
@ -632,10 +632,10 @@ sub getEventsIn {
my $tz = $self->session->user->profileField("timeZone");
# Warn and return if no startDate or endDate
# Warn and return undef if no startDate or endDate
unless ($start && $end) {
$self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEventsIn() called with not enough arguments at ".join('::',(caller)[1,2]));
return;
return undef;
}
# Create objects and adjust for timezone

View file

@ -80,7 +80,7 @@ sub addChild {
if ($properties->{className} ne "WebGUI::Asset::Post::Thread"
and $properties->{className} ne 'WebGUI::Asset::RSSFromParent') {
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
return;
return undef;
}
return $self->SUPER::addChild($properties, @other);
}

View file

@ -264,11 +264,11 @@ sub addToScratchCart {
my $scratchCart = $self->session->scratch->get('EMS_scratch_cart');
my @eventsInCart = split("\n",$scratchCart);
my ($isApproved) = $self->session->db->quickArray("select approved from EventManagementSystem_products where productId = ?",[$event]);
return unless $isApproved;
return undef unless $isApproved;
unless (scalar(@eventsInCart) || $scratchCart) {
# the cart is empty, so check if this is a master event or not.
my ($isChild) = $self->session->db->quickArray("select prerequisiteId from EventManagementSystem_products where productId = ?",[$event]);
return if $isChild;
return undef if $isChild;
$self->session->scratch->set('currentMainEvent',$event);
$self->session->scratch->set('EMS_scratch_cart', $event);
return $event;
@ -276,7 +276,7 @@ sub addToScratchCart {
# check if event is actually available.
my ($numberRegistered) = $self->session->db->quickArray("select count(*) from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where t.transactionId=p.transactionId and t.status='Completed' and r.purchaseId = p.purchaseId and r.returned=0 and r.productId=?",[$event]);
my ($maxAttendees) = $self->session->db->quickArray("select maximumAttendees from EventManagementSystem_products where productId=?",[$event]);
return unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
return undef unless ($self->canApproveEvents || ($maxAttendees > $numberRegistered));
my $bid = $self->session->scratch->get('currentBadgeId');
my @pastEvents = ($bid)?$self->session->db->buildArray("select r.productId from EventManagementSystem_registrations as r, EventManagementSystem_purchases as p, transaction as t where r.returned=0 and r.badgeId=? and t.transactionId=p.transactionId and t.status='Completed' and p.purchaseId=r.purchaseId group by productId",[$bid]):();
@ -1397,7 +1397,7 @@ sub verifyPrerequisitesForm {
my %var;
#If there is no missing event data, return nothing
return unless scalar(@$missingEventMessageLoop);
return undef unless scalar(@$missingEventMessageLoop);
my $i18n = WebGUI::International->new($self->session, 'Asset_EventManagementSystem');

View file

@ -102,7 +102,7 @@ sub addAlbumFromCollaboration {
$class->addAlbumFromThread( $gallery, $thread );
}
return;
return undef;
}
#----------------------------------------------------------------------------
@ -126,7 +126,7 @@ sub addAlbumFromFilesystem {
# TODO!!!
return;
return undef;
}
#----------------------------------------------------------------------------
@ -198,7 +198,7 @@ sub addAlbumFromThread {
}
}
return;
return undef;
}
1;

View file

@ -141,7 +141,7 @@ sub addArchive {
});
$versionTag->requestCommit;
return;
return undef;
}
#----------------------------------------------------------------------------

View file

@ -97,7 +97,7 @@ sub definition {
#-------------------------------------------------------------------
sub duplicate {
# Buggo: how do we duplicate these?
return;
return undef;
}

View file

@ -299,7 +299,7 @@ sub getGraphConfig {
my $self = shift;
my $config = $self->get("graphConfiguration");
return unless $config;
return undef unless $config;
return $self->thawGraphConfig($config);
}

View file

@ -57,7 +57,7 @@ sub _clobberImproperDependants {
my $self = shift;
my $projectId = shift;
my @nondependTaskIds = $self->session->db->buildArray("SELECT sequenceNumber FROM PM_task WHERE projectId = ? AND taskType <> 'timed'", [$projectId]);
return unless @nondependTaskIds;
return undef unless @nondependTaskIds;
$self->session->db->write("UPDATE PM_task SET dependants = NULL WHERE projectId = ? AND dependants IN (".join(', ', ('?') x @nondependTaskIds).")", [$projectId, @nondependTaskIds]);
}
@ -444,12 +444,12 @@ sub getProjectInstance {
my $session = shift;
my $db = $session->db;
my $projectId = $_[0];
return unless $projectId;
return undef unless $projectId;
my ($assetId) = $db->quickArray("select assetId from PM_project where projectId=?",[$projectId]);
if($assetId) {
return WebGUI::Asset->newByDynamicClass($session,$assetId);
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -824,8 +824,8 @@ recent revision will be fetched.
sub _getFileFromDatabase {
my ($constraint, $dbLink);
my $self = shift;
my $recordId = shift || return;
my $fieldName = shift || return;
my $recordId = shift || return undef;
my $fieldName = shift || return undef;
my $revision = shift;
$dbLink = $self->_getDbLink;
@ -4086,7 +4086,7 @@ sub _constructSearchQuery {
my $searchType = ($self->session->form->process("searchType") || $self->session->scratch->get('SQLForm_'.$self->getId.'searchType')) eq 'and' ? 'and' : 'or';
return if (!@constraints);
return undef if (!@constraints);
# Construct the search query
my $sortField = @sortClauses ? ('('.join('+', @sortClauses).') AS sqlform_orderby') : '1 AS sqlform_orderby';
@ -4260,7 +4260,7 @@ sub _clearScratch {
$scratch->delete("SQLForm_${id}$tag");
}
return; # nothing explicitly
return undef; # nothing explicitly
}
#-------------------------------------------------------------------

View file

@ -286,7 +286,7 @@ sub getEditForm {
function toggleQuery(Id) {
queryClass = "query" + Id;
var tr = document.getElementsByTagName("tr");
if (tr == null) return;
if (tr == null) return undef;
for (i=0; i < tr.length; i++) {
if(tr[i].className == queryClass) {
if(tr[i].style.display == 'none') {
@ -384,7 +384,7 @@ sub download {
my $self = shift;
# Instead of going through some costly exercises...
return if ($self->getValue("downloadType") eq "none");
return undef if ($self->getValue("downloadType") eq "none");
# Initiate an empty debug loop
$self->{_debug_loop} = [] ;
@ -419,7 +419,7 @@ sub download {
}
else {
# I don't know what to do
return;
return undef;
}
}
@ -705,7 +705,7 @@ sub www_download {
my $self = shift;
# Only allow if download type is not "none"
return if $self->getValue("downloadType") eq "none";
return undef if $self->getValue("downloadType") eq "none";
# Only allow users in appropriate group
return $self->session->privilege->noAccess()

View file

@ -154,7 +154,7 @@ sub _convertToEpoch {
my $time = $_[1];
unless ($date =~ m{^\d+/\d+/\d+} and $time =~ m{^\d+:\d+}) {
return;
return undef;
}
my ($month,$day,$year) = split("/",$date);

View file

@ -279,7 +279,7 @@ sub _find_record {
}
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -338,7 +338,7 @@ sub _get_rss_data {
if (!$response->is_success()) {
$session->errorHandler->warn("Error retrieving url '$url': " .
$response->status_line());
return;
return undef;
}
my $xml = $response->content();
@ -370,7 +370,7 @@ sub _get_rss_data {
$session->errorHandler->warn("error parsing rss for url $url :".$@);
#Returning undef on a parse failure is a change from previous behaviour,
#but it SHOULDN'T have a major effect.
return;
return undef;
}
# make sure that the {channel} points to the channel

View file

@ -376,7 +376,7 @@ sub view {
# hashref
} elsif (ref $return eq 'HASH') {
@result = $return;
@result = $return undef;
# blessed object, to be stripped with Data::Structure::Util
} elsif ( ref $return) {

View file

@ -48,7 +48,7 @@ Removes asset from lineage, places it in clipboard state. The "gap" in the linea
sub cut {
my $self = shift;
return if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
$self->session->db->beginTransaction;
$self->session->db->write("update asset set state='clipboard-limbo' where lineage like ? and state='published'",[$self->get("lineage").'%']);
$self->session->db->write("update asset set state='clipboard', stateChangedBy=?, stateChanged=? where assetId=?", [$self->session->user->userId, $self->session->datetime->time(), $self->getId]);

View file

@ -265,7 +265,7 @@ sub www_deployPackage {
my $packageMasterAsset = WebGUI::Asset->newByDynamicClass($self->session, $packageMasterAssetId);
unless ($packageMasterAsset->getValue('isPackage')) { #only deploy packages
$self->session->errorHandler->security('deploy an asset as a package which was not set as a package.');
return;
return undef;
}
my $masterLineage = $packageMasterAsset->get("lineage");
if (defined $packageMasterAsset && $packageMasterAsset->canView && $self->get("lineage") !~ /^$masterLineage/) {

View file

@ -212,7 +212,7 @@ lineage is changed in state to trash-limbo.
sub trash {
my $self = shift;
return if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
return undef if ($self->getId eq $self->session->setting->get("defaultPage") || $self->getId eq $self->session->setting->get("notFoundPage"));
foreach my $asset ($self, @{$self->getLineage(['descendants'], {returnObjects => 1})}) {
$asset->_invokeWorkflowOnExportedFiles($self->session->setting->get('trashWorkflow'), 1);
}

View file

@ -180,7 +180,7 @@ Override this method in your asset if you want your asset to automatically run i
=cut
sub getAutoCommitWorkflowId {
return;
return undef;
}
#-------------------------------------------------------------------
@ -306,7 +306,7 @@ Returns the user who locked this asset, or undef if the asset is unlocked.
sub lockedBy {
my $self = shift;
my $userId = $self->get("isLockedBy");
return unless defined $userId;
return undef unless defined $userId;
return WebGUI::User->new($self->session, $userId);
}
@ -543,9 +543,9 @@ sub www_purgeRevision {
my $session = $self->session;
return $session->privilege->insufficient() unless $self->canEdit;
my $revisionDate = $session->form->process("revisionDate");
return unless $revisionDate;
return undef unless $revisionDate;
my $asset = WebGUI::Asset->new($session,$self->getId,$self->get("className"),$revisionDate);
return if ($asset->get('revisionDate') != $revisionDate);
return undef if ($asset->get('revisionDate') != $revisionDate);
my $parent = $asset->getParent;
$asset->purgeRevision;
if ($session->form->process("proceed") eq "manageRevisionsInTag") {

View file

@ -304,7 +304,7 @@ sub createAccountSave {
);
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -364,7 +364,7 @@ sub deactivateAccountConfirm {
#});
$self->logout;
return;
return undef;
}
#-------------------------------------------------------------------
@ -680,7 +680,7 @@ sub login {
$self->session->errorHandler->warn($error) if $error;
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -705,7 +705,7 @@ sub logout {
$self->session->errorHandler->warn($error) if $error;
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -251,7 +251,7 @@ sub createAccountSave {
$self->logout;
return $self->displayLogin($i18n->get('check email for validation','AuthWebGUI'));
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -577,7 +577,7 @@ sub editUserSettingsFormSave {
return \@errors;
}
else {
return;
return undef;
}
}

View file

@ -94,7 +94,7 @@ Retrieve content from the filesystem cache.
sub get {
my $self = shift;
return if ($self->session->config->get("disableCache"));
return undef if ($self->session->config->get("disableCache"));
# getting better performance using native dbi than webgui sql
my $dbh = $self->session->db->dbh;
my $sth = $dbh->prepare("select content from cache where namespace=? and cachekey=? and expires>?");
@ -102,7 +102,7 @@ sub get {
my $data = $sth->fetchrow_arrayref;
$sth->finish;
my $content = $data->[0];
return unless ($content);
return undef unless ($content);
# Storable doesn't like non-reference arguments, so we wrap it in a scalar ref.
return ${thaw($content)};
}

View file

@ -105,12 +105,12 @@ Retrieve content from the filesystem cache.
sub get {
my $self = shift;
return if ($self->session->config->get("disableCache"));
return undef if ($self->session->config->get("disableCache"));
my $folder = $self->getFolder;
if (-e $folder."/expires" && -e $folder."/cache" && open(my $FILE,"<",$folder."/expires")) {
my $expires = <$FILE>;
close($FILE);
return if ($expires < $self->session->datetime->time());
return undef if ($expires < $self->session->datetime->time());
my $value;
eval {$value = retrieve($folder."/cache")};
if (ref $value eq "SCALAR") {
@ -119,7 +119,7 @@ sub get {
return $value;
}
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -171,7 +171,7 @@ sub getNamespaceSize {
my $expiresModifier = shift || 0;
$self->session->stow->set("cacheSize", 0);
File::Find::find({no_chdir=>1, wanted=> sub {
return unless $File::Find::name =~ m/^(.*)expires$/;
return undef unless $File::Find::name =~ m/^(.*)expires$/;
my $dir = $1;
if (open(my $FILE,"<",$dir."/expires")) {
my $expires = <$FILE>;
@ -244,7 +244,7 @@ sub set {
eval {mkpath($path,0)};
if ($@) {
$self->session->errorHandler->error("Couldn't create cache folder: ".$path." : ".$@);
return;
return undef;
}
}
my $value;

View file

@ -84,7 +84,7 @@ undef if it's not recurring.
=cut
sub duration {
return;
return undef;
}
#-------------------------------------------------------------------
@ -97,7 +97,7 @@ your item you don't have to override this method or if you do, you can just retu
=cut
sub handler {
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -134,7 +134,7 @@ You only need to override this method if your gateway uses a webbased contacting
=cut
sub confirmRecurringTransaction {
return;
return undef;
}
#-------------------------------------------------------------------
@ -277,7 +277,7 @@ The term number you want the status of.
=cut
sub getRecurringPaymentStatus {
return;
return undef;
}
#-------------------------------------------------------------------
@ -383,7 +383,7 @@ A hashref containing:
=cut
sub normalTransaction {
return;
return undef;
}
#-------------------------------------------------------------------
@ -408,7 +408,7 @@ A hashref containing:
=cut
sub recurringTransaction {
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -36,7 +36,7 @@ our @ISA = qw(WebGUI::Commerce::Payment);
#-------------------------------------------------------------------
sub connectionError {
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -119,7 +119,7 @@ sub connectionError {
$self = shift;
return $self->resultMessage if ($self->{_connectionError});
return;
return undef;
}
#-------------------------------------------------------------------
@ -325,7 +325,7 @@ sub getRecurringPaymentStatus {
my $transactionData = $self->session->db->quickHashRef("select * from ITransact_recurringStatus where gatewayId=".$self->session->db->quote($recurringId));
unless ($transactionData->{recipe}) { # if for some reason there's no transaction data, we shouldn't calc anything
$self->session->errorHandler->error("For some reason recurring transaction $recurringId doesn't have any recurring status transaction data. This is most likely because you don't have the Recurring Postback URL set in your ITransact virtual terminal.");
return;
return undef;
}
my $lastTerm = int(($transactionData->{lastTransaction} - $transactionData->{initDate}) / $resolve{$transactionData->{recipe}}) + 1;
@ -337,7 +337,7 @@ sub getRecurringPaymentStatus {
$paymentHistory{resultCode} = $transactionData->{status}.' '.$transactionData->{errorMessage};
$paymentHistory{resultCode} = 0 if $transactionData->{status} eq 'OK';
} else {
return;
return undef;
}
return \%paymentHistory;
@ -350,7 +350,7 @@ sub errorCode {
$resultCode = $self->{_response}->{Status};
return $resultCode unless ($resultCode eq 'OK');
return;
return undef;
}
#-------------------------------------------------------------------
@ -607,7 +607,7 @@ sub transactionError {
$resultCode = $self->resultCode;
return $self->resultMessage if ($resultCode ne 'OK');
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -401,7 +401,7 @@ you'll have to overload this method. Defaults to undef.
=cut
sub trackingNumber {
return;
return undef;
}
#-------------------------------------------------------------------
@ -414,7 +414,7 @@ info of his package. Overload this method if your plugin supports tracking. Defa
=cut
sub trackingUrl {
return;
return undef;
}
1;

View file

@ -95,7 +95,7 @@ sub cancelTransaction {
$self->status('Canceled');
return;
return undef;
}
#-------------------------------------------------------------------
@ -293,7 +293,7 @@ sub getByGatewayId {
" and gateway=".$self->session->db->quote($paymentGateway));
return WebGUI::Commerce::Transaction->new($self->session, $transactionId) if $transactionId;
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -206,7 +206,7 @@ sub tryAssetMethod {
my $asset = shift;
my $method = shift;
my $state = $asset->get("state");
return if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published
return undef if ($state ne "published" && $state ne "archived" && !$session->var->isAdminOn); # can't interact with an asset if it's not published
$session->asset($asset);
my $methodToTry = "www_".$method;
my $output = eval{$asset->$methodToTry()};

View file

@ -56,7 +56,7 @@ sub handler {
close($FILE);
return $output;
}
return;
return undef;
}

View file

@ -52,7 +52,7 @@ sub handler {
$http->sendHeader;
return "none";
}
return;
return undef;
}
1;

View file

@ -112,7 +112,7 @@ The current WebGUI::Session object.
sub handler {
my $session = shift;
unless ($session->setting->get("specialState") eq "init") {
return;
return undef;
}
$session->http->setCacheControl("none");
my $i18n = WebGUI::International->new($session, "WebGUI");
@ -489,7 +489,7 @@ a:visited { color: '.$form->get("visitedLinkColor").'; }
# remove init state
$session->setting->remove('specialState');
$session->http->setRedirect($session->url->gateway("?setup=complete"));
return;
return undef;
}
else {
$legend = "Admin Acccount";

View file

@ -248,7 +248,7 @@ sub db {
} else {
$self->session->errorHandler->warn("DatabaseLink [".$self->getId."] The DSN specified is of an improper format.");
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -344,7 +344,7 @@ sub new {
unless (defined($databaseLink{databaseLinkId}))
{
$session->errorHandler->warn("Could not find database link '".$databaseLinkId."'");
return;
return undef;
}
bless {_session=>$session, _databaseLink => \%databaseLink }, $class;

View file

@ -171,7 +171,7 @@ sub new
# If no DateTime object created yet, I don't know how
unless ($self)
{
return;
return undef;
}
@ -548,7 +548,7 @@ A string representing the output format for the date. Defaults to '%z %Z'. You c
sub webguiDate {
my $self = shift;
my $session = $self->session;
return unless ($session);
return undef unless ($session);
my $format = shift || "%z %Z";
my $temp;

View file

@ -68,7 +68,7 @@ sub AUTOLOAD {
my $control = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::".$name, "new", [ $session, @params ]) };
if ($@) {
$session->errorHandler->error($@);
return;
return undef;
}
return $control->toHtml;
}

View file

@ -91,7 +91,7 @@ A class method that returns a value to be used as the autogenerated ID for this
=cut
sub generateIdParameter {
return;
return undef;
}
#-------------------------------------------------------------------
@ -112,7 +112,7 @@ sub getValueFromPost {
if (defined $formValue) {
return $formValue;
} else {
return;
return undef;
}
}

View file

@ -75,7 +75,7 @@ An optional value to use instead of POST input.
sub getValueFromPost {
my $self = shift;
my $color = @_ ? shift : $self->session->form->param($self->get("name"));
return unless $color =~ /\#\w{6}/;
return undef unless $color =~ /\#\w{6}/;
return $color;
}

View file

@ -118,7 +118,7 @@ sub new {
eval ($load);
if ($@) {
$session->errorHandler->error("Couldn't compile form control: ".$fieldType.". Root cause: ".$@);
return;
return undef;
}
my $formObj = $cmd->new($session, $param);
if ($formObj->isa('WebGUI::Form::List')) {

View file

@ -86,7 +86,7 @@ sub getValueFromPost {
if ($value =~ /^([0-9a-zA-Z]([-.+\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/i) {
return $value;
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -220,14 +220,14 @@ sub getValueFromPost {
my @files = @{ $storage->getFiles };
if (scalar(@files) < 1) {
$storage->delete;
return;
return undef;
} else {
my $id = $storage->getId;
$self->set("value", $id);
return $id;
}
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -77,7 +77,7 @@ A class method that returns a value to be used as the autogenerated ID for this
=cut
sub generateIdParameter {
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -200,7 +200,7 @@ sub getValueFromPost {
@files = @images;
}
return unless @files;
return undef unless @files;
$storage->generateThumbnail($_) for @images; # Make a thumbnail for each filename in @images
}
}

View file

@ -93,7 +93,7 @@ method.
sub correctValues {
my ($self, $value) = @_;
return unless defined $value;
return undef unless defined $value;
my @defaultValues;
if (ref $value eq "ARRAY") {
@defaultValues = @{ $value };

View file

@ -86,7 +86,7 @@ sub getValueFromPost {
if ($value =~ /^[x\d \.\-\+\(\)]+$/ and $value =~ /\d/) {
return $value;
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -85,7 +85,7 @@ A class method that returns a value to be used as the autogenerated ID for this
=cut
sub generateIdParameter {
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -78,7 +78,7 @@ Returns undef.
=cut
sub getValueFromPost {
return;
return undef;
}
#-------------------------------------------------------------------
@ -103,7 +103,7 @@ Outputs nothing.
=cut
sub toHtmlAsHidden {
return;
return undef;
}

View file

@ -173,7 +173,7 @@ sub getSliderValue {
return $i if $keys[$i] eq $self->get('value')->[0];
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -132,7 +132,7 @@ sub getValueFromPost {
return $value
}
else {
return;
return undef;
}
}
@ -147,7 +147,7 @@ sub getValueFromPost {
} else {
# Mysql format
my $value = $self->session->form->param($self->get("name"));
return unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/;
return undef unless $value =~ /^\d{2}\D\d{2}(\D\d{2})?$/;
return $value;
}
}

View file

@ -94,7 +94,7 @@ sub getValueFromPost {
if ($value =~ /^[A-Z\d\s\-]+$/) {
return $value;
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -74,7 +74,7 @@ sub AUTOLOAD {
my $control = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::".$name, "new", [ $self->session, $params ]) };
if ($@) {
$self->session->errorHandler->error($@);
return;
return undef;
}
return $control->getValueFromPost(@args);
}
@ -176,7 +176,7 @@ sub process {
return $default;
}
if ($value =~ /^[\s]+$/) {
return;
return undef;
}
return $value;
}

View file

@ -1024,7 +1024,7 @@ sub new {
unless ($groupExists) {
$self->{_session}->errorHandler->warn('WebGUI::Group->new called with a non-existant groupId:'
.'['.$self->{_groupId}.']');
return;
return undef;
}
}

View file

@ -121,7 +121,7 @@ sub filter {
} ;
#HTML::Parser event handler called with non-tag text (no tags)
my $html_parser_text_sub = sub {
return if $html_parser_inside_tag{script} || $html_parser_inside_tag{style}; # do not output text
return undef if $html_parser_inside_tag{script} || $html_parser_inside_tag{style}; # do not output text
$html_parser_text .= $_[0] ;
} ;
my $parser = HTML::Parser->new(api_version => 3,
@ -236,7 +236,7 @@ sub html2text {
}
};
my $textHandler = sub {
return if $inside->{script} || $inside->{style};
return undef if $inside->{script} || $inside->{style};
if ($_[0] =~ /\S+/) {
$text .= $_[0];
}
@ -303,7 +303,7 @@ sub makeAbsolute {
if(not exists $linkElements{$tagname}) { # no need to touch this tag
$absolute .= $text;
return;
return undef;
}
# Build a hash with tag attributes
@ -356,7 +356,7 @@ sub makeParameterSafe {
my $text = shift;
${ $text } =~ s/,/&#44;/g;
${ $text } =~ s/'/&#39;/g;
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -88,7 +88,7 @@ sub AUTOLOAD {
my $control = eval { WebGUI::Pluggable::instanciate("WebGUI::Form::".$name, "new", [ $self->session, %params ]) };
if ($@) {
$self->session->errorHandler->error($@);
return;
return undef;
}
$self->{_data} .= $control->toHtmlWithWrapper;
}

View file

@ -602,12 +602,12 @@ sub processConfigurationForm {
my $class = shift;
my $session = shift;
return unless ($class->getPluginList($session));
return undef unless ($class->getPluginList($session));
my $namespace = "WebGUI::Image::".$session->form->process('graphingPlugin');
$namespace =~ s/_/::/g;
return unless (isIn($namespace, @{$class->getPluginList($session)}));
return undef unless (isIn($namespace, @{$class->getPluginList($session)}));
my $graph = $class->load($session, $namespace);

View file

@ -493,7 +493,7 @@ sub drawLabel {
my $slice = shift;
# Draw labels only once
return unless ($slice->{mainSlice});
return undef unless ($slice->{mainSlice});
$startRadius = $self->getRadius * $slice->{scaleFactor}+ $self->getStickOffset;
$stopRadius = $startRadius + $self->getStickLength;

View file

@ -148,7 +148,7 @@ sub getColorIndex {
return $index if ($self->getColor($index)->getId eq $color->getId);
}
return;
return undef;
}
#-------------------------------------------------------------------
@ -372,7 +372,7 @@ sub removeColor {
my $self = shift;
my $paletteIndex = shift;
return unless (defined $paletteIndex);
return undef unless (defined $paletteIndex);
my $color = $self->getColor($paletteIndex);
@ -426,10 +426,10 @@ sub setColor {
my $index = shift;
my $color = shift;
return if ($index >= $self->getNumberOfColors);
return if ($index < 0);
return unless (defined $index);
return unless (defined $color);
return undef if ($index >= $self->getNumberOfColors);
return undef if ($index < 0);
return undef unless (defined $index);
return undef unless (defined $color);
$color->save;
@ -484,7 +484,7 @@ sub setPaletteIndex {
my $self = shift;
my $index = shift;
return unless (defined $index);
return undef unless (defined $index);
$index = ($self->getNumberOfColors - 1) if ($index >= $self->getNumberOfColors);
$index = 0 if ($index < 0);

View file

@ -72,10 +72,10 @@ sub addPrivateMessage {
my $userId = $messageData->{userId};
my $sentBy = $messageData->{sentBy} || $self->session->user->userId;
return unless $userId;
return undef unless $userId;
my $u = WebGUI::User->new($self->session,$userId);
return unless ($isReply || $u->acceptsPrivateMessages($sentBy));
return undef unless ($isReply || $u->acceptsPrivateMessages($sentBy));
return $self->addMessage($messageData);
}

View file

@ -264,16 +264,16 @@ sub setStatus {
my $userId = shift || $self->session->user->userId;
unless ($status) {
$self->session->errorHandler->warn("No status passed in for message. Exit without update");
return;
return undef;
}
if($status eq "completed") {
$self->setCompleted($userId);
return;
return undef;
}
$self->{_properties}{status} = $status;
$self->session->db->setRow("inbox","messageId",$self->{_properties});
return;
return undef;
}
1;

View file

@ -219,7 +219,7 @@ sub new {
my $class = shift;
my $session = shift;
$ldapLinkId = shift;
return unless $ldapLinkId;
return undef unless $ldapLinkId;
$ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class;
}
@ -291,7 +291,7 @@ sub recurseProperty {
my $count = $_[4] || 0;
my $recurseFilter = $_[5] || $self->get->{ldapGlobalRecursiveFilter};
my $rfAlreadyTransformed = $_[6];
return unless($ldap && $base && $property);
return undef unless($ldap && $base && $property);
if (length $recurseFilter and not $rfAlreadyTransformed) {
$recurseFilter =~ tr/\r//d;
@ -302,7 +302,7 @@ sub recurseProperty {
#Prevent infinite recursion
$count++;
return if $count == 99;
return undef if $count == 99;
#search the base
my $msg = $ldap->search(
@ -310,8 +310,8 @@ sub recurseProperty {
scope => 'sub',
filter => "&(objectClass=*)"
);
#return if nothing found
return if($msg->code || $msg->count == 0);
#return undef if nothing found
return undef if($msg->code || $msg->count == 0);
#loop through the results
for (my $i = 0; $i < $msg->count; $i++) {
my $entry = $msg->entry($i);

View file

@ -37,7 +37,7 @@ sub process {
return "[AD:".$name."]";
}
my $adSpace = WebGUI::AdSpace->newByName($session, $name);
return unless defined $adSpace;
return undef unless defined $adSpace;
return $adSpace->displayImpression;
}

View file

@ -50,7 +50,7 @@ sub process {
$output .= "AssetProxy:".Time::HiRes::tv_interval($t) if ($session->errorHandler->canShowPerformanceIndicators());
return $output;
}
return;
return undef;
} else {
my $i18n = WebGUI::International->new($session, 'Macro_AssetProxy');
return $i18n->get('invalid url');

View file

@ -50,7 +50,7 @@ sub process {
$randomAsset->prepareView;
return $randomAsset->view;
}
return;
return undef;
} else {
return $i18n->get('childless');
}

View file

@ -37,7 +37,7 @@ sub process {
if (my $image = WebGUI::Asset::File::Image->newByUrl($session,$url)) {
return $image->getThumbnailUrl;
} else {
return;
return undef;
}
}

View file

@ -77,11 +77,11 @@ sub connect {
my $pop = Net::POP3->new($params->{server}, Timeout => 60);
unless (defined $pop) {
$session->errorHandler->error("Couldn't connect to POP3 server ". $params->{server});
return;
return undef;
}
unless ($pop->login($params->{account}, $params->{password})) {
$session->errorHandler->error("Couldn't log in to POP3 server ".$params->{server}." as ".$params->{account});
return;
return undef;
}
my $messageNumbers = $pop->list;
my @ids = ();
@ -150,7 +150,7 @@ Retrieves the next available message from the server. Returns undef if there are
sub getNextMessage {
my $self = shift;
my $id = pop(@{$self->{_ids}});
return unless $id;
return undef unless $id;
my $rawMessage = $self->{_pop}->get($id);
my $parser = MIME::Parser->new;
$parser->output_to_core(1);
@ -159,7 +159,7 @@ sub getNextMessage {
$self->{_pop}->delete($id);
} else {
$self->session->errorHandler->error("Could not parse POP3 message $id");
return;
return undef;
}
my $head = $parsedMessage->head;
my $type = $head->get("Content-Type");

View file

@ -178,7 +178,7 @@ sub addHtmlRaw {
Type => "text/html",
);
return;
return undef;
}
@ -208,7 +208,7 @@ sub addText {
Data => wrap( '', '', $text ),
);
return;
return undef;
}
@ -423,9 +423,9 @@ sub retrieve {
my $class = shift;
my $session = shift;
my $messageId = shift;
return unless $messageId;
return undef unless $messageId;
my $data = $session->db->getRow("mailQueue","messageId", $messageId);
return unless $data->{messageId};
return undef unless $data->{messageId};
$session->db->deleteRow("mailQueue","messageId", $messageId);
my $parser = MIME::Parser->new;
$parser->output_to_core(1);

View file

@ -58,7 +58,7 @@ sub execute {
if ( $@ ) {
die $@ if ($@ =~ "^fatal:");
$session->errorHandler->error($@);
return;
return undef;
}
} else {
$session->errorHandler->security("execute an invalid operation: ".$op);

View file

@ -54,7 +54,7 @@ Handles a click on an advertisement.
sub www_clickAd {
my $session = shift;
my $id = $session->form->param("id");
return unless $id;
return undef unless $id;
my $url = WebGUI::AdSpace->countClick($session, $id);
$session->http->setRedirect($url);
return "Redirecting to $url";

View file

@ -91,7 +91,7 @@ and set the __PROCESSED flag to prevent processing entries twice.
sub _process {
my ($session, $helpEntry, $key) = @_;
return if exists($helpEntry->{__PROCESSED}) and $helpEntry->{__PROCESSED};
return undef if exists($helpEntry->{__PROCESSED}) and $helpEntry->{__PROCESSED};
$helpEntry->{related} = [ _related($session, $helpEntry->{related}) ];
##Add an ISA link unless it already exists.
##This simplifies handling later.
@ -157,7 +157,7 @@ sub _get {
}
else {
$session->errorHandler->warn("Unable to load help for $namespace -> $id");
return;
return undef;
}
}

View file

@ -45,7 +45,7 @@ sub www_ssoViaSessionId {
}
}
}
return;
return undef;
}

View file

@ -41,12 +41,12 @@ An instanciated session object.
sub _getSpeller {
my ($baseDir, $userDir, $homeDir);
my $session = shift;
return unless Text::Aspell->can('new');
return undef unless Text::Aspell->can('new');
my $speller = Text::Aspell->new;
# Get language
my $lang = $session->form->process('lang');
return unless (isIn($lang, map {m/^.*?:([^:]*):.*?$/} $speller->list_dictionaries));
return undef unless (isIn($lang, map {m/^.*?:([^:]*):.*?$/} $speller->list_dictionaries));
# User homedir
my $userId = $session->user->userId;

View file

@ -295,7 +295,7 @@ Allows an administrator to assume another user.
sub www_becomeUser {
my $session = shift;
return $session->privilege->adminOnly() unless canEdit($session);
return unless WebGUI::User->validUserId($session, $session->form->process("uid"));
return undef unless WebGUI::User->validUserId($session, $session->form->process("uid"));
$session->var->end($session->var->get("sessionId"));
$session->user({userId=>$session->form->process("uid")});
return "";

View file

@ -537,7 +537,7 @@ sub www_setWorkingVersionTag {
$tag->setWorking();
}
if ($session->form->param("backToSite")) {
return;
return undef;
}
return www_manageVersions($session);
}

View file

@ -55,7 +55,7 @@ The assetId to add.
sub add {
my $session = shift;
return unless ($session->setting->get("passiveProfilingEnabled"));
return undef unless ($session->setting->get("passiveProfilingEnabled"));
my $assetId = shift;
$session->db->write("insert into passiveProfileLog (passiveProfileLogId, userId, sessionId, assetId, dateOfEntry) values (?,?,?,?,?)",
[
@ -63,7 +63,7 @@ sub add {
$session->var->get("sessionId"), $assetId,
$session->datetime->time(),
]);
return;
return undef;
}
#-------------------------------------------------------------------
@ -84,13 +84,13 @@ The assetId of the page you want to log.
sub addPage {
my $session = shift;
return unless ($session->setting->get("passiveProfilingEnabled"));
return undef unless ($session->setting->get("passiveProfilingEnabled"));
my $pageId = shift;
my @wids = $session->db->buildArray("select assetId from asset where parentId=".$session->db->quote($pageId));
foreach my $wid (@wids) {
add($session,$wid);
}
return;
return undef;
}
#-------------------------------------------------------------------

View file

@ -429,7 +429,7 @@ function addSTClassName(el, sClassName) {
var l = p.length;
for (var i = 0; i < l; i++) {
if (p[i] == sClassName)
return;
return undef;
}
p[p.length] = sClassName;
el.className = p.join(" ").replace( /(^\s+)|(\s+$)/g, "" );

View file

@ -73,7 +73,7 @@ sub delete {
$self->session->db->write("delete from productVariants where productId=".$self->session->db->quote($self->get('productId')));
$self->session->db->write("delete from products where productId=".$self->session->db->quote($self->get('productId')));
return;
return undef;
}
#-------------------------------------------------------------------
@ -87,7 +87,7 @@ sub deleteParameter {
$self->updateVariants;
return;
return undef;
}
#-------------------------------------------------------------------
@ -110,7 +110,7 @@ sub deleteOption {
$self->updateVariants;
return;
return undef;
}
#-------------------------------------------------------------------
@ -136,7 +136,7 @@ sub getByOptionId {
($productId) = $session->db->quickArray("select productId from productParameters as t1, productParameterOptions as t2 ".
"where t1.parameterId=t2.parameterId and t2.optionId=".$session->db->quote($optionId));
return unless ($productId);
return undef unless ($productId);
return WebGUI::Product->new($session,$productId);
}

View file

@ -278,7 +278,7 @@ sub new {
my $class = shift;
my $session = shift;
my $id = shift;
return unless ($id);
return undef unless ($id);
my $properties = $session->db->getRow("userProfileCategory","profileCategoryId",$id);
bless {_session=>$session, _properties=>$properties}, $class;
}

View file

@ -109,8 +109,8 @@ sub create {
"select count(*) from userProfileField where fieldName=?",
[$fieldName]
);
return if $fieldNameExists;
return if $class->isReservedFieldName($fieldName);
return undef if $fieldNameExists;
return undef if $class->isReservedFieldName($fieldName);
### Data okay, create the field
# Add the record
@ -553,11 +553,11 @@ sub new {
my $class = shift;
my $session = shift;
my $id = shift;
return unless ($id);
return if $class->isReservedFieldName($id);
return undef unless ($id);
return undef if $class->isReservedFieldName($id);
my $properties = $session->db->getRow("userProfileField","fieldName",$id);
# Reject properties that don't exist.
return unless scalar keys %$properties;
return undef unless scalar keys %$properties;
bless {_session=>$session, _properties=>$properties}, $class;
}
@ -731,10 +731,10 @@ The unique ID of a category to assign this field to.
sub setCategory {
my $self = shift;
my $categoryId = shift;
return unless ($categoryId);
return undef unless ($categoryId);
my $currentCategoryId = $self->get("profileCategoryId");
return if ($categoryId eq $currentCategoryId);
return undef if ($categoryId eq $currentCategoryId);
my ($sequenceNumber) = $self->session->db->quickArray("select max(sequenceNumber) from userProfileField where profileCategoryId=".$self->session->db->quote($categoryId));
$self->session->db->setRow("userProfileField","fieldName",{fieldName=>$self->getId, profileCategoryId=>$categoryId, sequenceNumber=>$sequenceNumber+1});

View file

@ -323,7 +323,7 @@ sub connect {
unless (defined $dbh) {
$session->errorHandler->error("Couldn't connect to database: $dsn");
return;
return undef;
}
##Set specific attributes for this database.
@ -571,11 +571,11 @@ sub quickCSV {
$sth = $self->prepare($sql);
$sth->execute($params);
return unless $csv->combine($sth->getColumnNames);
return undef unless $csv->combine($sth->getColumnNames);
$output = $csv->string();
while (@data = $sth->array) {
return unless $csv->combine(@data);
return undef unless $csv->combine(@data);
$output .= $csv->string();
}

View file

@ -313,7 +313,7 @@ sub unconditionalRead {
$sth->execute(@$placeholders) or $errorHandler->warn("Unconditional read failed: ".$sql." : ".$sth->errstr);
bless {_sql=>$sql, _db=>$db, _sth=>$sth}, $class;
} else {
return;
return undef;
}
}

View file

@ -55,14 +55,14 @@ sub addFile {
if ($path =~ m/\.(\w+)$/) {
my $type = lc($1);
if ($filters->{$type}) {
open my $fh, "$filters->{$type} $path |" or return; # open pipe to filter
open my $fh, "$filters->{$type} $path |" or return undef; # open pipe to filter
$content = do { local $/; <$fh> }; # slurp file
close $fh;
}
}
return $self->addKeywords($content)
if $content =~ m/\S/; # only index if we fine non-whitespace
return;
return undef;
}

View file

@ -183,7 +183,7 @@ sub db {
}
else {
if ($skipFatal) {
return;
return undef;
}
else {
$self->errorHandler->fatal("Couldn't connect to WebGUI database, and can't continue without it.");

View file

@ -422,7 +422,7 @@ An integer ranging from 1-7 representing the day of the week (Sunday is 1 and Sa
sub getDayName {
my $self = shift;
my $day = shift;
return unless ($day >= 1 && $day <= 7);
return undef unless ($day >= 1 && $day <= 7);
my $i18n = WebGUI::International->new($self->session,'DateTime');
return $i18n->get((qw/monday tuesday wednesday thursday friday saturday sunday/)[$day-1]);
@ -552,7 +552,7 @@ An integer ranging from 1-12 representing the month.
sub getMonthName {
my $self = shift;
my $month = shift;
return unless ($month >= 1 && $month <= 12);
return undef unless ($month >= 1 && $month <= 12);
my $i18n = WebGUI::International->new($self->session,'DateTime');
return $i18n->get((qw/january february march april may june
@ -734,7 +734,7 @@ sub mailToEpoch {
my $dt = eval {$parser->parse_datetime($date)};
if ($@) {
$self->session->errorHandler->warn($date." is not a valid date for email, and is so poorly formatted, we can't even guess what it is.");
return;
return undef;
}
return $dt->epoch;
}
@ -909,7 +909,7 @@ A string in the format of YYYY-MM-DD or YYYY-MM-DD HH:MM:SS.
sub setToEpoch {
my $self = shift;
my $set = shift;
return unless $set;
return undef unless $set;
my $time_zone = $self->getTimeZone();
my $parser = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%d %H:%M:%S', time_zone=>$time_zone);
my $dt = $parser->parse_datetime($set);

View file

@ -110,7 +110,7 @@ sub param {
@data = $self->session->request->param($field);
return wantarray ? @data : $data[0];
} else {
return;
return undef;
}
} else {
if ($self->session->request) {
@ -123,7 +123,7 @@ sub param {
}
return keys %params;
} else {
return;
return undef;
}
}
}

View file

@ -264,11 +264,11 @@ Generates and sends HTTP headers for a response.
sub sendHeader {
my $self = shift;
return if ($self->{_http}{noHeader});
return undef if ($self->{_http}{noHeader});
return $self->_sendMinimalHeader unless defined $self->session->db(1);
my ($request, $datetime, $config, $var) = $self->session->quick(qw(request datetime config var));
return unless $request;
return undef unless $request;
my $userId = $var->get("userId");
# send webgui session cookie
@ -305,7 +305,7 @@ sub sendHeader {
$request->status($self->getStatus());
$request->status_line($self->getStatus().' '.$self->getStatusDescription());
}
return;
return undef;
}
sub _sendMinimalHeader {
@ -316,7 +316,7 @@ sub _sendMinimalHeader {
$request->no_cache(1);
$request->status($self->getStatus());
$request->status_line($self->getStatus().' '.$self->getStatusDescription());
return;
return undef;
}
@ -508,7 +508,7 @@ sub setRedirect {
my $self = shift;
my $url = shift;
my @params = $self->session->form->param;
return if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self
return undef if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self
$self->session->errorHandler->info("Redirecting to $url");
$self->{_http}{location} = $url;
$self->setStatus("302", "Redirect");

View file

@ -60,7 +60,7 @@ The name of the scratch variable.
sub delete {
my $self = shift;
my $name = shift;
return unless ($name);
return undef unless ($name);
my $value = delete $self->{_data}{$name};
$self->session->db->write("delete from userSessionScratch where name=? and sessionId=?", [$name, $self->session->getId]);
return $value;
@ -97,7 +97,7 @@ The name of the scratch variable.
sub deleteName {
my $self = shift;
my $name = shift;
return unless ($name);
return undef unless ($name);
delete $self->{_data}{$name};
$self->session->db->write("delete from userSessionScratch where name=?", [$name]);
}
@ -122,7 +122,7 @@ sub deleteNameByValue {
my $self = shift;
my $name = shift;
my $value = shift;
return unless ($name and defined $value);
return undef unless ($name and defined $value);
delete $self->{_data}{$name} if ($self->{_data}{$name} eq $value);
$self->session->db->write("delete from userSessionScratch where name=? and value=?", [$name,$value]);
}
@ -215,7 +215,7 @@ sub set {
my $self = shift;
my $name = shift;
my $value = shift;
return unless ($name);
return undef unless ($name);
$self->{_data}{$name} = $value;
$self->session->db->write("insert into userSessionScratch (sessionId, name, value) values (?,?,?) on duplicate key update value=VALUES(value)", [$self->session->getId, $name, $value]);
}

Some files were not shown because too many files have changed in this diff Show more