update.inc.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. function posid($field, $value) {
  2. if(!empty($value) && is_array($value)) {
  3. if($_GET['a']=='add') {
  4. $position_data_db = pc_base::load_model('position_data_model');
  5. $textcontent = array();
  6. foreach($value as $r) {
  7. if($r!='-1') {
  8. if(empty($textcontent)) {
  9. foreach($this->fields AS $_key=>$_value) {
  10. if($_value['isposition']) {
  11. $textcontent[$_key] = $this->data[$_key];
  12. }
  13. }
  14. $textcontent = array2string($textcontent);
  15. }
  16. $thumb = $this->data['thumb'] ? 1 : 0;
  17. $position_data_db->insert(array('id'=>$this->id,'catid'=>$this->data['catid'],'posid'=>$r,'thumb'=>$thumb,'module'=>'content','modelid'=>$this->modelid,'data'=>$textcontent,'listorder'=>$this->id,'siteid'=>get_siteid()));
  18. }
  19. }
  20. } else {
  21. $posids = array();
  22. $catid = $this->data['catid'];
  23. $push_api = pc_base::load_app_class('push_api','admin');
  24. foreach($value as $r) {
  25. if($r!='-1') $posids[] = $r;
  26. }
  27. $textcontent = array();
  28. foreach($this->fields AS $_key=>$_value) {
  29. if($_value['isposition']) {
  30. $textcontent[$_key] = $this->data[$_key];
  31. }
  32. }
  33. //颜色选择为隐藏域 在这里进行取值
  34. $textcontent['style'] = $_POST['style_color'] ? strip_tags($_POST['style_color']) : '';
  35. $textcontent['inputtime'] = strtotime($textcontent['inputtime']);
  36. if($_POST['style_font_weight']) $textcontent['style'] = $textcontent['style'].';'.strip_tags($_POST['style_font_weight']);
  37. $push_api->position_update($this->id, $this->modelid, $catid, $posids, $textcontent,0);
  38. }
  39. }
  40. }