Skip to content

Commit a88b1b4

Browse files
displayFunction
1 parent d19d8b7 commit a88b1b4

16 files changed

+92
-76
lines changed

.repertoire_scanner/.repertoire.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
$addonsRepo = new RepertoireAddons();
66
$accesRepo = new RepertoireAcces();
7-
$ListingRepo = new RepertoireListing();
8-
9-
$addons = $addonsRepo->getAddons();
7+
$ListingRepo = new RepertoireListing();

.repertoire_scanner/api/advencedSearch.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
require_once '../autoload.php';
44

5-
$ListingRepo = new RepertoireListingAdvenced();
5+
$ListingRepo = new RepertoireListingAdvenced(array(
6+
'node_modules',
7+
'vendor'
8+
));
69

710
if ( $ListingRepo->sendApi() ) {
811
$ListingRepo->jsonFormatListing();

.repertoire_scanner/autoload.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function loadAttributClass($classname) {
1818

1919
function loadFunction($classname) {
2020

21-
if ( file_exists($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'.repertoire_scanner/function/'.$classname.".php") ) {
22-
require_once $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'.repertoire_scanner/function/'.$classname.".php";
21+
if ( file_exists($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'.repertoire_scanner/class/'.$classname.".php") ) {
22+
require_once $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'.repertoire_scanner/class/'.$classname.".php";
2323
}
2424

2525
}

.repertoire_scanner/function/RepertoireAcces.php renamed to .repertoire_scanner/class/RepertoireAcces.php

+37
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,41 @@ public function getAccesServeur() {
9393
return $this->acces_serveur;
9494
}
9595

96+
// #########################
97+
// ##### DISPLAYER #########
98+
// #########################
99+
100+
public function displayMetaAcces() {
101+
?>
102+
<meta class="metaAcces" data-acces="<?= $this->acces ?>" >
103+
<meta class="metaAccesUrl" data-accesUrl="<?= $this->acces_serveur ?>">
104+
<?php
105+
}
106+
107+
public function displayParentButton(String $class = "goBack",String $intitule = "parent directory") {
108+
if( $this->getParentGetUrl() != "" ) {
109+
?>
110+
<a class="<?= $class ?>" href="<?php
111+
112+
if ( $this->parent_directory($this->getAccesServeur()) == $this->getParentGetUrl()) {
113+
114+
echo $this->getServer();
115+
116+
} else {
117+
118+
echo $this->getParentGetUrl();
119+
120+
}
121+
?>"><?= $intitule ?></a>
122+
123+
<?php
124+
}
125+
}
126+
127+
public function displayPhpMyAdmin(String $class = "", String $target = "_blank" , String $intitule = "PhpMyAdmin"){
128+
if( $this->server != "") {
129+
echo '<a class="'.$class.'" target="'.$target.'" href="'.$this->server.'/phpmyadmin/">'.$intitule.'</a>';
130+
}
131+
}
132+
96133
}

.repertoire_scanner/function/RepertoireAddons.php renamed to .repertoire_scanner/class/RepertoireAddons.php

+29
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,33 @@ public function getAddons() : array|bool {
4444
return $this->scanStatus;
4545
}
4646

47+
// #########################
48+
// ##### DISPLAYER #########
49+
// #########################
50+
51+
public function displayAddonsBar() {
52+
53+
echo '<div class="addons">';
54+
foreach( $this->getAddons() as $value ) {
55+
56+
if ( $value->active ) {
57+
$url = $value->url;
58+
$class = '';
59+
if ( str_contains( $value->url , 'frame|' ) ) {
60+
$url = explode('|',$value->url)[1];
61+
$class = 'iframeOpener';
62+
}
63+
64+
?>
65+
<a target="_blank" class="cells <?= $class ?>" href="<?= $url ?>" style="order: <?= $value->order ?>;">
66+
<div class="logo" style="background: url('<?= $value->icon ?>'); background-position: center; background-size: contain; background-repeat: no-repeat;"></div>
67+
</a>
68+
<?php
69+
}
70+
71+
}
72+
echo '</div>';
73+
74+
}
75+
4776
}

.repertoire_scanner/function/RepertoireListingAdvenced.php renamed to .repertoire_scanner/class/RepertoireListingAdvenced.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22

33
class RepertoireListingAdvenced extends RepertoireListing {
44

5-
private array $notIncludeArray = array(
6-
'node_modules',
7-
'vendor'
8-
);
5+
private array $notIncludeArray = array();
96
private string $howSearch = '';
107
private ?string $accesSearch = null;
118
private ?string $accesServerSearch = null;
129

1310
public function __construct($notIncludeArray = false){
1411
parent::__construct(true);
1512

16-
if($notIncludeArray && is_array($notIncludeArray)) {
13+
if($notIncludeArray && is_array($notIncludeArray)) {
1714
$this->notIncludeArray = $notIncludeArray;
1815
}
1916

index.php

+17-65
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818
<meta name='robots' content='noindex, nofollow' />
1919

20-
<meta class="metaAcces" data-acces="<?= $accesRepo->getAcces() ?>" >
21-
<meta class="metaAccesUrl" data-accesUrl="<?= $accesRepo->getAccesServeur() ?>">
20+
<?php $accesRepo->displayMetaAcces() ?>
2221
<title>File Manager</title>
2322
</head>
2423

@@ -35,19 +34,12 @@
3534
</div>
3635

3736
<div class="right-btn">
38-
39-
<?php
40-
41-
if( $accesRepo->getServer() != "") {
42-
43-
echo '<a target="_blank" href="'.$accesRepo->getServer().'/phpmyadmin/">PhpMyAdmin</a>';
44-
45-
}
46-
47-
?>
48-
37+
<?php $accesRepo->displayPhpMyAdmin(
38+
'',
39+
'_blank',
40+
'SQLgestion'
41+
); ?>
4942
<a class="parameterBtn" > <img src=".repertoire_scanner/assets/images/addons/parameter.png" alt=""> </a>
50-
5143
</div>
5244

5345
</nav>
@@ -68,33 +60,17 @@
6860
<!-- ######################### -->
6961
<div class="list-file">
7062
<h3>
71-
<?php
72-
if( $accesRepo->getParentGetUrl() != "" ) {
73-
?>
74-
<a class="goBack" href="<?php
75-
76-
if ( $accesRepo->parent_directory($accesRepo->getAccesServeur()) == $accesRepo->getParentGetUrl()) {
77-
78-
echo $accesRepo->getServer();
79-
80-
} else {
81-
82-
echo $accesRepo->getParentGetUrl();
83-
84-
}
85-
?>">Go To Parent</a>
86-
87-
<?php
88-
}
89-
90-
?>
91-
63+
<?php $accesRepo->displayParentButton(
64+
'goBack',
65+
'Parent folder'
66+
); ?>
9267
</h3>
93-
<?php
94-
95-
$ListingRepo->display_listing( $accesRepo->getAcces() , $accesRepo->getAccesServeur() , $accesRepo->getParentGetUrl() , [] );
96-
97-
?>
68+
<?php $ListingRepo->display_listing(
69+
$accesRepo->getAcces() ,
70+
$accesRepo->getAccesServeur() ,
71+
$accesRepo->getParentGetUrl() ,
72+
[]
73+
); ?>
9874

9975
</div>
10076

@@ -173,33 +149,9 @@
173149
<!-- ######################### -->
174150
<!-- ADDONS -->
175151
<!-- ######################### -->
176-
177-
<div class="addons">
178152

179-
<?php
180-
181-
foreach( $addons as $value ) {
153+
<?php $addonsRepo->displayAddonsBar() ?>
182154

183-
if ( $value->active ) {
184-
$url = $value->url;
185-
$class = '';
186-
if ( str_contains( $value->url , 'frame|' ) ) {
187-
$url = explode('|',$value->url)[1];
188-
$class = 'iframeOpener';
189-
}
190-
191-
?>
192-
<a target="_blank" class="cells <?= $class ?>" href="<?= $url ?>" style="order: <?= $value->order ?>;">
193-
<div class="logo" style="background: url('<?= $value->icon ?>'); background-position: center; background-size: contain; background-repeat: no-repeat;"></div>
194-
</a>
195-
<?php
196-
}
197-
198-
}
199-
200-
?>
201-
202-
</div>
203155

204156
</body>
205157

0 commit comments

Comments
 (0)