-
Notifications
You must be signed in to change notification settings - Fork 2
/
installer.php
91 lines (66 loc) · 1.95 KB
/
installer.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
<?php
$ci = & get_instance();
$ci->load->helper(array('form', 'url', 'file'));
$config['upload_path'] = 'plugins/plugin_installer/workspace';
$config['allowed_types'] = 'zip|tar|gz';
$config['max_size'] = '2000';
$ci->load->library('upload', $config);
if ( ! $ci->upload->do_upload())
{
$error = $ci->upload->display_errors('<div>', '</div>');
}
else
{
$data = $ci->upload->data();
$zip = new ZipArchive;
$res = $zip->open($data['full_path']);
if ($res === TRUE) {
$zip->extractTo('plugins');
$zip->close();
//echo 'ok';
} else {
$zip_fail = 'Oops! Looks like we had an issue unzipping your plugin';
}
}
?>
<div class="vbx-plugin">
<h3>Install New Plugin</h3>
<br />
<div class="error-message" style="display: block;">
<?php echo $error;?>
<?php echo isset($zip_fail);?>
</div>
<br />
<?php echo form_open_multipart('http://vbx.ripstyles.com/p/installer');?>
<input type="file" name="userfile" size="20" />
<br /><br />
<input type="submit" value="Upload and Install Selected Zip Archive" />
</form>
<!--
<br />
<br />
<h3>Manage Applets and Plugins</h3>
<br />
<?php
// directory path can be either absolute or relative
$directory = 'plugins';
// open the specified directory and check if it's opened successfully
if ($handle = opendir($directory)) {
// keep reading the directory entries 'til the end
while (false !== ($file = readdir($handle))) {
// just skip the reference to current and parent directory
if ($file != "." && $file != "..") {
if (is_dir("$directory/$file")) {
// found a directory, do something with it?
echo "[$file]<br>";
} else {
// found an ordinary file
echo "$file<br>";
}
}
}
// ALWAYS remember to close what you opened
closedir($handle);
}
?>-->
</div>