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
/
backup.php,v
< prev
next >
Wrap
Text File
|
2003-10-20
|
12KB
|
707 lines
head 1.9;
access;
symbols
Initial:1.1.1.1 bule:1.1.1;
locks; strict;
comment @# @;
1.9
date 2003.10.20.00.21.45; author bule; state Exp;
branches;
next 1.8;
1.8
date 2003.10.18.00.33.41; author bule; state Exp;
branches;
next 1.7;
1.7
date 2003.10.06.00.39.26; author bule; state Exp;
branches;
next 1.6;
1.6
date 2003.10.01.06.51.29; author bule; state Exp;
branches;
next 1.5;
1.5
date 2003.09.11.05.28.22; author bule; state Exp;
branches;
next 1.4;
1.4
date 2003.09.05.06.42.30; author bule; state Exp;
branches;
next 1.3;
1.3
date 2003.09.04.07.26.59; 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.9
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: backup.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 backup capabilities for various
// tables in the database.
//
// 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']) {
$web->redirect("login.php");
exit;
}
$indonesia = new Indonesia();
$status = $indonesia->get_dictionary_status();
if ($status["status"] == 1 || $status["status"] == 2) {
$web->redirect("admin.php");
exit;
}
?>
<html>
<head>
<title>Bahasa Indonesia Dictionary: Backup Tables</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() {
password = document.backups.password.value;
if (is_white_space(password)) {
alert("You must enter a password value.");
document.backups.password.focus();
return(false);
}
return(true);
}
//////////////////////////////////////////////////////////////////////////////
// -->
</script>
</head>
<body>
<?
$web->show_logo("Backup Tables");
?>
<a href="admin.php">Administration</a>
<br>
<?
if (
($_SESSION['NODUP_BACKUPS']) &&
(isset($_POST['id'])) &&
($_SESSION['NODUP_BACKUPS'] == $_POST['id'])) {
//Do nothing...prevents refresh duplication of last action
} else if (
(isset($_POST['backup_tables'])) &&
(isset($_POST['id'])) &&
(isset($_POST['password']))) {
$total_tables = count($_POST['backup_tables']);
$all_flag = 0;
$fail_flag = 0;
foreach($_POST['backup_tables'] as $table) {
$table = $web->strip($table);
if ($total_tables > 1 && $table == "all") {
print
"<hr><b>You can't select ALL TABLES " .
"and one or more individual tables. " .
"Select one or the other only.</b><hr>\n";
$fail_flag = 1;
break;
} else if ($table == "all") {
$all_flag = 1;
}
}
if (!$fail_flag) {
if ($_SESSION['NODUP_BACKUPS']) {
unset($_SESSION['NODUP_BACKUPS']);
}
$errstr =
$indonesia->login($_SESSION['ADMIN'], $_POST['password']);
if ($errstr != "") {
print "<hr><b>Permission denied!</b><hr>\n";
} else if ($all_flag == 1) {
$errstr = $indonesia->backup();
if ($errstr != "") {
print
"<hr><b>${errstr}</b><hr>\n";
} else {
print
"<hr><b>Successful backup for " .
"all tables.</b><hr>\n";
$_SESSION['NODUP_BACKUPS'] = $_POST['id'];
}
} else {
$backed_up_tables = 0;
$fail_flag = 0;
foreach($_POST['backup_tables'] as $table) {
$table = $web->strip($table);
$errstr = $indonesia->create_backup($table);
if ($errstr != "") {
print "<hr><b>${errstr}</b><hr>\n";
$fail_flag = 1;
break;
} else {
$table_uc = ucfirst($table);
$table_uc =
preg_replace("/_/", " ", $table_uc);
print
"<hr><b>Successful backup " .
"for table: ${table_uc}</b><hr>\n";
$backed_up_tables++;
}
if ($backed_up_tables == 1) {
$_SESSION['NODUP_BACKUPS'] =
$_POST['id'];
}
}
if ((!$fail_flag) && ($backed_up_tables == 0)) {
print
"<hr><b>You must select at least " .
"one table or ALL TABLES.</b><hr>\n";
}
}
}
} else if (
(isset($_POST['id'])) &&
(isset($_POST['password']))) {
if ($_SESSION['NODUP_BACKUPS']) {
unset($_SESSION['NODUP_BACKUPS']);
}
print
"<hr><b>You must select at least one table or ALL TABLES.</b><hr>\n";
}
show_tables($web, $indonesia);
?>
</body>
</html>
<?
//////////////////////////////////////////////////////////////////////////////
function show_tables($web, $indonesia) {
$sql_files = array();
$id = uniqid(rand(), true);
$errstr = $indonesia->get_sql_data_files($sql_files);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
return;
}
$total_tables = count($sql_files) + 1;
$table_select =
"\n<select multiple size=\"${total_tables}\" " .
"name=\"backup_tables[]\">\n" .
"<option value=\"all\">ALL TABLES\n";
foreach($sql_files as $table => $path) {
$table = $web->tohtml($table);
$table_uc = ucfirst($table);
$table_uc = preg_replace("/_/", " ", $table_uc);
$table_select .= "<option value=\"${table}\">${table_uc}\n";
}
$table_select .= "</select>\n";
print <<<EOFST
<form name="backups" method="post" onsubmit='return verify()'>
<table width="50%" cellpadding="3" cellspacing="3" border="1">
<tr>
<td wrap>
<b>Select one or more<br>
tables or ALL TABLES:</b>
</td>
<td colspan="2">${table_select}</td>
</tr><tr>
<td colspan="3"> </td>
</tr><tr>
<td>
<input type="submit" value="Backup!">
</td>
<td>
<b>Password:</b>
</td>
<td align="center">
<input type="password" name="password">
</td>
</tr>
</tr><tr>
<td wrap colspan="3">
<i>Note: Some tables may require up to a few minutes to do a complete
backup. Please wait for backup to complete before doing something else.</i>
</td>
</tr>
</table>
<input type="hidden" name="id" value="${id}">
</form>
<script language="Javascript" type="text/javascript">
</script>
EOFST;
return;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
?>
@
1.8
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 17, 2003
d62 2
@
1.7
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: October 05, 2003
d63 2
d66 1
a66 25
//////////////////////////////////////////////////////////////////////////////
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(stoken);
}
d84 1
a84 1
//////////////////////////////////////////////////////////////////////////////
@
1.6
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 30, 2003
d110 3
a112 1
<h2>Bahasa Indonesia Dictionary: Backup Tables</h2>
@
1.5
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 08, 2003
d40 1
a40 1
if (!session_is_registered("ADMIN")) {
d115 1
a115 1
(session_is_registered("NODUP_BACKUPS")) &&
d155 1
a155 1
if (session_is_registered("NODUP_BACKUPS")) {
d157 1
a157 1
session_unregister("NODUP_BACKUPS");
d182 1
a182 3
$NODUP_BACKUPS = $_POST['id'];
session_register("NODUP_BACKUPS");
d220 2
a221 3
$NODUP_BACKUPS = $_POST['id'];
session_register("NODUP_BACKUPS");
d238 1
a238 1
if (session_is_registered("NODUP_BACKUPS")) {
d240 1
a240 1
session_unregister("NODUP_BACKUPS");
d292 1
a292 1
<table cellpadding="3" cellspacing="3" border="1">
d308 1
a308 1
<td bgcolor="black">
d310 6
@
1.4
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 04, 2003
d109 1
a109 1
<body bgcolor="#CCCC99">
@
1.3
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: September 03, 2003
a91 13
//name = document.backups.backup_tables[].value;
//if (is_white_space(name)) {
// alert(
// "You must select one or more tables " +
// "to backup or ALL tables.");
// document.backups.backup_tables.focus();
// return(false);
//}
d109 1
a109 1
<body>
d236 12
d298 2
a299 2
Select one or more<br>
tables or ALL TABLES:
d309 1
a309 1
Password:
d311 1
a311 1
<td>
@
1.2
log
@*** empty log message ***
@
text
@d12 1
a12 1
// Modified: August 18, 2003
a46 9
if (session_is_registered("NODUP_BACKUP_TABLE")) {
session_unregister("NODUP_BACKUP_TABLE");
$web->redirect("admin.php");
exit;
}
d61 1
a61 1
<title>Bahasa Indonesia Dictionary: Backup</title>
d92 1
a92 1
name = document.backup.backup_table.value;
d94 1
a94 1
if (is_white_space(name)) {
d96 3
a98 1
alert("You must select a table to backup or ALL tables.");
d100 1
a100 1
document.backup.backup_table.focus();
d102 2
a103 2
return(false);
}
d105 1
a105 1
password = document.backup.password.value;
d111 1
a111 1
document.backup.password.focus();
d123 1
a123 1
<h2>Bahasa Indonesia Dictionary: Backup</h2>
d125 1
a125 1
<br><br>
d127 40
a166 1
if (isset($_POST['backup_table']) && isset($_POST['password'])) {
d168 1
a168 1
$errstr = $indonesia->login($_SESSION['ADMIN'], $_POST['password']);
d170 5
a174 1
if ($errstr != "") {
d176 1
a176 1
print "<br><hr><b>Permission denied!</b><hr><br>\n";
d178 1
a178 1
} else {
d180 1
a180 1
if ($_POST['backup_table'] == "all") {
d187 1
a187 1
"<br><hr><b>${errstr}</b><hr><br>\n";
d192 2
a193 2
"<br><hr><b>Successful backup operation " .
"for all tables.</b><hr><br>\n";
d195 1
a195 1
$NODUP_BACKUP_TABLE = 1;
d197 1
a197 1
session_register("NODUP_BACKUP_TABLE");
d200 22
a221 1
} else {
d223 2
a224 2
$errstr =
$indonesia->create_backup($_POST['backup_table']);
d226 6
a231 1
if ($errstr != "") {
d233 1
a233 2
print
"<br><hr><b>${errstr}</b><hr><br>\n";
d235 1
a235 1
} else {
d237 3
a239 6
print
"<br><hr><b>Successful backup operation " .
"for " .
$_POST['backup_table'] .
" table." .
"</b><hr><br>\n";
d241 1
a241 1
$NODUP_BACKUP_TABLE = 1;
d243 3
a245 1
session_register("NODUP_BACKUP_TABLE");
d249 1
d251 1
a251 1
} else {
a252 2
show_tables($web, $indonesia);
}
d263 2
d274 2
d277 2
a278 2
"\n<select name=\"backup_table\">\n" .
"<option value=\"\">\n" .
d283 2
d295 1
a295 1
<form name="backup" method="post" onsubmit='return verify()'>
d298 4
a301 1
<td>Select a Table:</td>
d317 1
a319 1
document.backup.backup_table.focus();
@
1.1
log
@Initial revision
@
text
@d5 33
a37 1
a259 1
@
1.1.1.1
log
@Bahasa Indonesia Dictionary
@
text
@@