home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
oss
/
cvs-2004
/
bahasa
/
web
/
dictionary.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
11KB
|
630 lines
head 1.6;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.6
date 2003.10.20.00.21.45; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.10.18.00.33.41; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.10.06.00.39.26; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.10.01.06.51.29; author bule; state Exp;
branches;
next 1.2;
1.2
date 2003.08.19.06.42.07; author bule; state Exp;
branches;
next 1.1;
1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2003.08.12.19.18.23; author bule; state Exp;
branches;
next ;
desc
@@
1.6
log
@*** empty log message ***
@
text
@<?
session_start();
require_once("../php/Indonesia.php");
require_once("../php/Web.php");
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Project Name: Bahasa Indonesia Dictionary
// Directory: bahasa/web
// File Name: dictionary.php
// Author(s): John L. Whiteman
// Created: June 23, 2003
// Modified: October 19, 2003
// Description: The purpose of this restricted access PHP web
// client page is provide major table operations
// against the dictionary database, like create,
// recreate, and delete table operations.
//
// Copyright (c) 2003 John L. Whiteman
//
// Permission is herby granted, free of charge, to any person obtaining a
// copy of this software, data, and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
// ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHERE IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING IN THE SOFTWARE.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
$web = new Web();
if (
(!$_SESSION['ADMIN']) &&
(!$_SESSION['DB_ADMIN'])) {
$web->redirect("login.php");
exit;
}
if ($_SESSION['NODUP_DICTIONARY']) {
unset($_SESSION['NODUP_DICTIONARY']);
$web->redirect("admin.php");
exit;
}
if (
(!isset($_POST['create'])) &&
(!isset($_POST['destroy'])) &&
(!isset($_POST['recreate'])) &&
(!isset($_POST['password']))) {
$web->redirect("admin.php");
exit;
}
$indonesia = new Indonesia();
$status = $indonesia->get_dictionary_status();
if ($status["status"] == 1) {
$web->redirect("admin.php");
exit;
}
$is_initialized = 0;
if (
$status["status"] == 0 ||
$status["status"] == 3 ||
$status["status"] == 4) {
$is_initialized = 1;
}
$title = "Create Dictionary";
//Can't destroy because never created
if (isset($_POST['destroy'])) {
if (!$is_initialized) {
$web->redirect("admin.php");
exit;
}
$title = "Destroy Dictionary";
}
//Can't recreate because never created
if (isset($_POST['recreate'])) {
if (!$is_initialized) {
$web->redirect("admin.php");
exit;
}
$title = "Recreate Dictionary";
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: <? echo ${title};?></title>
<link href="bahasa.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bahasa.js"></script>
<script language="Javascript" type="text/javascript">
<!--
//////////////////////////////////////////////////////////////////////////////
function verify() {
var name = document.dictionary.name.value;
name = trim(name);
if (is_white_space(name)) {
alert("You must enter your name.");
document.dictionary.name.focus();
return(false);
}
var password = document.dictionary.password.value;
if (is_white_space(password)) {
alert("You must enter your password.");
document.dictionary.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<body>
<?
$web->show_logo("$title");
?>
<a href="admin.php">Administration</a>
<br><br>
<?
if (!isset($_POST['password'])) {
if (isset($_POST['destroy'])) {
show_destroy($indonesia);
} else if (isset($_POST['recreate'])) {
show_recreate($indonesia);
} else if (isset($_POST['create'])) {
show_create($indonesia);
//Should never reach here, but just in case
} else {
print
"This option is not supported.<br>\n" .
"Please go to " .
"<a href=\"admin.php\">Administration</a>" .
" to see what is available.";
}
} else if ((isset($_POST['name'])) && (isset($_POST['password']))) {
if (isset($_POST['destroy'])) {
$errstr =
$indonesia->login_db_user(
$_POST['name'], $_POST['password']);
if ($errstr != "") {
show_destroy($indonesia);
print "<br><hr><b>${errstr}</b><hr><br>\n";
} else {
$errstr =
$indonesia->destroy_dictionary();
if ($errstr != "") {
print
"<br><b>ERROR:</b><br>\n" .
"${errstr}<br>";
} else {
print
"<br><b>SUCCESS:</b><br>\n" .
"Dictionary tables and data " .
"destroyed!<br>" .
"Please log back in as " .
"database administrator.";
$_SESSION['NODUP_DICTIONARY'] = 1;
unset($_SESSION['ADMIN']);
}
}
} else if (isset($_POST['recreate'])) {
$errstr =
$indonesia->login_db_user(
$_POST['name'], $_POST['password']);
if ($errstr != "") {
show_recreate($indonesia);
print "<br><hr><b>${errstr}</b><hr><br>\n";
} else {
$errstr =
$indonesia->create_dictionary();
if ($errstr != "") {
print
"<br><b>ERROR:</b><br>\n" .
"${errstr}<br>";
} else {
print
"<br><b>SUCCESS:</b><br>\n" .
"Dictionary tables and data " .
"recreated!<br>";
$_SESSION['NODUP_DICTIONARY'] = 1;
}
}
} else if (isset($_POST['create'])) {
$errstr =
$indonesia->login_db_user(
$_POST['name'], $_POST['password']);
if ($errstr != "") {
show_create($indonesia);
print "<br><hr><b>${errstr}</b><hr><br>\n";
} else {
$errstr =
$indonesia->create_dictionary();
if ($errstr != "") {
print
"<br><b>ERROR:</b><br>\n" .
"${errstr}<br>";
} else {
print
"<br><b>SUCCESS:</b><br>\n" .
"Dictionary tables and data " .
"created!<br>" .
"Please log back in as an " .
"administrator.";
$_SESSION['NODUP_DICTIONARY'] = 1;
unset($_SESSION['DB_ADMIN']);
}
}
//Should never reach here, but just in case
} else {
print
"This option is not supported.<br>\n" .
"Please go to " .
"<a href=\"admin.php\">Administration</a>" .
" to see what is available.";
}
}
?>
</body>
</html>
<?
function show_create($indonesia) {
print <<<EOFSC
<b>WARNING:</b><br>
This operation will create the default tables and data
in the dictionary database.<br>
It assumes that you already created a database and
configured the Dictionary.pm class module properly.<br>
See project documentation for more details if you are not sure.
<form name="dictionary" method="post" onsubmit="return verify()">
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>
<input type="submit" value="Create Dictionary">
</td>
<td>
Name:
</td>
<td>
<input type="text" name="name">
</td>
<td>
Password:
</td>
<td>
<input type="password" name="password">
</td>
</tr>
</table>
<input type="hidden" name="create" value="1">
<input type="hidden" name="create_flag" value="1">
</form>
EOFSC;
return;
}
function show_destroy($indonesia) {
print <<<EOFSD
<b>WARNING:</b><br>
All tables and data in the dictionary database will be
permanently destroyed.<br>
If new data has been inserted into the dictionary since
it was last created,<br>then you should
<a href="backup.php">backup</a>
the dictionary before proceeding with this operation.
<form name="dictionary" method="post" onsubmit="return verify()">
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>Name:</td>
<td>
<input type="text" name="name">
</td>
<td>
Password:
</td>
<td>
<input type="password" name="password">
</td>
</tr><tr>
<td colspan="4" align="right">
<input type="submit" value="Destroy Dictionary!">
</td>
</tr>
</table>
<input type="hidden" name="destroy" value="1">
</form>
<script language="Javascript" type="text/javascript">
document.dictionary.name.focus();
</script>
EOFSD;
return;
}
function show_recreate($indonesia) {
print <<<EOFSR
<b>WARNING:</b><br>
All tables and data in the dictionary database will be
permanently destroyed.<br>
If new data has been inserted into the dictionary since
it was last created,<br>then you should
<a href="backup.php">backup</a>
the dictionary before proceeding with this operation.
<form name="dictionary" method="post" onsubmit="return verify()">
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>
Name:
</td>
<td>
<input type="text" name="name">
</td>
<td>
Password:
</td>
<td>
<input type="password" name="password">
</td>
</tr><tr>
<td colspan="4" align="right">
<input type="submit" value="Recreate Dictionary!">
</td>
</tr>
</table>
<input type="hidden" name="recreate" value="1">
</form>
<script language="Javascript" type="text/javascript">
document.dictionary.name.focus();
</script>
EOFSR;
return;
}
?>
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d122 2
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d121 3
a123 3
<title>
Bahasa Indonesia Dictionary: <? echo ${title};?>
</title>
d126 2
a127 26
function is_white_space(stoken) {
if (stoken == null) return(true);
if (stoken == '') return(true);
if (stoken == "") return(true);
return(false);
}
function trim(stoken) {
if (is_white_space(stoken)) {
return(stoken)
}
stoken = stoken.replace(/^\s*/, "");
stoken = stoken.replace(/\s*&/, "");
return(token);
}
d156 2
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d184 3
a186 1
<h2>Bahasa Indonesia Dictionary: <? echo ${title};?></h2>
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 18, 2003
d42 2
a43 2
(!session_is_registered("ADMIN")) &&
(!session_is_registered("DB_ADMIN"))) {
d50 1
a50 1
if (session_is_registered("NODUP_DICTIONARY")) {
d52 1
a52 1
session_unregister("NODUP_DICTIONARY");
d249 1
a249 1
$NODUP_DICTIONARY = 1;
d251 1
a251 3
session_register("NODUP_DICTIONARY");
session_unregister("ADMIN");
d285 1
a285 3
$NODUP_DICTIONARY = 1;
session_register("NODUP_DICTIONARY");
d322 1
a322 3
$NODUP_DICTIONARY = 1;
session_register("NODUP_DICTIONARY");
d324 1
a324 1
session_unregister("DB_ADMIN");
@
1.1
log
@Initial revision
@
text
@d5 34
a38 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@