Esempio n. 1
0
 /**
  * Adds $this->UpdateUserID and $this->DateUpdated fields to an associative
  * array of fieldname/values if those fields exist on the table being
  * updated.
  *
  * @param array $Fields The array of fields to add the values to.
  */
 protected function AddUpdateFields(&$Fields)
 {
     $this->DefineSchema();
     if ($this->Schema->FieldExists($this->Name, $this->DateUpdated)) {
         if (!isset($Fields[$this->DateUpdated])) {
             $Fields[$this->DateUpdated] = Gdn_Format::ToDateTime();
         }
     }
     $Session = Gdn::Session();
     if ($Session->UserID > 0 && $this->Schema->FieldExists($this->Name, $this->UpdateUserID)) {
         if (!isset($Fields[$this->UpdateUserID])) {
             $Fields[$this->UpdateUserID] = $Session->UserID;
         }
     }
     if ($this->Schema->FieldExists($this->Name, 'UpdateIPAddress') && !isset($Fields['UpdateIPAddress'])) {
         $Fields['UpdateIPAddress'] = Gdn::Request()->IpAddress();
     }
 }
Esempio n. 2
0
 /**
  * Adds $this->UpdateUserID and $this->DateUpdated fields to an associative
  * array of fieldname/values if those fields exist on the table being
  * updated.
  *
  * @param array $Fields The array of fields to add the values to.
  */
 protected function AddUpdateFields(&$Fields)
 {
     $this->DefineSchema();
     if ($this->Schema->FieldExists($this->Name, $this->DateUpdated)) {
         $Fields[$this->DateUpdated] = Gdn_Format::ToDateTime();
     }
     $Session = Gdn::Session();
     if ($Session->UserID > 0 && $this->Schema->FieldExists($this->Name, $this->UpdateUserID)) {
         $Fields[$this->UpdateUserID] = $Session->UserID;
     }
 }