diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 3b34f6da4..039f8667d 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -3,6 +3,25 @@ - Removed debugging from the events calendar that should have been removed before the last release. - bugfix [ 1033670 ] JAVASCRIPT BUG + - bugfix [ 1034374 ] no pagination on groups + - bugfix [ 1035466 ] Pagination Broken - "Manage Users in Group" + - bugfix [ 1034900 ] unquoted themeID causing SQL error + - bugfix [ 1035510 ] USS search and user defined fields + - bugfix [ 1034373 ] No root path(s) specified + - bugfix [ 1035751 ] AdminBar.pm has message hardcoded, can't be translated. + - bugfix [ 1037161 ] Upgrade fail to change custom language to English + - bugfix [ 1036797 ] Bugs in Survey.pm (dapperedodo) + - bugfix [ 1036636 ] collateral folders missing + - bugfix [ 1036012 ] Themes broken + - Added a performance cache to the USS. Our testing indicates most USS' will see + more than 900% increase in performance. + - Added a performance cache to the Events Calendar. Our testing indicates + that most Events Calendars will see more than 33000% increase in + performance. No that's not a typo. + - bugfix [ 1035901 ] Comparision logic based on int ids + - bugfix [ 1035891 ] DBMS reserved keyword in webgui wsclient table + - bugfix [ 1035055 ] Forum Karma + - bugfix [ 1034381 ] action2 not working 6.2.5 diff --git a/docs/upgrades/upgrade_6.0.3-6.1.0.pl b/docs/upgrades/upgrade_6.0.3-6.1.0.pl index c0a6b7fae..85572895d 100644 --- a/docs/upgrades/upgrade_6.0.3-6.1.0.pl +++ b/docs/upgrades/upgrade_6.0.3-6.1.0.pl @@ -73,6 +73,7 @@ print "\tResetting user languages.\n" unless ($quiet); my ($defaultLangId) = WebGUI::SQL->quickArray("select dataDefault from userProfileField where fieldName='language'"); $defaultLangId =~ s/\[//; $defaultLangId =~ s/\]//; +$defaultLangId = 1 if ($defaultLangId > 21); my $langs = { 1 => "English", 2 => "German", @@ -97,7 +98,9 @@ WebGUI::SQL->write("update userProfileData set fieldData='".$langs->{$defaultLan WebGUI::SQL->write("update userProfileData set fieldData='English' where fieldName='language' and fieldData=1"); WebGUI::SQL->write("alter table page change languageId languageId varchar(50) not null default 'English'"); foreach my $key (keys %{$langs}) { - WebGUI::SQL->write("update page set languageId=".quote($langs->{$key})." where languageId=".$key); + my $langId = $key; + $langId = 1 if ($key > 21); + WebGUI::SQL->write("update page set languageId=".quote($langs->{$langId})." where languageId=".$key); } #-------------------------------------------- diff --git a/docs/upgrades/upgrade_6.2.2-6.2.3.sql b/docs/upgrades/upgrade_6.2.2-6.2.3.sql index 260251fec..1e5c93566 100644 --- a/docs/upgrades/upgrade_6.2.2-6.2.3.sql +++ b/docs/upgrades/upgrade_6.2.2-6.2.3.sql @@ -1,5 +1,5 @@ insert into webguiVersion values ('6.2.3','upgrade',unix_timestamp()); -update collateralFolder set parentId='-1' where parentId='0'; +update collateralFolder set parentId='-1' where collateralFolderId='0'; delete from template where namespace='Navigation' and templateId='6'; diff --git a/docs/upgrades/upgrade_6.2.4-6.2.5.sql b/docs/upgrades/upgrade_6.2.4-6.2.5.sql index acf958668..6dbc36de6 100644 --- a/docs/upgrades/upgrade_6.2.4-6.2.5.sql +++ b/docs/upgrades/upgrade_6.2.4-6.2.5.sql @@ -2,5 +2,5 @@ insert into webguiVersion values ('6.2.5','upgrade',unix_timestamp()); update template set template='^JavaScript(\"/textFix.js\");\r\n \r\n\r\n^RawHeadTags(\r\n \r\n\r\n \r\n\r\n \r\n);\r\n\r\n \r\n\r\n \r\n\r\n ' where templateId=6 and namespace='richEditor'; -update page set parentId=0 where parentId is null; -update page set parentId=0 where parentId=''; +update page set parentId='0' where parentId is null; +update page set parentId='0' where parentId=''; diff --git a/docs/upgrades/upgrade_6.2.5-6.2.6.sql b/docs/upgrades/upgrade_6.2.5-6.2.6.sql index 5f8410de6..74f78eb52 100644 --- a/docs/upgrades/upgrade_6.2.5-6.2.6.sql +++ b/docs/upgrades/upgrade_6.2.5-6.2.6.sql @@ -1,3 +1,4 @@ insert into webguiVersion values ('6.2.6','upgrade',unix_timestamp()); - +update collateralFolder set parentId='0' where parentId='-1' and collateralFolderId<>'0'; +alter table WSClient change call callMethod text; diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index d52e87023..b368a4a97 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -78,31 +78,32 @@ sub _getPageInfo { return $pageData; } -#------------------------------------------------------------------- -sub _processAction { - my ($urlString, %form, $pair, @pairs, @param); - $urlString = WebGUI::URL::unescape($_[0]); - @pairs = split(/\&/,$urlString); - foreach $pair (@pairs) { - @param = split(/\=/,$pair); - $form{$param[0]} = $param[1]; - } - $session{form} = \%form; -} - - #------------------------------------------------------------------- sub _processOperations { my ($cmd, $output); - if (exists $session{form}{op}) { - if ($session{form}{op} =~ /^[A-Za-z]+$/) { - $cmd = "WebGUI::Operation::www_".$session{form}{op}; + my $op = $session{form}{op}; + my $opNumber = shift || 1; + if ($op) { + if ($op =~ /^[A-Za-z]+$/) { + $cmd = "WebGUI::Operation::www_".$op; $output = eval($cmd); - WebGUI::ErrorHandler::security("call a non-existent operation: $session{form}{op}. Root cause: ".$@) if($@); + WebGUI::ErrorHandler::security("call a non-existent operation: $op. Root cause: ".$@) if($@); } else { - WebGUI::ErrorHandler::security("execute an invalid operation: ".$session{form}{op}); + WebGUI::ErrorHandler::security("execute an invalid operation: ".$op); } } + $opNumber++; + if ($output eq "" && exists $session{form}{"op".$opNumber}) { + my $urlString = WebGUI::URL::unescape($session{form}{"op".$opNumber}); + my @pairs = split(/\&/,$urlString); + my %form; + foreach my $pair (@pairs) { + my @param = split(/\=/,$pair); + $form{$param[0]} = $param[1]; + } + $session{form} = \%form; + $output = _processOperations($opNumber); + } return $output; } @@ -114,8 +115,6 @@ sub page { my $pageUrl = shift; my $fastcgi = shift; WebGUI::Session::open($webguiRoot,$configFile,$fastcgi) unless ($useExistingSession); - -# JT: don't forget to do something with action 2 my $page = _getPageInfo($pageUrl); my $output = _processOperations(); if ($output ne "") { diff --git a/lib/WebGUI/Affiliate.pm b/lib/WebGUI/Affiliate.pm index 38bcc2074..f8a6e6f92 100644 --- a/lib/WebGUI/Affiliate.pm +++ b/lib/WebGUI/Affiliate.pm @@ -50,9 +50,9 @@ account if possible. =cut sub grabReferral { - if ($session{user}{userId} != 1 && $session{user}{referringAffiliate} > 0) { + if ($session{user}{userId} ne "1" && $session{user}{referringAffiliate}) { return ""; - } elsif ($session{user}{userId} != 1 && (($session{user}{referringAffiliate} == 0 && $session{scratch}{referringAffiliate} > 0) || $session{form}{affiliateId} ne "")) { + } elsif ($session{user}{userId} ne "1" && (($session{user}{referringAffiliate} eq "0" && $session{scratch}{referringAffiliate}) || $session{form}{affiliateId})) { my $u = WebGUI::User->new($session{user}{userId}); $u->referringAffiliate($session{scratch}{referringAffiliate}); } elsif ($session{user}{userId} != 1) { diff --git a/lib/WebGUI/Forum/UI.pm b/lib/WebGUI/Forum/UI.pm index 8548da2ed..17e70907d 100644 --- a/lib/WebGUI/Forum/UI.pm +++ b/lib/WebGUI/Forum/UI.pm @@ -1728,6 +1728,8 @@ sub www_post { if ($var->{'newpost.isNewMessage'}) { $var->{'subscribe.label'} = WebGUI::International::get(873); return WebGUI::Privilege::insufficient() unless ($forum->canPost); + my $u = WebGUI::User->new($session{user}{userId}); + $u->karma($forum->get("karmaPerPost"),"Forum (".$forum->get("forumId").")","Forum Post") if ($session{setting}{useKarma}); if ($forum->isModerator) { $var->{'lock.label'} = WebGUI::International::get(1012); $var->{'lock.form'} = WebGUI::Form::yesNo({ diff --git a/lib/WebGUI/Help/WebGUI.pm b/lib/WebGUI/Help/WebGUI.pm index 2d4b64f22..476e87353 100644 --- a/lib/WebGUI/Help/WebGUI.pm +++ b/lib/WebGUI/Help/WebGUI.pm @@ -416,6 +416,10 @@ our $HELP = { { tag => 'settings manage', namespace => 'WebGUI' + }, + { + tag => 'navigation macros', + namespace => 'WebGUI' } ] }, @@ -470,7 +474,7 @@ our $HELP = { namespace => 'WebGUI' }, { - tag => 'navigation macro', + tag => 'navigation macros', namespace => 'WebGUI' }, { @@ -691,7 +695,7 @@ our $HELP = { } ] }, - 'navigation macro' => { + 'navigation macros' => { title => '841', body => '842', related => [ @@ -1060,7 +1064,7 @@ our $HELP = { body => '1093', related => [ { - tag => 'navigation macro', + tag => 'navigation macros', namespace => 'WebGUI' }, { @@ -1082,7 +1086,7 @@ our $HELP = { body => '1095', related => [ { - tag => 'navigation macro', + tag => 'navigation macros', namespace => 'WebGUI' }, { @@ -1100,7 +1104,7 @@ our $HELP = { body => '1097', related => [ { - tag => 'navigation macro', + tag => 'navigation macros', namespace => 'WebGUI' }, { diff --git a/lib/WebGUI/Macro/AdminBar.pm b/lib/WebGUI/Macro/AdminBar.pm index 919093312..d6e00aa26 100644 --- a/lib/WebGUI/Macro/AdminBar.pm +++ b/lib/WebGUI/Macro/AdminBar.pm @@ -144,7 +144,7 @@ sub process { WebGUI::URL::page('op=listUsers')=>WebGUI::International::get(7), WebGUI::URL::page('op=viewStatistics')=>WebGUI::International::get(144), WebGUI::URL::page('op=listDatabaseLinks')=>WebGUI::International::get(981), - WebGUI::URL::page('op=listNavigation')=>'Manage navigation.' + WebGUI::URL::page('op=listNavigation')=>WebGUI::International::get("manage navigation","Navigation") ); } elsif (WebGUI::Grouping::isInGroup(11)) { %hash = ( diff --git a/lib/WebGUI/Macro/r_printable.pm b/lib/WebGUI/Macro/r_printable.pm index 34cb85260..02cedfb1d 100644 --- a/lib/WebGUI/Macro/r_printable.pm +++ b/lib/WebGUI/Macro/r_printable.pm @@ -24,7 +24,7 @@ sub process { @param = WebGUI::Macro::getParams($_[0]); my $append = 'op=makePrintable'; if ($session{env}{REQUEST_URI} =~ /op\=/) { - $append = 'action2='.WebGUI::URL::escape($append); + $append = 'op2='.WebGUI::URL::escape($append); } $temp = WebGUI::URL::append($session{env}{REQUEST_URI},$append); if ($param[1] ne "") { diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm index ebcae09d5..29532f5af 100644 --- a/lib/WebGUI/Navigation.pm +++ b/lib/WebGUI/Navigation.pm @@ -310,7 +310,7 @@ sub build { # Some information about my mother my $mother = WebGUI::Page->getPage($page->{parentId}); - if ($page->{parentId} > 0) { + if ($page->{parentId} ne "0") { foreach (qw(title urlizedTitle parentId pageId)) { $pageData->{"page.mother.$_"} = $mother->get($_); } diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm index 8d7a9f795..062e51233 100644 --- a/lib/WebGUI/Operation/Group.pm +++ b/lib/WebGUI/Operation/Group.pm @@ -533,6 +533,7 @@ sub www_manageUsersInGroup { $output .= ''.epochToHuman($row->{expireDate},"%z").''; } $output .= ''.WebGUI::Form::formFooter(); + $output .= $p->getBarTraditional; $output .= '

