Subversion Repositories vnag

Rev

Rev 76 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 76 Rev 77
Line 1... Line 1...
1
<?php /* <ViaThinkSoftSignature>
1
<?php /* <ViaThinkSoftSignature>
2
UzghgdkH2mWbh17KeuX+tCGeGd4f9DmMtoRV1S0L+qpVQ+3khc8X9mMqxd1pNwzG/
2
SJsIrfinSzsYbyQO+IHwJkShVGvRRbKXBSTuyO+b058nk32JwGIh6fEo7tkWBAtS0
3
+FnU1vAhHRT2sOcWVGsWThIBZtSIbdy+/HoAhqB94nAqwMIzwrOCwOnB+2EbbkWPv
3
3e9479eHecdKr4IYhYwPF02Z/JUO3xt4E4rhevEtATx9XgJgV+bu4mMxrYZPxShUx
4
TQImz8/wxd+Bh3sKpefgxZa1soa5fsLib/Ag2xDL4swEJ3HZRwPqB/su+I7zbMmVH
4
NjEr9DYGYlfJgY+XgK1bwjGjIHyBpO4Eh1QovgJ3I2mWEiYaX3S/vuw+KGsa063uT
5
Aks5P0MnfZY1Jtj1yXaFilaTkUDDqaN8AOEjbA9qa7mxa79zhLq1weDLTeprYUMWq
5
tsyBWIMgn+XTN5bJWz6jqgOKGnsKVTSeEpre78uCloLFmI0wXp8MNfBfesSs40zK0
6
R3jO6ohiNgIEddRhmvCC3n5HMiIfyUtJHwpS/+4VLBqejpMmEP9cTeCabS8HZO1SD
6
trqCF8yp3NitzwUtnecwQxbncp8iVGU9bO8EoD3BUy9Ohv8GINCQjtnuuAx9YFVlD
7
AJvmIa6rhPdA6gYw0eSI4LzkMKohgykrO6/i1o4+6Uo4INpe7foJClnRNboPLHdr8
7
++wb8yN3p3NsLw8r5nu0DCPbfPxJALC7UiBcZ/z7m6CO4rbsaV1yfSaX5jDrAvCtd
8
TniS7Xz7Y8/EK+RRQx9dy1AQEzJ3zE30y3Hj3SvAPzlVs2SjTz5+tmVlsqAp092lQ
8
TQPBIcb/V+HcVgikGSbZkBxTv8+R27nyv3csGPIOu5AQM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xw5gOJoSCzOy3/8dFmoIWQyx1
17
Dj+7vk/SYhUA2esmDt5h13MZIlxiyCQ3WimVhqzy4ugNBHFdCkoaXsCm0gCy1rLmO
17
ZsejNS4tLZf52gOg1XuF01ZRUyMX8X2XW8AUPd2b8Fu3cObSuUDpYgNGRK54INMjO
18
kV8CTAW6zEhBCrgGHhaaGMV0RTc6ygnkVjPyZ3c6p6bxlc3DJgJ7E1dDNOqWH/mzO
18
VXSsrOZOpo9ybNQ2h6OrJndA1UJtrThowVxn55DsfSAQ4AaI7ZLztGRMSmWk6c5P3
19
n61R6pl7ISJ9/Js0FJkL5WcvCbjao2QuJD00gyGsJpOt3WfCCHGjif/VWZo4M9Y/K
19
iNSa2U9Xy5fV9neN1T5BibyP64aFWkR+gZFC9Xxgdl/YQiPEmorxU98JtDwtsBR5J
20
GDyE+Lwq2690k+K2876Y+rdXoopjhLv6GYXXrjPhUTRMtzXkK5tiVjRzLMN5T2fvC
20
FdMfIzsrreiXs9rbrTeX3sw0T4Ag2hOrQuoBuZy5TDoh8Gjc8bebfcALNR88sktN7
21
gWLFxi5J1qM4DV4AGLF245144Stsa3j558edqgWEK4CVTsHGT1YiQFF0omFVlG9IT
21
WMEA8T3uxhE13LI3Pu3iM6iWw+6+gNGmBA9kC42jQvN7s5S+7CEA9PyDVI0CiFn5p
22
cMeslXPMLRwpyx2Z/UoMBiTsc+7lazwlZ/w9RutNd7pRWA1E3GcIC4AO4NPLQ/1nW
22
uzEa/b8BTISIhb6dQzM0yUs2vk+PXFAa5muIGMGmf+dUbPuC+BXbGRic81xKDdYDU
23
w==
23
w==
24
</ViaThinkSoftSignature> */ ?>
24
</ViaThinkSoftSignature> */ ?>
25
<?php
25
<?php
26
 
