cache_custominfo.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: cache_custominfo.php 26112 2011-12-02 03:06:01Z zhengqingpeng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. function build_cache_custominfo() {
  12. $data = C::t('common_setting')->fetch_all(array('extcredits', 'customauthorinfo', 'postno', 'postnocustom'));
  13. $data['customauthorinfo'] = unserialize($data['customauthorinfo']);
  14. $data['customauthorinfo'] = $data['customauthorinfo'][0];
  15. $data['fieldsadd'] = '';
  16. $data['extcredits'] = unserialize($data['extcredits']);
  17. $order = array();
  18. if($data['customauthorinfo']) {
  19. foreach($data['customauthorinfo'] as $k => $v) {
  20. if($v['left']) {
  21. $order['left'][$k] = $v['order'];
  22. }
  23. if($v['menu']) {
  24. $order['menu'][$k] = $v['order'];
  25. }
  26. }
  27. if(!empty($order['left'])) {
  28. asort($order['left']);
  29. }
  30. if(!empty($order['menu'])) {
  31. asort($order['menu']);
  32. }
  33. }
  34. $data['setting'] = $order;
  35. $profile = array();
  36. foreach(C::t('common_member_profile_setting')->fetch_all_by_available_showinthread(1, 1) as $field) {
  37. $data['fieldsadd'] .= ', mp.'.$field['fieldid'].' AS '.$field['fieldid'];
  38. $profile['field_'.$field['fieldid']] = array($field['title'], $field['fieldid']);
  39. }
  40. $data['profile'] = $profile;
  41. $postnocustomnew[0] = $data['postno'] != '' ? (preg_match("/^[\x01-\x7f]+$/", $data['postno']) ? '<sup>'.$data['postno'].'</sup>' : $data['postno']) : '<sup>#</sup>';
  42. $data['postnocustom'] = unserialize($data['postnocustom']);
  43. if(is_array($data['postnocustom'])) {
  44. foreach($data['postnocustom'] as $key => $value) {
  45. $value = trim($value);
  46. $postnocustomnew[$key + 1] = preg_match("/^[\x01-\x7f]+$/", $value) ? '<sup>'.$value.'</sup>' : $value;
  47. }
  48. }
  49. unset($data['customauthorinfo'], $data['postno'], $data['postnocustom'], $data['extcredits']);
  50. $data['postno'] = $postnocustomnew;
  51. savecache('custominfo', $data);
  52. }
  53. ?>