applications/dashboard/controllers/class.statisticscontroller.php
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->IsPostBack()) {
         $Flow = TRUE;
         
         if ($Flow && $this->Form->GetFormValue('Reregister')) {
            Gdn::Statistics()->Register();
         }
         
         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;
         }
      }
      
      $AnalyticsEnabled = Gdn_Statistics::CheckIsEnabled();
      if ($AnalyticsEnabled) {
         $ConfFile = PATH_CONF.'/config.php';
         $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->Form->SetFormValue('InstallationID', Gdn::InstallationID());
      $this->Form->SetFormValue('InstallationSecret', Gdn::InstallationSecret());
      
      $this->Render();
   }
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->IsPostBack()) {
         $Flow = TRUE;
         
         if ($Flow && $this->Form->GetFormValue('Reregister')) {
            Gdn::Statistics()->Register();
         }
         
         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;
         }
      }
      
      $AnalyticsEnabled = Gdn_Statistics::CheckIsEnabled();
      if ($AnalyticsEnabled) {
         $ConfFile = PATH_CONF.'/config.php';
         $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->Form->SetFormValue('InstallationID', Gdn::InstallationID());
      $this->Form->SetFormValue('InstallationSecret', Gdn::InstallationSecret());
      
      $this->Render();
   }
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 -> IsPostBack ( ) ) { $ Flow = TRUE ; if ( $ Flow && $ this -> Form -> GetFormValue ( 'Reregister' ) ) { Gdn :: Statistics ( ) -> Register ( ) ; } 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 ; } } $ AnalyticsEnabled = Gdn_Statistics :: CheckIsEnabled ( ) ; if ( $ AnalyticsEnabled ) { $ ConfFile = PATH_CONF . '/config.php' ; $ 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 -> Form -> SetFormValue ( 'InstallationID' , Gdn :: InstallationID ( ) ) ; $ this -> Form -> SetFormValue ( 'InstallationSecret' , Gdn :: InstallationSecret ( ) ) ; $ this -> Render ( ) ; }
Statistics setup & configuration.

@since 2.0.17
@access public
Statistics setup & configuration .