1- <?php
2- error_reporting (1 );
1+ <?php
32 class Copy {
4-
5- public $ name = 'this ' ;
63
74 function recursive_copy ($ src , $ dst ) {
85 if (is_dir ($ src )) {
@@ -36,6 +33,8 @@ function recursive_copy($src, $dst) {
3633 }
3734
3835 $ copy = new Copy ();
36+ $ done = '' ;
37+ $ current_path = getcwd () . '/ ' ;
3938
4039 if (isset ($ _POST ['submit ' ]) && $ _POST ['submit ' ] == 'Submit ' ) {
4140 // print_r(getcwd());
@@ -46,19 +45,21 @@ function recursive_copy($src, $dst) {
4645 die;
4746 }
4847
49- $ json = json_decode ($ json , true );
50-
51- $ fix_dst = (isset ($ json ['default_copy_path ' ]) ? $ json ['default_copy_path ' ] : getcwd ()) . '/ ' ;
48+ $ json = json_decode ($ json , true );
5249
53- require_once $ json ['default_path ' ] . '/admin/config.php ' ;
54- require_once $ json ['default_path ' ] . '/config.php ' ;
50+
51+ $ fix_dst = isset ($ json ['default_copy_path ' ]) ? $ current_path . $ json ['default_copy_path ' ] . '/ ' : $ current_path ;
52+
53+ require_once $ current_path . $ json ['default_path ' ] . '/admin/config.php ' ;
54+ require_once $ current_path . $ json ['default_path ' ] . '/config.php ' ;
5555
5656 foreach ($ json ['all_files ' ] as $ key => $ folder ) {
57- $ copy ->recursive_copy ($ json ['default_path ' ] . '/ ' . $ folder , $ fix_dst . $ folder );
57+ $ copy ->recursive_copy ($ current_path . $ json ['default_path ' ] . '/ ' . $ folder , $ fix_dst . $ folder );
5858 }
5959 foreach ($ json ['single_file ' ] as $ key => $ file ) {
60- $ copy ->recursive_copy ($ json ['default_path ' ] . '/ ' . $ file , $ fix_dst . $ file );
60+ $ copy ->recursive_copy ($ current_path . $ json ['default_path ' ] . '/ ' . $ file , $ fix_dst . $ file );
6161 }
62+ $ done = 'success ' ;
6263 }
6364?>
6465
@@ -68,11 +69,15 @@ function recursive_copy($src, $dst) {
6869 <title>CES Module Backup</title>
6970</head>
7071<body>
72+ <?php if ($ done == 'success ' ) { ?>
73+ <div style="display: block; width: 100%; background-color: lightgreen; font-size: 24px; text-align: center">Success</div>
74+ <?php } ?>
75+
7176 <form action="" method="post" enctype="multipart/form-data">
7277 <label>Upload Schema File</label> <input name="file" type="file" />
7378 <br />
7479 <br />
7580 <input type="submit" name="submit" value="Submit"/>
7681 </form>
7782</body>
78- </html>
83+ </html>
0 commit comments