-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin.php
102 lines (90 loc) · 3.39 KB
/
admin.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
<?php
/*
* **************************************************************************************************
* Repositorix
* @version 1.1
* @author bronco@warriordudimanche.net
* @url warriordudimanche.net
*
* gestionnaire simplifié de dépôt de plugin PluXML
* compatible avec spxplugindownloader de je-evrard (http://forum.pluxml.org/viewtopic.php?id=4934)
*
* - gestion du glisser-déposer d'un zip de plugin
* - génération automatique d'un fichier repository.xml
* - génération automatique d'un flux RSS
* - génération automatique d'une page regroupant tous les plugins avec leur lien de téléchargement
*
* **************************************************************************************************
*/
include('INCLUDES/auto_restrict.php');
include('INCLUDES/functions.php');
include('INCLUDES/config.php');
include('INCLUDES/templates.php');
# Gestion de la régénération
if (isset($_GET['regen'])){
$xml='<?xml version="1.0" encoding="UTF-8"?><document>'."\n";
$html=$template['header_index'];
$zipfiles=glob('ZIPFILES/*.zip');
sort($zipfiles,SORT_NATURAL | SORT_FLAG_CASE);
foreach ($zipfiles as $zipfile){
$nom=str_replace('.zip','',basename($zipfile));
$file=basename($zipfile);
$dest='REPO/'.$nom;
rrmdir($dest);
unzip_file($zipfile, 'REPO/');
rename ($dest.'/icon.png', $dest.'/'.$nom.'.png');
preg_match('#\<document\>([^§]+)\<\/document\>#i',file_get_contents($dest.'/infos.xml'),$infos);
$icon=URL_ROOT.'REPO/'.$nom.'/'.$nom.'.png';
$zip=URL_ROOT.'ZIPFILES/'.$file;
# XML
$xml.="<plugin>\n";
$xml.=$infos[1];
$xml.='<name>'.$nom.'</name>'."\n";
$xml.='<file>'.$zip.'</file>'."\n";
$xml.='<icon>'.$icon.'</icon>'."\n";
$xml.="</plugin>\n";
# HTML
$html.="<ul class=\"plugin\">\n";
$html.=info2html($infos[1]);
$html.='<li class="download"><a href="'.$zip .'">'.$file.'</a></li>';
$html.="</ul>\n";
}
$xml.='</document>';
$html.=$template['footer_index'];
$version=intval(@file_get_contents('repository.version'));
$version++;
file_put_contents('repository.version', $version);
file_put_contents('repository.xml', $xml);
file_put_contents('index.html', $html);
}
?><!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<title><?php echo TITRE; ?></title>
<link rel="icon" href="INCLUDES/IMG/favicon.png" />
<link rel="stylesheet" href="INCLUDES/style.css" media="screen"/>
<body>
<header>
<h1><?php echo TITRE; ?></h1>
<h4>Lien vers le XML du dépôt: <a href="<?php echo URL_ROOT.'repository.xml';?>"><?php echo URL_ROOT.'repository.xml';?></a></h4>
</header>
<aside>
<?php
test_server_config();
unset($_SESSION['auto_dropzone']);
$auto_dropzone['auto_refresh_after_upload']=true;
$auto_dropzone['dropzone_text']="Glisser les ZIP des plugins";
$auto_dropzone['destination_filepath']='../ZIPFILES/';
$auto_dropzone['my_filepath']='INCLUDES/auto_dropzone.php';
$auto_dropzone['allowed_filetypes']='zip,application/x-zip-compressed';
$auto_dropzone['use_style']=false;
include('INCLUDES/auto_dropzone.php');
?>
</aside>
<footer>
Repositorix by <a href="http://warriordudimanche.net"/>Bronco</a>
</footer>
</body>
</head>