Subversion Repositories oidplus

Rev

Rev 504 | 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
511 daniel-mar 5
 * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
306 daniel-mar 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>
504 daniel-mar 32
<html lang="<?php echo substr(OIDplus::getCurrentLang(),0,2); ?>">
306 daniel-mar 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">
364 daniel-mar 38
        <link rel="stylesheet" href="../setup/setup.min.css.php">
504 daniel-mar 39
        <link rel="shortcut icon" type="image/x-icon" href="../favicon.ico.php">
306 daniel-mar 40
        <?php
41
        if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) {
42
        ?>
43
        <script src="https://www.google.com/recaptcha/api.js"></script>
44
        <?php
45
        }
46
        ?>
47
</head>
48
 
49
<body>
50
 
51
<?php
52
 
360 daniel-mar 53
echo '<h1>'._L('OIDplus File Completeness Check').'</h1>';
306 daniel-mar 54
 
360 daniel-mar 55
echo '<p><input type="button" onclick="document.location=\'index.php\'" value="'._L('Go back to updater').'"></p>';
56
 
306 daniel-mar 57
if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false)) {
58
        $secret = OIDplus::baseConfig()->getValue('RECAPTCHA_PRIVATE', '');
59
        $response = $_POST["g-recaptcha-response"];
60
        $verify = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
61
        $captcha_success = json_decode($verify);
62
}
63
 
64
if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) && ($captcha_success->success==false)) {
360 daniel-mar 65
        echo '<p><font color="red"><b>'._L('CAPTCHA not successfully verified').'</b></font></p>';
499 daniel-mar 66
        //echo '<p><a href="index.php">'._L('Try again').'</a></p>';
306 daniel-mar 67
} else {
415 daniel-mar 68
        if (!OIDplus::authUtils()->adminCheckPassword($_REQUEST['admin_password'])) {
360 daniel-mar 69
                echo '<p><font color="red"><b>'._L('Wrong password').'</b></font></p>';
499 daniel-mar 70
                //echo '<p><a href="index.php">'._L('Try again').'</a></p>';
306 daniel-mar 71
        } else {
72
                $svn = new phpsvnclient(OIDPLUS_REPO);
73
 
74
                $svn_rev = isset($_REQUEST['svn_version']) && is_numeric($_REQUEST['svn_version']) ? (int)$_REQUEST['svn_version'] : -1;
75
 
76
                list($svn_cont, $local_cont) = $svn->compareToDirectory('../', '/trunk/', $svn_rev);
77
                foreach ($local_cont as $key => &$c) {
316 daniel-mar 78
                        if ((strpos($c,'userdata/') === 0) && ($c !== 'userdata/info.txt') && ($c !== 'userdata/.htaccess') && ($c !== 'userdata/index.html') && (substr_count($c,'/') > 2)) unset($local_cont[$key]);
79
                        if (strstr($c,'3p/vts_vnag')) unset($local_cont[$key]); // This is an external library
80
                        if (strstr($c,'3p/vts_fileformats')) unset($local_cont[$key]); // This is an external library
306 daniel-mar 81
                }
82
                foreach ($svn_cont as $key => &$c) {
83
                        if ((strpos($c,'userdata/') === 0) && ($c !== 'userdata/info.txt') && ($c !== 'userdata/.htaccess') && ($c !== 'userdata/index.html') && (substr($c,-1) !== '/')) unset($svn_cont[$key]);
84
                }
85
                echo '<pre>';
360 daniel-mar 86
                echo $svn_rev == -1 ? _L('Compare local <--> svn-head')."\n\n" : _L('Compare local <--> svn-%1',$svn_rev)."\n\n";
87
                echo '=== '._L('FILES MISSING').' ==='."\n";
306 daniel-mar 88
                $diff = array_diff($svn_cont, $local_cont);
360 daniel-mar 89
                if (count($diff) === 0) echo _L('Everything OK')."\n";
306 daniel-mar 90
                foreach ($diff as $c) echo "$c\n";
91
                echo "\n";
92
 
360 daniel-mar 93
                echo '=== '._L('ADDITIONAL FILES').' ==='."\n";
306 daniel-mar 94
                $diff = array_diff($local_cont, $svn_cont);
360 daniel-mar 95
                if (count($diff) === 0) echo _L('Everything OK')."\n";
306 daniel-mar 96
                foreach ($diff as $c) echo "$c\n";
97
                echo "\n";
98
                echo '</pre>';
99
        }
100
}
101
 
102
?>
103
 
104
</body>
499 daniel-mar 105
</html>