diff --git a/api/cora/session.php b/api/cora/session.php index 536d125..68c18d8 100644 --- a/api/cora/session.php +++ b/api/cora/session.php @@ -124,7 +124,6 @@ final class session { // Set all of the necessary cookies. Both *_session_key and *_user_id are // read every API request and made available to the API. $this->set_cookie('session_key', $session_key, $expire); - $this->set_cookie('session_user_id', $user_id, $expire); if(isset($additional_cookie_values) === true) { foreach($additional_cookie_values as $key => $value) { $this->set_cookie($key, $value, $expire, false); @@ -157,8 +156,6 @@ final class session { } if($session_key === null) { - $this->delete_cookie('session_key'); - $this->delete_cookie('session_user_id'); return false; } @@ -186,7 +183,6 @@ final class session { ) ) { $this->delete_cookie('session_key'); - $this->delete_cookie('session_user_id'); return false; } @@ -204,7 +200,6 @@ final class session { } else { $this->delete_cookie('session_key'); - $this->delete_cookie('session_user_id'); return false; } } @@ -277,7 +272,7 @@ final class session { /** * Sets a cookie. If you want to set custom cookies, use the - * $additional_cookie_valeus argument on $session->create(). + * $additional_cookie_values argument on $session->create(). * * @param string $name The name of the cookie. * @param mixed $value The value of the cookie. @@ -291,10 +286,13 @@ final class session { $this->setting = setting::get_instance(); $path = '/'; // The current directory that the cookie is being set in. $secure = $this->setting->get('force_ssl'); - $domain = null; - if($domain === null) { // See setting documentation for more info. - $domain = ''; - } + + preg_match( + '/https?:\/\/(.*?)\//', + $this->setting->get('beestat_root_uri'), + $matches + ); + $domain = $matches[1]; $cookie_success = setcookie( $name, diff --git a/api/cora/setting.example.php b/api/cora/setting.example.php index d961840..ec96eb5 100644 --- a/api/cora/setting.example.php +++ b/api/cora/setting.example.php @@ -106,7 +106,7 @@ final class setting { * Used anytime the API needs to know where the site is at. Don't forget * the trailing slash. * - * Example: https://beestat.io/ + * Example: https://app.beestat.io/ */ 'beestat_root_uri' => '', diff --git a/api/ecobee.php b/api/ecobee.php index 5a28844..ddce844 100644 --- a/api/ecobee.php +++ b/api/ecobee.php @@ -142,7 +142,7 @@ class ecobee extends external_api { } // Redirect to the proper location. - header('Location: ' . $this->setting->get('beestat_root_uri') . 'dashboard/'); + header('Location: ' . $this->setting->get('beestat_root_uri')); } else if(isset($error) === true) { throw new Exception($error_description); diff --git a/api/ecobee_initialize.php b/api/ecobee_initialize.php index 59de1a4..c5f67f5 100644 --- a/api/ecobee_initialize.php +++ b/api/ecobee_initialize.php @@ -24,6 +24,6 @@ if(isset($_GET['error_description']) === true) { $setting = cora\setting::get_instance(); -header('Location: ' . $setting->get('beestat_root_uri') . 'api/index.php?resource=ecobee&method=initialize&arguments=' . json_encode($arguments) . '&api_key=' . $setting->get('ecobee_api_key_local')); +header('Location: ' . $setting->get('beestat_root_uri') . 'api/?resource=ecobee&method=initialize&arguments=' . json_encode($arguments) . '&api_key=' . $setting->get('ecobee_api_key_local')); die(); diff --git a/api/patreon_initialize.php b/api/patreon_initialize.php index d53f34f..8bc2523 100644 --- a/api/patreon_initialize.php +++ b/api/patreon_initialize.php @@ -18,6 +18,6 @@ if(isset($_GET['code']) === true) { $setting = cora\setting::get_instance(); -header('Location: ' . $setting->get('beestat_root_uri') . 'api/index.php?resource=patreon&method=initialize&arguments=' . json_encode($arguments) . '&api_key=' . $setting->get('patreon_api_key_local')); +header('Location: ' . $setting->get('beestat_root_uri') . 'api/?resource=patreon&method=initialize&arguments=' . json_encode($arguments) . '&api_key=' . $setting->get('patreon_api_key_local')); die(); diff --git a/app.php b/app.php new file mode 100644 index 0000000..d5f7dd1 --- /dev/null +++ b/app.php @@ -0,0 +1,25 @@ + + + + +
+