Rev 78 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 78 | Rev 79 | ||
---|---|---|---|
Line 2280... | Line 2280... | ||
2280 | } else { |
2280 | } else { |
2281 | return $this->pluginName; |
2281 | return $this->pluginName; |
2282 | } |
2282 | } |
2283 | } |
2283 | } |
2284 | 2284 | ||
2285 | private static function isCertified($file) { |
- | |
2286 | $cont = file_get_contents($file); |
- | |
2287 | - | ||
2288 | $regex = '@<\?php /\* <ViaThinkSoftSignature>(.+)</ViaThinkSoftSignature> \*/ \?>\n@ismU'; |
- | |
2289 | - | ||
2290 | $m = array(); |
- | |
2291 | if (!preg_match($regex, $cont, $m)) { |
- | |
2292 | return false; |
- | |
2293 | } |
- | |
2294 | $signature = base64_decode($m[1]); |
- | |
2295 | - | ||
2296 | $naked = preg_replace($regex, '', $cont); |
- | |
2297 | $hash = hash("sha256", $naked.basename($file)); |
- | |
2298 | - | ||
2299 | $public_key = <<<'VTSKEY' |
- | |
2300 | -----BEGIN PUBLIC KEY----- |
- | |
2301 | MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEA4UEmad2KHWzfGLcAzbOD |
- | |
2302 | IhqWyoPA1Cg4zN5YK/CWUiE7sh2CNinIwYqGnIOhZLp54/Iyv3H05QeWJU7kD+jQ |
- | |
2303 | 5JwR8+pqk8ZGBfqlxXUBJ2bZhYIBJZYfilSROa7jgPPrrw0CjdGLmM3wmc8ztQRv |
- | |
2304 | 4GpP7MaKVyVOsRz5xEcpzghWZ+Cl8Nxq1Vo02RkMYOOPA16abxZ65lVM8Vv2EKGf |
- | |
2305 | /VAVViTFvLWPxggvt1fbJJniC0cwt8gjzFXt6IJJSRlqc1lOO9ZIa/EWDKuHKQ1n |
- | |
2306 | ENQCqnuVPFDZU3lU20Z+6+EA0YngcvNYi3ucdIvgBd4Yv5FetzuxiOZUoDRfh/3R |
- | |
2307 | 6dCJ8CvRiq0BSZcynTIWNmF3AVsH7vjxZe8kMDbwZNnR0suZ5MfBh6L/s1lCEWlS |
- | |
2308 | GwmCLc3MnOLxq3JLnfmbVa509YxlUamdSswnvzes28AjnzQ3LQchspP2a8bSXH6/ |
- | |
2309 | qpbwvmV5WiNgwJck04VhaXrRRy3XFSwuk7KU/L4aqadXP26kgDqIYNvPXSa9JyGc |
- | |
2310 | 14zwdmAtn36o8vpXM/A7GhdWqgPLlJbdTdK6IfwpBs8P/JB6y3t6RzAGiEOITdj9 |
- | |
2311 | QUhW+sAoKno0j4WT7s80vWNWz37WoFJcvVLnVEYitnW6DqM+GOt2od3g6WgI6dOa |
- | |
2312 | MESA4J44Y4x1gXBw/M6F/ZngP4EJoAUG0GbzsaZ6HKLt4pDTZmw8PnNcXrOMYkr/ |
- | |
2313 | N5EliTXil45DCaLkgNJmpdXjNpIvShW4ogq2osw+SQUalnAbW8ddiaOVCdgXkDFq |
- | |
2314 | gvnl5QSeUrKPF5v+vlnwWar6Rp7iInQpnA+PTSbAlO3Dd9WqbWx+uNoI/kXUlN0O |
- | |
2315 | a/vi5Uwat2Bz3N+jIpnBqg4+O+SG0z3UCVmT6Leg+kqO/rXbzoVv/DV7E30vTqdo |
- | |
2316 | wsswdJEM1BI7Wyid6HPwBek+rdv77gUg3W37vUcdfKxsYRcoHriXLHpmENznJcEx |
- | |
2317 | /nvilw6To1zx2LKmM/p56MQriKkXnqoOBpkpn3PaWyXZKY9xJNTAbcSP3haE7z9p |
- | |
2318 | PzJw88KI8dnYuFg4yS/AgmVGAUtu3bhDG4qF9URu2ck868zViH996lraYkmFIWJG |
- | |
2319 | r7h1LImhrwDEJvb/rOW8QvOZBX9H6pcSKs/LQbeoy6HMIOTlny+S15xtiS4t6Ayv |
- | |
2320 | 3m0ry5c0qkl/mgKvGpeRnNlrcr6mb2fzxxGvcuBzi25wgIbRLPgJoqsmeBvW1OLU |
- | |
2321 | +9DpkNvitEJnPRo86v0VF86aou12Sm8Wb4mtrQ7h3qLIYvw2LN2mYh4WlgrSwPpx |
- | |
2322 | YvE2+vWapilnnDWoiu2ZmDWa7WW/ihqvX9fmp/qzxQvJmBYIN8dFpgcNLqSx526N |
- | |
2323 | bwIDAQAB |
- | |
2324 | -----END PUBLIC KEY----- |
- | |
2325 | VTSKEY; |
- | |
2326 | - | ||
2327 | if (!function_exists('openssl_verify')) return null; |
- | |
2328 | - | ||
2329 | if (!openssl_verify($hash, $signature, $public_key, OPENSSL_ALGO_SHA256)) { |
- | |
2330 | return false; |
- | |
2331 | } |
- | |
2332 | - | ||
2333 | return true; |
- | |
2334 | } |
- | |
2335 | - | ||
2336 | // $version should contain the version, not the program name or copyright. |
2285 | // $version should contain the version, not the program name or copyright. |
2337 | protected $version; |
2286 | protected $version; |
2338 | public function setVersion($version) { |
2287 | public function setVersion($version) { |
2339 | $this->version = $this->replaceStuff($version); |
2288 | $this->version = $this->replaceStuff($version); |
2340 | } |
2289 | } |
Line 2349... | Line 2298... | ||
2349 | if (!_empty($ver)) { |
2298 | if (!_empty($ver)) { |
2350 | $ret = sprintf(VNagLang::$x_version_x, $ret, $ver); |
2299 | $ret = sprintf(VNagLang::$x_version_x, $ret, $ver); |
2351 | } |
2300 | } |
2352 | $ret = trim($ret); |
2301 | $ret = trim($ret); |
2353 | 2302 | ||
2354 | $certified = true; |
- | |
2355 | foreach (get_included_files() as $file) { |
- | |
2356 | $certified &= self::isCertified($file); |
- | |
2357 | } |
- | |
2358 | if ($certified) { |
- | |
2359 | $ret .= ' (' . VNagLang::$certified . ')'; |
- | |
2360 | } |
- | |
2361 | - | ||
2362 | return $ret; |
2303 | return $ret; |
2363 | } |
2304 | } |
2364 | 2305 | ||
2365 | // $copyright should contain the copyright only, no program name or version. |
2306 | // $copyright should contain the copyright only, no program name or version. |
2366 | // $CURYEAR$ will be replaced by the current year |
2307 | // $CURYEAR$ will be replaced by the current year |
Line 2496... | Line 2437... | ||
2496 | static $x_version_x = '%s, version %s'; |
2437 | static $x_version_x = '%s, version %s'; |
2497 | 2438 | ||
2498 | // Argument names (help page) |
2439 | // Argument names (help page) |
2499 | static $argname_value = 'value'; |
2440 | static $argname_value = 'value'; |
2500 | static $argname_seconds = 'seconds'; |
2441 | static $argname_seconds = 'seconds'; |
2501 | static $certified = 'Certified by ViaThinkSoft'; |
- | |
2502 | 2442 | ||
2503 | // Exceptions |
2443 | // Exceptions |
2504 | static $query_without_expected_argument = "The argument '%s' is queried, but was not added to the list of expected arguments. Please contact the plugin author."; |
2444 | static $query_without_expected_argument = "The argument '%s' is queried, but was not added to the list of expected arguments. Please contact the plugin author."; |
2505 | static $required_argument_missing = "The argument '%s' is required."; |
2445 | static $required_argument_missing = "The argument '%s' is required."; |
2506 | static $performance_data_invalid = 'Performance data invalid.'; |
2446 | static $performance_data_invalid = 'Performance data invalid.'; |