protected function setValueFromTempFile() { if (!$this->temp_file || !file_exists($this->temp_file)) { I2CE::raiseError("Failed to load binary file from missing temp file!"); return false; } parent::setFromDB(file_get_contents($this->temp_file)); }
/** * Sets the value of this field from the database format. * @param mixed $value */ public function setFromDB($value) { //keys should be fixed length of 9 so we can reduce the string processing. //format is mime-type<VAL1>file-name<val-2>some-keys<VAL3>datadatadatadata //keys don't need to be in a fixed order while (strlen($value) >= 10 && $value[9] == '<') { $key = substr($value, 0, 9); if (!array_key_exists($key, self::$keys) || ($pos = strpos($value, '>')) === false) { break; } $var = self::$keys[$key]; $this->{$var} = substr($value, 10, $pos - 10); $value = substr($value, $pos + 1); } parent::setFromDB($value); }