Rev 350 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
306 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
20 | declare(ticks=1); |
||
21 | |||
22 | set_time_limit(0); |
||
23 | |||
24 | require_once __DIR__ . '/../includes/oidplus.inc.php'; |
||
25 | |||
26 | // Note: we don't want to use OIDplus::init() in this updater (it should be independent as much as possible) |
||
27 | OIDplus::baseConfig(); // This call will redirect to setup if userdata/baseconfig/config.inc.php is missing |
||
28 | |||
29 | define('OIDPLUS_REPO', 'https://svn.viathinksoft.com/svn/oidplus'); |
||
30 | |||
31 | ?><!DOCTYPE html> |
||
32 | <html lang="en"> |
||
33 | |||
34 | <head> |
||
360 | daniel-mar | 35 | <title><?php echo _L('OIDplus File Completeness Check'); ?></title> |
306 | daniel-mar | 36 | <meta name="robots" content="noindex"> |
37 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||
38 | <link rel="stylesheet" href="../setup/setup.css"> |
||
39 | <?php |
||
40 | if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) { |
||
41 | ?> |
||
42 | <script src="https://www.google.com/recaptcha/api.js"></script> |
||
43 | <?php |
||
44 | } |
||
45 | ?> |
||
46 | </head> |
||
47 | |||
48 | <body> |
||
49 | |||
50 | <?php |
||
51 | |||
360 | daniel-mar | 52 | echo '<h1>'._L('OIDplus File Completeness Check').'</h1>'; |
306 | daniel-mar | 53 | |
360 | daniel-mar | 54 | echo '<p><input type="button" onclick="document.location=\'index.php\'" value="'._L('Go back to updater').'"></p>'; |
55 | |||
306 | daniel-mar | 56 | if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) { |
57 | $secret = OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', ''); |
||
58 | $response = $_POST["g-recaptcha-response"]; |
||
59 | $verify = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}"); |
||
60 | $captcha_success = json_decode($verify); |
||
61 | } |
||
62 | |||
63 | if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) && ($captcha_success->success==false)) { |
||
360 | daniel-mar | 64 | echo '<p><font color="red"><b>'._L('CAPTCHA not successfully verified').'</b></font></p>'; |
306 | daniel-mar | 65 | //echo '<p><a href="index.php">Try again</a></p>'; |
66 | } else { |
||
67 | if (!OIDplusAuthUtils::adminCheckPassword($_REQUEST['admin_password'])) { |
||
360 | daniel-mar | 68 | echo '<p><font color="red"><b>'._L('Wrong password').'</b></font></p>'; |
306 | daniel-mar | 69 | //echo '<p><a href="index.php">Try again</a></p>'; |
70 | } else { |
||
71 | $svn = new phpsvnclient(OIDPLUS_REPO); |
||
72 | |||
73 | $svn_rev = isset($_REQUEST['svn_version']) && is_numeric($_REQUEST['svn_version']) ? (int)$_REQUEST['svn_version'] : -1; |
||
74 | |||
75 | list($svn_cont, $local_cont) = $svn->compareToDirectory('../', '/trunk/', $svn_rev); |
||
76 | foreach ($local_cont as $key => &$c) { |
||
316 | daniel-mar | 77 | if ((strpos($c,'userdata/') === 0) && ($c !== 'userdata/info.txt') && ($c !== 'userdata/.htaccess') && ($c !== 'userdata/index.html') && (substr_count($c,'/') > 2)) unset($local_cont[$key]); |
78 | if (strstr($c,'3p/vts_vnag')) unset($local_cont[$key]); // This is an external library |
||
79 | if (strstr($c,'3p/vts_fileformats')) unset($local_cont[$key]); // This is an external library |
||
306 | daniel-mar | 80 | } |
81 | foreach ($svn_cont as $key => &$c) { |
||
82 | if ((strpos($c,'userdata/') === 0) && ($c !== 'userdata/info.txt') && ($c !== 'userdata/.htaccess') && ($c !== 'userdata/index.html') && (substr($c,-1) !== '/')) unset($svn_cont[$key]); |
||
83 | } |
||
84 | echo '<pre>'; |
||
360 | daniel-mar | 85 | echo $svn_rev == -1 ? _L('Compare local <--> svn-head')."\n\n" : _L('Compare local <--> svn-%1',$svn_rev)."\n\n"; |
86 | echo '=== '._L('FILES MISSING').' ==='."\n"; |
||
306 | daniel-mar | 87 | $diff = array_diff($svn_cont, $local_cont); |
360 | daniel-mar | 88 | if (count($diff) === 0) echo _L('Everything OK')."\n"; |
306 | daniel-mar | 89 | foreach ($diff as $c) echo "$c\n"; |
90 | echo "\n"; |
||
91 | |||
360 | daniel-mar | 92 | echo '=== '._L('ADDITIONAL FILES').' ==='."\n"; |
306 | daniel-mar | 93 | $diff = array_diff($local_cont, $svn_cont); |
360 | daniel-mar | 94 | if (count($diff) === 0) echo _L('Everything OK')."\n"; |
306 | daniel-mar | 95 | foreach ($diff as $c) echo "$c\n"; |
96 | echo "\n"; |
||
97 | echo '</pre>'; |
||
98 | } |
||
99 | } |
||
100 | |||
101 | ?> |
||
102 | |||
103 | </body> |
||
360 | daniel-mar | 104 | </html> |