'.WebGUI::International::get(976).'

'; $output .= WebGUI::Operation::User::getUserSearchForm("manageUsersInGroup",{gid=>$session{form}{gid}}); my ($userCount) = WebGUI::SQL->quickArray("select count(*) from users"); diff --git a/lib/WebGUI/Operation/Template.pm b/lib/WebGUI/Operation/Template.pm index d1bce2586..54878cc57 100644 --- a/lib/WebGUI/Operation/Template.pm +++ b/lib/WebGUI/Operation/Template.pm @@ -128,7 +128,7 @@ sub www_editTemplate { $f = WebGUI::HTMLForm->new; $f->hidden("op","editTemplateSave"); $f->readOnly($session{form}{tid},WebGUI::International::get(503)); - $f->hidden("action2",$session{form}{afterEdit}); + $f->raw('buildHashRef("select distinct(namespace),namespace from template order by namespace"); @@ -164,7 +164,7 @@ sub www_editTemplateSave { name=>$session{form}{name}, template=>$session{form}{template} }); - if ($session{form}{action2} eq "") { + if ($session{form}{op2} eq "") { return www_listTemplates(); } else { return ""; diff --git a/lib/WebGUI/Operation/Theme.pm b/lib/WebGUI/Operation/Theme.pm index 783a05469..5fbbac435 100644 --- a/lib/WebGUI/Operation/Theme.pm +++ b/lib/WebGUI/Operation/Theme.pm @@ -114,7 +114,7 @@ sub www_addThemeComponentSave { $id = $2; my $componentId = WebGUI::Id::generate(); WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id) - values ($session{form}{themeId}, $componentId, ".quote($type).", ".quote($id).")"); + values (".quote($session{form}{themeId}).", ".quote($componentId).", ".quote($type).", ".quote($id).")"); } return www_editTheme(); } @@ -122,7 +122,6 @@ sub www_addThemeComponentSave { #------------------------------------------------------------------- sub www_deleteTheme { return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9)); - return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0); my $output = helpIcon("theme delete"); $output .= '

'.WebGUI::International::get(42).'

'; $output .= WebGUI::International::get(907).'

'; @@ -137,15 +136,14 @@ sub www_deleteTheme { #------------------------------------------------------------------- sub www_deleteThemeConfirm { return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9)); - return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0); - my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".$session{form}{themeId}); + my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId})); unless ($theme->{original}) { WebGUI::SQL->write("delete from collateralFolder where name=".quote($theme->{name})); - my $sth = WebGUI::SQL->read("select type,Id from themeComponent where themeId=".$session{form}{themeId}); + my $sth = WebGUI::SQL->read("select type,Id from themeComponent where themeId=".quote($session{form}{themeId})); while (my $component = $sth->hashRef) { if ($component->{type} eq "template") { my ($id,$namespace) = split("_",$component->{id}); - WebGUI::SQL->write("delete from template where templateId=".$id + WebGUI::SQL->write("delete from template where templateId=".quote($id) ." and namespace=".quote($namespace)); } else { my $c = WebGUI::Collateral->new($component->{id}); @@ -154,15 +152,14 @@ sub www_deleteThemeConfirm { } $sth->finish; } - WebGUI::SQL->write("delete from theme where themeId=".$session{form}{themeId}); - WebGUI::SQL->write("delete from themeComponent where themeId=".$session{form}{themeId}); + WebGUI::SQL->write("delete from theme where themeId=".quote($session{form}{themeId})); + WebGUI::SQL->write("delete from themeComponent where themeId=".quote($session{form}{themeId})); return www_listThemes(); } #------------------------------------------------------------------- sub www_deleteThemeComponent { return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9)); - return WebGUI::Privilege::vitalComponent() if ($session{form}{themeId} < 1000 && $session{form}{themeId} > 0); my $output = '

'.WebGUI::International::get(42).'

'; $output .= WebGUI::International::get(908).'

'; $output .= '

quickHashRef("select * from theme where themeId=$session{form}{themeId}"); + $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId})); } $output .= helpIcon("theme add/edit"); $output .= '

