| 125 | | $request_value = self::xssfilter($_POST[$this->name]); |
|---|
| 126 | | |
|---|
| 127 | | if (get_magic_quotes_gpc()) $request_value = stripslashes($request_value); |
|---|
| 128 | | $this->value = $request_value; |
|---|
| | 130 | |
|---|
| | 131 | if (is_array($_POST[$this->name])) |
|---|
| | 132 | { |
|---|
| | 133 | $values = array(); |
|---|
| | 134 | foreach ($_POST[$this->name] as $value) |
|---|
| | 135 | { |
|---|
| | 136 | $request_value = self::xssfilter($_POST[$this->name]); |
|---|
| | 137 | if (get_magic_quotes_gpc()) $request_value = stripslashes($request_value); |
|---|
| | 138 | $values[] = $request_value; |
|---|
| | 139 | } |
|---|
| | 140 | $this->value = implode($this->serialization_sep,$values); |
|---|
| | 141 | } |
|---|
| | 142 | else |
|---|
| | 143 | { |
|---|
| | 144 | $request_value = self::xssfilter($_POST[$this->name]); |
|---|
| | 145 | if (get_magic_quotes_gpc()) $request_value = stripslashes($request_value); |
|---|
| | 146 | $this->value = $request_value; |
|---|
| | 147 | } |
|---|
| 140 | | $this->value = $this->model->get($name); |
|---|
| | 159 | |
|---|
| | 160 | if ($this->options_table!="") |
|---|
| | 161 | { |
|---|
| | 162 | //da ottimizzare, (options_array dovrebbe accettare anche uncampo solo) |
|---|
| | 163 | $this->db->query('SET @rownum:=-1;'); |
|---|
| | 164 | $this->db->select('@rownum:=@rownum+1 rownum,'.$this->name); |
|---|
| | 165 | $this->db->from($this->options_table); |
|---|
| | 166 | $this->db->where($this->model->pk); |
|---|
| | 167 | $this->db->get(); |
|---|
| | 168 | $values = $this->db->options_array(); |
|---|
| | 169 | $this->value = implode($this->serialization_sep,$values); |
|---|
| | 170 | } |
|---|
| | 171 | else |
|---|
| | 172 | { |
|---|
| | 173 | $this->value = $this->model->get($name); |
|---|
| | 174 | } |
|---|
| | 175 | |
|---|
| 158 | | $request_value = self::xssfilter($_POST[$this->name]); |
|---|
| 159 | | if (get_magic_quotes_gpc()) $request_value = stripslashes($request_value); |
|---|
| 160 | | $this->new_value = $request_value; |
|---|
| | 193 | |
|---|
| | 194 | //serializzazione o gestione della relazione 1-n o n-m |
|---|
| | 195 | if (is_array($_POST[$this->name])) |
|---|
| | 196 | { |
|---|
| | 197 | $values = array(); |
|---|
| | 198 | foreach ($_POST[$this->name] as $value) |
|---|
| | 199 | { |
|---|
| | 200 | $values[] = (get_magic_quotes_gpc()) ? stripslashes(self::xssfilter($value)) : self::xssfilter($value); |
|---|
| | 201 | } |
|---|
| | 202 | $this->new_value = implode($this->serialization_sep,$values); |
|---|
| | 203 | } |
|---|
| | 204 | else |
|---|
| | 205 | { |
|---|
| | 206 | $request_value = self::xssfilter($_POST[$this->name]); |
|---|
| | 207 | if (get_magic_quotes_gpc()) $request_value = stripslashes($request_value); |
|---|
| | 208 | $this->new_value = $request_value; |
|---|
| | 209 | } |
|---|
| | 210 | |
|---|
| | 326 | |
|---|
| | 327 | if ($this->options_table!="") |
|---|
| | 328 | { |
|---|
| | 329 | //bisogna farla diventare "post_process" e creare una procedure per eliminare i figli in cancellazione, |
|---|
| | 330 | $this->db->delete($this->options_table, $this->model->pk); |
|---|
| | 331 | |
|---|
| | 332 | $values = explode('|',$this->new_value); |
|---|
| | 333 | foreach ($values as $value) |
|---|
| | 334 | { |
|---|
| | 335 | $set = $this->model->pk; |
|---|
| | 336 | $set[$this->name] = $value; |
|---|
| | 337 | $this->db->insert($this->options_table, $set); |
|---|
| | 338 | unset($set); |
|---|
| | 339 | } |
|---|
| | 340 | } |
|---|