domainset.ctrl.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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('miniapp');
  8. load()->classs('cloudapi');
  9. load()->classs('uploadedfile');
  10. load()->func('file');
  11. $dos = array('display');
  12. $do = in_array($do, $dos) ? $do : 'display';
  13. $wxapp_info = miniapp_fetch($_W['uniacid']);
  14. $is_module_wxapp = false;
  15. if (!empty($version_id)) {
  16. $is_single_module_wxapp = $version_info['type'] == WXAPP_CREATE_MODULE; }
  17. if ($do == 'display') {
  18. $appurl = $_W['siteroot'].'app/index.php';
  19. $uniacid = 0;
  20. if ($version_info) {
  21. $wxapp = pdo_get('account_wxapp', array('uniacid' => $version_info['uniacid']));
  22. if ($wxapp && !empty($wxapp['appdomain'])) {
  23. $appurl = $wxapp['appdomain'];
  24. }
  25. if (!starts_with($appurl, 'https')) { $appurl = str_replace('http', 'https', $appurl);
  26. }
  27. $uniacid = $version_info['uniacid'];
  28. }
  29. if ($_W['ispost']) {
  30. $appurl = safe_gpc_url($_GPC['appurl'], false);
  31. if (!starts_with($appurl, 'https')) {
  32. itoast('域名必须以https开头');
  33. return;
  34. }
  35. $file = $_FILES['file'];
  36. if (!empty($file['name']) && $file['error'] == 0) {
  37. $ext = pathinfo($file['name'], PATHINFO_EXTENSION);
  38. if (strtolower($ext) == 'txt') {
  39. $file['name'] = parse_path($file['name']);
  40. file_move($file['tmp_name'], IA_ROOT . '/' . $file['name']);
  41. }
  42. }
  43. if ($version_info) {
  44. $update = pdo_update('account_wxapp', array('appdomain' => $appurl), array('uniacid' => $uniacid));
  45. itoast('更新成功'); }
  46. }
  47. template('wxapp/domainset');
  48. }