'.WebGUI::International::get(902).'

'; @@ -219,7 +215,7 @@ sub www_editTheme { my $query = "select collateral.name as name, themeComponent.themeComponentId as componentId, collateral.collateralType as componentType from themeComponent, collateral where collateral.collateralId=themeComponent.id and themeComponent.type=collateral.collateralType - and themeComponent.themeId=$session{form}{themeId} order by name"; + and themeComponent.themeId=".quote($session{form}{themeId})." order by name"; my $sth = WebGUI::SQL->read($query); while (my $component = $sth->hashRef) { $output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId} @@ -228,11 +224,11 @@ sub www_editTheme { } $sth->finish; $sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent - where type='template' and themeId=".$session{form}{themeId}); + where type='template' and themeId=".quote($session{form}{themeId})); while (my $data = $sth->hashRef) { my ($templateId,$namespace) = split("_",$data->{id}); my ($name) = WebGUI::SQL->quickArray("select name from template where - templateId=".$templateId." and namespace=".quote($namespace)); + templateId=".quote($templateId)." and namespace=".quote($namespace)); $output .= deleteIcon('op=deleteThemeComponent&themeId='.$session{form}{themeId} .'&themeComponentId='.$data->{themeComponentId}) .' '.$name.' ('.$componentTypes->{template}.'/'.$namespace.')
'; @@ -248,10 +244,10 @@ sub www_editThemeSave { if ($session{form}{themeId} eq "new") { $session{form}{themeId} = WebGUI::Id::generate(); WebGUI::SQL->write("insert into theme (themeId,webguiVersion,original,versionNumber) - values ($session{form}{themeId},".quote($WebGUI::VERSION).",1,0)"); + values (".quote($session{form}{themeId}).",".quote($WebGUI::VERSION).",1,0)"); } WebGUI::SQL->write("update theme set name=".quote($session{form}{name}).", designer=".quote($session{form}{designer}).", - designerURL=".quote($session{form}{designerURL})." where themeId=".$session{form}{themeId}); + designerURL=".quote($session{form}{designerURL})." where themeId=".quote($session{form}{themeId})); if ($session{form}{proceed} eq "addComponent") { return www_addThemeComponent(); } @@ -266,9 +262,9 @@ sub www_exportTheme { my $tempId = "theme".$session{form}{themeId}; my $propertyFile = WebGUI::Attachment->new("_theme.properties","temp",$tempId); WebGUI::SQL->write("update theme set versionNumber=versionNumber+1, webguiVersion=".quote($WebGUI::VERSION) - ." where themeId=".$session{form}{themeId}); - my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".$session{form}{themeId}); - my $sth = WebGUI::SQL->read("select * from themeComponent where themeId=".$session{form}{themeId}); + ." where themeId=".quote($session{form}{themeId})); + my $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId})); + my $sth = WebGUI::SQL->read("select * from themeComponent where themeId=".quote($session{form}{themeId})); while (my $component = $sth->hashRef) { my $key = $component->{themeComponentId}; $theme->{components}{$key}{type} = $component->{type}; @@ -294,7 +290,7 @@ sub www_exportTheme { } elsif ($component->{type} eq "template") { my ($id, $namespace) = split("_",$component->{id}); $theme->{components}{$key}{properties} = WebGUI::SQL->quickHashRef("select * from template - where templateId=".$id." and namespace=".quote($namespace)); + where templateId=".quote($id)." and namespace=".quote($namespace)); } } $sth->finish; @@ -388,10 +384,10 @@ sub www_importThemeSave { my $theme = $propertiesFile->getHashref; my $themeId = WebGUI::Id::generate(); WebGUI::SQL->write("insert into theme (themeId,name,designer,designerURL,webguiVersion,versionNumber,original) values - ($themeId, ".quote($theme->{name}).", ".quote($theme->{designer}).", ".quote($theme->{designerURL}) + (".quote($themeId).", ".quote($theme->{name}).", ".quote($theme->{designer}).", ".quote($theme->{designerURL}) .", ".quote($theme->{webguiVersion}).", $theme->{versionNumber}, 0)"); my $collateralFolderId = WebGUI::Id::generate(); - WebGUI::SQL->write("insert into collateralFolder (collateralFolderId,name,parentId) values ($collateralFolderId, + WebGUI::SQL->write("insert into collateralFolder (collateralFolderId,name,parentId) values (".quote($collateralFolderId).", ".quote($theme->{name}).", 0)"); foreach my $key (keys %{$theme->{components}}) { my $type = $theme->{components}{$key}{type}; @@ -406,7 +402,7 @@ sub www_importThemeSave { my $id = $theme->{components}{$key}{properties}{$type."Id"}; $id .= "_".$theme->{components}{$key}{properties}{namespace} if ($type eq "template"); WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id) - values ($themeId, ".WebGUI::Id::generate().", ".quote($type).", ".quote($id).")"); + values (".quote($themeId).", ".quote(WebGUI::Id::generate()).", ".quote($type).", ".quote($id).")"); } elsif (isIn($type, qw(image file snippet))) { $theme->{components}{$key}{properties}{collateralFolderId} = $collateralFolderId; my $c = WebGUI::Collateral->new("new"); @@ -414,7 +410,7 @@ sub www_importThemeSave { $c->saveFromFilesystem($propertiesFile->getNode->getPath.$session{os}{slash} .$theme->{components}{$key}{properties}{filename}); WebGUI::SQL->write("insert into themeComponent (themeId,themeComponentId,type,id) - values ($themeId, ".WebGUI::Id::generate().", ".quote($type).", " + values (".quote($themeId).", ".quote(WebGUI::Id::generate()).", ".quote($type).", " .quote($c->get("collateralId")).")"); } } @@ -453,7 +449,7 @@ sub www_listThemes { sub www_viewTheme { return WebGUI::Privilege::insufficient unless (WebGUI::Grouping::isInGroup(9)); my ($output, $theme, $f); - $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=$session{form}{themeId}"); + $theme = WebGUI::SQL->quickHashRef("select * from theme where themeId=".quote($session{form}{themeId})); $output .= '

