site.ctrl.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('system');
  8. $dos = array('basic', 'copyright', 'about', 'save_setting','sms');
  9. $do = in_array($do, $dos) ? $do : 'basic';
  10. $settings = $_W['setting']['copyright'];
  11. if(empty($settings) || !is_array($settings)) {
  12. $settings = array();
  13. } else {
  14. $settings['slides'] = iunserializer($settings['slides']);
  15. }
  16. if ($do == 'basic') {
  17. $path = IA_ROOT . '/web/themes/';
  18. if(is_dir($path)) {
  19. if ($handle = opendir($path)) {
  20. while (false !== ($templatepath = readdir($handle))) {
  21. if ($templatepath != '.' && $templatepath != '..') {
  22. if(is_dir($path.$templatepath)){
  23. $template[] = $templatepath;
  24. }
  25. }
  26. }
  27. }
  28. }
  29. $template_ch_name = system_template_ch_name();
  30. $templates_ch = array_keys($template_ch_name);
  31. if (!empty($template)) {
  32. foreach ($template as $template_val) {
  33. if (!in_array($template_val, $templates_ch)) {
  34. $template_ch_name[$template_val] = $template_val;
  35. }
  36. }
  37. }
  38. }
  39. if ($do == 'save_setting') {
  40. $system_setting_items = system_setting_items();
  41. $key = safe_gpc_string($_GPC['key']);
  42. switch ($key) {
  43. case 'statcode':
  44. $settings[$key] = system_check_statcode($_GPC['value']);
  45. break;
  46. case 'url':
  47. $settings[$key] = (strexists($_GPC['value'], 'http://') || strexists($_GPC['value'], 'https://')) ? $_GPC['value'] : "http://{$_GPC['value']}";
  48. break;
  49. case 'footerleft':
  50. $settings[$key] = safe_gpc_html(htmlspecialchars_decode($_GPC['value']));
  51. break;
  52. case 'footerright':
  53. $settings[$key] = safe_gpc_html(htmlspecialchars_decode($_GPC['value']));
  54. break;
  55. case 'slides':
  56. $settings[$key] = iserializer($_GPC['value']);
  57. break;
  58. case 'companyprofile':
  59. $settings[$key] = safe_gpc_html(htmlspecialchars_decode($_GPC['value']));
  60. break;
  61. case 'template':
  62. break;
  63. case 'baidumap':
  64. break;
  65. default:
  66. $settings[$key] = $_GPC['is_int'] == 1 ? intval($_GPC['value']) : safe_gpc_string($_GPC['value']);
  67. break;
  68. }
  69. if (!in_array($key, $system_setting_items)) {
  70. iajax(-1, '参数错误!', url('system/site'));
  71. }
  72. if ($key == 'template') {
  73. setting_save(array('template' => safe_gpc_string($_GPC['value'])), 'basic');
  74. } else if($key = 'baidumap') {
  75. $settings['baidumap'] = array('lng' => $_GPC['lng'], 'lat' => $_GPC['lat']);
  76. setting_save($settings, 'copyright');
  77. } else {
  78. setting_save($settings, 'copyright');
  79. }
  80. iajax(0, '更新设置成功!', referer());
  81. }
  82. template('system/site');