-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
executable file
·104 lines (90 loc) · 3.28 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
<?php
@ini_set('default_socket_timeout', 5);
require_once("pre.php");
require_once("../classes/Administrateur.class.php");
session_start();
header("Content-type: text/html; charset=utf-8");
if(isset($action))
if($action == "deconnexion") unset($_SESSION["util"]);
require_once("../lib/simplepie.inc");
require_once("../classes/Variable.class.php");
function couperTexte($texte, $nbcar){
if (strlen($texte) < $nbcar) return $texte;
$res = "";
$mots = explode(" ", $texte);
foreach($mots as $mot) {
$tmp = "$res $mot";
if (strlen($tmp) > $nbcar) break;
$res = $tmp;
}
return $res . "...";
}
function lire_feed($url, $nb=3) {
$feed = new SimplePie($url, '../client/cache/flux');
$feed->init();
$feed->handle_content_type();
$tab = $feed->get_items();
return (count($tab) > 0) ? array_slice($tab, 0, 3) : false;
}
function afficher_feed($url, $picto, $nb = 3) {
$items = lire_feed($url, $nb);
if ($items !== false) {
foreach($items as $item){
$link = $item->get_permalink();
$title = strip_tags($item->get_title());
$author = strip_tags($item->get_author());
$description = $item->get_description();
$date = $item->get_date('d/m/Y');
?>
<div class="span4">
<h2><?php echo($date); ?> - <?php echo $title; ?></h2>
<p><?php echo couperTexte($description, 250); ?></p>
<p><a class="btn" href="<?php echo($link); ?>" target="_blank">Lire la suite »</a></p>
</div>
<?php
}
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<?php require_once("title.php");?>
</head>
<body>
<?php
ActionsAdminModules::instance()->inclure_module_admin("index_top");
?>
<div class="loginpage">
<div class="brandbar">
<div class="container">
<a class="brand" href="accueil.php">
v. <?php echo rtrim(preg_replace("/(.)/", "$1.", Variable::lire('version')), "."); ?>
</a>
</div>
</div>
<div id="wrapper" class="container">
<?php
ActionsAdminModules::instance()->inclure_module_admin("index");
?>
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Administration Thelia</h1>
<form action="accueil.php" method="post" class="well form-inline">
<input type="text" class="input" placeholder="Nom d'utilisateur" name="identifiant" />
<input type="password" class="input" placeholder="Mot de passe" name="motdepasse" />
<input name="action" type="hidden" value="identifier" />
<button type="submit" class="btn btn-primary">Connexion »</button>
</form>
</div>
<!-- Example row of columns -->
<div class="row-fluid">
<?php afficher_feed("http://thelia.net/Flux-rss.html?id_rubrique=8", "picto-formation.gif"); ?>
</div>
</div>
<?php
ActionsAdminModules::instance()->inclure_module_admin("index_bottom");
?>
<?php require_once("pied.php");?>
</body>
</html>