diff --git a/content/content.index.php b/content/content.index.php index 43e08ee..dcb2303 100644 --- a/content/content.index.php +++ b/content/content.index.php @@ -50,7 +50,7 @@ public function build() { if (!($at = @json_decode($config['at']))) { $html = <<Server auth failed! Please check your configuration and make sure you have a valid access token +

Server auth failed! Please check your configuration.

HTML; } else { diff --git a/extension.driver.php b/extension.driver.php index 3329c05..9a70919 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -96,7 +96,7 @@ public function dashboard_panel_options($context) { $label = Widget::Label('Google Analytics Service account email', Widget::Input('config[email]', $config['email'])); $fieldset->appendChild($label); - $label = Widget::Label('Google Analytics p12 key file path', Widget::Input('config[keyfile]', $config['keyfile'])); + $label = Widget::Label('Google Analytics p12 key file path (absolute or DOCROOT relative)', Widget::Input('config[keyfile]', $config['keyfile'])); $fieldset->appendChild($label); $label = Widget::Label('Height (include units)', Widget::Input('config[height]', $config['height'])); @@ -130,7 +130,11 @@ public function dashboard_panel_validate($context) { public static function createClient(array $config, $panelId) { $client = new Google_Client(); - $key = @file_get_contents($config['keyfile']); + $keyfile = $config['keyfile']; + if (strpos($keyfile, '/') !== 0) { + $keyfile = DOCROOT . '/' . $keyfile; + } + $key = @file_get_contents($keyfile); if (!!$key) { $cred = new Google_Auth_AssertionCredentials( $config['email'],