GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch dev (8ea4e3)
by Liuta
02:53
created
includes/class-xcloner-api.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 
109
-    /**
110
-     * Checks API access
111
-     */
112
-    private function check_access()
109
+	/**
110
+	 * Checks API access
111
+	 */
112
+	private function check_access()
113 113
 	{
114 114
 		if (function_exists('current_user_can') && !current_user_can('manage_options')) {
115 115
 			die("Not allowed access here!");
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
      */
292 292
 	public function backup_files()
293 293
 	{
294
-        $return = array();
295
-        $additional = array();
294
+		$return = array();
295
+		$additional = array();
296 296
 
297 297
 		$this->check_access();
298 298
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
 	public function backup_database()
358 358
 	{
359
-        $data = array();
359
+		$data = array();
360 360
 
361 361
 		$this->check_access();
362 362
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
      */
393 393
 	public function scan_filesystem()
394 394
 	{
395
-        $data = array();
395
+		$data = array();
396 396
 
397 397
 		$this->check_access();
398 398
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
      */
678 678
 	public function get_scheduler_list()
679 679
 	{
680
-        $return = array();
680
+		$return = array();
681 681
 
682 682
 		$this->check_access();
683 683
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
      */
762 762
 	public function delete_schedule_by_id()
763 763
 	{
764
-        $data = array();
764
+		$data = array();
765 765
 
766 766
 		$this->check_access();
767 767
 
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
      */
780 780
 	public function delete_backup_by_name()
781 781
 	{
782
-        $data = array();
782
+		$data = array();
783 783
 
784 784
 		$this->check_access();
785 785
 
@@ -928,9 +928,9 @@  discard block
 block discarded – undo
928 928
 
929 929
 	public function get_manage_backups_list() {
930 930
 
931
-        $this->check_access();
931
+		$this->check_access();
932 932
 
933
-        $return = array();
933
+		$return = array();
934 934
 		$storage_selection = "";
935 935
 
936 936
 		if (isset($_GET['storage_selection']) and $_GET['storage_selection']) {
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 		$this->check_access();
1114 1114
 
1115 1115
 		$backup_parts = array();
1116
-        $return = array();
1116
+		$return = array();
1117 1117
 
1118 1118
 		$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
1119 1119
 		$start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start']);
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 	{
1226 1226
 		$this->check_access();
1227 1227
 
1228
-        $return = array();
1228
+		$return = array();
1229 1229
 
1230 1230
 		$backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
1231 1231
 		$storage_type = $this->xcloner_sanitization->sanitize_input_as_string($_POST['storage_type']);
@@ -1334,9 +1334,9 @@  discard block
 block discarded – undo
1334 1334
 		}
1335 1335
 
1336 1336
 		try {
1337
-            unlink($tmp_file);
1338
-        }catch(Exception $e) {
1339
-        }
1337
+			unlink($tmp_file);
1338
+		}catch(Exception $e) {
1339
+		}
1340 1340
 
1341 1341
 		exit;
1342 1342
 	}
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 	{
1388 1388
 		$this->check_access();
1389 1389
 
1390
-        $return = array();
1390
+		$return = array();
1391 1391
 
1392 1392
 		$return['part'] = 0;
1393 1393
 		$return['total_parts'] = 0;
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		$this->xcloner_remote_storage   = $xcloner_container->get_xcloner_remote_storage();
91 91
 
92 92
 		if (isset($_POST['API_ID'])) {
93
-			$this->logger->info("Processing ajax request ID " . substr($this->xcloner_sanitization->sanitize_input_as_string($_POST['API_ID']),
93
+			$this->logger->info("Processing ajax request ID ".substr($this->xcloner_sanitization->sanitize_input_as_string($_POST['API_ID']),
94 94
 					0, 15));
95 95
 		}
96 96
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 
132 132
 
133 133
 		$data['recordsPerSession'] = $this->xcloner_settings->get_xcloner_option('xcloner_database_records_per_request');
134
-		$data['TEMP_DBPROCESS_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path() . DS . ".database";
135
-		$data['TEMP_DUMP_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path() . DS . "database-sql.sql";
134
+		$data['TEMP_DBPROCESS_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS.".database";
135
+		$data['TEMP_DUMP_FILE'] = $this->xcloner_settings->get_xcloner_tmp_path().DS."database-sql.sql";
136 136
 
137 137
 		try {
138 138
 			$this->xcloner_database->init($data);
139 139
 
140
-		} catch (Exception $e) {
140
+		}catch (Exception $e) {
141 141
 
142 142
 			$this->send_response($e->getMessage());
143 143
 			$this->logger->error($e->getMessage());
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 		} else {
224 224
 
225 225
 			$schedule['status'] = 1;
226
-			$schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'] .
227
-				" " . $this->form_params['backup_params']['schedule_start_time']);
226
+			$schedule['start_at'] = strtotime($this->form_params['backup_params']['schedule_start_date'].
227
+				" ".$this->form_params['backup_params']['schedule_start_time']);
228 228
 
229 229
 			if ($schedule['start_at'] <= time()) {
230 230
 				$schedule['start_at'] = "";
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 		if (!isset($_POST['id'])) {
251 251
 			$wpdb->insert(
252
-				$wpdb->prefix . 'xcloner_scheduler',
252
+				$wpdb->prefix.'xcloner_scheduler',
253 253
 				$schedule,
254 254
 				array(
255 255
 					'%s',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		} else {
260 260
 			$wpdb->update(
261
-				$wpdb->prefix . 'xcloner_scheduler',
261
+				$wpdb->prefix.'xcloner_scheduler',
262 262
 				$schedule,
263 263
 				array('id' => $_POST['id']),
264 264
 				array(
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		try {
313 313
 			$return = $this->archive_system->start_incremental_backup($this->form_params['backup_params'],
314 314
 				$this->form_params['extra'], $init);
315
-		} catch (Exception $e) {
315
+		}catch (Exception $e) {
316 316
 			$return = array();
317 317
 			$return['error'] = true;
318 318
 			$return['status'] = 500;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 					$additional['lines_total'] = $return['extra']['lines_total'];
340 340
 					$this->archive_system->send_notification($to, $from, $subject, $return['extra']['backup_parent'],
341 341
 						$this->form_params, "", $additional);
342
-				} catch (Exception $e) {
342
+				}catch (Exception $e) {
343 343
 					$this->logger->error($e->getMessage());
344 344
 				}
345 345
 			}
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		if (isset($params->backup_params)) {
438 438
 			foreach ($params->backup_params as $param) {
439 439
 				$this->form_params['backup_params'][$param->name] = $this->xcloner_sanitization->sanitize_input_as_string($param->value);
440
-				$this->logger->debug("Adding form parameter " . $param->name . "." . $param->value . "\n", array(
440
+				$this->logger->debug("Adding form parameter ".$param->name.".".$param->value."\n", array(
441 441
 					'POST',
442 442
 					'fields filter'
443 443
 				));
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		if (isset($params->table_params)) {
450 450
 			foreach ($params->table_params as $param) {
451 451
 				$this->form_params['database'][$param->parent][] = $this->xcloner_sanitization->sanitize_input_as_raw($param->id);
452
-				$this->logger->debug("Adding database filter " . $param->parent . "." . $param->id . "\n", array(
452
+				$this->logger->debug("Adding database filter ".$param->parent.".".$param->id."\n", array(
453 453
 					'POST',
454 454
 					'database filter'
455 455
 				));
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 				if (!in_array($param->parent, $this->form_params['excluded_files'])) {
469 469
 					//$this->form_params['excluded_files'][] = $this->xcloner_sanitization->sanitize_input_as_relative_path($param->id);
470 470
 					$unique_exclude_files[] = $param->id;
471
-					$this->logger->debug("Adding file filter " . $param->id . "\n", array(
471
+					$this->logger->debug("Adding file filter ".$param->id."\n", array(
472 472
 						'POST',
473 473
 						'exclude files filter'
474 474
 					));
@@ -516,13 +516,13 @@  discard block
 block discarded – undo
516 516
 				'text' => $this->xcloner_settings->get_xcloner_start_path(),
517 517
 				//'children' => true,
518 518
 				'state' => array('selected' => false, 'opened' => true),
519
-				'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/file-icon-root.png"
519
+				'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/file-icon-root.png"
520 520
 			);
521 521
 		}
522 522
 
523 523
 		try {
524 524
 			$files = $this->xcloner_file_system->list_directory($folder);
525
-		} catch (Exception $e) {
525
+		}catch (Exception $e) {
526 526
 
527 527
 			print $e->getMessage();
528 528
 			$this->logger->error($e->getMessage());
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			if ($file['type'] == "dir") {
544 544
 				$children = true;
545 545
 			} else {
546
-				$text .= " (" . $this->xcloner_requirements->file_format_size($file['size']) . ")";
546
+				$text .= " (".$this->xcloner_requirements->file_format_size($file['size']).")";
547 547
 			}
548 548
 
549 549
 			if ($this->xcloner_file_system->is_excluded($file)) {
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 				//'title' => "test",
560 560
 				'children' => $children,
561 561
 				'state' => array('selected' => $selected, 'opened' => false, "checkbox_disabled" => $selected),
562
-				'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/file-icon-" . strtolower(substr($file['type'],
563
-						0, 1)) . ".png"
562
+				'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/file-icon-".strtolower(substr($file['type'],
563
+						0, 1)).".png"
564 564
 			);
565 565
 		}
566 566
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		if ($database == "#") {
587 587
 			try {
588 588
 				$return = $this->xcloner_database->get_all_databases();
589
-			} catch (Exception $e) {
589
+			}catch (Exception $e) {
590 590
 				$this->logger->error($e->getMessage());
591 591
 			}
592 592
 
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
 				$data[] = array(
608 608
 					'id' => $database['name'],
609 609
 					'parent' => '#',
610
-					'text' => $database['name'] . " (" . (int)$database['num_tables'] . ")",
610
+					'text' => $database['name']." (".(int)$database['num_tables'].")",
611 611
 					'children' => true,
612 612
 					'state' => $state,
613
-					'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/database-icon.png"
613
+					'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/database-icon.png"
614 614
 				);
615 615
 			}
616 616
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
 			try {
620 620
 				$return = $this->xcloner_database->list_tables($database, "", 1);
621
-			} catch (Exception $e) {
621
+			}catch (Exception $e) {
622 622
 				$this->logger->error($e->getMessage());
623 623
 			}
624 624
 
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
 				}
636 636
 
637 637
 				$data[] = array(
638
-					'id' => $database . "." . $table['name'],
638
+					'id' => $database.".".$table['name'],
639 639
 					'parent' => $database,
640
-					'text' => $table['name'] . " (" . (int)$table['records'] . ")",
640
+					'text' => $table['name']." (".(int)$table['records'].")",
641 641
 					'children' => false,
642 642
 					'state' => $state,
643
-					'icon' => plugin_dir_url(dirname(__FILE__)) . "/admin/assets/table-icon.png"
643
+					'icon' => plugin_dir_url(dirname(__FILE__))."/admin/assets/table-icon.png"
644 644
 				);
645 645
 			}
646 646
 		}
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
 		$return['data'] = array();
687 687
 
688 688
 		foreach ($data as $res) {
689
-			$action = "<a href=\"#" . $res->id . "\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a>
690
-					<a href=\"#" . $res->id . "\" class=\"delete\" title='Delete'><i class=\"material-icons  \">delete</i></a>";
689
+			$action = "<a href=\"#".$res->id."\" class=\"edit\" title='Edit'> <i class=\"material-icons \">edit</i></a>
690
+					<a href=\"#" . $res->id."\" class=\"delete\" title='Delete'><i class=\"material-icons  \">delete</i></a>";
691 691
 			if ($res->status) {
692 692
 				$status = '<i class="material-icons active status">timer</i>';
693 693
 			} else {
694 694
 				$status = '<i class="material-icons status inactive">timer_off</i>';
695 695
 			}
696 696
 
697
-			$next_run_time = wp_next_scheduled('xcloner_scheduler_' . $res->id, array($res->id));
697
+			$next_run_time = wp_next_scheduled('xcloner_scheduler_'.$res->id, array($res->id));
698 698
 
699
-			$next_run = date(get_option('date_format') . " " . get_option('time_format'), $next_run_time);
699
+			$next_run = date(get_option('date_format')." ".get_option('time_format'), $next_run_time);
700 700
 
701 701
 			$remote_storage = $res->remote_storage;
702 702
 
@@ -705,16 +705,16 @@  discard block
 block discarded – undo
705 705
 			}
706 706
 
707 707
 			if (trim($next_run)) {
708
-				$date_text = date(get_option('date_format') . " " . get_option('time_format'),
708
+				$date_text = date(get_option('date_format')." ".get_option('time_format'),
709 709
 					$next_run_time + (get_option('gmt_offset') * HOUR_IN_SECONDS));
710 710
 
711 711
 				if ($next_run_time >= time()) {
712
-					$next_run = "in " . human_time_diff($next_run_time, time());
712
+					$next_run = "in ".human_time_diff($next_run_time, time());
713 713
 				} else {
714 714
 					$next_run = __("executed", 'xcloner-backup-and-restore');
715 715
 				}
716 716
 
717
-				$next_run = "<a href='#' title='" . $date_text . "'>" . $next_run . "</a>";
717
+				$next_run = "<a href='#' title='".$date_text."'>".$next_run."</a>";
718 718
 				//$next_run .=" ($date_text)";
719 719
 			}
720 720
 
@@ -726,11 +726,11 @@  discard block
 block discarded – undo
726 726
 				if ($this->xcloner_file_system->get_storage_filesystem()->has($res->last_backup)) {
727 727
 					$metadata = $this->xcloner_file_system->get_storage_filesystem()->getMetadata($res->last_backup);
728 728
 					$backup_size = size_format($this->xcloner_file_system->get_backup_size($res->last_backup));
729
-					$backup_time = date(get_option('date_format') . " " . get_option('time_format'),
729
+					$backup_time = date(get_option('date_format')." ".get_option('time_format'),
730 730
 						$metadata['timestamp'] + (get_option('gmt_offset') * HOUR_IN_SECONDS));
731 731
 				}
732 732
 
733
-				$backup_text = "<span title='" . $backup_time . "' class='shorten_string'>" . $res->last_backup . " (" . $backup_size . ")</span>";
733
+				$backup_text = "<span title='".$backup_time."' class='shorten_string'>".$res->last_backup." (".$backup_size.")</span>";
734 734
 			}
735 735
 
736 736
 			$schedules = wp_get_schedules();
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			$return['data'][] = array(
743 743
 				$res->id,
744 744
 				$res->name,
745
-				$res->recurrence,/*$res->start_at,*/
745
+				$res->recurrence, /*$res->start_at,*/
746 746
 				$next_run,
747 747
 				$remote_storage,
748 748
 				$backup_text,
@@ -808,25 +808,25 @@  discard block
 block discarded – undo
808 808
 			$this->process_params($params);
809 809
 			$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($this->form_params['extra']['backup_parent']);
810 810
 
811
-			if(isset($this->form_params['extra']['start'])) {
811
+			if (isset($this->form_params['extra']['start'])) {
812 812
 				$start = $this->xcloner_sanitization->sanitize_input_as_int($this->form_params['extra']['start']);
813
-			}else{
813
+			} else {
814 814
 				$start = 0;
815 815
 			}
816 816
 
817
-			if(isset($this->form_params['extra']['iv'])) {
817
+			if (isset($this->form_params['extra']['iv'])) {
818 818
 				$iv = $this->xcloner_sanitization->sanitize_input_as_raw($this->form_params['extra']['iv']);
819
-			}else{
819
+			} else {
820 820
 				$iv = "";
821 821
 			}
822 822
 
823
-			if(isset($this->form_params['extra']['part'])) {
823
+			if (isset($this->form_params['extra']['part'])) {
824 824
 				$return['part'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($this->form_params['extra']['part']);
825
-			}else{
825
+			} else {
826 826
 				$return['part'] = 0;
827 827
 			}
828 828
 
829
-		}else{
829
+		} else {
830 830
 			$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
831 831
 			$start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start']);
832 832
 			$iv = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['iv']);
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
 		}
842 842
 
843 843
 		$return['processing_file'] = $backup_file;
844
-		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file);
844
+		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file);
845 845
 
846 846
 		try {
847 847
 			$this->logger->info(json_encode($_POST));
848 848
 			$this->logger->info($iv);
849 849
 			$return = array_merge($return,
850 850
 				$this->xcloner_encryption->encrypt_file($backup_file, "", "", $start, base64_decode($iv)));
851
-		}catch(\Exception $e){
851
+		}catch (\Exception $e) {
852 852
 			$return['error'] = true;
853 853
 			$return['message'] = $e->getMessage();
854 854
 			$return['error_message'] = $e->getMessage();
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 		//echo strlen($return['iv']);exit;
858 858
 
859
-		if($return['finished']) {
859
+		if ($return['finished']) {
860 860
 			if ($this->xcloner_file_system->is_multipart($source_backup_file)) {
861 861
 				$return['start'] = 0;
862 862
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 
872 872
 		if (isset($_POST['data'])) {
873
-			$return['extra'] = array_merge($this->form_params['extra'],  $return);
873
+			$return['extra'] = array_merge($this->form_params['extra'], $return);
874 874
 		}
875 875
 
876 876
 		$this->send_response($return, 0);
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 		$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
890 890
 		$start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start']);
891 891
 		$iv = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['iv']);
892
-		$decryption_key = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['decryption_key']);;
892
+		$decryption_key = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['decryption_key']); ;
893 893
 		$return['part'] = $this->xcloner_sanitization->sanitize_input_as_int($_POST['part']);
894 894
 
895 895
 		$backup_file = $source_backup_file;
@@ -900,17 +900,17 @@  discard block
 block discarded – undo
900 900
 		}
901 901
 
902 902
 		$return['processing_file'] = $backup_file;
903
-		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file);
903
+		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file);
904 904
 
905 905
 		try {
906 906
 			$return = array_merge($return,
907 907
 				$this->xcloner_encryption->decrypt_file($backup_file, "", $decryption_key, $start, base64_decode($iv)));
908
-		}catch(\Exception $e){
908
+		}catch (\Exception $e) {
909 909
 			$return['error'] = true;
910 910
 			$return['message'] = $e->getMessage();
911 911
 		}
912 912
 
913
-		if($return['finished']) {
913
+		if ($return['finished']) {
914 914
 			if ($this->xcloner_file_system->is_multipart($source_backup_file)) {
915 915
 				$return['start'] = 0;
916 916
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 		foreach ($backup_list as $file_info):?>
945 945
             <?php
946 946
 			if ($storage_selection == "gdrive") {
947
-				$file_info['path'] = $file_info['filename'] . "." . $file_info['extension'];
947
+				$file_info['path'] = $file_info['filename'].".".$file_info['extension'];
948 948
 			}
949 949
 			$file_exists_on_local_storage = true;
950 950
 
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
                             <?php endif ?>
1066 1066
                             <?php
1067 1067
 							$basename = $file_info['basename'];
1068
-							if(isset($file_info['childs']) and sizeof($file_info['childs']))
1068
+							if (isset($file_info['childs']) and sizeof($file_info['childs']))
1069 1069
 								$basename = $file_info['childs'][0][0];
1070 1070
 							?>
1071
-                            <?php if($this->xcloner_encryption->is_encrypted_file($basename)) :?>
1071
+                            <?php if ($this->xcloner_encryption->is_encrypted_file($basename)) :?>
1072 1072
                                 <a href="#<?php echo $file_info['basename'] ?>" class="backup-decryption"
1073 1073
                                    title="<?php echo __('Backup Decryption', 'xcloner-backup-and-restore') ?>">
1074 1074
                                     <i class="material-icons">enhanced_encryption</i>
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 			$backup_file = $backup_parts[$return['part']];
1127 1127
 		}
1128 1128
 
1129
-		if($this->xcloner_encryption->is_encrypted_file($backup_file)) {
1129
+		if ($this->xcloner_encryption->is_encrypted_file($backup_file)) {
1130 1130
 			$return['error'] = true;
1131 1131
 			$return['message'] = __("Backup archive is encrypted, please decrypt it first before you can list it's content.", "xcloner-backup-and-restore");
1132 1132
 			$this->send_response($return, 0);
@@ -1134,10 +1134,10 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
 		try {
1136 1136
 			$tar = new Tar();
1137
-			$tar->open($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file, $start);
1137
+			$tar->open($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file, $start);
1138 1138
 
1139 1139
 			$data = $tar->contents(get_option('xcloner_files_to_process_per_request'));
1140
-		} catch (Exception $e) {
1140
+		}catch (Exception $e) {
1141 1141
 			$return['error'] = true;
1142 1142
 			$return['message'] = $e->getMessage();
1143 1143
 			$this->send_response($return, 0);
@@ -1145,14 +1145,14 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
 		$return['files'] = array();
1147 1147
 		$return['finished'] = 1;
1148
-		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path() . DS . $backup_file);
1148
+		$return['total_size'] = filesize($this->xcloner_settings->get_xcloner_store_path().DS.$backup_file);
1149 1149
 		$i = 0;
1150 1150
 
1151 1151
 		if (isset($data['extracted_files']) and is_array($data['extracted_files'])) {
1152 1152
 			foreach ($data['extracted_files'] as $file) {
1153 1153
 				$return['files'][$i]['path'] = $file->getPath();
1154 1154
 				$return['files'][$i]['size'] = $file->getSize();
1155
-				$return['files'][$i]['mtime'] = date(get_option('date_format') . " " . get_option('time_format'),
1155
+				$return['files'][$i]['mtime'] = date(get_option('date_format')." ".get_option('time_format'),
1156 1156
 					$file->getMtime());
1157 1157
 
1158 1158
 				$i++;
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 					"copy_backup_remote_to_local"
1201 1201
 				), array($backup_file, $storage_type));
1202 1202
 			}
1203
-		} catch (Exception $e) {
1203
+		}catch (Exception $e) {
1204 1204
 
1205 1205
 			$return['error'] = 1;
1206 1206
 			$return['message'] = $e->getMessage();
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 					"upload_backup_to_storage"
1242 1242
 				), array($backup_file, $storage_type));
1243 1243
 			}
1244
-		} catch (Exception $e) {
1244
+		}catch (Exception $e) {
1245 1245
 
1246 1246
 			$return['error'] = 1;
1247 1247
 			$return['message'] = $e->getMessage();
@@ -1301,21 +1301,21 @@  discard block
 block discarded – undo
1301 1301
         $phar2->setStub($phar2->createDefaultStub('vendor/autoload.php', 'vendor/autoload.php'));
1302 1302
          * */
1303 1303
 
1304
-		$tmp_file = $this->xcloner_settings->get_xcloner_tmp_path() . DS . "xcloner-restore.tgz";
1304
+		$tmp_file = $this->xcloner_settings->get_xcloner_tmp_path().DS."xcloner-restore.tgz";
1305 1305
 
1306 1306
 		$tar = new Tar();
1307 1307
 		$tar->create($tmp_file);
1308 1308
 
1309
-		$tar->addFile(dirname(__DIR__) . "/restore/vendor.build.txt", "vendor.phar");
1309
+		$tar->addFile(dirname(__DIR__)."/restore/vendor.build.txt", "vendor.phar");
1310 1310
 		//$tar->addFile(dirname(__DIR__)."/restore/vendor.tgz", "vendor.tgz");
1311 1311
 
1312 1312
 		$files = $xcloner_plugin_filesystem->listContents("vendor/", true);
1313 1313
 		foreach ($files as $file) {
1314
-			$tar->addFile(dirname(__DIR__) . DS . $file['path'], $file['path']);
1314
+			$tar->addFile(dirname(__DIR__).DS.$file['path'], $file['path']);
1315 1315
 		}
1316 1316
 
1317
-		$content = file_get_contents(dirname(__DIR__) . "/restore/xcloner_restore.php");
1318
-		$content = str_replace("define('AUTH_KEY', '');", "define('AUTH_KEY', '" . md5(AUTH_KEY) . "');", $content);
1317
+		$content = file_get_contents(dirname(__DIR__)."/restore/xcloner_restore.php");
1318
+		$content = str_replace("define('AUTH_KEY', '');", "define('AUTH_KEY', '".md5(AUTH_KEY)."');", $content);
1319 1319
 
1320 1320
 		$tar->addData("xcloner_restore.php", $content);
1321 1321
 
@@ -1324,18 +1324,18 @@  discard block
 block discarded – undo
1324 1324
 		if (file_exists($tmp_file)) {
1325 1325
 			header('Content-Description: File Transfer');
1326 1326
 			header('Content-Type: application/octet-stream');
1327
-			header('Content-Disposition: attachment; filename="' . basename($tmp_file) . '"');
1327
+			header('Content-Disposition: attachment; filename="'.basename($tmp_file).'"');
1328 1328
 			header('Expires: 0');
1329 1329
 			header('Cache-Control: must-revalidate');
1330 1330
 			header('Pragma: public');
1331
-			header('Content-Length: ' . filesize($tmp_file));
1331
+			header('Content-Length: '.filesize($tmp_file));
1332 1332
 			readfile($tmp_file);
1333 1333
 
1334 1334
 		}
1335 1335
 
1336 1336
 		try {
1337 1337
             unlink($tmp_file);
1338
-        }catch(Exception $e) {
1338
+        }catch (Exception $e) {
1339 1339
         }
1340 1340
 
1341 1341
 		exit;
@@ -1364,9 +1364,9 @@  discard block
 block discarded – undo
1364 1364
 		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1365 1365
 		header('Cache-Control: private', false);
1366 1366
 		header('Content-Transfer-Encoding: binary');
1367
-		header('Content-Disposition: attachment; filename="' . $metadata['path'] . '";');
1367
+		header('Content-Disposition: attachment; filename="'.$metadata['path'].'";');
1368 1368
 		header('Content-Type: application/octet-stream');
1369
-		header('Content-Length: ' . $metadata['size']);
1369
+		header('Content-Length: '.$metadata['size']);
1370 1370
 
1371 1371
 		ob_end_clean();
1372 1372
 
@@ -1428,12 +1428,12 @@  discard block
 block discarded – undo
1428 1428
 			$xcloner_file_transfer->set_target($target_url);
1429 1429
 			$return['start'] = $xcloner_file_transfer->transfer_file($file, $start, $hash);
1430 1430
 
1431
-		} catch (Exception $e) {
1431
+		}catch (Exception $e) {
1432 1432
 
1433 1433
 			$return = array();
1434 1434
 			$return['error'] = true;
1435 1435
 			$return['status'] = 500;
1436
-			$return['message'] = "CURL communication error with the restore host. " . $e->getMessage();
1436
+			$return['message'] = "CURL communication error with the restore host. ".$e->getMessage();
1437 1437
 			$this->send_response($return, 0);
1438 1438
 
1439 1439
 		}
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
 		$this->check_access();
1458 1458
 
1459 1459
 		define("XCLONER_PLUGIN_ACCESS", 1);
1460
-		include_once(dirname(__DIR__) . DS . "restore" . DS . "xcloner_restore.php");
1460
+		include_once(dirname(__DIR__).DS."restore".DS."xcloner_restore.php");
1461 1461
 
1462 1462
 		return;
1463 1463
 	}
Please login to merge, or discard this patch.
Braces   +22 added lines, -14 removed lines patch added patch discarded remove patch
@@ -810,23 +810,23 @@  discard block
 block discarded – undo
810 810
 
811 811
 			if(isset($this->form_params['extra']['start'])) {
812 812
 				$start = $this->xcloner_sanitization->sanitize_input_as_int($this->form_params['extra']['start']);
813
-			}else{
813
+			} else{
814 814
 				$start = 0;
815 815
 			}
816 816
 
817 817
 			if(isset($this->form_params['extra']['iv'])) {
818 818
 				$iv = $this->xcloner_sanitization->sanitize_input_as_raw($this->form_params['extra']['iv']);
819
-			}else{
819
+			} else{
820 820
 				$iv = "";
821 821
 			}
822 822
 
823 823
 			if(isset($this->form_params['extra']['part'])) {
824 824
 				$return['part'] = (int)$this->xcloner_sanitization->sanitize_input_as_int($this->form_params['extra']['part']);
825
-			}else{
825
+			} else{
826 826
 				$return['part'] = 0;
827 827
 			}
828 828
 
829
-		}else{
829
+		} else{
830 830
 			$source_backup_file = $this->xcloner_sanitization->sanitize_input_as_string($_POST['file']);
831 831
 			$start = $this->xcloner_sanitization->sanitize_input_as_int($_POST['start']);
832 832
 			$iv = $this->xcloner_sanitization->sanitize_input_as_raw($_POST['iv']);
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 			$this->logger->info($iv);
849 849
 			$return = array_merge($return,
850 850
 				$this->xcloner_encryption->encrypt_file($backup_file, "", "", $start, base64_decode($iv)));
851
-		}catch(\Exception $e){
851
+		} catch(\Exception $e){
852 852
 			$return['error'] = true;
853 853
 			$return['message'] = $e->getMessage();
854 854
 			$return['error_message'] = $e->getMessage();
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 		try {
906 906
 			$return = array_merge($return,
907 907
 				$this->xcloner_encryption->decrypt_file($backup_file, "", $decryption_key, $start, base64_decode($iv)));
908
-		}catch(\Exception $e){
908
+		} catch(\Exception $e){
909 909
 			$return['error'] = true;
910 910
 			$return['message'] = $e->getMessage();
911 911
 		}
@@ -1009,7 +1009,8 @@  discard block
 block discarded – undo
1009 1009
                                                    title="<?php echo __('Backup Decryption', 'xcloner-backup-and-restore') ?>">
1010 1010
                                                     <i class="material-icons">enhanced_encryption</i>
1011 1011
                                                 </a>
1012
-                                            <?php else: ?>
1012
+                                            <?php else {
1013
+	: ?>
1013 1014
                                                 <a href="#<?php echo $child[0] ?>" class="list-backup-content"
1014 1015
                                                    title="<?php echo __('List Backup Content',
1015 1016
 													   'xcloner-backup-and-restore') ?>"><i
@@ -1028,7 +1029,9 @@  discard block
 block discarded – undo
1028 1029
                                                         class="material-icons">file_upload</i></a>
1029 1030
                                         <?php endif ?>
1030 1031
                                     </li>
1031
-                                <?php endforeach; ?>
1032
+                                <?php endforeach;
1033
+}
1034
+?>
1032 1035
                             </ul>
1033 1036
                         <?php endif; ?>
1034 1037
                 <?php
@@ -1036,11 +1039,12 @@  discard block
 block discarded – undo
1036 1039
 				ob_end_clean();
1037 1040
 				?>
1038 1041
                     <?php ob_start(); ?>
1039
-                        <?php if (isset($file_info['timestamp']))
1042
+                        <?php if (isset($file_info['timestamp'])) {
1040 1043
 							echo date("Y-m-d H:i", $file_info['timestamp'])
1041 1044
 						?>
1042 1045
                     <?php
1043 1046
 						$return['data'][$i][] = ob_get_contents();
1047
+}
1044 1048
 						ob_end_clean();
1045 1049
 						?>
1046 1050
 
@@ -1065,15 +1069,17 @@  discard block
 block discarded – undo
1065 1069
                             <?php endif ?>
1066 1070
                             <?php
1067 1071
 							$basename = $file_info['basename'];
1068
-							if(isset($file_info['childs']) and sizeof($file_info['childs']))
1069
-								$basename = $file_info['childs'][0][0];
1072
+							if(isset($file_info['childs']) and sizeof($file_info['childs'])) {
1073
+															$basename = $file_info['childs'][0][0];
1074
+							}
1070 1075
 							?>
1071 1076
                             <?php if($this->xcloner_encryption->is_encrypted_file($basename)) :?>
1072 1077
                                 <a href="#<?php echo $file_info['basename'] ?>" class="backup-decryption"
1073 1078
                                    title="<?php echo __('Backup Decryption', 'xcloner-backup-and-restore') ?>">
1074 1079
                                     <i class="material-icons">enhanced_encryption</i>
1075 1080
                                 </a>
1076
-                            <?php else: ?>
1081
+                            <?php else {
1082
+	: ?>
1077 1083
                                 <a href="#<?php echo $file_info['basename'] ?>" class="list-backup-content"
1078 1084
                                     title="<?php echo __('List Backup Content', 'xcloner-backup-and-restore') ?>"><i
1079 1085
                                     class="material-icons">folder_open</i></a>
@@ -1083,7 +1089,9 @@  discard block
 block discarded – undo
1083 1089
                                     <i class="material-icons">no_encryption</i>
1084 1090
                                 </a>
1085 1091
                             <?php endif?>
1086
-                        <?php endif; ?>
1092
+                        <?php endif;
1093
+}
1094
+?>
1087 1095
 
1088 1096
                         <a href="#<?php echo $file_info['basename'] ?>" class="delete"
1089 1097
                            title="<?php echo __('Delete Backup', 'xcloner-backup-and-restore') ?>">
@@ -1335,7 +1343,7 @@  discard block
 block discarded – undo
1335 1343
 
1336 1344
 		try {
1337 1345
             unlink($tmp_file);
1338
-        }catch(Exception $e) {
1346
+        } catch(Exception $e) {
1339 1347
         }
1340 1348
 
1341 1349
 		exit;
Please login to merge, or discard this patch.