-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
136 lines (116 loc) · 4.04 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php session_start(); ?>
<!doctype html>
<?php
require_once 'vendor/autoload.php';
include("./function.php");
include("./phpFileTree/php_file_tree.php");
$dir = "./Notes";
$actual_path = $_GET['dir'];
if (!isset($actual_path))
{
$actual_path = $dir;
}
if (!isset($_SESSION["view"])) {
$_SESSION["view"]='list';
} else {
if(isset($_GET['view']))
{
$_SESSION["view"]=$_GET['view'];
}
}
$view_mode = $_SESSION["view"];
?>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="All my markdown file">
<meta name="author" content="Lucas Tarasconi">
<link rel="icon" href="#">
<title>WebDown - <?php echo get_group($actual_path); ?></title>
<!-- Bootstrap core CSS -->
<link href="./css/perso.css" rel="stylesheet">
<link href="./css/bootstrap.min.css" rel="stylesheet">
<link href="./prism/prism.css" rel="stylesheet" />
<link href="./phpFileTree/styles/default/default.css" rel="stylesheet" type="text/css" media="screen" />
<!-- Custom styles for this template -->
<link href="./css/starter-template.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="./index.php">WebDown</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<?php
onlyLocalFolder($dir);
?>
</div>
</nav>
<div class="container">
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
<?php ariane($actual_path); ?>
</ol>
</nav>
<article>
<?php
$path_parts = pathinfo($actual_path);
if ($path_parts['extension'] == 'md') {
print_markdown($actual_path);
} else {
?>
<ul class="nav ">
<h1><?php
echo basename($actual_path );
?></h1>
<?php
view_mode($actual_path,$view_mode);
?></ul><?php
if($view_mode == 'cards'){
?>
<div class="row">
<?php cards_view($actual_path); ?>
</div>
<?php } elseif ($view_mode == 'list'){ ?>
<ul>
<?php localFolder($actual_path); ?>
</ul>
<?php }
elseif ($view_mode == 'tree') {
$allowed = array("gif", "jpg", "jpeg", "png","md","markdown");
echo php_file_tree($actual_path, "./index.php?dir=[link]",$allowed);
}
?>
<div class="row">
<div class="col">
<h2>Last modified :</h2>
<?php list_ordered($actual_path,'date') ?>
</div>
<div class="col">
<h2>By name :</h2>
<?php list_ordered($actual_path,'name') ?>
</div>
</div>
</div>
</div>
<?php
}
?>
</article>
<br />
<br />
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="./js/vendor/jquery.min.js"><\/script>')</script>
<script src="./phpFileTree/php_file_tree.js" type="text/javascript"></script>
<script src="./prism/prism.js"></script>
<script src="./js/vendor/popper.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
</body>
</html>