26
 
27
/*
27
/*
Line 55... Line 55...
55
 
55
 
56
        protected function get_local_version($path) {
56
        protected function get_local_version($path) {
57
                $path = realpath($path) === false ? $path : realpath($path);
57
                $path = realpath($path) === false ? $path : realpath($path);
58
 
58
 
59
                $cont = @file_get_contents("$path/includes/constants.php");
59
                $cont = @file_get_contents("$path/includes/constants.php");
-
 
60
                if ($cont === false) {
-
 
61
                        throw new VNagException("Cannot find version information at $path (cannot read constants.php)");
-
 
62
                }
60
                if (!preg_match("@define\('SCRIPT_VERSION', '(.*)'\);@ismU", $cont, $m)) {
63
                if (!preg_match("@define\('SCRIPT_VERSION', '(.*)'\);@ismU", $cont, $m)) {
61
                        throw new Exception("Cannot find version information at $path");
64
                        throw new VNagException("Cannot find version information at $path (constant SCRIPT_VERSION not found in constants.php)");
62
                }
65
                }
63
 
66
 
64
                return $m[1];
67
                return $m[1];
65
        }
68
        }
66
 
69
 
67
        protected function get_latest_version() {
70
        protected function get_latest_version() {
68
                $cont = $this->url_get_contents('https://www.4homepages.de/download-4images');
71
                $cont = $this->url_get_contents('https://www.4homepages.de/download-4images');
69
                if ($cont === false) {
72
                if ($cont === false) {
70
                        throw new Exception("Cannot access website with latest version");
73
                        throw new VNagException("Cannot access website with latest version");
71
                }
74
                }
72
 
75
 
73
                if (!preg_match('@<h2>Download 4images (.+)</h2>@ismU', $cont, $m)) {
76
                if (!preg_match('@<h2>Download 4images (.+)</h2>@ismU', $cont, $m)) {
74
                        if (!preg_match('@>Current Version: (.+)</a>@ismU', $cont, $m)) {
77
                        if (!preg_match('@>Current Version: (.+)</a>@ismU', $cont, $m)) {
75
                                throw new Exception("Cannot find version information on the website");
78
                                throw new VNagException("Cannot find version information on the website");
76
                        }
79
                        }
77
                }
80
                }
78
 
81
 
79
                return trim($m[1]);
82
                return trim($m[1]);
80
        }
83
        }
81
 
84
 
82
        protected function cbRun($optional_args=array()) {
85
        protected function cbRun($optional_args=array()) {
83
                $system_dir = $this->argSystemDir->getValue();
86
                $system_dir = $this->argSystemDir->getValue();
84
                if (empty($system_dir)) {
87
                if (empty($system_dir)) {
85
                        throw new Exception("Please specify the directory of the 4images installation.");
88
                        throw new VNagException("Please specify the directory of the 4images installation.");
86
                }
89
                }
87
                $system_dir = realpath($system_dir) === false ? $system_dir : realpath($system_dir);
90
                $system_dir = realpath($system_dir) === false ? $system_dir : realpath($system_dir);
88
 
91
 
89
                if (!is_dir($system_dir)) {
92
                if (!is_dir($system_dir)) {
90
                        throw new Exception('Directory "'.$system_dir.'" not found.');
93
                        throw new VNagException('Directory "'.$system_dir.'" not found.');
91
                }
94
                }
92
 
95
 
93
                $version = $this->get_local_version($system_dir);
96
                $version = $this->get_local_version($system_dir);
94
 
97
 
95
                $latest_version = $this->get_latest_version();
98
                $latest_version = $this->get_latest_version();