/**
  * Statistics setup & configuration.
  *
  * @since 2.0.17
  * @access public
  */
 public function index()
 {
     $this->permission('Garden.Settings.Manage');
     $this->addSideMenu('dashboard/statistics');
     //$this->addJsFile('statistics.js');
     $this->title(t('Vanilla Statistics'));
     $this->enableSlicing($this);
     if ($this->Form->authenticatedPostBack()) {
         $Flow = true;
         if ($Flow && $this->Form->getFormValue('Reregister')) {
             $id = Gdn::installationID();
             $secret = Gdn::installationSecret();
             Gdn::installationID(false);
             Gdn::installationSecret(false);
             Gdn::Statistics()->register();
             if (!Gdn::installationID()) {
                 Gdn::installationID($id);
                 Gdn::installationSecret($secret);
             }
             $this->Form->setFormValue('InstallationID', Gdn::installationID());
             $this->Form->setFormValue('InstallationSecret', Gdn::installationSecret());
         }
         if ($Flow && $this->Form->getFormValue('Save')) {
             Gdn::installationID($this->Form->getFormValue('InstallationID'));
             Gdn::installationSecret($this->Form->getFormValue('InstallationSecret'));
             $this->informMessage(t("Your settings have been saved."));
         }
         if ($Flow && $this->Form->getFormValue('AllowLocal')) {
             saveToConfig('Garden.Analytics.AllowLocal', true);
         }
         if ($Flow && $this->Form->getFormValue('Allow')) {
             saveToConfig('Garden.Analytics.Enabled', true);
         }
         if ($Flow && $this->Form->getFormValue('ClearCredentials')) {
             Gdn::installationID(false);
             Gdn::installationSecret(false);
             Gdn::statistics()->Tick();
             $Flow = false;
         }
     } else {
         $this->Form->setValue('InstallationID', Gdn::installationID());
         $this->Form->setValue('InstallationSecret', Gdn::installationSecret());
     }
     $AnalyticsEnabled = Gdn_Statistics::checkIsEnabled();
     if ($AnalyticsEnabled) {
         $ConfFile = Gdn::config()->defaultPath();
         $this->setData('ConfWritable', $ConfWritable = is_writable($ConfFile));
         if (!$ConfWritable) {
             $AnalyticsEnabled = false;
         }
     }
     $this->setData('AnalyticsEnabled', $AnalyticsEnabled);
     $NotifyMessage = Gdn::get('Garden.Analytics.Notify', false);
     $this->setData('NotifyMessage', $NotifyMessage);
     if ($NotifyMessage !== false) {
         Gdn::set('Garden.Analytics.Notify', null);
     }
     $this->render();
 }
 protected function SecurityToken($SetSecurityToken = NULL)
 {
     static $SecurityToken = NULL;
     if (!is_null($SetSecurityToken)) {
         $SecurityToken = $SetSecurityToken;
     }
     if (is_null($SecurityToken)) {
         $Request = array('VanillaID' => $this->VanillaID);
         Gdn::Statistics()->BasicParameters($Request);
         $Response = Gdn::Statistics()->Analytics('graph/getsecuritytoken.json', $Request, array('Success' => array($this, 'SecurityTokenCallback')));
     }
     return $SecurityToken;
 }
Example #3
0
 public function SettingsController_AnalyticsTick_Create($Sender)
 {
     Gdn::Statistics()->Tick();
     $Sender->DeliveryType(DELIVERY_TYPE_VIEW);
     $Sender->DeliveryMethod(DELIVERY_METHOD_JSON);
     $Sender->Render('tick', 'statistics', 'dashboard');
 }
Example #4
0
Gdn::FactoryInstall('Form', 'Gdn_Form', NULL, Gdn::FactoryInstance);
// Identity, Authenticator & Session.
Gdn::FactoryInstall('Identity', 'Gdn_CookieIdentity');
Gdn::FactoryInstall(Gdn::AliasSession, 'Gdn_Session');
Gdn::FactoryInstall(Gdn::AliasAuthenticator, 'Gdn_Auth');
// Dispatcher.
Gdn::FactoryInstall(Gdn::AliasRouter, 'Gdn_Router');
Gdn::FactoryInstall(Gdn::AliasDispatcher, 'Gdn_Dispatcher');
// Smarty Templating Engine
Gdn::FactoryInstall('Smarty', 'Smarty', PATH_LIBRARY . '/vendors/Smarty-2.6.25/libs/Smarty.class.php');
Gdn::FactoryInstall('ViewHandler.tpl', 'Gdn_Smarty');
// Slice handler
Gdn::FactoryInstall(Gdn::AliasSlice, 'Gdn_Slice');
// Remote Statistics
Gdn::FactoryInstall('Statistics', 'Gdn_Statistics', NULL, Gdn::FactorySingleton);
Gdn::Statistics();
// Regarding
Gdn::FactoryInstall('Regarding', 'Gdn_Regarding', NULL, Gdn::FactorySingleton);
Gdn::Regarding();
// Other objects.
Gdn::FactoryInstall('Dummy', 'Gdn_Dummy');
/**
 * Extension Startup
 *
 * Allow installed Extensions (Applications, Themes, Plugins) to execute startup
 * and bootstrap procedures that they may have, here.
 */
// Applications startup
foreach (Gdn::ApplicationManager()->EnabledApplicationFolders() as $ApplicationName => $ApplicationFolder) {
    // Include the application's bootstrap.
    $Gdn_Path = PATH_APPLICATIONS . "/{$ApplicationFolder}/settings/bootstrap.php";
 /**
  * Verify connection credentials.
  *
  * @since 2.0.17
  * @access public
  */
 public function Verify()
 {
     $CredentialsValid = Gdn::Statistics()->ValidateCredentials();
     $this->SetData('StatisticsVerified', $CredentialsValid);
     $this->Render();
 }
Example #6
0
 /**
  *
  * @param Gdn_Controller $Sender
  */
 public function SettingsController_AnalyticsTick_Create($Sender)
 {
     $Sender->DeliveryMethod(DELIVERY_METHOD_JSON);
     $Sender->DeliveryType(DELIVERY_TYPE_DATA);
     Gdn::Statistics()->Tick();
     $this->FireEvent("AnalyticsTick");
     $Sender->Render();
 }