/[docman]/contrib/backup.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /contrib/backup.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Sat May 26 09:56:51 2001 UTC (22 years, 10 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
script to allow backup using mass downloader (wget, GetRight...)

1 <?php
2
3 /*
4 backup.php -- make a backup of docman site using mass downloader
5
6 Dobrica Pavlinusic <dpavlin@rot13.org>
7 v0.0 2001-05-25
8
9 Usage:
10
11 rename this script to .backup.php in same dir where .index.php is
12
13 $ wget -r -np http://docman.site.com/.backup.php?secret
14
15 where "secret" is password defined below!
16
17 */
18
19
20 // change this to password
21 $password="secret";
22
23 $dir=dirname($SCRIPT_FILENAME);
24 $dir_len=strlen($dir)-strlen(dirname($SCRIPT_NAME));
25
26
27 //////////////////////////////////////////////////////////////////
28
29 function urlpath($url) {
30 $url=urlencode(StripSlashes("$url"));
31 $url=str_replace("%2F","/",$url);
32 $url=str_replace("+","%20",$url);
33 return($url);
34 }
35
36 //////////////////////////////////////////////////////////////////
37
38
39 print "<html>
40 <head>
41 <title>backup docman site</title>
42 </head>
43 <body>";
44
45 if ($QUERY_STRING != $password) {
46 print "you are not allowed to do backup!";
47 } else {
48
49 print "<h1>Files to backup:</h1><ul>";
50
51 $dirs = array( $dir );
52
53 while ($dirs) {
54
55 $dir=array_shift($dirs);
56 $handle=opendir($dir);
57 while ($file = readdir($handle)) {
58 if (substr($file,0,1) != ".") {
59 if (is_dir("$dir/$file"))
60 array_push($dirs,"$dir/$file");
61 else
62 $url=urlpath(substr("$dir",$dir_len,strlen($dir)-$dir_len)."/$file");
63 if ($url != "") {
64 print "<li><a href=\"$url\">$url</a> [$dir/$file]\n";
65 }
66 }
67 }
68 closedir($handle);
69 }
70
71 print "</ul>";
72 }
73
74 print "
75 </body>
76 </html>
77 ";

  ViewVC Help
Powered by ViewVC 1.1.26