aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-03-26 17:19:57 +0100
committertcit <tcit@tcit.fr>2014-03-26 17:19:57 +0100
commitad03eb6286f07074ffa8bd25950359cd670f3526 (patch)
treece675c342b784c8f7e37340d4d23105626d8db71 /inc
parentcc60cbbbabba932648cfe35ca1ae8b7ddba1186c (diff)
downloadwallabag-ad03eb6286f07074ffa8bd25950359cd670f3526.tar.gz
wallabag-ad03eb6286f07074ffa8bd25950359cd670f3526.tar.zst
wallabag-ad03eb6286f07074ffa8bd25950359cd670f3526.zip
Fix of #580 : Add some random for Windows hosts
Diffstat (limited to 'inc')
-rwxr-xr-xinc/poche/Poche.class.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index c7aa71e8..a8cd5871 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -1122,7 +1122,13 @@ class Poche
1122 public function generateToken() 1122 public function generateToken()
1123 { 1123 {
1124 if (ini_get('open_basedir') === '') { 1124 if (ini_get('open_basedir') === '') {
1125 $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15); 1125 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
1126 echo 'This is a server using Windows!';
1127 // alternative to /dev/urandom for Windows
1128 $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);
1129 } else {
1130 $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15);
1131 }
1126 } 1132 }
1127 else { 1133 else {
1128 $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); 1134 $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);