'.WebGUI::International::get(930).'

'; $f = WebGUI::HTMLForm->new; $f->readOnly( @@ -485,18 +481,18 @@ sub www_viewTheme { my $query = "select collateral.name as name, themeComponent.themeComponentId as componentId, collateral.collateralType as componentType from themeComponent, collateral where collateral.collateralId=themeComponent.id and themeComponent.type=collateral.collateralType - and themeComponent.themeId=$session{form}{themeId} order by name"; + and themeComponent.themeId=".quote($session{form}{themeId})." order by name"; my $sth = WebGUI::SQL->read($query); while (my $component = $sth->hashRef) { $output .= $component->{name}.' ('.$componentTypes->{$component->{componentType}}.')
'; } $sth->finish; $sth = WebGUI::SQL->read("select themeComponentId,id from themeComponent - where type='template' and themeId=".$session{form}{themeId}); + where type='template' and themeId=".quote($session{form}{themeId})); while (my $data = $sth->hashRef) { my ($templateId,$namespace) = split("_",$data->{id}); my ($name) = WebGUI::SQL->quickArray("select name from template where - templateId=".$templateId." and namespace=".quote($namespace)); + templateId=".quote($templateId)." and namespace=".quote($namespace)); $output .= $name.' ('.$componentTypes->{template}.')
'; } $sth->finish; diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index 8cc193c2b..3ac20c51b 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -440,6 +440,7 @@ sub www_editUserGroup { $output .= ''.epochToHuman($row->{expireDate},"%z").''; } $output .= ''.WebGUI::Form::formFooter(); + $output .= $p->getBarTraditional; $output .= '

