File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -66,15 +66,17 @@ public static function decryptlicensekey(string $encryptedlicensekey): array {
6666
6767 // Step 2: Decrypt using public key.
6868 openssl_public_decrypt ($ encryptedlicensekey , $ licensekey , self ::MOD_MOODUELL_PUBLIC_KEY );
69-
69+ if (!$ licensekey ) {
70+ return [];
71+ }
7072 // Step 3: Do another base64 decode and decrypt using wwwroot.
7173 $ c = base64_decode ($ licensekey );
7274 $ ivlen = openssl_cipher_iv_length ($ cipher = "AES-128-CBC " );
7375 $ iv = substr ($ c , 0 , $ ivlen );
7476
7577 // Bugfix when passing wrong license keys that are too short.
7678 if (strlen ($ iv ) != 16 ) {
77- return false ;
79+ return [] ;
7880 }
7981
8082 $ sha2len = 32 ;
@@ -102,6 +104,9 @@ public static function pro_version_is_activated() {
102104 // DEBUG: echo "License key from plugin config: $licensekey_from_settings<br>"; END.
103105
104106 $ data = self ::decryptlicensekey ($ licensekeyfromsettings );
107+ if ($ data == []) {
108+ return false ;
109+ }
105110 // Return true if the current timestamp has not yet reached the expiration date.
106111 if (time () < strtotime ($ data ['exptime ' ]) && isset ($ data ['product ' ]) && $ data ['product ' ] == 'mooduell ' ) {
107112 return true ;
Original file line number Diff line number Diff line change 4747 $ pluginconfig = get_config ('mooduell ' );
4848 if (!empty ($ pluginconfig ->licensekey )) {
4949 $ licensekey = $ pluginconfig ->licensekey ;
50-
51- $ expirationdate = wb_payment::decryptlicensekey ($ licensekey )['exptime ' ];
52- if (wb_payment::pro_version_is_activated ()) {
53- $ licensekeydesc = "<p style='color: green; font-weight: bold'> "
54- . get_string ('license_activated ' , 'mod_mooduell ' )
55- . $ expirationdate
56- . ")</p> " ;
50+ $ decryptedlicensekey = wb_payment::decryptlicensekey ($ licensekey );
51+ if (array_key_exists ('exptime ' , $ decryptedlicensekey )) {
52+ $ expirationdate = $ decryptedlicensekey ['exptime ' ];
53+
54+ if (wb_payment::pro_version_is_activated ()) {
55+ $ licensekeydesc = "<p style='color: green; font-weight: bold'> "
56+ . get_string ('license_activated ' , 'mod_mooduell ' )
57+ . $ expirationdate
58+ . ")</p> " ;
59+ }
5760 } else {
5861 $ licensekeydesc = "<p style='color: red; font-weight: bold'> "
5962 . get_string ('license_invalid ' , 'mod_mooduell ' )
You can’t perform that action at this time.
0 commit comments