package WebGUI::Operation::WebGUI; #------------------------------------------------------------------- # WebGUI is Copyright 2001-2006 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::HTMLForm; use WebGUI::User; #------------------------------------------------------------------- =head2 www_genesis ( ) The beginning of WebGUI. =cut sub www_genesis { my $session = shift; $session->style->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; } =head2 www_setup ( ) Initial setup for a brand new WebGUI install. Sets the administrator name, password and email address, as well as some other WebGUI settings. =cut #------------------------------------------------------------------- sub www_setup { my $session = shift; $session->http->setMimeType("text/html"); return "" unless ($session->setting->get("specialState") eq "init"); my $i18n = WebGUI::International->new($session, "WebGUI"); my $output = ' WebGUI Initial Configuration

WebGUI Initial Configuration

'; if ($session->form->process("step") eq "2") { $output .= 'Company Information'; my $u = WebGUI::User->new($session,"3"); $u->username($session->form->process("username","text","Admin")); $u->profileField("email",$session->form->email("email")); $u->identifier(Digest::MD5::md5_base64($session->form->process("identifier","password","123qwe"))); my $f = WebGUI::HTMLForm->new($session,action=>$session->url->gateway()); $f->hidden( -name=>"op", -value=>"setup" ); $f->hidden( -name=>"step", -value=>"3" ); $f->text( -name=>"companyName", -value=>$session->setting->get("companyName"), -label=>$i18n->get(125), -hoverHelp=>$i18n->get('125 description'), ); $f->email( -name=>"companyEmail", -value=>$session->setting->get("companyEmail"), -label=>$i18n->get(126), -hoverHelp=>$i18n->get('126 description'), ); $f->url( -name=>"companyURL", -value=>$session->setting->get("companyURL"), -label=>$i18n->get(127), -hoverHelp=>$i18n->get('127 description'), ); $f->submit; $output .= $f->print; } elsif ($session->form->process("step") eq "3") { $session->setting->remove('specialState'); $session->setting->set('companyName',$session->form->text("companyName")); $session->setting->set('companyURL',$session->form->url("companyURL")); $session->setting->set('companyEmail',$session->form->email("companyEmail")); $session->http->setRedirect($session->url->gateway()); $session->http->getHeader; return ""; } else { $output .= 'Admin Account'; my $u = WebGUI::User->new($session,'3'); my $f = WebGUI::HTMLForm->new($session,action=>$session->url->gateway()); $f->hidden( -name=>"op", -value=>"setup" ); $f->hidden( -name=>"step", -value=>"2" ); $f->text( -name=>"username", -value=>$u->username, -label=>$i18n->get(50), -hoverHelp=>$i18n->get('50 setup description'), ); $f->text( -name=>"identifier", -value=>"123qwe", -label=>$i18n->get(51), -hoverHelp=>$i18n->get('51 description'), -subtext=>'
('.$i18n->get("password clear text").')
' ); $f->email( -name=>"email", -value=>$u->profileField("email"), -label=>$i18n->get(56), -hoverHelp=>$i18n->get('56 description'), ); $f->submit; $output .= $f->print; } $output .= '
'; return $output; } =head2 theWg ( ) The core WebGUI function. All WebGUI Assets, Operations and functions require this to work, even superseding the session variable. =cut #------------------------------------------------------------------- sub www_theWg { my $session = shift; $session->style->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->process("debug")==1&&$session->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!!!Includes$session->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}).$session->icon->copy("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;