public function update($values, $wheres = array()) { if (in_array($values["type"], array("select", "radios", "checkboxes"))) { $this->validate("options", $values["options"], array($this, "validateOptions")); } if ($this->errorCount()) { return false; } return parent::update($values, $wheres); }
/** * Update a member's details. * * @param array $values An array of fields to update and their values. * @param array $wheres An array of WHERE conditions. * @return bool|ETSQLResult */ public function update($values, $wheres = array()) { if (isset($values["username"])) { $this->validate("username", $values["username"], array($this, "validateUsername")); } if (isset($values["email"])) { $this->validate("email", $values["email"], array($this, "validateEmail")); } if (isset($values["password"])) { $this->validate("password", $values["password"], array($this, "validatePassword")); $values["password"] = $this->hashPassword($values["password"]); } // MD5 the "reset password" hash for storage (for extra safety). if (isset($values["resetPassword"])) { $values["resetPassword"] = md5($values["resetPassword"]); } if ($this->errorCount()) { return false; } return parent::update($values, $wheres); }
/** * Update a channel's details. * * @param array $values An array of fields to update and their values. * @param array $wheres An array of WHERE conditions. * @return bool|ETSQLResult */ public function update($values, $wheres = array()) { if (isset($values["title"])) { $this->validate("title", $values["title"], array($this, "validateTitle")); } if (isset($values["slug"])) { $this->validate("slug", $values["slug"], array($this, "validateSlug")); } // Collapse the attributes. if (isset($values["attributes"])) { $values["attributes"] = serialize($values["attributes"]); } if ($this->errorCount()) { return false; } // Reset channels in the global cache. ET::$cache->remove(self::CACHE_KEY); return parent::update($values, $wheres); }
/** * Update a member's details. * * @param array $values An array of fields to update and their values. * @param array $wheres An array of WHERE conditions. * @return bool|ETSQLResult */ public function update($values, $wheres = array()) { if (isset($values["username"])) { $values["username"] = trim($values["username"]); $this->validate("username", $values["username"], array($this, "validateUsername")); } if (isset($values["email"])) { $this->validate("email", $values["email"], array($this, "validateEmail")); } if (isset($values["password"])) { $this->validate("password", $values["password"], array($this, "validatePassword")); $values["password"] = $this->hashPassword($values["password"]); } // Serialize preferences. if (isset($values["preferences"])) { $values["preferences"] = serialize($values["preferences"]); } if ($this->errorCount()) { return false; } return parent::update($values, $wheres); }