'.WebGUI::International::get(605).'

'; $output .= WebGUI::Operation::Group::getGroupSearchForm("editUserGroup",{uid=>$session{form}{uid}}); my ($groupCount) = WebGUI::SQL->quickArray("select count(*) from users"); diff --git a/lib/WebGUI/Session.pm b/lib/WebGUI/Session.pm index c5ff92f39..912939d1f 100644 --- a/lib/WebGUI/Session.pm +++ b/lib/WebGUI/Session.pm @@ -69,7 +69,7 @@ These subroutines are available from this package: #------------------------------------------------------------------- sub _setupSessionVars { - my (%vars, $uid, $encryptedPassword); + my (%vars, $uid); tie %vars, 'Tie::CPHash'; if ($_[0] ne "") { %vars = WebGUI::SQL->quickHash("select * from userSession where sessionId=".quote($_[0])); diff --git a/lib/WebGUI/Wobject/EventsCalendar.pm b/lib/WebGUI/Wobject/EventsCalendar.pm index d7f2f14e1..c746531ba 100644 --- a/lib/WebGUI/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Wobject/EventsCalendar.pm @@ -12,6 +12,7 @@ package WebGUI::Wobject::EventsCalendar; use strict; use Tie::CPHash; +use WebGUI::Cache; use WebGUI::DateTime; use WebGUI::FormProcessor; use WebGUI::HTMLForm; @@ -30,6 +31,14 @@ use WebGUI::Wobject; our @ISA = qw(WebGUI::Wobject); +#------------------------------------------------------------------- +sub deleteCache { + my $self = shift; + my $cache = WebGUI::Cache->new("EventsCalendar_".$self->wid); + $cache->delete; +} + + #------------------------------------------------------------------- sub duplicate { my ($sth, $w, @row, $newEventId, $previousRecurringEventId); @@ -233,6 +242,7 @@ sub www_edit { #------------------------------------------------------------------- sub www_editSave { $_[0]->SUPER::www_editSave(); + $_[0]->deleteCache; if ($session{form}{proceed} eq "addEvent") { $session{form}{eid} = "new"; return $_[0]->www_editEvent; @@ -308,6 +318,7 @@ sub www_editEvent { #------------------------------------------------------------------- sub www_editEventSave { return WebGUI::Privilege::insufficient() unless ($_[0]->canEdit); + $_[0]->deleteCache; my (@startDate, @endDate, $until, @eventId, $i, $recurringEventId); $startDate[0] = WebGUI::FormProcessor::dateTime("startDate"); $startDate[0] = time() unless ($startDate[0] > 0); @@ -368,6 +379,9 @@ sub www_editEventSave { sub www_view { $_[0]->logView() if ($session{setting}{passiveProfilingEnabled}); my ( $junk, $sameDate, $p, @list, $date, $flag, %previous, $maxDate, $minDate); + my $cache = WebGUI::Cache->new("EventsCalendar_".$_[0]->wid); + my $monthloop = $cache->get; + unless (defined $monthloop) { # figure out the date range tie %previous, 'Tie::CPHash'; if ($_[0]->get("startMonth") eq "first") { @@ -409,14 +423,7 @@ sub www_view { $session{form}{calPn} = 1; } } - - # create template variables - my %var; - $var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId")); - $var{"addevent.label"} = WebGUI::International::get(20,$_[0]->get("namespace")); - my @monthloop; for (my $i=1;$i<$monthCount;$i++) { - # if ($session{form}{calPn} == ($i)) { my $thisMonth = WebGUI::DateTime::addToDate($minDate,0,($i-1),0); my ($monthStart, $monthEnd) = WebGUI::DateTime::monthStartEnd($thisMonth); my @thisMonthDate = WebGUI::DateTime::epochToArray($thisMonth); @@ -506,7 +513,7 @@ sub www_view { }); $dayOfWeekCounter++; } - push(@monthloop, { + push(@$monthloop, { 'daysInMonth'=>$daysInMonth, 'day_loop'=>\@dayloop, 'prepad_loop'=>\@prepad, @@ -514,13 +521,17 @@ sub www_view { 'month'=>WebGUI::DateTime::getMonthName($date[1]), 'year'=>$date[0] }); - # } - # $row[$i-1] = "page"; } + $cache->set($monthloop,3600); + } + # create template variables $p = WebGUI::Paginator->new(WebGUI::URL::page("func=view&wid=".$_[0]->get("wobjectId")),$_[0]->get("paginateAfter"),"calPn"); - $p->setDataByArrayRef(\@monthloop); + $p->setDataByArrayRef($monthloop); + my %var; $var{month_loop} = $p->getPageData; $p->appendTemplateVars(\%var); + $var{"addevent.url"} = WebGUI::URL::page('func=editEvent&eid=new&wid='.$_[0]->get("wobjectId")); + $var{"addevent.label"} = WebGUI::International::get(20,$_[0]->get("namespace")); $var{'sunday.label'} = WebGUI::DateTime::getDayName(7); $var{'monday.label'} = WebGUI::DateTime::getDayName(1); $var{'tuesday.label'} = WebGUI::DateTime::getDayName(2); diff --git a/lib/WebGUI/Wobject/IndexedSearch/Search.pm b/lib/WebGUI/Wobject/IndexedSearch/Search.pm index 04d065ba4..f11fb9d91 100644 --- a/lib/WebGUI/Wobject/IndexedSearch/Search.pm +++ b/lib/WebGUI/Wobject/IndexedSearch/Search.pm @@ -67,7 +67,7 @@ sub _recurseCrumbTrail { my ($sth, %data, $output); tie %data, 'Tie::CPHash'; %data = WebGUI::SQL->quickHash("select pageId,parentId,menuTitle,urlizedTitle from page where pageId=".quote($_[0])); - if ($data{pageId} > 1) { + if ($data{pageId}) { $output .= _recurseCrumbTrail($data{parentId}); } if ($data{menuTitle} ne "") { diff --git a/lib/WebGUI/Wobject/Survey.pm b/lib/WebGUI/Wobject/Survey.pm index ab38dd51b..2177c6c56 100644 --- a/lib/WebGUI/Wobject/Survey.pm +++ b/lib/WebGUI/Wobject/Survey.pm @@ -292,11 +292,11 @@ sub getResponseDrivenQuestionIds { if ($previousResponse->{Survey_answerId}) { ($questionId) = WebGUI::SQL->quickArray("select gotoQuestion from Survey_answer where Survey_answerId=".quote($previousResponse->{Survey_answerId})); - unless ($questionId > 0) { + unless ($questionId) { ($questionId) = WebGUI::SQL->quickArray("select gotoQuestion from Survey_question where Survey_questionId=".quote($previousResponse->{Survey_questionId})); } - unless ($questionId > 0) { # terminate survey + unless ($questionId) { # terminate survey $self->completeResponse($responseId); return (); } @@ -854,12 +854,12 @@ sub www_respond { return "" unless ($session{scratch}{$varname}); my $userId = ($self->get("anonymous")) ? substr(md5_hex($session{user}{userId}),0,8) : $session{user}{userId}; foreach my $key (keys %{$session{form}}) { - if ($key =~ /answerId_(\d+)/) { + if ($key =~ /^answerId_(.+)$/) { my $id = $1; my ($previousResponse) = WebGUI::SQL->quickArray("select count(*) from Survey_questionResponse where Survey_answerId=".quote($session{form}{"answerId_".$id})." and Survey_responseId=".quote($session{scratch}{$varname})); next if ($previousResponse); - my $answer = $self->getCollateral("Survey_answer","Survey_answerId",quote($session{form}{"answerId_".$id})); + my $answer = $self->getCollateral("Survey_answer","Survey_answerId",$session{form}{"answerId_".$id}); my $response = $session{form}{"textResponse_".$id} || $answer->{answer}; WebGUI::SQL->write("insert into Survey_questionResponse (Survey_answerId,Survey_questionId,Survey_responseId,Survey_id,comment,response,dateOfResponse) values ( ".quote($answer->{Survey_answerId}).", ".quote($answer->{Survey_questionId}).", ".quote($session{scratch}{$varname}).", ".quote($answer->{Survey_id}).", @@ -955,7 +955,7 @@ sub www_viewGradebook { $var->{title} = WebGUI::International::get(71,$self->get("namespace")); my $p = WebGUI::Paginator->new(WebGUI::URL::page('func=viewGradebook&wid='.$self->get("wobjectId"))); $p->setDataByQuery("select userId,username,ipAddress,Survey_responseId,startDate,endDate from Survey_response - where isComplete=1 and Survey_id=".$self->get("Survey_id")." order by username,ipAddress,startDate"); + where isComplete=1 and Survey_id=".quote($self->get("Survey_id"))." order by username,ipAddress,startDate"); my $users = $p->getPageData; ($var->{'question.count'}) = WebGUI::SQL->quickArray("select count(*) from Survey_question where Survey_id=".quote($self->get("Survey_id"))); if ($var->{'question.count'} > $self->get("questionsPerResponse")) { diff --git a/lib/WebGUI/Wobject/USS.pm b/lib/WebGUI/Wobject/USS.pm index 3a6ab6ec9..6919f22af 100644 --- a/lib/WebGUI/Wobject/USS.pm +++ b/lib/WebGUI/Wobject/USS.pm @@ -13,6 +13,7 @@ package WebGUI::Wobject::USS; use strict; use Tie::CPHash; use WebGUI::Attachment; +use WebGUI::Cache; use WebGUI::DateTime; use WebGUI::Forum; use WebGUI::Forum::UI; @@ -59,6 +60,15 @@ sub _xml_encode { return $_[0]; } +#------------------------------------------------------------------- +sub deleteCachedSubmission { + my $self = shift; + my $submissionId = shift; + my $cache = WebGUI::Cache->new("USS_submission_".$submissionId); + $cache->delete; +} + + #------------------------------------------------------------------- sub duplicate { WebGUI::ErrorHandler::warn("USS wobjects cannot be duplicated until after 6.3."); @@ -247,14 +257,16 @@ sub viewSubmissionAsPage { #------------------------------------------------------------------- sub www_approveSubmission { + my $self = shift; my (%submission); tie %submission, 'Tie::CPHash'; if (WebGUI::Grouping::isInGroup(4,$session{user}{userId}) || WebGUI::Grouping::isInGroup(3,$session{user}{userId})) { %submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=".quote($session{form}{sid})); WebGUI::SQL->write("update USS_submission set status='Approved' where USS_submissionId=".quote($session{form}{sid})); WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='. - $session{form}{wid}.'&sid='.$session{form}{sid}),4,$_[0]->get("namespace")); + $session{form}{wid}.'&sid='.$session{form}{sid}),4,$self->get("namespace")); WebGUI::MessageLog::completeEntry($session{form}{mlog}); + $self->deleteCachedSubmission; return WebGUI::Operation::www_viewMessageLog(); } else { return WebGUI::Privilege::insufficient(); @@ -269,13 +281,15 @@ sub www_copy { #------------------------------------------------------------------- sub www_deleteFile { + my $self = shift; my ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=".quote($session{form}{sid})); - if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) { - $_[0]->setCollateral("USS_submission","USS_submissionId",{ + if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) { + $self->setCollateral("USS_submission","USS_submissionId",{ $session{form}{file}=>'', USS_submissionId=>$session{form}{sid} },0,0); - return $_[0]->www_editSubmission(); + $self->deleteCachedSubmission; + return $self->www_editSubmission(); } else { return WebGUI::Privilege::insufficient(); } @@ -283,9 +297,10 @@ sub www_deleteFile { #------------------------------------------------------------------- sub www_deleteSubmission { + my $self = shift; my ($owner) = WebGUI::SQL->quickArray("select userId from USS_submission where USS_submissionId=".quote($session{form}{sid})); - if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) { - return $_[0]->confirm(WebGUI::International::get(17,$_[0]->get("namespace")), + if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) { + return $self->confirm(WebGUI::International::get(17,$self->get("namespace")), WebGUI::URL::page('func=deleteSubmissionConfirm&wid='.$session{form}{wid}.'&sid='.$session{form}{sid})); } else { return WebGUI::Privilege::insufficient(); @@ -294,8 +309,9 @@ sub www_deleteSubmission { #------------------------------------------------------------------- sub www_deleteSubmissionConfirm { + my $self = shift; my ($owner, $forumId, $pageId) = WebGUI::SQL->quickArray("select userId,forumId,pageId from USS_submission where USS_submissionId=".quote($session{form}{sid})); - if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($_[0]->get("groupToApprove"))) { + if ($owner eq $session{user}{userId} || WebGUI::Grouping::isInGroup($self->get("groupToApprove"))) { my ($inUseElsewhere) = WebGUI::SQL->quickArray("select count(*) from USS_submission where forumId=".quote($forumId)); unless ($inUseElsewhere > 1) { my $forum = WebGUI::Forum->new($forumId); @@ -303,7 +319,8 @@ sub www_deleteSubmissionConfirm { } my $page = WebGUI::Page->new($pageId); $page->purge; - $_[0]->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid}); + $self->deleteCachedSubmission; + $self->deleteCollateral("USS_submission","USS_submissionId",$session{form}{sid}); my $file = WebGUI::Attachment->new("",$session{form}{wid},$session{form}{sid}); $file->deleteNode; return ""; @@ -314,14 +331,16 @@ sub www_deleteSubmissionConfirm { #------------------------------------------------------------------- sub www_denySubmission { + my $self = shift; my (%submission); tie %submission, 'Tie::CPHash'; if (WebGUI::Grouping::isInGroup(4,$session{user}{userId}) || WebGUI::Grouping::isInGroup(3,$session{user}{userId})) { %submission = WebGUI::SQL->quickHash("select * from USS_submission where USS_submissionId=".quote($session{form}{sid})); WebGUI::SQL->write("update USS_submission set status='Denied' where USS_submissionId=".quote($session{form}{sid})); WebGUI::MessageLog::addInternationalizedEntry($submission{userId},'',WebGUI::URL::page('func=viewSubmission&wid='. - $session{form}{wid}.'&sid='.$session{form}{sid}),5,$_[0]->get("namespace")); + $session{form}{wid}.'&sid='.$session{form}{sid}),5,$self->get("namespace")); WebGUI::MessageLog::completeEntry($session{form}{mlog}); + $self->deleteCachedSubmission; return WebGUI::Operation::www_viewMessageLog(); } else { return WebGUI::Privilege::insufficient(); @@ -674,6 +693,7 @@ sub www_editSubmissionSave { my $page = WebGUI::Page->new($submission->{pageId}); $page->set(\%pageVars); $_[0]->setCollateral("USS_submission", "USS_submissionId", \%hash, 1, 0, "USS_id", $_[0]->get("USS_id")); + $_[0]->deleteCachedSubmission; return $_[0]->www_viewSubmission(); } else { return WebGUI::Privilege::insufficient(); @@ -715,7 +735,7 @@ sub www_view { WebGUI::Style::setLink($var{"rss.url"},{ rel=>'alternate', type=>'application/rss+xml', title=>'RSS' }); if ($session{scratch}{search}) { $numResults = $session{scratch}{numResults}; - $constraints = WebGUI::Search::buildConstraints([qw(USS_submission.username USS_submission.title USS_submission.content)]); + $constraints = WebGUI::Search::buildConstraints([qw(USS_submission.username USS_submission.title USS_submission.content USS_submission.userDefined1 USS_submission.userDefined2 USS_submission.userDefined3 USS_submission.userDefined4 USS_submission.userDefined5)]); } if ($constraints ne "") { $constraints = "USS_submission.status='Approved' and ".$constraints; @@ -746,6 +766,9 @@ sub www_view { $i = 0; my $imageURL = ""; foreach $row (@$page) { + my $cache = WebGUI::Cache->new("USS_submission_".$row->{USS_submissionId}); + my $submission = $cache->get; + unless (defined $submission) { $page->[$i]->{content} = WebGUI::HTML::filter($page->[$i]->{content},$_[0]->get("filterContent")); $page->[$i]->{content} =~ s/\n/\^\-\;/ unless ($page->[$i]->{content} =~ m/\^\-\;/); $page->[$i]->{content} = WebGUI::HTML::format($page->[$i]->{content},$page->[$i]->{contentType}); @@ -779,7 +802,7 @@ sub www_view { $inDateRange = 1; } else { $inDateRange = 0; } - push (@submission,{ + $submission = { "submission.id"=>$page->[$i]->{USS_submissionId}, "submission.url"=>WebGUI::URL::gateway($page->[$i]->{urlizedTitle}), "submission.content"=>$content[0], @@ -798,7 +821,6 @@ sub www_view { "submission.image"=>$imageURL, "submission.date"=>epochToHuman($page->[$i]->{dateSubmitted}), "submission.date.updated"=>epochToHuman($page->[$i]->{dateUpdated}), - "submission.currentUser"=>($session{user}{userId} eq $page->[$i]->{userId} && $session{user}{userId} != 1), "submission.userProfile"=>WebGUI::URL::page('op=viewProfile&uid='.$page->[$i]->{userId}), "submission.edit.url"=>WebGUI::URL::page($quickurl.'editSubmission'), "submission.secondColumn"=>(($i+1)%2==0), @@ -807,7 +829,11 @@ sub www_view { "submission.fifthColumn"=>(($i+1)%5==0), 'submission.controls'=>$controls, 'submission.inDateRange'=>$inDateRange - }); + }; + $cache->set($submission,3600); + } + $submission->{"submission.currentUser"}=($session{user}{userId} eq $submission->{"submission.userId"} && $session{user}{userId} != 1); + push(@submission,$submission); $i++; } $var{submissions_loop} = \@submission; diff --git a/lib/WebGUI/Wobject/WSClient.pm b/lib/WebGUI/Wobject/WSClient.pm index e9fe918f8..795867973 100644 --- a/lib/WebGUI/Wobject/WSClient.pm +++ b/lib/WebGUI/Wobject/WSClient.pm @@ -66,7 +66,7 @@ sub new { -properties => $property, -useMetaData => 1, -extendedProperties => { - call => { + callMethod => { fieldType => 'textarea', }, debugMode => { @@ -165,9 +165,9 @@ sub www_edit { -value => $_[0]->get('proxy'), ); $properties->text ( - -name => 'call', + -name => 'callMethod', -label => WebGUI::International::get(4, $_[0]->get('namespace')), - -value => $_[0]->get('call'), + -value => $_[0]->get('callMethod'), ); $properties->textarea ( -name => 'params', @@ -262,7 +262,7 @@ sub www_view { # snag our SOAP call and preprocess if needed if ($self->get('preprocessMacros')) { - $call = WebGUI::Macro::process($self->get("call")); + $call = WebGUI::Macro::process($self->get("callMethod")); $param_str = WebGUI::Macro::process($self->get("params")); } diff --git a/lib/WebGUI/i18n/English/Navigation.pm b/lib/WebGUI/i18n/English/Navigation.pm index 9b33abf50..890ec5e34 100644 --- a/lib/WebGUI/i18n/English/Navigation.pm +++ b/lib/WebGUI/i18n/English/Navigation.pm @@ -1,6 +1,12 @@ package WebGUI::i18n::English::Navigation; our $I18N = { + 'manage navigation' => { + message => q|Manage Navigation|, + lastUpdated => 1077081255, + context=>q|Used in the Admin Bar| + }, + '33' => { message => q|Error: This identifier is already in use. Please use an unique value.|, lastUpdated => 1077081255 diff --git a/sbin/upgrade.pl b/sbin/upgrade.pl index fab766887..5bc1093a7 100644 --- a/sbin/upgrade.pl +++ b/sbin/upgrade.pl @@ -172,7 +172,7 @@ foreach my $file (@files) { ($config{$file}{version}) = WebGUI::SQL->quickArray("select webguiVersion from webguiVersion order by dateApplied desc, webguiVersion desc limit 1",$dbh); $dbh->disconnect; - rmtree($config->get("uploadsPath".$slash."temp")); + rmtree($config->get("uploadsPath").$slash."temp"); } else { delete $config{$file}; print "\tSkipping non-MySQL database.\n" unless ($quiet);