Browse Source

Merge pull request #9 from FranklinDM/master

Port PHP7 and cluster port changes across
Moonchild 6 years ago
parent
commit
3ce6eeddfe
3 changed files with 13 additions and 4 deletions
  1. 2 1
      index.php
  2. 9 2
      user.php
  3. 2 1
      weave_storage.php

+ 2 - 1
index.php

@@ -198,7 +198,8 @@
 		else if ($_SERVER['REQUEST_METHOD'] == 'PUT') #add a single record to the server
 		{
 			$wbo = new wbo();
-			if (!$wbo->extract_json(get_json()))
+			$json = get_json();
+			if (!$wbo->extract_json($json))
 				report_problem(WEAVE_ERROR_JSON_PARSE, 400);
 
 			check_quota($db);

+ 9 - 2
user.php

@@ -127,12 +127,19 @@
 
                 // modification to support iPhone/iPod Touch devices
                 // check http://www.rfkd.de/?p=974 for further details
+                $port = parse_url(FSYNCMS_ROOT, PHP_URL_PORT);
+                $url_port = '';
+                // If the url has a port
+                if ($port != '')
+                    $url_port = ":" . $port;
+                // New URL
+                $parsed_url = parse_url(FSYNCMS_ROOT, PHP_URL_HOST) . $url_port . parse_url(FSYNCMS_ROOT, PHP_URL_PATH);
                 if (isset($_SERVER['HTTPS'])) {
-                    exit("https://" . parse_url(FSYNCMS_ROOT, PHP_URL_HOST) . parse_url(FSYNCMS_ROOT, PHP_URL_PATH));
+                    exit("https://" . $parsed_url);
                 } else {
                     // allow http requests because use of self-signed certificates
                     // on iPhone/iPod Touch devices doesn't work
-                    exit("http://"  . parse_url(FSYNCMS_ROOT, PHP_URL_HOST) . parse_url(FSYNCMS_ROOT, PHP_URL_PATH));
+                    exit("http://"  . $parsed_url);
                 }
             }
             else if($function == 'password_reset')

+ 2 - 1
weave_storage.php

@@ -737,10 +737,11 @@ class WeaveStorage
         try
         {
             $update_statement = "update users set login = :logintime where username = :username";
+            $time = time();
 
             $sth = $this->_dbh->prepare($update_statement);
             $sth->bindParam(':username', $username);
-            $sth->bindParam(':logintime', time());
+            $sth->bindParam(':logintime', $time);
             $sth->execute();
         }
         catch( PDOException $exception )