package WebGUI::Operation::WebGUI; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2005 Plain Black Corporation. #------------------------------------------------------------------- # Please read the legal notices (docs/legal.txt) and the license # (docs/license.txt) that came with this distribution before using # this software. #------------------------------------------------------------------- # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- use Digest::MD5; use strict; use WebGUI::FormProcessor; use WebGUI::HTMLForm; use WebGUI::HTTP; use WebGUI::Session; use WebGUI::SQL; use WebGUI::Style; use WebGUI::User; #------------------------------------------------------------------- sub www_genesis { $session{page}{useEmptyStyle} = 1; my $output = 'About WebGUI



And the Internet was without form, and void; and darkness was upon the face of the web. And Plain Black formed WebGUI of the dust of tags and script, and breathed into the web the breath of life; and content became a living soul.



Ruling WebGUI, 2:7




'; return $output; } #------------------------------------------------------------------- sub www_setup { unless ($session{setting}{specialState} eq "init") { if (rand(10)>5) { return www_genesis(); } else { return www_theWg(); } } my $output = ' WebGUI Initial Configuration

WebGUI Initial Configuration

'; if ($session{form}{step} eq "2") { $output .= 'Company Information'; my $u = WebGUI::User->new("3"); $u->username(WebGUI::FormProcessor::process("username","text","Admin")); $u->profileField("email",WebGUI::FormProcessor::email("email")); $u->identifier(Digest::MD5::md5_base64(WebGUI::FormProcessor::process("identifier","password","123qwe"))); my $f = WebGUI::HTMLForm->new; $f->hidden( -name=>"op", -value=>"setup" ); $f->hidden( -name=>"step", -value=>"3" ); $f->text( -name=>"companyName", -value=>$session{setting}{companyName}, -label=>"Company Name" ); $f->email( -name=>"companyEmail", -value=>$session{setting}{companyEmail}, -label=>"Company Email Address" ); $f->url( -name=>"companyURL", -value=>$session{setting}{companyURL}, -label=>"Company URL" ); $f->submit; $output .= $f->print; } elsif ($session{form}{step} eq "3") { WebGUI::SQL->write("update settings set value=".quote(WebGUI::FormProcessor::text("companyName"))." where name='companyName'"); WebGUI::SQL->write("update settings set value=".quote(WebGUI::FormProcessor::url("companyURL"))." where name='companyURL'"); WebGUI::SQL->write("update settings set value=".quote(WebGUI::FormProcessor::email("companyEmail"))." where name='companyEmail'"); WebGUI::SQL->write("delete from settings where name='specialState'"); WebGUI::HTTP::setRedirect($session{env}{SCRIPT_NAME}); return ""; } else { $output .= 'Admin Account'; my $u = WebGUI::User->new('3'); my $f = WebGUI::HTMLForm->new; $f->hidden( -name=>"op", -value=>"setup" ); $f->hidden( -name=>"step", -value=>"2" ); $f->text( -name=>"username", -value=>$u->username, -label=>"Username" ); $f->text( -name=>"identifier", -value=>"123qwe", -label=>"Password", -subtext=>'
(Displayed in clear text so you can ensure you\'ve typed it correctly.)
' ); $f->email( -name=>"email", -value=>$u->profileField("email"), -label=>"Email Address" ); $f->submit; $output .= $f->print; } $output .= '
'; return $output; } #------------------------------------------------------------------- sub www_theWg { $session{page}{useEmptyStyle} = 1; my $output = 'WebGUI
packageWebGUI;our$VERSION="5.5.0";usestrictqw(varssubs);useTie::CPHash;useW
ebGUI::Cache;useWebGUI::ErrorHandler;useWebGUI::Icon;useWebGUI::Internation
al;useWebGUI::Macro;useWebGUI::Operation;useWebGUI::Privilege;useWebGUI::Se
s
sion;useWebGUI::SQL;useWebGUI::Style;useWebGUI::Page;useWebGUI::Template;u
s
eWebGUI::URL;useWebGUI::Utility;sub_generateDebug{if($session{setting}{sho
w
Debug}||($session{form}{debug}==1&&WebGUI::Privilege::isInGroup(3))){retur
nW
ebGUI::ErrorHandler::showDebug();}return"";}sub_generatePage{my($canEdit,
$pageEdit,$sth,$wobject,%contentHash,$originalWobject,$sql,$extra,%hash,$cm
d,$w,$template,$canEditWobject);if(WebGUI::Privilege::canViewPage()){if($se
ssion{var}{adminOn}){$canEdit=WebGUI::Privilege::canEditPage();if($canEdit)
{$pageEdit="\n<br>".pageIcon().deleteIcon("op=deletePage").editIcon("op=edi
tPage").moveUpIcon("op=movePageUp").moveDownIcon("op=movePageDown").cutIcon
("op=cutPage")."\n";}}$sth=WebGUI::SQL->read("select*fromwobjectwherepageId
=$session{page}{pageId}orderbysequenceNumber,wobjectId");while($wobject=$st
h->hashRef){#--EaterEggGoesHere!!!IncludesWebGUI::Privilege::canEditWobject
()asp
artofthechecksumof$canEdit$canEditWobject=$canEdit&&WebGUI::Privilege:
:canE
ditWobject($wobject->{wobjectId});#--EndChangesif($session{var}{adminO
n}&&$
canEditWobject){$contentHash{"page.position".${$wobject}{templatePosit
ion}}
.="\n<hr>".wobjectIcon().deleteIcon("func=delete&wid=".${$wobject}{wob
jectId}
).editIcon("func=edit&wid=".${$wobject}{wobjectId}).moveUpIcon("func
=moveUp&wid=".
${$wobject}{wobjectId}).moveDownIcon("func=moveDown&wid=".${$
wobject}{wobj
ectId}).moveTopIcon("func=moveTop&wid=".${$wobject}{wobjectId}
).moveBottomI
con("func=moveBottom&wid=".${$wobject}{wobjectId}).cutIcon("fu
nc=cut&wid=".
${$wobject}{wobjectId}).copyIcon("func=copy&wid=".${$wobject}{
wobjectId});
if(${$wobject}{namespace}ne"WobjectProxy"&&isIn("WobjectProxy",
@{$session{c
onfig}{wobjects}})){$contentHash{"page.position".${$wobject}{te
mplatePositi
on}}.=shortcutIcon("func=createShortcut&wid=".${$wobject}{wobje
ctId})}$con
tentHash{"page.position".${$wobject}{templatePosition}}.="<br>";
}#--EasterEg
gGoesHere!!Checksifuserhasprivilegetoviewthewobjectif(!WebGUI::
Privilege::c
anViewWobject($wobject->{wobjectId})){next;}#--EndChangesif(${$
wobject}{nam
espace}eq"WobjectProxy"){$originalWobject=$wobject;my($wobjectP
roxy)=WebGUI:
:SQL->quickHashRef("select*fromWobjectProxywherewobjectId=".${
$wobject}{wobj
ectId});$wobject=WebGUI::SQL->quickHashRef("select*fromwobjec
twherewobject.w
objectId=".$wobjectProxy->{proxiedWobjectId});if(${$wobject}
{namespace}eq""){
$wobject=$originalWobject;}else{${$wobject}{startDate}=${$
originalWobject}{s
tartDate};${$wobject}{endDate}=${$originalWobject}{endDat
e};${$wobject}{templ
atePosition}=${$originalWobject}{templatePosition};${$w
object}{_WobjectProxy}=${
$originalWobject}{wobjectId};if($wobjectProxy->{ov


'; return $output; } 1;