-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
228 lines (193 loc) · 7.13 KB
/
index.php
File metadata and controls
228 lines (193 loc) · 7.13 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE html>
<html lang="en">
<head>
<title>Repo stsyem installation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<style>
.button {
display: inline-block;
padding: 2px 13px;
font-size: 15px;
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #fff;
background-color: #4CAF50;
border: none;
border-radius: 15px;
box-shadow: 0 3px #999;
}
/* Full-width inputs */
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* Remove the navbar's default margin-bottom and rounded borders */
.navbar {
margin-bottom: 0;
border-radius: 0;
}
/* Set height of the grid so .sidenav can be 100% (adjust as needed) */
.row.content {height: 450px}
/* Set gray background color and 100% height */
.sidenav {
padding-top: 20px;
background-color: #f1f1f1;
height: 100%;
}
/* Set black background color, white text and some padding */
footer {
background-color: #555;
color: white;
padding: 15px;
}
/* On small screens, set height to 'auto' for sidenav and grid */
@media screen and (max-width: 767px) {
.sidenav {
height: auto;
padding: 15px;
}
.row.content {height:auto;}
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">MyRepo</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Installation</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
<div class="container-fluid text">
<div class="row content">
<div class="col-sm-5 ">
<form action="" method="post" enctype="multipart/form-data"> <div style="margin-left: 10px; width: 400px" >
<font color="blue">Repository url: </font><?php $actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$actual_link = explode('/index.php',$actual_link);
echo $actual_link[0];?><br><br><font color="green"><b>Enter the following repo details:</b></font><br><br>
<input type="hidden" value="<?php echo $actual_link[0]; ?>"readonly name="repository_domain" >
Repository id:
<input type="text" value="myrepo" name="repo_id" >
Repository name:
<input type="text" value="MyRepo" name="repo_name" >
Repository summary:
<input type="text" value="This is my repo" name="repo_summary" >
Repository owner's anme:
<input type="text" value="Ireneusz Wójcik" name="repo_provider_name" >
Repository description:
<input type="text" value="The first easy to use repository." name="repo_description" >
<br>
<input type="submit" class="button" value="Install Repository system" name="submit">
</form>
<?php
if (isset($_POST['repository_domain']) and $_POST['repository_domain']!=='' and isset($_POST['repository_domain']) and $_POST['repository_domain']!==''){
$repository_domain = $_POST['repository_domain'];
$repo_id= $_POST['repo_id'];
$repo_name=$_POST['repo_name'];
$repo_summary=$_POST['repo_summary'];
$repo_provider_name=$_POST['repo_provider_name'];
$repo_description = $_POST['repo_description'];
//1. creating config file
$config_file = '<?php
//////////////////////////////////Repo config//////////////////////////////////////////////////////////////
// switching off the errors
ini_set("display_errors","off");
//Repository adddress - forward slash on the end
$repository_domain = "'.$repository_domain.'";
// Repo id - it is used as repo packages folder
$repo_id="'.$repo_id.'";
//Repo name displayed in kodi
$repo_name="'.$repo_name.'" ;
//Repo summary
$repo_summary ="'.$repo_summary.'";
// Nname of the repo owner
$repo_provider_name="'.$repo_provider_name.'";
//Description of the repo
$repo_description = "'.$repo_description.'";
//////////////////////////////////////Do not change below///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
//Repository details
$addon_header_1=\' <addon id="'.$repo_id.'" name="\'.$repo_name.\'" version="\';
$addon_header_2=\'" provider-name="\'.$repo_provider_name.\'">
<requires>
<import addon="xbmc.addon" version="12.0.0"/>
</requires>
<extension point="xbmc.addon.repository" name="\'.$repo_name.\'">
<info compressed="false">\'.$repository_domain .\'/_\'.$repo_id.\'/addons.xml</info>
<checksum>\'.$repository_domain .\'/_\'.$repo_id.\'/addons.xml.md5</checksum>
<datadir zip="true">\'.$repository_domain .\'/_\'.$repo_id.\'/</datadir>
<hashes>false</hashes>
</extension>
<extension point="xbmc.addon.metadata">
<summary>\'.$repo_summary.\'</summary>
<description>\'.$repo_description.\'</description>
<platform>all</platform>
</extension>
</addon>\';
/////////////////////////////////////////////////////
';
$info_file = '<p> <h2>'.$repo_name.'</h2>
<p>'.$repo_summary.'</p>
<p>'.$repo_description.'</p>
<p></p>
<p></p>';
//1.1 - Creating config file
$my_ver = 'config.php';
$handle = fopen($my_ver, 'w') or die('<br><br>f11110-You don\'t have suficient permission to write in the directory');
fwrite($handle, $config_file);
//2.0 unziping folders
$zip = new ZipArchive;
if ($zip->open('lib.zip') == TRUE) {
$zip->extractTo('.');
$zip->close();
chmod("./uploads/", 0775);
}
//2.1 unziping folders for packages storage
$zip = new ZipArchive;
if ($zip->open('lib_repo.zip') == TRUE) {
$zip->extractTo('./_'.$repo_id);
$zip->close();
chmod('./_'.$repo_id, 0775);
}
//3.1 - Creating repo info file
mkdir('_'.$repo_id.'/'.$repo_id, 0775);
mkdir(''.$repo_id, 0775);
$my_ver = '_'.$repo_id.'/info.html';
$handle = fopen($my_ver, 'w') or die('f11111');
fwrite($handle, $info_file);
$repoversion = file_get_contents($repository_domain.'/_'.$repo_id.'/zip.php');
unlink('lib.zip');
unlink('lib_repo.zip');
header("Refresh:0; url=registration.php");
}
?>
</div>
</div>
</div><br><br><br><br><br>
<footer class="container-fluid text-center">
<p>MyRepo - installer</p>
</footer>
</body>
</html>