国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5KB

  1. <?php
  2. /**
  3. *
  4. * 二维码生成
  5. *
  6. * @version $Id: qrcode.php$
  7. * @package DedeCMS.Site
  8. * @copyright Copyright (c) 2020, DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license
  10. * @link https://www.dedebiz.com
  11. */
  12. $cfg_NotPrintHead = 'Y';
  13. require_once(dirname(__FILE__) . '/../include/common.inc.php');
  14. require_once(DEDEINC . '/qrcode.class.php');
  15. $action = isset($action) ? $action : '';
  16. $type = isset($type) ? RemoveXSS(HtmlReplace($type, 3)) : '';
  17. $id = (isset($id) && is_numeric($id)) ? $id : 0;
  18. if (!in_array($type, array('list', 'arc', 'index'))) $url = "https://www.dedebiz.com";
  19. if ($action == 'get_qrcode') {
  20. if ($type == 'arc') {
  21. $url = $cfg_basehost . $cfg_plus_dir . '/view.php?aid=' . $id;
  22. } elseif ($type == 'list') {
  23. $url = $cfg_basehost . $cfg_plus_dir . '/list.php?tid=' . $id;
  24. }
  25. if ($id == 0) $url = "https://www.dedebiz.com";
  26. if ($type == 'index') $url = $cfg_basehost . $cfg_plus_dir . '/index.php';
  27. header("Content-Type: image/png");
  28. $params = array();
  29. $params['data'] = $url;
  30. $params['size'] = 6;
  31. $qrcode = new DedeQrcode;
  32. $qrcode->generate($params);
  33. } else {
  34. header("Content-Type: text/html; charset={$cfg_soft_lang}");
  35. $dtp = new DedeTemplate();
  36. $tplfile = DEDETEMPLATE . '/plus/qrcode.htm';
  37. $dtp->LoadTemplate($tplfile);
  38. $dtp->SetVar('id', $id);
  39. $dtp->SetVar('type', $type);
  40. $dtp->Display();
  41. exit();
  42. }