WebGUI 2.7.0 release
This commit is contained in:
parent
c0463670e8
commit
08b81c6064
104 changed files with 7333 additions and 2576 deletions
|
|
@ -22,11 +22,12 @@ use WebGUI::International;
|
|||
use WebGUI::Mail;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_viewMessageLog &www_viewProfile &www_editProfile &www_editProfileSave &www_createAccount &www_deactivateAccount &www_deactivateAccountConfirm &www_displayAccount &www_displayLogin &www_login &www_logout &www_recoverPassword &www_recoverPasswordFinish &www_saveAccount &www_updateAccount);
|
||||
our @EXPORT = qw(&www_viewMessageLog &www_viewProfile &www_editProfile &www_editProfileSave &www_createAccount &www_deactivateAccount &www_deactivateAccountConfirm &www_displayAccount &www_displayLogin &www_login &www_logout &www_recoverPassword &www_recoverPasswordFinish &www_createAccountSave &www_updateAccount);
|
||||
our %ldapStatusCode = ( 0=>'success (0)', 1=>'Operations Error (1)', 2=>'Protocol Error (2)', 3=>'Time Limit Exceeded (3)', 4=>'Size Limit Exceeded (4)', 5=>'Compare False (5)', 6=>'Compare True (6)', 7=>'Auth Method Not Supported (7)', 8=>'Strong Auth Required (8)', 9=>'Referral (10)', 11=>'Admin Limit Exceeded (11)', 12=>'Unavailable Critical Extension (12)', 13=>'Confidentiality Required (13)', 14=>'Sasl Bind In Progress (14)', 15=>'No Such Attribute (16)', 17=>'Undefined Attribute Type (17)', 18=>'Inappropriate Matching (18)', 19=>'Constraint Violation (19)', 20=>'Attribute Or Value Exists (20)', 21=>'Invalid Attribute Syntax (21)', 32=>'No Such Object (32)', 33=>'Alias Problem (33)', 34=>'Invalid DN Syntax (34)', 36=>'Alias Dereferencing Problem (36)', 48=>'Inappropriate Authentication (48)', 49=>'Invalid Credentials (49)', 50=>'Insufficient Access Rights (50)', 51=>'Busy (51)', 52=>'Unavailable (52)', 53=>'Unwilling To Perform (53)', 54=>'Loop Detect (54)', 64=>'Naming Violation (64)', 65=>'Object Class Violation (65)', 66=>'Not Allowed On Non Leaf (66)', 67=>'Not Allowed On RDN (67)', 68=>'Entry Already Exists (68)', 69=>'Object Class Mods Prohibited (69)', 71=>'Affects Multiple DSAs (71)', 80=>'other (80)');
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -62,7 +63,7 @@ sub _hasBadPassword {
|
|||
#-------------------------------------------------------------------
|
||||
sub _hasBadUsername {
|
||||
my ($otherUser);
|
||||
($otherUser) = WebGUI::SQL->quickArray("select username from users where username='$_[0]'",$session{dbh});
|
||||
($otherUser) = WebGUI::SQL->quickArray("select username from users where username='$_[0]'");
|
||||
if (($otherUser ne "" && $otherUser ne $session{user}{username}) || $_[0] eq "") {
|
||||
return 1;
|
||||
} else {
|
||||
|
|
@ -93,8 +94,8 @@ sub www_createAccount {
|
|||
$output .= www_displayLogin();
|
||||
} else {
|
||||
$output .= '<h1>'.WebGUI::International::get(54).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= WebGUI::Form::hidden("op","saveAccount");
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","createAccountSave");
|
||||
$output .= '<table>';
|
||||
unless ($session{setting}{authMethod} eq "LDAP" && $session{setting}{usernameBinding} eq "yes") {
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
|
|
@ -109,7 +110,7 @@ sub www_createAccount {
|
|||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(55).'</td><td>'.WebGUI::Form::password("identifier2",20,30).'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'<span class="formSubtext"><br>'.WebGUI::International::get(57).'</span></td></tr>';
|
||||
%language = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
%language = WebGUI::SQL->buildHash("select distinct(language) from international");
|
||||
$array[0] = "English";
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%language,\@array).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
|
|
@ -125,6 +126,68 @@ sub www_createAccount {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_createAccountSave {
|
||||
my ($username, $uri, $ldap, $port, %args, $search, $connectDN, $auth, $output, $error, $uid, $registeredUserExpire, $encryptedPassword);
|
||||
if ($session{setting}{authMethod} eq "LDAP" && $session{setting}{usernameBinding} eq "yes") {
|
||||
$username = $session{form}{ldapId};
|
||||
} else {
|
||||
$username = $session{form}{username};
|
||||
}
|
||||
if (_hasBadUsername($username)) {
|
||||
$error = WebGUI::International::get(77);
|
||||
$error .= ' "'.$username.'too", ';
|
||||
$error .= '"'.$username.'2", ';
|
||||
$error .= '"'.$username.'_'.WebGUI::DateTime::epochToHuman(time(),"%y").'"';
|
||||
$error .= '<p>';
|
||||
}
|
||||
if (_hasBadPassword($session{form}{identifier1},$session{form}{identifier2})) {
|
||||
$error .= WebGUI::International::get(78);
|
||||
}
|
||||
if ($session{setting}{authMethod} eq "LDAP") {
|
||||
$uri = URI->new($session{setting}{ldapURL});
|
||||
if ($uri->port < 1) {
|
||||
$port = 389;
|
||||
} else {
|
||||
$port = $uri->port;
|
||||
}
|
||||
%args = (port => $port);
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= WebGUI::International::get(79);
|
||||
$ldap->bind;
|
||||
$search = $ldap->search (base => $uri->dn, filter => $session{setting}{ldapId}."=".$session{form}{ldapId});
|
||||
if (defined $search->entry(0)) {
|
||||
$connectDN = "cn=".$search->entry(0)->get_value("cn");
|
||||
$ldap->unbind;
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= WebGUI::International::get(79);
|
||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{ldapPassword});
|
||||
if ($auth->code == 48 || $auth->code == 49) {
|
||||
$error .= WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
} elsif ($auth->code > 0) {
|
||||
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69);
|
||||
WebGUI::ErrorHandler::warn("LDAP error: ".$ldapStatusCode{$auth->code});
|
||||
}
|
||||
$ldap->unbind;
|
||||
} else {
|
||||
$error .= WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
}
|
||||
}
|
||||
if ($error eq "") {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
$uid = getNextId("userId");
|
||||
WebGUI::SQL->write("insert into users (userId,username,identifier,email,authMethod,ldapURL,connectDN,language) values ($uid, ".quote($username).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{setting}{authMethod}).", ".quote($session{setting}{ldapURL}).", ".quote($connectDN).", ".quote($session{form}{language}).")");
|
||||
($registeredUserExpire) = WebGUI::SQL->quickArray("select expireAfter from groups where groupId=2");
|
||||
WebGUI::SQL->write("insert into groupings values (2,$uid,".(time()+$registeredUserExpire).")");
|
||||
_login($uid,$encryptedPassword);
|
||||
$output .= WebGUI::International::get(80).'<p>';
|
||||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output = "<h1>".WebGUI::International::get(70)."</h1>".$error.www_createAccount();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deactivateAccount {
|
||||
my ($output);
|
||||
|
|
@ -142,8 +205,8 @@ sub www_deactivateAccount {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_deactivateAccountConfirm {
|
||||
if ($session{user}{userId} != 1) {
|
||||
WebGUI::SQL->write("delete from users where userId=$session{user}{userId}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{user}{userId}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from users where userId=$session{user}{userId}");
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{user}{userId}");
|
||||
WebGUI::Session::end($session{var}{sessionId});
|
||||
_login(1,"null");
|
||||
}
|
||||
|
|
@ -155,7 +218,7 @@ sub www_displayAccount {
|
|||
my ($output, %hash, @array);
|
||||
if ($session{user}{userId} != 1) {
|
||||
$output .= '<h1>'.WebGUI::International::get(61).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","updateAccount");
|
||||
$output .= '<table>';
|
||||
if ($session{user}{authMethod} eq "LDAP" && $session{setting}{usernameBinding} eq "yes") {
|
||||
|
|
@ -172,7 +235,7 @@ sub www_displayAccount {
|
|||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(55).'</td><td>'.WebGUI::Form::password("identifier2",20,30,"password").'</td></tr>';
|
||||
}
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255,$session{user}{email}).'<span class="formSubtext"><br>'.WebGUI::International::get(57).'</span></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international");
|
||||
$array[0] = $session{user}{language};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
|
|
@ -192,7 +255,7 @@ sub www_displayLogin {
|
|||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output .= '<h1>'.WebGUI::International::get(66).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","login");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
|
|
@ -218,7 +281,7 @@ sub www_editProfile {
|
|||
%gender = ('male'=>WebGUI::International::get(339),'female'=>WebGUI::International::get(340));
|
||||
if ($session{user}{userId} != 1) {
|
||||
$output .= '<h1>'.WebGUI::International::get(338).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editProfileSave");
|
||||
$output .= WebGUI::Form::hidden("uid",$session{user}{userId});
|
||||
$output .= '<table>';
|
||||
|
|
@ -270,7 +333,7 @@ sub www_editProfile {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSave {
|
||||
if ($session{user}{userId} != 1) {
|
||||
WebGUI::SQL->write("update users set firstName=".quote($session{form}{firstName}).", middleName=".quote($session{form}{middleName}).", lastName=".quote($session{form}{lastName}).", icq=".quote($session{form}{icq}).", aim=".quote($session{form}{aim}).", msnIM=".quote($session{form}{msnIM}).", yahooIM=".quote($session{form}{yahooIM}).", homeAddress=".quote($session{form}{homeAddress}).", homeCity=".quote($session{form}{homeCity}).", homeState=".quote($session{form}{homeState}).", homeZip=".quote($session{form}{homeZip}).", homeCountry=".quote($session{form}{homeCountry}).", homePhone=".quote($session{form}{homePhone}).", workAddress=".quote($session{form}{workAddress}).", workCity=".quote($session{form}{workCity}).", workState=".quote($session{form}{workState}).", workZip=".quote($session{form}{workZip}).", workCountry=".quote($session{form}{workCountry}).", workPhone=".quote($session{form}{workPhone}).", cellPhone=".quote($session{form}{cellPhone}).", pager=".quote($session{form}{pager}).", gender=".quote($session{form}{gender}).", birthdate=".quote($session{form}{birthdate}).", homepage=".quote($session{form}{homepage})." where userId=".$session{form}{uid},$session{dbh});
|
||||
WebGUI::SQL->write("update users set firstName=".quote($session{form}{firstName}).", middleName=".quote($session{form}{middleName}).", lastName=".quote($session{form}{lastName}).", icq=".quote($session{form}{icq}).", aim=".quote($session{form}{aim}).", msnIM=".quote($session{form}{msnIM}).", yahooIM=".quote($session{form}{yahooIM}).", homeAddress=".quote($session{form}{homeAddress}).", homeCity=".quote($session{form}{homeCity}).", homeState=".quote($session{form}{homeState}).", homeZip=".quote($session{form}{homeZip}).", homeCountry=".quote($session{form}{homeCountry}).", homePhone=".quote($session{form}{homePhone}).", workAddress=".quote($session{form}{workAddress}).", workCity=".quote($session{form}{workCity}).", workState=".quote($session{form}{workState}).", workZip=".quote($session{form}{workZip}).", workCountry=".quote($session{form}{workCountry}).", workPhone=".quote($session{form}{workPhone}).", cellPhone=".quote($session{form}{cellPhone}).", pager=".quote($session{form}{pager}).", gender=".quote($session{form}{gender}).", birthdate=".quote($session{form}{birthdate}).", homepage=".quote($session{form}{homepage})." where userId=".$session{form}{uid});
|
||||
return www_displayAccount();
|
||||
} else {
|
||||
return www_displayLogin();
|
||||
|
|
@ -280,7 +343,7 @@ sub www_editProfileSave {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_login {
|
||||
my ($uri, $port, $ldap, %args, $auth, $error, $uid,$pass,$authMethod, $ldapURL, $connectDN, $success);
|
||||
($uid,$pass,$authMethod, $ldapURL, $connectDN) = WebGUI::SQL->quickArray("select userId,identifier,authMethod,ldapURL,connectDN from users where username=".quote($session{form}{username}),$session{dbh});
|
||||
($uid,$pass,$authMethod, $ldapURL, $connectDN) = WebGUI::SQL->quickArray("select userId,identifier,authMethod,ldapURL,connectDN from users where username=".quote($session{form}{username}));
|
||||
if ($authMethod eq "LDAP") {
|
||||
$uri = URI->new($ldapURL);
|
||||
if ($uri->port < 1) {
|
||||
|
|
@ -331,7 +394,7 @@ sub www_recoverPassword {
|
|||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output .= '<h1>'.WebGUI::International::get(71).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","recoverPasswordFinish");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
|
||||
|
|
@ -351,13 +414,13 @@ sub www_recoverPassword {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_recoverPasswordFinish {
|
||||
my ($sth, $username, $encryptedPassword, $userId, $password, $flag, $message, $output);
|
||||
$sth = WebGUI::SQL->read("select username, userId from users where email=".quote($session{form}{email}),$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select username, userId from users where email=".quote($session{form}{email}));
|
||||
while (($username,$userId) = $sth->array) {
|
||||
foreach (0,1,2,3,4,5) {
|
||||
$password .= chr(ord('A') + randint(32));
|
||||
}
|
||||
$encryptedPassword = Digest::MD5::md5_base64($password);
|
||||
WebGUI::SQL->write("update users set identifier='$encryptedPassword' where userId='$userId'",$session{dbh});
|
||||
WebGUI::SQL->write("update users set identifier='$encryptedPassword' where userId='$userId'");
|
||||
$flag = 1;
|
||||
$message = $session{setting}{recoverPasswordEmail};
|
||||
$message .= "\n".WebGUI::International::get(50).": ".$username."\n";
|
||||
|
|
@ -375,67 +438,6 @@ sub www_recoverPasswordFinish {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_saveAccount {
|
||||
my ($username, $uri, $ldap, $port, %args, $search, $connectDN, $auth, $output, $error, $uid, $encryptedPassword);
|
||||
if ($session{setting}{authMethod} eq "LDAP" && $session{setting}{usernameBinding} eq "yes") {
|
||||
$username = $session{form}{ldapId};
|
||||
} else {
|
||||
$username = $session{form}{username};
|
||||
}
|
||||
if (_hasBadUsername($username)) {
|
||||
$error = WebGUI::International::get(77);
|
||||
$error .= ' "'.$username.'too", ';
|
||||
$error .= '"'.$username.'2", ';
|
||||
$error .= '"'.$username.'_'.WebGUI::DateTime::epochToHuman(time(),"%y").'"';
|
||||
$error .= '<p>';
|
||||
}
|
||||
if (_hasBadPassword($session{form}{identifier1},$session{form}{identifier2})) {
|
||||
$error .= WebGUI::International::get(78);
|
||||
}
|
||||
if ($session{setting}{authMethod} eq "LDAP") {
|
||||
$uri = URI->new($session{setting}{ldapURL});
|
||||
if ($uri->port < 1) {
|
||||
$port = 389;
|
||||
} else {
|
||||
$port = $uri->port;
|
||||
}
|
||||
%args = (port => $port);
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= WebGUI::International::get(79);
|
||||
$ldap->bind;
|
||||
$search = $ldap->search (base => $uri->dn, filter => $session{setting}{ldapId}."=".$session{form}{ldapId});
|
||||
if (defined $search->entry(0)) {
|
||||
$connectDN = "cn=".$search->entry(0)->get_value("cn");
|
||||
$ldap->unbind;
|
||||
$ldap = Net::LDAP->new($uri->host, %args) or $error .= WebGUI::International::get(79);
|
||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{ldapPassword});
|
||||
if ($auth->code == 48 || $auth->code == 49) {
|
||||
$error .= WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
} elsif ($auth->code > 0) {
|
||||
$error .= 'LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '.WebGUI::International::get(69);
|
||||
WebGUI::ErrorHandler::warn("LDAP error: ".$ldapStatusCode{$auth->code});
|
||||
}
|
||||
$ldap->unbind;
|
||||
} else {
|
||||
$error .= WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
}
|
||||
}
|
||||
if ($error eq "") {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
$uid = getNextId("userId");
|
||||
WebGUI::SQL->write("insert into users (userId,username,identifier,email,authMethod,ldapURL,connectDN,language) values ($uid, ".quote($username).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{setting}{authMethod}).", ".quote($session{setting}{ldapURL}).", ".quote($connectDN).", ".quote($session{form}{language}).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into groupings values (2,$uid)",$session{dbh});
|
||||
_login($uid,$encryptedPassword);
|
||||
$output .= WebGUI::International::get(80).'<p>';
|
||||
$output .= www_displayAccount();
|
||||
} else {
|
||||
$output = "<h1>".WebGUI::International::get(70)."</h1>".$error.www_createAccount();
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_updateAccount {
|
||||
my ($output, $error, $encryptedPassword, $passwordStatement);
|
||||
|
|
@ -457,7 +459,7 @@ sub www_updateAccount {
|
|||
}
|
||||
if ($error eq "") {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", language=".quote($session{form}{language})." where userId=".$session{user}{userId},$session{dbh});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", email=".quote($session{form}{email}).", language=".quote($session{form}{language})." where userId=".$session{user}{userId});
|
||||
if ($passwordStatement ne "") {
|
||||
_login($session{user}{userId},$encryptedPassword);
|
||||
}
|
||||
|
|
@ -478,7 +480,7 @@ sub www_viewMessageLog {
|
|||
my (@data, $output, $sth, @row, $i, $dataRows, $prevNextBar);
|
||||
if (WebGUI::Privilege::isInGroup(2,$session{user}{userId})) {
|
||||
$output = '<h1>'.WebGUI::International::get(159).'</h1>';
|
||||
$sth = WebGUI::SQL->read("select messageLogId,message,url,dateOfEntry from messageLog where userId=$session{user}{userId} order by dateOfEntry desc",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select messageLogId,message,url,dateOfEntry from messageLog where userId=$session{user}{userId} order by dateOfEntry desc");
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr><td class="tableData">';
|
||||
if ($data[2] ne "") {
|
||||
|
|
@ -513,7 +515,7 @@ sub www_viewMessageLog {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_viewProfile {
|
||||
my ($output, %user);
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId='$session{form}{uid}'",$session{dbh});
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId='$session{form}{uid}'");
|
||||
if ($user{username} eq "") {
|
||||
WebGUI::Privilege::notMember();
|
||||
} elsif ($session{user}{userId} != 1) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ our @EXPORT = qw(&www_switchOffAdmin &www_switchOnAdmin);
|
|||
#-------------------------------------------------------------------
|
||||
sub www_switchOffAdmin {
|
||||
if ($session{var}{sessionId}) {
|
||||
WebGUI::SQL->write("update session set adminOn=0 where sessionId='$session{var}{sessionId}'",$session{dbh});
|
||||
WebGUI::SQL->write("update session set adminOn=0 where sessionId='$session{var}{sessionId}'");
|
||||
WebGUI::Session::refreshSessionVars($session{var}{sessionId});
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -33,7 +33,7 @@ sub www_switchOffAdmin {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_switchOnAdmin {
|
||||
if ($session{var}{sessionId}) {
|
||||
WebGUI::SQL->write("update session set adminOn=1 where sessionId='$session{var}{sessionId}'",$session{dbh});
|
||||
WebGUI::SQL->write("update session set adminOn=1 where sessionId='$session{var}{sessionId}'");
|
||||
WebGUI::Session::refreshSessionVars($session{var}{sessionId});
|
||||
return "";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -13,10 +13,12 @@ package WebGUI::Operation::Group;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -27,14 +29,15 @@ our @EXPORT = qw(&www_addGroup &www_addGroupSave &www_deleteGroup &www_deleteGro
|
|||
sub www_addGroup {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=17&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(17);
|
||||
$output .= '<h1>'.WebGUI::International::get(83).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","addGroupSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(84).'</td><td>'.WebGUI::Form::text("groupName",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",'').'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(84),WebGUI::Form::text("groupName",20,30));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",''));
|
||||
$output .= tableFormRow(WebGUI::International::get(367),WebGUI::Form::text("expireAfter",20,30,314496000));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -47,7 +50,7 @@ sub www_addGroup {
|
|||
sub www_addGroupSave {
|
||||
my ($output);
|
||||
if ($session{var}{sessionId}) {
|
||||
WebGUI::SQL->write("insert into groups values (".getNextId("groupId").", ".quote($session{form}{groupName}).", ".quote($session{form}{description}).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into groups values (".getNextId("groupId").", ".quote($session{form}{groupName}).", ".quote($session{form}{description}).", '$session{form}{expireAfter}')");
|
||||
$output = www_listGroups();
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -61,7 +64,7 @@ sub www_deleteGroup {
|
|||
if ($session{form}{gid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=15&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(15);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(86).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteGroupConfirm&gid='.$session{form}{gid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
|
|
@ -77,8 +80,8 @@ sub www_deleteGroupConfirm {
|
|||
if ($session{form}{gid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from groups where groupId=$session{form}{gid}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where groupId=$session{form}{gid}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from groups where groupId=$session{form}{gid}");
|
||||
WebGUI::SQL->write("delete from groupings where groupId=$session{form}{gid}");
|
||||
return www_listGroups();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -87,28 +90,33 @@ sub www_deleteGroupConfirm {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroup {
|
||||
my ($output, $sth, %group, @user);
|
||||
my ($output, $sth, %group, %hash);
|
||||
tie %group, 'Tie::CPHash';
|
||||
tie %hash, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}",$session{dbh});
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=17&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
%group = WebGUI::SQL->quickHash("select * from groups where groupId=$session{form}{gid}");
|
||||
$output .= helpLink(17);
|
||||
$output .= '<h1>'.WebGUI::International::get(87).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editGroupSave");
|
||||
$output .= WebGUI::Form::hidden("gid",$session{form}{gid});
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(84).'</td><td>'.WebGUI::Form::text("groupName",20,30,$group{groupName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(85).'</td><td>'.WebGUI::Form::textArea("description",$group{description}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(88).'</td><td valign="top">';
|
||||
$sth = WebGUI::SQL->read("select users.username,users.userId from users,groupings where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId order by users.username",$session{dbh});
|
||||
while (@user = $sth->array) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=editUser&uid='.$user[1].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a> <a href="'.$session{page}{url}.'?op=viewProfile&uid='.$user[1].'">'.$user[0].'</a><br>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '<br></td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(84),WebGUI::Form::text("groupName",20,30,$group{groupName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(85),WebGUI::Form::textArea("description",$group{description}));
|
||||
$output .= tableFormRow(WebGUI::International::get(367),WebGUI::Form::text("expireAfter",20,30,$group{expireAfter}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '<h1>'.WebGUI::International::get(88).'</h1>';
|
||||
$output .= '<table><tr><td class="tableHeader"> </td><td class="tableHeader">'.WebGUI::International::get(50).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select users.username,users.userId,groupings.expireDate from groupings,users where groupings.groupId=$session{form}{gid} and groupings.userId=users.userId order by users.username");
|
||||
while (%hash = $sth->hash) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGrouping&uid='.$hash{userId}.'&gid='.$session{form}{gid}.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td class="tableData"><a href="'.$session{page}{url}.'/op=editUser&uid='.$hash{userId}.'">'.$hash{username}.'</a></td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</table>';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
|
|
@ -118,7 +126,7 @@ sub www_editGroup {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editGroupSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).", description=".quote($session{form}{description})." where groupId=".$session{form}{gid},$session{dbh});
|
||||
WebGUI::SQL->write("update groups set groupName=".quote($session{form}{groupName}).", description=".quote($session{form}{description}).", expireAfter='$session{form}{expireAfter}' where groupId=".$session{form}{gid});
|
||||
return www_listGroups();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -129,15 +137,15 @@ sub www_editGroupSave {
|
|||
sub www_listGroups {
|
||||
my ($output, $dataRows, $prevNextBar, $sth, @data, @row, $i);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=10&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = helpLink(10);
|
||||
$output .= '<h1>'.WebGUI::International::get(89).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addGroup">'.WebGUI::International::get(90).'</a></div>';
|
||||
$output .= '<table border=1 cellpadding=5 cellspacing=0 align="center">';
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select groupId,groupName,description from groups where groupName<>'Reserved' order by groupName");
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[1].'</td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[2].'</td></tr>';
|
||||
$row[$i] = '<tr><td valign="top" class="tableData"><a href="'.$session{page}{url}.'?op=deleteGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editGroup&gid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td>';
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$data[2].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -16,28 +16,28 @@ use Tie::CPHash;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_viewHelp &www_viewHelpIndex);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewHelp {
|
||||
my ($output, %help, @data, $sth, %seeAlso);
|
||||
my ($output, %help, @data, $sth, %seeAlso, $namespace);
|
||||
$namespace = $session{form}{namespace} || "WebGUI";
|
||||
tie %help, 'Tie::CPHash';
|
||||
%help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid} and namespace='$session{form}{namespace}' and language='$session{user}{language}'",$session{dbh});
|
||||
%help = WebGUI::SQL->quickHash("select * from help where helpId=$session{form}{hid} and namespace='$namespace' and language='$session{user}{language}'");
|
||||
$output = '<h1>'.WebGUI::International::get(93).': '.$help{action}.' '.$help{object}.'</h1>';
|
||||
$help{body} =~ s/\n/\<br\>/g;
|
||||
$output .= $help{body};
|
||||
$output .= '<p><b>'.WebGUI::International::get(94).':';
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}' and action<>'$help{action}' and language='$session{user}{language}' order by action",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where object='$help{object}' and action<>'$help{action}' and language='$session{user}{language}' order by action");
|
||||
while (@data = $sth->array) {
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$data[0].'&namespace='.$data[3].'">'.$data[1].' '.$data[2].'</a>,';
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select helpId, namespace from helpSeeAlso where seeAlsoId in ($help{seeAlso})");
|
||||
while (@data = $sth->array) {
|
||||
%seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]' and namespace='$data[1]' and language='$session{user}{language}'",$session{dbh});
|
||||
%seeAlso = WebGUI::SQL->quickHash("select helpId,namespace,action,object from help where helpId='$data[0]' and namespace='$data[1]' and language='$session{user}{language}'");
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=viewHelp&hid='.$seeAlso{helpId}.'&namespace='.$seeAlso{namespace}.'">'.$seeAlso{action}.' '.$seeAlso{object}.'</a>,';
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -50,7 +50,7 @@ sub www_viewHelpIndex {
|
|||
my ($sth, @data, $output, $previous);
|
||||
$output = '<h1>'.WebGUI::International::get(95).'</h1>';
|
||||
$output .= '<table width="100%"><tr><td valign="top"><b>'.WebGUI::International::get(96).'</b><p>';
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where language='$session{user}{language}' order by action,object",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select helpId, action, object, namespace from help where language='$session{user}{language}' order by action,object");
|
||||
while (@data = $sth->array) {
|
||||
if ($data[1] ne $previous) {
|
||||
$output .= '<p><b>'.$data[1].'</b><br>';
|
||||
|
|
@ -60,7 +60,7 @@ sub www_viewHelpIndex {
|
|||
}
|
||||
$sth->finish;
|
||||
$output .= '</td><td valign="top"><b>'.WebGUI::International::get(97).'</b><p>';
|
||||
$sth = WebGUI::SQL->read("select helpId, object, action, namespace from help where language='$session{user}{language}' order by object,action",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select helpId, object, action, namespace from help where language='$session{user}{language}' order by object,action");
|
||||
while (@data = $sth->array) {
|
||||
if ($data[1] ne $previous) {
|
||||
$output .= '<p><b>'.$data[1].'</b><br>';
|
||||
|
|
|
|||
83
lib/WebGUI/Operation/Package.pm
Normal file
83
lib/WebGUI/Operation/Package.pm
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
package WebGUI::Operation::Package;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001 Plain Black Software.
|
||||
#-------------------------------------------------------------------
|
||||
# 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 Exporter;
|
||||
use strict qw(vars subs);
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_deployPackage &www_selectPackageToDeploy);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _duplicateWidgets {
|
||||
my ($b, $widgetId, $widgetType, $func);
|
||||
$b = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=$_[0]");
|
||||
while (($widgetId,$widgetType) = $b->array) {
|
||||
$func = "WebGUI::Widget::".$widgetType."::duplicate";
|
||||
&$func($widgetId,$_[1]);
|
||||
}
|
||||
$b->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _recursePageTree {
|
||||
my ($a, %package, %newParent, $newPageId);
|
||||
tie %newParent, 'Tie::CPHash';
|
||||
tie %package, 'Tie::CPHash';
|
||||
%newParent = WebGUI::SQL->quickHash("select * from page where pageId=$_[1]");
|
||||
_duplicateWidgets($_[0],$_[1]);
|
||||
$a = WebGUI::SQL->read("select * from page where parentId=$_[0]");
|
||||
while (%package = $a->hash) {
|
||||
$newPageId = getNextId("pageId");
|
||||
WebGUI::SQL->write("insert into page values ($newPageId,$_[1],".quote($package{title}).",$newParent{styleId},$session{user}{userId},$newParent{ownerView},$newParent{ownerEdit},$newParent{groupId},$newParent{groupView},$newParent{groupEdit},$newParent{worldView},$newParent{worldEdit},$package{sequenceNumber},".quote($package{metaTags}).",".quote($package{urlizedTitle}).",$package{defaultMetaTags},".quote($package{template}).")");
|
||||
_recursePageTree($package{pageId},$newPageId);
|
||||
}
|
||||
$a->finish;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_selectPackageToDeploy {
|
||||
my ($output, %data, $sth, $flag);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
tie %data,'Tie::CPHash';
|
||||
$output = helpLink(30);
|
||||
$output .= '<h1>'.WebGUI::International::get(375).'</h1>';
|
||||
$output .= '<ul>';
|
||||
$sth = WebGUI::SQL->read("select * from page where parentId=5");
|
||||
while (%data = $sth->hash) {
|
||||
$output .= '<li> <a href="'.$session{page}{url}.'?op=deployPackage&pid='.$data{pageId}.'">'.$data{title}.'</a>';
|
||||
$flag = 1;
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= WebGUI::International::get(377) unless $flag;
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deployPackage {
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
_recursePageTree($session{form}{pid},$session{page}{pageId});
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -16,6 +16,7 @@ use WebGUI::Form;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Template;
|
||||
use WebGUI::Utility;
|
||||
|
|
@ -26,9 +27,9 @@ our @EXPORT = qw(&www_movePageUp &www_movePageDown &www_addPage &www_addPageSave
|
|||
#-------------------------------------------------------------------
|
||||
sub _recursivelyChangePrivileges {
|
||||
my ($sth, $pageId);
|
||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
||||
while (($pageId) = $sth->array) {
|
||||
WebGUI::SQL->write("update page set ownerId=$session{form}{ownerId}, ownerView=$session{form}{ownerView}, ownerEdit=$session{form}{ownerEdit}, groupId='$session{form}{groupId}', groupView=$session{form}{groupView}, groupEdit=$session{form}{groupEdit}, worldView=$session{form}{worldView}, worldEdit=$session{form}{worldEdit} where pageId=$pageId",$session{dbh});
|
||||
WebGUI::SQL->write("update page set ownerId=$session{form}{ownerId}, ownerView=$session{form}{ownerView}, ownerEdit=$session{form}{ownerEdit}, groupId='$session{form}{groupId}', groupView=$session{form}{groupView}, groupEdit=$session{form}{groupEdit}, worldView=$session{form}{worldView}, worldEdit=$session{form}{worldEdit} where pageId=$pageId");
|
||||
_recursivelyChangePrivileges($pageId);
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -37,9 +38,9 @@ sub _recursivelyChangePrivileges {
|
|||
#-------------------------------------------------------------------
|
||||
sub _recursivelyChangeStyle {
|
||||
my ($sth, $pageId);
|
||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
||||
while (($pageId) = $sth->array) {
|
||||
WebGUI::SQL->write("update page set styleId=$session{form}{styleId} where pageId=$pageId",$session{dbh});
|
||||
WebGUI::SQL->write("update page set styleId=$session{form}{styleId} where pageId=$pageId");
|
||||
_recursivelyChangeStyle($pageId);
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -48,9 +49,9 @@ sub _recursivelyChangeStyle {
|
|||
#-------------------------------------------------------------------
|
||||
sub _reorderPages {
|
||||
my ($sth, $i, $pid);
|
||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0] order by sequenceNumber",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from page where parentId=$_[0] order by sequenceNumber");
|
||||
while (($pid) = $sth->array) {
|
||||
WebGUI::SQL->write("update page set sequenceNumber='$i' where pageId=$pid",$session{dbh});
|
||||
WebGUI::SQL->write("update page set sequenceNumber='$i' where pageId=$pid");
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
@ -61,19 +62,19 @@ sub www_addPage {
|
|||
my ($output, @array, %hash);
|
||||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = helpLink(1);
|
||||
$output .= '<h1>'.WebGUI::International::get(98).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","addPageSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,128,$session{form}{title}).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$session{form}{title}));
|
||||
%hash = sortHash(WebGUI::Template::getList());
|
||||
$array[0] = "Default";
|
||||
$output .= '<script language="JavaScript"> function updateTemplateImage(template) { document.template.src = "'.$session{setting}{lib}.'/templates/"+template+".gif"; } </script>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(356).'</td><td>'.WebGUI::Form::selectList("template",\%hash, \@array, 1, 0, "updateTemplateImage(this.form.template.value)").'<br><img src="'.$session{setting}{lib}.'/templates/Default.gif" name="template"></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(100).'</td><td>'.WebGUI::Form::textArea("metaTags",$session{form}{metaTags}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(307).'</td><td>'.WebGUI::Form::checkbox("defaultMetaTags",1,1).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(356),WebGUI::Form::selectList("template",\%hash, \@array, 1, 0, "updateTemplateImage(this.form.template.value)").'<br><img src="'.$session{setting}{lib}.'/templates/Default.gif" name="template">');
|
||||
$output .= tableFormRow(WebGUI::International::get(100),WebGUI::Form::textArea("metaTags",$session{form}{metaTags}));
|
||||
$output .= tableFormRow(WebGUI::International::get(307),WebGUI::Form::checkbox("defaultMetaTags",1,1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -85,12 +86,12 @@ sub www_addPage {
|
|||
sub www_addPageSave {
|
||||
my ($urlizedTitle, $test, $nextSeq);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from page where parentId=$session{page}{pageId}",$session{dbh});
|
||||
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from page where parentId=$session{page}{pageId}");
|
||||
$urlizedTitle = urlize($session{form}{title});
|
||||
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle'",$session{dbh})) {
|
||||
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle'")) {
|
||||
$urlizedTitle .= 2;
|
||||
}
|
||||
WebGUI::SQL->write("insert into page values (".getNextId("pageId").", $session{page}{pageId}, ".quote($session{form}{title}).", $session{page}{styleId}, $session{user}{userId}, $session{page}{ownerView}, $session{page}{ownerEdit}, $session{page}{groupId}, $session{page}{groupView}, $session{page}{groupEdit}, $session{page}{worldView}, $session{page}{worldEdit}, '$nextSeq', ".quote($session{form}{metaTags}).", '$urlizedTitle', '$session{form}{defaultMetaTags}', '$session{form}{template}')",$session{dbh});
|
||||
WebGUI::SQL->write("insert into page values (".getNextId("pageId").", $session{page}{pageId}, ".quote($session{form}{title}).", $session{page}{styleId}, $session{user}{userId}, $session{page}{ownerView}, $session{page}{ownerEdit}, $session{page}{groupId}, $session{page}{groupView}, $session{page}{groupEdit}, $session{page}{worldView}, $session{page}{worldEdit}, '$nextSeq', ".quote($session{form}{metaTags}).", '$urlizedTitle', '$session{form}{defaultMetaTags}', '$session{form}{template}')");
|
||||
return "";
|
||||
} else {
|
||||
return WebGUI::Privilege::insufficient();
|
||||
|
|
@ -102,7 +103,7 @@ sub www_cutPage {
|
|||
if ($session{page}{pageId} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("update page set parentId=2 where pageId=".$session{page}{pageId},$session{dbh});
|
||||
WebGUI::SQL->write("update page set parentId=2 where pageId=".$session{page}{pageId});
|
||||
_reorderPages($session{page}{parentId});
|
||||
WebGUI::Session::refreshPageInfo($session{page}{parentId});
|
||||
return "";
|
||||
|
|
@ -117,7 +118,7 @@ sub www_deletePage {
|
|||
if ($session{page}{pageId} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::canEditPage()) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=3&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(3);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(101).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deletePageConfirm">'.WebGUI::International::get(44).'</a>';
|
||||
|
|
@ -133,7 +134,7 @@ sub www_deletePageConfirm {
|
|||
if ($session{page}{pageId} < 25) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("update page set parentId=3 where pageId=".$session{page}{pageId},$session{dbh});
|
||||
WebGUI::SQL->write("update page set parentId=3 where pageId=".$session{page}{pageId});
|
||||
_reorderPages($session{page}{parentId});
|
||||
WebGUI::Session::refreshPageInfo($session{page}{parentId});
|
||||
return "";
|
||||
|
|
@ -148,46 +149,46 @@ sub www_editPage {
|
|||
tie %hash, "Tie::IxHash";
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
%yesNo = ("0"=>"No", "1"=>"Yes");
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=1&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = helpLink(1);
|
||||
$output .= '<h1>'.WebGUI::International::get(102).'</h1>';
|
||||
$output .= '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editPageSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td colspan=2><b>'.WebGUI::International::get(103).'</b></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(99).'</td><td>'.WebGUI::Form::text("title",20,128,$session{page}{title}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(104).'</td><td>'.WebGUI::Form::text("urlizedTitle",20,128,$session{page}{urlizedTitle}).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(99),WebGUI::Form::text("title",20,128,$session{page}{title}));
|
||||
$output .= tableFormRow(WebGUI::International::get(104),WebGUI::Form::text("urlizedTitle",20,128,$session{page}{urlizedTitle}));
|
||||
%hash = sortHash(WebGUI::Template::getList());
|
||||
$array[0] = $session{page}{template};
|
||||
$output .= '<script language="JavaScript"> function updateTemplateImage(template) { document.template.src = "'.$session{setting}{lib}.'/templates/"+template+".gif"; } </script>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(356).'</td><td>'.WebGUI::Form::selectList("template",\%hash,\@array,1,0,"updateTemplateImage(this.form.template.value)").'<br><img src="'.$session{setting}{lib}.'/templates/'.$session{page}{template}.'.gif" name="template"></td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(100).'</td><td>'.WebGUI::Form::textArea("metaTags",$session{page}{metaTags}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(307).'</td><td>'.WebGUI::Form::checkbox("defaultMetaTags",1,$session{page}{defaultMetaTags}).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(356),WebGUI::Form::selectList("template",\%hash,\@array,1,0,"updateTemplateImage(this.form.template.value)").'<br><img src="'.$session{setting}{lib}.'/templates/'.$session{page}{template}.'.gif" name="template">');
|
||||
$output .= tableFormRow(WebGUI::International::get(100),WebGUI::Form::textArea("metaTags",$session{page}{metaTags}));
|
||||
$output .= tableFormRow(WebGUI::International::get(307),WebGUI::Form::checkbox("defaultMetaTags",1,$session{page}{defaultMetaTags}));
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(105).'</b></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
%hash = WebGUI::SQL->buildHash("select styleId,name from style where name<>'Reserved' order by name");
|
||||
$array[0] = $session{page}{styleId};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(105).'</td><td>'.WebGUI::Form::selectList("styleId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(6).'</a></span></td></tr>';
|
||||
$output .= '<tr><td class="formDescription"></td><td>'.WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">'.WebGUI::International::get(106).'</span></td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(105),WebGUI::Form::selectList("styleId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(6).'</a></span>');
|
||||
$output .= tableFormRow("",WebGUI::Form::checkbox("recurseStyle","yes").' <span class="formSubtext">'.WebGUI::International::get(106).'</span>');
|
||||
$output .= '<tr><td colspan=2><hr size=1><b>'.WebGUI::International::get(107).'</b></td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select users.userId,users.username from users,groupings where groupings.groupId=4 and groupings.userId=users.userId order by users.username",$session{dbh});
|
||||
%hash = WebGUI::SQL->buildHash("select users.userId,users.username from users,groupings where groupings.groupId=4 and groupings.userId=users.userId order by users.username");
|
||||
$array[0] = $session{page}{ownerId};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(108).'</td><td>'.WebGUI::Form::selectList("ownerId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(7).'</a></span></td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(108),WebGUI::Form::selectList("ownerId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listUsers">'.WebGUI::International::get(7).'</a></span>');
|
||||
$array[0] = $session{page}{ownerView};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(109).'</td><td>'.WebGUI::Form::selectList("ownerView",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(109),WebGUI::Form::selectList("ownerView",\%yesNo,\@array));
|
||||
$array[0] = $session{page}{ownerEdit};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(110).'</td><td>'.WebGUI::Form::selectList("ownerEdit",\%yesNo,\@array).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$output .= tableFormRow(WebGUI::International::get(110),WebGUI::Form::selectList("ownerEdit",\%yesNo,\@array));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = $session{page}{groupId};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(111).'</td><td>'.WebGUI::Form::selectList("groupId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(5).'</a></span></td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(111),WebGUI::Form::selectList("groupId",\%hash,\@array).' <span class="formSubtext"><a href="'.$session{page}{url}.'?op=listGroups">'.WebGUI::International::get(5).'</a></span>');
|
||||
$array[0] = $session{page}{groupView};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(112).'</td><td>'.WebGUI::Form::selectList("groupView",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(112),WebGUI::Form::selectList("groupView",\%yesNo,\@array));
|
||||
$array[0] = $session{page}{groupEdit};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(113).'</td><td>'.WebGUI::Form::selectList("groupEdit",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(113),WebGUI::Form::selectList("groupEdit",\%yesNo,\@array));
|
||||
$array[0] = $session{page}{worldView};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(114).'</td><td>'.WebGUI::Form::selectList("worldView",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(114),WebGUI::Form::selectList("worldView",\%yesNo,\@array));
|
||||
$array[0] = $session{page}{worldEdit};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(115).'</td><td>'.WebGUI::Form::selectList("worldEdit",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription"></td><td>'.WebGUI::Form::checkbox("recursePrivs","yes").' <span class="formSubtext">'.WebGUI::International::get(116).'</span></td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(115),WebGUI::Form::selectList("worldEdit",\%yesNo,\@array));
|
||||
$output .= tableFormRow("",WebGUI::Form::checkbox("recursePrivs","yes").' <span class="formSubtext">'.WebGUI::International::get(116).'</span>');
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
|
|
@ -200,10 +201,10 @@ sub www_editPageSave {
|
|||
my (%parent, $urlizedTitle, $test);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
$urlizedTitle = urlize($session{form}{urlizedTitle});
|
||||
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle' and pageId<>$session{page}{pageId}",$session{dbh})) {
|
||||
while (($test) = WebGUI::SQL->quickArray("select urlizedTitle from page where urlizedTitle='$urlizedTitle' and pageId<>$session{page}{pageId}")) {
|
||||
$urlizedTitle .= 2;
|
||||
}
|
||||
WebGUI::SQL->write("update page set title=".quote($session{form}{title}).", styleId=$session{form}{styleId}, ownerId=$session{form}{ownerId}, ownerView=$session{form}{ownerView}, ownerEdit=$session{form}{ownerEdit}, groupId='$session{form}{groupId}', groupView=$session{form}{groupView}, groupEdit=$session{form}{groupEdit}, worldView=$session{form}{worldView}, worldEdit=$session{form}{worldEdit}, metaTags=".quote($session{form}{metaTags}).", urlizedTitle='$urlizedTitle', defaultMetaTags='$session{form}{defaultMetaTags}', template='$session{form}{template}' where pageId=$session{page}{pageId}",$session{dbh});
|
||||
WebGUI::SQL->write("update page set title=".quote($session{form}{title}).", styleId=$session{form}{styleId}, ownerId=$session{form}{ownerId}, ownerView=$session{form}{ownerView}, ownerEdit=$session{form}{ownerEdit}, groupId='$session{form}{groupId}', groupView=$session{form}{groupView}, groupEdit=$session{form}{groupEdit}, worldView=$session{form}{worldView}, worldEdit=$session{form}{worldEdit}, metaTags=".quote($session{form}{metaTags}).", urlizedTitle='$urlizedTitle', defaultMetaTags='$session{form}{defaultMetaTags}', template='$session{form}{template}' where pageId=$session{page}{pageId}");
|
||||
if ($session{form}{recurseStyle} eq "yes") {
|
||||
_recursivelyChangeStyle($session{page}{pageId});
|
||||
}
|
||||
|
|
@ -221,11 +222,11 @@ sub www_editPageSave {
|
|||
sub www_movePageDown {
|
||||
my (@data, $thisSeq);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from page where pageId=$session{page}{pageId}",$session{dbh});
|
||||
@data = WebGUI::SQL->quickArray("select pageId from page where parentId=$session{page}{parentId} and sequenceNumber=$thisSeq+1",$session{dbh});
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from page where pageId=$session{page}{pageId}");
|
||||
@data = WebGUI::SQL->quickArray("select pageId from page where parentId=$session{page}{parentId} and sequenceNumber=$thisSeq+1");
|
||||
if ($data[0] ne "") {
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber+1 where pageId=$session{page}{pageId}",$session{dbh});
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber-1 where pageId=$data[0]",$session{dbh});
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber+1 where pageId=$session{page}{pageId}");
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber-1 where pageId=$data[0]");
|
||||
}
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -237,11 +238,11 @@ sub www_movePageDown {
|
|||
sub www_movePageUp {
|
||||
my (@data, $thisSeq);
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from page where pageId=$session{page}{pageId}",$session{dbh});
|
||||
@data = WebGUI::SQL->quickArray("select pageId from page where parentId=$session{page}{parentId} and sequenceNumber=$thisSeq-1",$session{dbh});
|
||||
($thisSeq) = WebGUI::SQL->quickArray("select sequenceNumber from page where pageId=$session{page}{pageId}");
|
||||
@data = WebGUI::SQL->quickArray("select pageId from page where parentId=$session{page}{parentId} and sequenceNumber=$thisSeq-1");
|
||||
if ($data[0] ne "") {
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber-1 where pageId=$session{page}{pageId}",$session{dbh});
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber+1 where pageId=$data[0]",$session{dbh});
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber-1 where pageId=$session{page}{pageId}");
|
||||
WebGUI::SQL->write("update page set sequenceNumber=sequenceNumber+1 where pageId=$data[0]");
|
||||
}
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -252,9 +253,9 @@ sub www_movePageUp {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_pastePage {
|
||||
my ($output, $nextSeq);
|
||||
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from page where parentId=$session{page}{pageId}",$session{dbh});
|
||||
($nextSeq) = WebGUI::SQL->quickArray("select max(sequenceNumber)+1 from page where parentId=$session{page}{pageId}");
|
||||
if (WebGUI::Privilege::canEditPage()) {
|
||||
WebGUI::SQL->write("update page set parentId=$session{page}{pageId}, sequenceNumber='$nextSeq' where pageId=$session{form}{pageId}",$session{dbh});
|
||||
WebGUI::SQL->write("update page set parentId=$session{page}{pageId}, sequenceNumber='$nextSeq' where pageId=$session{form}{pageId}");
|
||||
_reorderPages($session{page}{pageId});
|
||||
return "";
|
||||
} else {
|
||||
|
|
@ -264,3 +265,4 @@ sub www_pastePage {
|
|||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use Tie::IxHash;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ our @EXPORT = qw(&www_search);
|
|||
sub www_search {
|
||||
my ($dataRows, $prevNextBar, $output, %page, @keyword, $pageId, $term, %result, $sth, @data, @row, $i);
|
||||
tie %result,'Tie::IxHash';
|
||||
$output = '<form method="post" action="'.$session{page}{url}.'">';
|
||||
$output = formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","search");
|
||||
$output .= WebGUI::Form::text("keywords",40,100,$session{form}{keywords});
|
||||
$output .= WebGUI::Form::submit(WebGUI::International::get(364));
|
||||
|
|
@ -34,34 +35,34 @@ sub www_search {
|
|||
if ($session{form}{keywords} ne "") {
|
||||
@keyword = split(" ",$session{form}{keywords});
|
||||
foreach $term (@keyword) {
|
||||
$sth = WebGUI::SQL->read("select pageId from page where title like '%".$term."%' and pageId > 25",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from page where title like '%".$term."%' and pageId > 25");
|
||||
while (@data = $sth->array) {
|
||||
$result{$data[0]} += 5;
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select pageId from page where metaTags like '%".$term."%' and pageId > 25",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from page where metaTags like '%".$term."%' and pageId > 25");
|
||||
while (@data = $sth->array) {
|
||||
$result{$data[0]} += 1;
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select pageId from widget where title like '%".$term."%' and pageId > 25",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from widget where title like '%".$term."%' and pageId > 25");
|
||||
while (@data = $sth->array) {
|
||||
$result{$data[0]} += 5;
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select pageId from widget where description like '%".$term."%' and pageId > 25",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select pageId from widget where description like '%".$term."%' and pageId > 25");
|
||||
while (@data = $sth->array) {
|
||||
$result{$data[0]} += 2;
|
||||
}
|
||||
$sth->finish;
|
||||
$sth = WebGUI::SQL->read("select widget.pageId from Article,widget where Article.widgetId=widget.widgetId and Article.body like '%".$term."%'",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select widget.pageId from Article,widget where Article.widgetId=widget.widgetId and Article.body like '%".$term."%'");
|
||||
while (@data = $sth->array) {
|
||||
$result{$data[0]} += 2;
|
||||
}
|
||||
$sth->finish;
|
||||
%result = sortHashDescending(%result);
|
||||
foreach $pageId (keys %result) {
|
||||
%page = WebGUI::SQL->quickHash("select pageId, title, urlizedTitle from page where pageId=$pageId",$session{dbh});
|
||||
%page = WebGUI::SQL->quickHash("select pageId, title, urlizedTitle from page where pageId=$pageId");
|
||||
$row[$i] = '<li><a href="'.$session{ENV}{SCRIPT_NAME}.'/'.$page{urlizedTitle}.'">'.$page{title}.'</a>';
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ use WebGUI::Form;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_editProfileSettings &www_editProfileSettingsSave &www_editAuthenticationSettings &www_editAuthenticationSettingsSave &www_editCompanyInformation &www_editCompanyInformationSave &www_editFileSettings &www_editFileSettingsSave &www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings &www_editMiscSettingsSave &www_manageSettings);
|
||||
|
|
@ -28,22 +28,22 @@ sub www_editAuthenticationSettings {
|
|||
%authMethod = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
%yesNo = ('yes'=>WebGUI::International::get(138), 'no'=>WebGUI::International::get(139));
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=2&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(2);
|
||||
$output .= '<h1>'.WebGUI::International::get(117).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editAuthenticationSettingsSave");
|
||||
$output .= '<table>';
|
||||
$array[0] = $session{setting}{anonymousRegistration};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(118).'</td><td>'.WebGUI::Form::selectList("anonymousRegistration",\%yesNo, \@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(118),WebGUI::Form::selectList("anonymousRegistration",\%yesNo, \@array));
|
||||
$array[0] = $session{setting}{authMethod};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(119).'</td><td>'.WebGUI::Form::selectList("authMethod",\%authMethod, \@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(119),WebGUI::Form::selectList("authMethod",\%authMethod, \@array));
|
||||
$array[0] = $session{setting}{usernameBinding};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(306).'</td><td>'.WebGUI::Form::selectList("usernameBinding",\%yesNo, \@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(120).'</td><td>'.WebGUI::Form::text("ldapURL",30,2048,$session{setting}{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(121).'</td><td>'.WebGUI::Form::text("ldapId",30,100,$session{setting}{ldapId}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(122).'</td><td>'.WebGUI::Form::text("ldapIdName",30,100,$session{setting}{ldapIdName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(123).'</td><td>'.WebGUI::Form::text("ldapPasswordName",30,100,$session{setting}{ldapPasswordName}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(306),WebGUI::Form::selectList("usernameBinding",\%yesNo, \@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(120),WebGUI::Form::text("ldapURL",30,2048,$session{setting}{ldapURL}));
|
||||
$output .= tableFormRow(WebGUI::International::get(121),WebGUI::Form::text("ldapId",30,100,$session{setting}{ldapId}));
|
||||
$output .= tableFormRow(WebGUI::International::get(122),WebGUI::Form::text("ldapIdName",30,100,$session{setting}{ldapIdName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(123),WebGUI::Form::text("ldapPasswordName",30,100,$session{setting}{ldapPasswordName}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -55,13 +55,13 @@ sub www_editAuthenticationSettings {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editAuthenticationSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{authMethod})." where name='authMethod'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapURL})." where name='ldapURL'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapId})." where name='ldapId'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapIdName})." where name='ldapIdName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapPasswordName})." where name='ldapPasswordName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{anonymousRegistration})." where name='anonymousRegistration'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{usernameBinding})." where name='usernameBinding'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{authMethod})." where name='authMethod'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapURL})." where name='ldapURL'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapId})." where name='ldapId'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapIdName})." where name='ldapIdName'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{ldapPasswordName})." where name='ldapPasswordName'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{anonymousRegistration})." where name='anonymousRegistration'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{usernameBinding})." where name='usernameBinding'");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -72,15 +72,15 @@ sub www_editAuthenticationSettingsSave {
|
|||
sub www_editCompanyInformation {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=6&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(6);
|
||||
$output .= '<h1>'.WebGUI::International::get(124).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editCompanyInformationSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(125).'</td><td>'.WebGUI::Form::text("companyName",30,255,$session{setting}{companyName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(126).'</td><td>'.WebGUI::Form::text("companyEmail",30,255,$session{setting}{companyEmail}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(127).'</td><td>'.WebGUI::Form::text("companyURL",30,2048,$session{setting}{companyURL}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(125),WebGUI::Form::text("companyName",30,255,$session{setting}{companyName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(126),WebGUI::Form::text("companyEmail",30,255,$session{setting}{companyEmail}));
|
||||
$output .= tableFormRow(WebGUI::International::get(127),WebGUI::Form::text("companyURL",30,2048,$session{setting}{companyURL}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -92,9 +92,9 @@ sub www_editCompanyInformation {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editCompanyInformationSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyName})." where name='companyName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyEmail})." where name='companyEmail'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyURL})." where name='companyURL'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyName})." where name='companyName'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyEmail})." where name='companyEmail'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{companyURL})." where name='companyURL'");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -105,16 +105,16 @@ sub www_editCompanyInformationSave {
|
|||
sub www_editFileSettings {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=11&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(11);
|
||||
$output .= '<h1>'.WebGUI::International::get(128).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editFileSettingsSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(129).'</td><td>'.WebGUI::Form::text("lib",30,255,$session{setting}{lib}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(130).'</td><td>'.WebGUI::Form::text("maxAttachmentSize",30,11,$session{setting}{maxAttachmentSize}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(131).'</td><td>'.WebGUI::Form::text("attachmentDirectoryWeb",30,255,$session{setting}{attachmentDirectoryWeb}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(132).'</td><td>'.WebGUI::Form::text("attachmentDirectoryLocal",30,255,$session{setting}{attachmentDirectoryLocal}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(129),WebGUI::Form::text("lib",30,255,$session{setting}{lib}));
|
||||
$output .= tableFormRow(WebGUI::International::get(130),WebGUI::Form::text("maxAttachmentSize",30,11,$session{setting}{maxAttachmentSize}));
|
||||
$output .= tableFormRow(WebGUI::International::get(131),WebGUI::Form::text("attachmentDirectoryWeb",30,255,$session{setting}{attachmentDirectoryWeb}));
|
||||
$output .= tableFormRow(WebGUI::International::get(132),WebGUI::Form::text("attachmentDirectoryLocal",30,255,$session{setting}{attachmentDirectoryLocal}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -126,10 +126,10 @@ sub www_editFileSettings {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editFileSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{lib})." where name='lib'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryLocal})." where name='attachmentDirectoryLocal'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{lib})." where name='lib'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{maxAttachmentSize})." where name='maxAttachmentSize'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryWeb})." where name='attachmentDirectoryWeb'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{attachmentDirectoryLocal})." where name='attachmentDirectoryLocal'");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -140,14 +140,14 @@ sub www_editFileSettingsSave {
|
|||
sub www_editMailSettings {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=13&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(13);
|
||||
$output .= '<h1>'.WebGUI::International::get(133).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editMailSettingsSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(134).'</td><td>'.WebGUI::Form::textArea("recoverPasswordEmail",$session{setting}{recoverPasswordEmail}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(135).'</td><td>'.WebGUI::Form::text("smtpServer",30,255,$session{setting}{smtpServer}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(134),WebGUI::Form::textArea("recoverPasswordEmail",$session{setting}{recoverPasswordEmail}));
|
||||
$output .= tableFormRow(WebGUI::International::get(135),WebGUI::Form::text("smtpServer",30,255,$session{setting}{smtpServer}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -159,8 +159,8 @@ sub www_editMailSettings {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editMailSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{recoverPasswordEmail})." where name='recoverPasswordEmail'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{smtpServer})." where name='smtpServer'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{recoverPasswordEmail})." where name='recoverPasswordEmail'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{smtpServer})." where name='smtpServer'");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -172,15 +172,15 @@ sub www_editMiscSettings {
|
|||
my ($output, @array, %notFoundPage);
|
||||
%notFoundPage = (1=>WebGUI::International::get(136), 4=>WebGUI::International::get(137));
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=24&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(24);
|
||||
$output .= '<h1>'.WebGUI::International::get(140).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editMiscSettingsSave");
|
||||
$output .= '<table>';
|
||||
$array[0] = $session{setting}{notFoundPage};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(141).'</td><td>'.WebGUI::Form::selectList("notFoundPage",\%notFoundPage,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(142).'</td><td>'.WebGUI::Form::text("sessionTimeout",30,11,$session{setting}{sessionTimeout}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(141),WebGUI::Form::selectList("notFoundPage",\%notFoundPage,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(142),WebGUI::Form::text("sessionTimeout",30,11,$session{setting}{sessionTimeout}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -192,8 +192,8 @@ sub www_editMiscSettings {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editMiscSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout})." where name='sessionTimeout'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{notFoundPage})." where name='notFoundPage'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{sessionTimeout})." where name='sessionTimeout'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{notFoundPage})." where name='notFoundPage'");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -205,22 +205,22 @@ sub www_editProfileSettings {
|
|||
my ($output, @array, %yesNo);
|
||||
%yesNo = ('1'=>WebGUI::International::get(138), '0'=>WebGUI::International::get(139));
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=22&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(22);
|
||||
$output .= '<h1>'.WebGUI::International::get(308).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editProfileSettingsSave");
|
||||
$output .= '<table>';
|
||||
$array[0] = $session{setting}{profileName};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(309).'</td><td>'.WebGUI::Form::selectList("profileName",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(309),WebGUI::Form::selectList("profileName",\%yesNo,\@array));
|
||||
$array[0] = $session{setting}{profileExtraContact};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(310).'</td><td>'.WebGUI::Form::selectList("profileExtraContact",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(310),WebGUI::Form::selectList("profileExtraContact",\%yesNo,\@array));
|
||||
$array[0] = $session{setting}{profileHome};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(311).'</td><td>'.WebGUI::Form::selectList("profileHome",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(311),WebGUI::Form::selectList("profileHome",\%yesNo,\@array));
|
||||
$array[0] = $session{setting}{profileWork};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(312).'</td><td>'.WebGUI::Form::selectList("profileWork",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(312),WebGUI::Form::selectList("profileWork",\%yesNo,\@array));
|
||||
$array[0] = $session{setting}{profileMisc};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(313).'</td><td>'.WebGUI::Form::selectList("profileMisc",\%yesNo,\@array).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(313),WebGUI::Form::selectList("profileMisc",\%yesNo,\@array));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -232,11 +232,11 @@ sub www_editProfileSettings {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSettingsSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileName})." where name='profileName'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileExtraContact})." where name='profileExtraContact'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileHome})." where name='profileHome'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileWork})." where name='profileWork'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileMisc})." where name='profileMisc'",$session{dbh});
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileName})." where name='profileName'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileExtraContact})." where name='profileExtraContact'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileHome})." where name='profileHome'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileWork})." where name='profileWork'");
|
||||
WebGUI::SQL->write("update settings set value=".quote($session{form}{profileMisc})." where name='profileMisc'");
|
||||
return www_manageSettings();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -247,7 +247,7 @@ sub www_editProfileSettingsSave {
|
|||
sub www_manageSettings {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=12&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(12);
|
||||
$output .= '<h1>'.WebGUI::International::get(143).'</h1>';
|
||||
$output .= '<ul>';
|
||||
$output .= '<li><a href="'.$session{page}{url}.'?op=editAuthenticationSettings">'.WebGUI::International::get(117).'</a>';
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
|
|
@ -37,19 +38,19 @@ sub www_viewStatistics {
|
|||
$response = $userAgent->request($request);
|
||||
$version = $response->content;
|
||||
chomp $version;
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=12&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(12);
|
||||
$output .= '<h1>'.WebGUI::International::get(144).'</h1>';
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(145).'</td><td class="tableData">'.$WebGUI::VERSION.' ('.WebGUI::International::get(349).': '.$version.')</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from session",$session{dbh});
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from session");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(146).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*)+1 from page where parentId>25",$session{dbh});
|
||||
($data) = WebGUI::SQL->quickArray("select count(*)+1 from page where parentId>25");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(147).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where pageId>25 or pageId=0",$session{dbh});
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from page where pageId>25 or pageId=0");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(148).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from users where userId>25",$session{dbh});
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from users where userId>25");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(149).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from groups where groupId>25",$session{dbh});
|
||||
($data) = WebGUI::SQL->quickArray("select count(*) from groups where groupId>25");
|
||||
$output .= '<tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableData">'.$data.'</td></tr>';
|
||||
$output .= '</table>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use WebGUI::Form;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
|
|
@ -27,16 +28,16 @@ our @EXPORT = qw(&www_copyStyle &www_addStyle &www_addStyleSave &www_deleteStyle
|
|||
sub www_addStyle {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=16&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(16);
|
||||
$output .= '<h1>'.WebGUI::International::get(150).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","addStyleSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(151).'</td><td>'.WebGUI::Form::text("name",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(152).'</td><td>'.WebGUI::Form::textArea("header",'',50,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(153).'</td><td>'.WebGUI::Form::textArea("footer",'',50,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(154).'</td><td>'.WebGUI::Form::textArea("styleSheet","<style>\n\n</style>",50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(151),WebGUI::Form::text("name",20,30));
|
||||
$output .= tableFormRow(WebGUI::International::get(152),WebGUI::Form::textArea("header",'',50,10));
|
||||
$output .= tableFormRow(WebGUI::International::get(153),WebGUI::Form::textArea("footer",'',50,10));
|
||||
$output .= tableFormRow(WebGUI::International::get(154),WebGUI::Form::textArea("styleSheet","<style>\n\n</style>",50,10));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -49,7 +50,7 @@ sub www_addStyle {
|
|||
sub www_addStyleSave {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("insert into style values (".getNextId("styleId").", ".quote($session{form}{name}).", ".quote($session{form}{header}).", ".quote($session{form}{footer}).", ".quote($session{form}{styleSheet}).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into style values (".getNextId("styleId").", ".quote($session{form}{name}).", ".quote($session{form}{header}).", ".quote($session{form}{footer}).", ".quote($session{form}{styleSheet}).")");
|
||||
$output = www_listStyles();
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -61,8 +62,8 @@ sub www_addStyleSave {
|
|||
sub www_copyStyle {
|
||||
my (%style);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}",$session{dbh});
|
||||
WebGUI::SQL->write("insert into style values (".getNextId("styleId").", ".quote('Copy of '.$style{name}).", ".quote($style{header}).", ".quote($style{footer}).", ".quote($style{styleSheet}).")",$session{dbh});
|
||||
%style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}");
|
||||
WebGUI::SQL->write("insert into style values (".getNextId("styleId").", ".quote('Copy of '.$style{name}).", ".quote($style{header}).", ".quote($style{footer}).", ".quote($style{styleSheet}).")");
|
||||
return www_listStyles();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -75,7 +76,8 @@ sub www_deleteStyle {
|
|||
if ($session{form}{sid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=4&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= helpLink(4);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(155).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteStyleConfirm&sid='.$session{form}{sid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'?op=listStyles">'.WebGUI::International::get(45).'</a></div>';
|
||||
|
|
@ -90,8 +92,8 @@ sub www_deleteStyleConfirm {
|
|||
if ($session{form}{sid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from style where styleId=".$session{form}{sid},$session{dbh});
|
||||
WebGUI::SQL->write("update page set styleId=2 where styleId=".$session{form}{sid},$session{dbh});
|
||||
WebGUI::SQL->write("delete from style where styleId=".$session{form}{sid});
|
||||
WebGUI::SQL->write("update page set styleId=2 where styleId=".$session{form}{sid});
|
||||
return www_listStyles();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -103,18 +105,18 @@ sub www_editStyle {
|
|||
my ($output, %style);
|
||||
tie %style, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}",$session{dbh});
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=16&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
%style = WebGUI::SQL->quickHash("select * from style where styleId=$session{form}{sid}");
|
||||
$output .= helpLink(16);
|
||||
$output .= '<h1>'.WebGUI::International::get(156).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editStyleSave");
|
||||
$output .= WebGUI::Form::hidden("sid",$session{form}{sid});
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(151).'</td><td>'.WebGUI::Form::text("name",20,30,$style{name}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(152).'</td><td>'.WebGUI::Form::textArea("header",$style{header},50,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(153).'</td><td>'.WebGUI::Form::textArea("footer",$style{footer},50,10).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(154).'</td><td>'.WebGUI::Form::textArea("styleSheet",$style{styleSheet},50,10).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(151),WebGUI::Form::text("name",20,30,$style{name}));
|
||||
$output .= tableFormRow(WebGUI::International::get(152),WebGUI::Form::textArea("header",$style{header},50,10));
|
||||
$output .= tableFormRow(WebGUI::International::get(153),WebGUI::Form::textArea("footer",$style{footer},50,10));
|
||||
$output .= tableFormRow(WebGUI::International::get(154),WebGUI::Form::textArea("styleSheet",$style{styleSheet},50,10));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -126,7 +128,7 @@ sub www_editStyle {
|
|||
#-------------------------------------------------------------------
|
||||
sub www_editStyleSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update style set name=".quote($session{form}{name}).", header=".quote($session{form}{header}).", footer=".quote($session{form}{footer}).", styleSheet=".quote($session{form}{styleSheet})." where styleId=".$session{form}{sid},$session{dbh});
|
||||
WebGUI::SQL->write("update style set name=".quote($session{form}{name}).", header=".quote($session{form}{header}).", footer=".quote($session{form}{footer}).", styleSheet=".quote($session{form}{styleSheet})." where styleId=".$session{form}{sid});
|
||||
return www_listStyles();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
|
|
@ -137,13 +139,13 @@ sub www_editStyleSave {
|
|||
sub www_listStyles {
|
||||
my ($output, $sth, @data, @row, $i, $prevNextBar, $dataRows);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=9&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = helpLink(9);
|
||||
$output .= '<h1>'.WebGUI::International::get(157).'</h1>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=addStyle">'.WebGUI::International::get(158).'</a></div>';
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select styleId,name from style where name<>'Reserved' order by name");
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr><td valign="top"><a href="'.$session{page}{url}.'?op=deleteStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?op=copyStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/copy.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top">'.$data[1].'</td></tr>';
|
||||
$row[$i] = '<tr><td valign="top" class="tableData"><a href="'.$session{page}{url}.'?op=deleteStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.'?op=editStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a><a href="'.$session{page}{url}.'?op=copyStyle&sid='.$data[0].'"><img src="'.$session{setting}{lib}.'/copy.gif" border=0></a></td>';
|
||||
$row[$i] .= '<td valign="top" class="tableData">'.$data[1].'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
$sth->finish;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ use Exporter;
|
|||
use strict qw(vars subs);
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm);
|
||||
|
|
@ -23,10 +23,10 @@ our @EXPORT = qw(&www_purgeTrash &www_purgeTrashConfirm);
|
|||
#-------------------------------------------------------------------
|
||||
sub _purgeWidgets {
|
||||
my ($b, $widgetId, $widgetType, $func);
|
||||
$b = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=$_[0]",$session{dbh});
|
||||
$b = WebGUI::SQL->read("select widgetId, widgetType from widget where pageId=$_[0]");
|
||||
while (($widgetId,$widgetType) = $b->array) {
|
||||
$func = "WebGUI::Widget::".$widgetType."::purge";
|
||||
&$func($widgetId,$session{dbh});
|
||||
&$func($widgetId);
|
||||
}
|
||||
$b->finish;
|
||||
}
|
||||
|
|
@ -34,11 +34,11 @@ sub _purgeWidgets {
|
|||
#-------------------------------------------------------------------
|
||||
sub _recursePageTree {
|
||||
my ($a, $pageId);
|
||||
$a = WebGUI::SQL->read("select pageId from page where parentId=$_[0]",$session{dbh});
|
||||
$a = WebGUI::SQL->read("select pageId from page where parentId=$_[0]");
|
||||
while (($pageId) = $a->array) {
|
||||
_recursePageTree($pageId);
|
||||
_purgeWidgets($pageId);
|
||||
WebGUI::SQL->write("delete from page where pageId=$pageId",$session{dbh});
|
||||
WebGUI::SQL->write("delete from page where pageId=$pageId");
|
||||
}
|
||||
$a->finish;
|
||||
}
|
||||
|
|
@ -47,7 +47,8 @@ sub _recursePageTree {
|
|||
sub www_purgeTrash {
|
||||
my ($output);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=46&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a><h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output = helpLink(46);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(162).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=purgeTrashConfirm">'.WebGUI::International::get(44).'</a>';
|
||||
$output .= ' <a href="'.$session{page}{url}.'">'.WebGUI::International::get(45).'</a></div>';
|
||||
|
|
|
|||
|
|
@ -14,40 +14,42 @@ use Digest::MD5 qw(md5_base64);
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::CPHash;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Privilege;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Shortcut;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Utility;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&www_becomeUser &www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers);
|
||||
our @EXPORT = qw(&www_editUserGroupSave &www_deleteGrouping &www_editGrouping &www_editGroupingSave &www_becomeUser &www_addUser &www_addUserSave &www_deleteUser &www_deleteUserConfirm &www_editUser &www_editUserSave &www_listUsers);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addUser {
|
||||
my ($output, %hash, @array);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=5&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(5);
|
||||
$output .= '<h1>'.WebGUI::International::get(163).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","addUserSave");
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier",20,30).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,30));
|
||||
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,30));
|
||||
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
$array[0] = $session{setting}{authMethod};
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(164).'</td><td>'.WebGUI::Form::selectList("authMethod",\%hash, \@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(165).'</td><td>'.WebGUI::Form::text("ldapURL",20,2048,$session{setting}{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(166).'</td><td>'.WebGUI::Form::text("connectDN",20,255).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
$output .= tableFormRow(WebGUI::International::get(164),WebGUI::Form::selectList("authMethod",\%hash, \@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(165),WebGUI::Form::text("ldapURL",20,2048,$session{setting}{ldapURL}));
|
||||
$output .= tableFormRow(WebGUI::International::get(166),WebGUI::Form::text("connectDN",20,255));
|
||||
$output .= tableFormRow(WebGUI::International::get(56),WebGUI::Form::text("email",20,255));
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
$array[0] = 2;
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(89).'</td><td>'.WebGUI::Form::selectList("groups",\%hash,\@array,5,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
$output .= tableFormRow(WebGUI::International::get(89),WebGUI::Form::selectList("groups",\%hash,\@array,5,1));
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international");
|
||||
$array[0] = "English";
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(304),WebGUI::Form::selectList("language",\%hash,\@array));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
} else {
|
||||
|
|
@ -58,14 +60,15 @@ sub www_addUser {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_addUserSave {
|
||||
my ($output, @groups, $uid, $gid, $encryptedPassword);
|
||||
my ($output, @groups, $uid, $gid, $encryptedPassword, $expireAfter);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
|
||||
$uid = getNextId("userId");
|
||||
WebGUI::SQL->write("insert into users (userId,username,identifier,email,authMethod,ldapURL,connectDN,language) values ($uid, ".quote($session{form}{username}).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{form}{authMethod}).", ".quote($session{form}{ldapURL}).", ".quote($session{form}{connectDN}).", ".quote($session{form}{language}).")",$session{dbh});
|
||||
WebGUI::SQL->write("insert into users (userId,username,identifier,email,authMethod,ldapURL,connectDN,language) values ($uid, ".quote($session{form}{username}).", ".quote($encryptedPassword).", ".quote($session{form}{email}).", ".quote($session{form}{authMethod}).", ".quote($session{form}{ldapURL}).", ".quote($session{form}{connectDN}).", ".quote($session{form}{language}).")");
|
||||
@groups = $session{cgi}->param('groups');
|
||||
foreach $gid (@groups) {
|
||||
WebGUI::SQL->write("insert into groupings values ($gid, $uid)",$session{dbh});
|
||||
($expireAfter) = WebGUI::SQL->quickArray("select expireAfter from groups where groupId=$gid");
|
||||
WebGUI::SQL->write("insert into groupings values ($gid, $uid, ".(time()+$expireAfter).")");
|
||||
}
|
||||
$output = www_listUsers();
|
||||
} else {
|
||||
|
|
@ -78,7 +81,7 @@ sub www_addUserSave {
|
|||
sub www_becomeUser {
|
||||
my ($cookieInfo, $output, $password);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
($password) = WebGUI::SQL->quickArray("select identifier from users where userId='$session{form}{uid}'",$session{dbh});
|
||||
($password) = WebGUI::SQL->quickArray("select identifier from users where userId='$session{form}{uid}'");
|
||||
WebGUI::Session::end($session{var}{sessionId});
|
||||
$cookieInfo = $session{form}{uid}."|".crypt($password,"yJ");
|
||||
WebGUI::Session::end($cookieInfo);
|
||||
|
|
@ -91,13 +94,23 @@ sub www_becomeUser {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteGrouping {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from groupings where groupId=$session{form}{gid} and userId=$session{form}{uid}");
|
||||
return www_editUser();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_deleteUser {
|
||||
my ($output);
|
||||
if ($session{form}{uid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=7&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output .= helpLink(7);
|
||||
$output .= '<h1>'.WebGUI::International::get(42).'</h1>';
|
||||
$output .= WebGUI::International::get(167).'<p>';
|
||||
$output .= '<div align="center"><a href="'.$session{page}{url}.'?op=deleteUserConfirm&uid='.$session{form}{uid}.'">'.WebGUI::International::get(44).'</a>';
|
||||
|
|
@ -113,70 +126,123 @@ sub www_deleteUserConfirm {
|
|||
if ($session{form}{uid} < 26) {
|
||||
return WebGUI::Privilege::vitalComponent();
|
||||
} elsif (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from users where userId=$session{form}{uid}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh});
|
||||
WebGUI::SQL->write("delete from users where userId=$session{form}{uid}");
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}");
|
||||
return www_listUsers();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGrouping {
|
||||
my ($output, $username, $group, $expireDate);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output .= '<h1>'.WebGUI::International::get(370).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editGroupingSave");
|
||||
$output .= WebGUI::Form::hidden("uid",$session{form}{uid});
|
||||
$output .= WebGUI::Form::hidden("gid",$session{form}{gid});
|
||||
($username) = WebGUI::SQL->quickArray("select username from users where userId=$session{form}{uid}");
|
||||
($group) = WebGUI::SQL->quickArray("select groupName from groups where groupId=$session{form}{gid}");
|
||||
($expireDate) = WebGUI::SQL->quickArray("select expireDate from groupings where groupId=$session{form}{gid} and userId=$session{form}{uid}");
|
||||
$output .= '<table>';
|
||||
$output .= tableFormRow(WebGUI::International::get(50),$username);
|
||||
$output .= tableFormRow(WebGUI::International::get(84),$group);
|
||||
$output .= tableFormRow(WebGUI::International::get(369),WebGUI::Form::text("expireDate",20,30,epochToSet($expireDate),1));
|
||||
$output .= formSave();
|
||||
$output .= '</table></form>';
|
||||
return $output;
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editGroupingSave {
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("update groupings set expireDate=".setToEpoch($session{form}{expireDate})." where groupId=$session{form}{gid} and userId=$session{form}{uid}");
|
||||
return www_editUser();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUser {
|
||||
my ($output, %user, %hash, @array, %gender);
|
||||
my ($output, %user, %hash, @array, %gender, $sth);
|
||||
tie %hash, 'Tie::CPHash';
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
%gender = ('male'=>WebGUI::International::get(339),'female'=>WebGUI::International::get(340));
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId=$session{form}{uid}",$session{dbh});
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=viewHelp&hid=5&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
%user = WebGUI::SQL->quickHash("select * from users where userId=$session{form}{uid}");
|
||||
$output .= '<table><tr><td valign="top">';
|
||||
$output .= helpLink(5);
|
||||
$output .= '<h1>'.WebGUI::International::get(168).'</h1>';
|
||||
$output .= ' <form method="post" action="'.$session{page}{url}.'"> ';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editUserSave");
|
||||
$output .= WebGUI::Form::hidden("uid",$session{form}{uid});
|
||||
$output .= '<table>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(50).'</td><td>'.WebGUI::Form::text("username",20,30,$user{username}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription">'.WebGUI::International::get(51).'</td><td>'.WebGUI::Form::password("identifier",20,30,"password").'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(50),WebGUI::Form::text("username",20,30,$user{username}));
|
||||
$output .= tableFormRow(WebGUI::International::get(51),WebGUI::Form::password("identifier",20,30,"password"));
|
||||
%hash = ('WebGUI'=>'WebGUI', 'LDAP'=>'LDAP');
|
||||
$array[0] = $user{authMethod};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(164).'</td><td>'.WebGUI::Form::selectList("authMethod",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(165).'</td><td>'.WebGUI::Form::text("ldapURL",20,2048,$user{ldapURL}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(166).'</td><td>'.WebGUI::Form::text("connectDN",20,255,$user{connectDN}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(56).'</td><td>'.WebGUI::Form::text("email",20,255,$user{email}).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName",$session{dbh});
|
||||
@array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}",$session{dbh});
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(89).'</td><td>'.WebGUI::Form::selectList("groups",\%hash,\@array,5,1).'</td></tr>';
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international",$session{dbh});
|
||||
$output .= tableFormRow(WebGUI::International::get(164),WebGUI::Form::selectList("authMethod",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(165),WebGUI::Form::text("ldapURL",20,2048,$user{ldapURL}));
|
||||
$output .= tableFormRow(WebGUI::International::get(166),WebGUI::Form::text("connectDN",20,255,$user{connectDN}));
|
||||
$output .= tableFormRow(WebGUI::International::get(56),WebGUI::Form::text("email",20,255,$user{email}));
|
||||
%hash = WebGUI::SQL->buildHash("select distinct(language) from international");
|
||||
@array = [];
|
||||
$array[0] = $user{language};
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(304).'</td><td>'.WebGUI::Form::selectList("language",\%hash,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(314).'</td><td>'.WebGUI::Form::text("firstName",20,50,$user{firstName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(315).'</td><td>'.WebGUI::Form::text("middleName",20,50,$user{middleName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(316).'</td><td>'.WebGUI::Form::text("lastName",20,50,$user{lastName}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(317).'</td><td>'.WebGUI::Form::text("icq",20,30,$user{icq}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(318).'</td><td>'.WebGUI::Form::text("aim",20,30,$user{aim}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(319).'</td><td>'.WebGUI::Form::text("msnIM",20,30,$user{msnIM}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(320).'</td><td>'.WebGUI::Form::text("yahooIM",20,30,$user{yahooIM}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(321).'</td><td>'.WebGUI::Form::text("cellPhone",20,30,$user{cellPhone}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(322).'</td><td>'.WebGUI::Form::text("pager",20,30,$user{pager}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(323).'</td><td>'.WebGUI::Form::text("homeAddress",20,128,$user{homeAddress}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(324).'</td><td>'.WebGUI::Form::text("homeCity",20,30,$user{homeCity}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(325).'</td><td>'.WebGUI::Form::text("homeState",20,30,$user{homeState}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(326).'</td><td>'.WebGUI::Form::text("homeZip",20,15,$user{homeZip}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(327).'</td><td>'.WebGUI::Form::text("homeCountry",20,30,$user{homeCountry}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(328).'</td><td>'.WebGUI::Form::text("homePhone",20,30,$user{homePhone}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(329).'</td><td>'.WebGUI::Form::text("workAddress",20,128,$user{workAddress}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(330).'</td><td>'.WebGUI::Form::text("workCity",20,30,$user{workCity}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(331).'</td><td>'.WebGUI::Form::text("workState",20,30,$user{workState}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(332).'</td><td>'.WebGUI::Form::text("workZip",20,15,$user{workZip}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(333).'</td><td>'.WebGUI::Form::text("workCountry",20,30,$user{workCountry}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(334).'</td><td>'.WebGUI::Form::text("workPhone",20,30,$user{workPhone}).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(304),WebGUI::Form::selectList("language",\%hash,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(314),WebGUI::Form::text("firstName",20,50,$user{firstName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(315),WebGUI::Form::text("middleName",20,50,$user{middleName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(316),WebGUI::Form::text("lastName",20,50,$user{lastName}));
|
||||
$output .= tableFormRow(WebGUI::International::get(317),WebGUI::Form::text("icq",20,30,$user{icq}));
|
||||
$output .= tableFormRow(WebGUI::International::get(318),WebGUI::Form::text("aim",20,30,$user{aim}));
|
||||
$output .= tableFormRow(WebGUI::International::get(319),WebGUI::Form::text("msnIM",20,30,$user{msnIM}));
|
||||
$output .= tableFormRow(WebGUI::International::get(320),WebGUI::Form::text("yahooIM",20,30,$user{yahooIM}));
|
||||
$output .= tableFormRow(WebGUI::International::get(321),WebGUI::Form::text("cellPhone",20,30,$user{cellPhone}));
|
||||
$output .= tableFormRow(WebGUI::International::get(322),WebGUI::Form::text("pager",20,30,$user{pager}));
|
||||
$output .= tableFormRow(WebGUI::International::get(323),WebGUI::Form::text("homeAddress",20,128,$user{homeAddress}));
|
||||
$output .= tableFormRow(WebGUI::International::get(324),WebGUI::Form::text("homeCity",20,30,$user{homeCity}));
|
||||
$output .= tableFormRow(WebGUI::International::get(325),WebGUI::Form::text("homeState",20,30,$user{homeState}));
|
||||
$output .= tableFormRow(WebGUI::International::get(326),WebGUI::Form::text("homeZip",20,15,$user{homeZip}));
|
||||
$output .= tableFormRow(WebGUI::International::get(327),WebGUI::Form::text("homeCountry",20,30,$user{homeCountry}));
|
||||
$output .= tableFormRow(WebGUI::International::get(328),WebGUI::Form::text("homePhone",20,30,$user{homePhone}));
|
||||
$output .= tableFormRow(WebGUI::International::get(329),WebGUI::Form::text("workAddress",20,128,$user{workAddress}));
|
||||
$output .= tableFormRow(WebGUI::International::get(330),WebGUI::Form::text("workCity",20,30,$user{workCity}));
|
||||
$output .= tableFormRow(WebGUI::International::get(331),WebGUI::Form::text("workState",20,30,$user{workState}));
|
||||
$output .= tableFormRow(WebGUI::International::get(332),WebGUI::Form::text("workZip",20,15,$user{workZip}));
|
||||
$output .= tableFormRow(WebGUI::International::get(333),WebGUI::Form::text("workCountry",20,30,$user{workCountry}));
|
||||
$output .= tableFormRow(WebGUI::International::get(334),WebGUI::Form::text("workPhone",20,30,$user{workPhone}));
|
||||
@array = ($user{gender});
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(335).'</td><td>'.WebGUI::Form::selectList("gender",\%gender,\@array).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(336).'</td><td>'.WebGUI::Form::text("birthdate",20,30,$user{birthdate}).'</td></tr>';
|
||||
$output .= '<tr><td class="formDescription" valign="top">'.WebGUI::International::get(337).'</td><td>'.WebGUI::Form::text("homepage",20,2048,$user{homepage}).'</td></tr>';
|
||||
$output .= '<tr><td></td><td>'.WebGUI::Form::submit(WebGUI::International::get(62)).'</td></tr>';
|
||||
$output .= tableFormRow(WebGUI::International::get(335),WebGUI::Form::selectList("gender",\%gender,\@array));
|
||||
$output .= tableFormRow(WebGUI::International::get(336),WebGUI::Form::text("birthdate",20,30,$user{birthdate}));
|
||||
$output .= tableFormRow(WebGUI::International::get(337),WebGUI::Form::text("homepage",20,2048,$user{homepage}));
|
||||
$output .= formSave();
|
||||
$output .= '</table>';
|
||||
$output .= '</form> ';
|
||||
$output .= '</form>';
|
||||
$output .= '</td><td> </td><td class="formDescription" valign="top">';
|
||||
$output .= '<h1>'.WebGUI::International::get(372).'</h1>';
|
||||
$output .= formHeader();
|
||||
$output .= WebGUI::Form::hidden("op","editUserGroupSave");
|
||||
$output .= WebGUI::Form::hidden("uid",$session{form}{uid});
|
||||
%hash = WebGUI::SQL->buildHash("select groupId,groupName from groups where groupName<>'Reserved' order by groupName");
|
||||
@array = WebGUI::SQL->buildArray("select groupId from groupings where userId=$session{form}{uid}");
|
||||
$output .= WebGUI::Form::selectList("groups",\%hash,\@array,5,1);
|
||||
$output .= '<br>'.WebGUI::Form::submit(WebGUI::International::get(62));
|
||||
$output .= '<p>'.WebGUI::International::get(373).'<p></form>';
|
||||
$output .= '<table><tr><td class="tableHeader">'.WebGUI::International::get(89).'</td><td class="tableHeader">'.WebGUI::International::get(84).'</td><td class="tableHeader">'.WebGUI::International::get(369).'</td></tr>';
|
||||
$sth = WebGUI::SQL->read("select groups.groupId,groups.groupName,groupings.expireDate from groupings,groups where groupings.groupId=groups.groupId and groupings.userId=$session{form}{uid} order by groups.groupName");
|
||||
while (%hash = $sth->hash) {
|
||||
$output .= '<tr><td><a href="'.$session{page}{url}.'?op=deleteGrouping&uid='.$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a><a href="'.$session{page}{url}.
|
||||
'?op=editGrouping&uid='.$session{form}{uid}.'&gid='.$hash{groupId}.'"><img src="'.$session{setting}{lib}.'/edit.gif" border=0></a></td>';
|
||||
$output .= '<td class="tableData">'.$hash{groupName}.'</td>';
|
||||
$output .= '<td class="tableData">'.epochToHuman($hash{expireDate},"%M/%D/%y").'</td></tr>';
|
||||
}
|
||||
$sth->finish;
|
||||
$output .= '</table>';
|
||||
$output .= '</td></tr></table>';
|
||||
} else {
|
||||
$output = WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
|
|
@ -185,34 +251,45 @@ sub www_editUser {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserSave {
|
||||
my (@groups, $error, $gid, $encryptedPassword, $passwordStatement);
|
||||
my ($error, $encryptedPassword, $passwordStatement);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
if ($session{form}{identifier} ne "password") {
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier});
|
||||
$passwordStatement = ', identifier='.quote($encryptedPassword);
|
||||
}
|
||||
$encryptedPassword = Digest::MD5::md5_base64($session{form}{identifier1});
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", authMethod=".quote($session{form}{authMethod}).", ldapURL=".quote($session{form}{ldapURL}).", connectDN=".quote($session{form}{connectDN}).", email=".quote($session{form}{email}).", language=".quote($session{form}{language}).", firstName=".quote($session{form}{firstName}).", middleName=".quote($session{form}{middleName}).", lastName=".quote($session{form}{lastName}).", icq=".quote($session{form}{icq}).", aim=".quote($session{form}{aim}).", msnIM=".quote($session{form}{msnIM}).", yahooIM=".quote($session{form}{yahooIM}).", homeAddress=".quote($session{form}{homeAddress}).", homeCity=".quote($session{form}{homeCity}).", homeState=".quote($session{form}{homeState}).", homeZip=".quote($session{form}{homeZip}).", homeCountry=".quote($session{form}{homeCountry}).", homePhone=".quote($session{form}{homePhone}).", workAddress=".quote($session{form}{workAddress}).", workCity=".quote($session{form}{workCity}).", workState=".quote($session{form}{workState}).", workZip=".quote($session{form}{workZip}).", workCountry=".quote($session{form}{workCountry}).", workPhone=".quote($session{form}{workPhone}).", cellPhone=".quote($session{form}{cellPhone}).", pager=".quote($session{form}{pager}).", gender=".quote($session{form}{gender}).", birthdate=".quote($session{form}{birthdate}).", homepage=".quote($session{form}{homepage})." where userId=".$session{form}{uid},$session{dbh});
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}",$session{dbh});
|
||||
@groups = $session{cgi}->param('groups');
|
||||
foreach $gid (@groups) {
|
||||
WebGUI::SQL->write("insert into groupings values ($gid, $session{form}{uid})",$session{dbh});
|
||||
}
|
||||
WebGUI::SQL->write("update users set username=".quote($session{form}{username}).$passwordStatement.", authMethod=".quote($session{form}{authMethod}).", ldapURL=".quote($session{form}{ldapURL}).", connectDN=".quote($session{form}{connectDN}).", email=".quote($session{form}{email}).", language=".quote($session{form}{language}).", firstName=".quote($session{form}{firstName}).", middleName=".quote($session{form}{middleName}).", lastName=".quote($session{form}{lastName}).", icq=".quote($session{form}{icq}).", aim=".quote($session{form}{aim}).", msnIM=".quote($session{form}{msnIM}).", yahooIM=".quote($session{form}{yahooIM}).", homeAddress=".quote($session{form}{homeAddress}).", homeCity=".quote($session{form}{homeCity}).", homeState=".quote($session{form}{homeState}).", homeZip=".quote($session{form}{homeZip}).", homeCountry=".quote($session{form}{homeCountry}).", homePhone=".quote($session{form}{homePhone}).", workAddress=".quote($session{form}{workAddress}).", workCity=".quote($session{form}{workCity}).", workState=".quote($session{form}{workState}).", workZip=".quote($session{form}{workZip}).", workCountry=".quote($session{form}{workCountry}).", workPhone=".quote($session{form}{workPhone}).", cellPhone=".quote($session{form}{cellPhone}).", pager=".quote($session{form}{pager}).", gender=".quote($session{form}{gender}).", birthdate=".quote($session{form}{birthdate}).", homepage=".quote($session{form}{homepage})." where userId=".$session{form}{uid});
|
||||
return www_listUsers();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editUserGroupSave {
|
||||
my (@groups, $gid, $expireAfter);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
WebGUI::SQL->write("delete from groupings where userId=$session{form}{uid}");
|
||||
@groups = $session{cgi}->param('groups');
|
||||
foreach $gid (@groups) {
|
||||
($expireAfter) = WebGUI::SQL->quickArray("select expireAfter from groups where groupId=$gid");
|
||||
WebGUI::SQL->write("insert into groupings values ($gid, $session{form}{uid}, ".(time()+$expireAfter).")");
|
||||
}
|
||||
return www_editUser();
|
||||
} else {
|
||||
return WebGUI::Privilege::adminOnly();
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_listUsers {
|
||||
my ($output, $sth, @data, @row, $dataRows, $prevNextBar, $i, $search);
|
||||
if (WebGUI::Privilege::isInGroup(3)) {
|
||||
$output = '<a href="'.$session{page}{url}.'?op=viewHelp&hid=8&namespace=WebGUI"><img src="'.$session{setting}{lib}.'/help.gif" border="0" align="right"></a>';
|
||||
$output = helpLink(8);
|
||||
$output .= '<h1>'.WebGUI::International::get(149).'</h1>';
|
||||
$output .= '<table class="tableData" align="center" width="75%"><tr><td>';
|
||||
$output .= '<a href="'.$session{page}{url}.'?op=addUser">'.WebGUI::International::get(169).'</a>';
|
||||
$output .= '</td><form method="post" action="'.$session{page}{url}.'"><td align="right">';
|
||||
$output .= '</td>'.formHeader().'<td align="right">';
|
||||
$output .= WebGUI::Form::hidden("op","listUsers");
|
||||
$output .= WebGUI::Form::text("keyword",20,50);
|
||||
$output .= WebGUI::Form::submit(WebGUI::International::get(170));
|
||||
|
|
@ -220,7 +297,7 @@ sub www_listUsers {
|
|||
if ($session{form}{keyword} ne "") {
|
||||
$search = " and (username like '%".$session{form}{keyword}."%' or email like '%".$session{form}{keyword}."%') ";
|
||||
}
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from users where username<>'Reserved' $search order by username",$session{dbh});
|
||||
$sth = WebGUI::SQL->read("select userId,username,email from users where username<>'Reserved' $search order by username");
|
||||
while (@data = $sth->array) {
|
||||
$row[$i] = '<tr class="tableData"><td>';
|
||||
$row[$i] .= '<a href="'.$session{page}{url}.'?op=deleteUser&uid='.$data[0].'"><img src="'.$session{setting}{lib}.'/delete.gif" border=0></a>';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue