forked from koke/easyota
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.php
37 lines (31 loc) · 973 Bytes
/
common.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
<?php
require 'CFPropertyList/CFPropertyList.php';
function get_plist($id) {
$zip = zip_open("apps/$id.ipa");
while(($zip_entry = zip_read($zip)) !== false){
if (preg_match("/\.app\/Info.plist$/", zip_entry_name($zip_entry))) {
$tmpfname = tempnam("/tmp", "FOO");
file_put_contents($tmpfname, zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)));
$plist = new CFPropertyList( $tmpfname );
}
}
zip_close($zip);
return $plist->toArray();
}
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
return false;
}
function base_url() {
$schema = is_ssl() ? 'https://' : 'http://';
$url = $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
return dirname(rtrim($url, '/'));
}
?>