国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

115 řádky
3.5KB

  1. <?php
  2. /**
  3. * @version $Id: install.inc.php 1 13:41 2010年7月26日Z tianya $
  4. * @package DedeBIZ.Install
  5. * @copyright Copyright (c) 2020, DedeBIZ.COM
  6. * @license https://www.dedebiz.com/license
  7. * @link https://www.dedebiz.com
  8. */
  9. function RunMagicQuotes(&$str)
  10. {
  11. if (!get_magic_quotes_gpc()) {
  12. if (is_array($str))
  13. foreach ($str as $key => $val) $str[$key] = RunMagicQuotes($val);
  14. else
  15. $str = addslashes($str);
  16. }
  17. return $str;
  18. }
  19. function gdversion()
  20. {
  21. //没启用php.ini函数的情况下如果有GD默认视作2.0以上版本
  22. if (!function_exists('phpinfo')) {
  23. if (function_exists('imagecreate')) return '2.0';
  24. else return 0;
  25. } else {
  26. ob_start();
  27. phpinfo(8);
  28. $module_info = ob_get_contents();
  29. ob_end_clean();
  30. if (preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i", $module_info, $matches)) {
  31. $gdversion_h = $matches[1];
  32. } else {
  33. $gdversion_h = 0;
  34. }
  35. return $gdversion_h;
  36. }
  37. }
  38. function GetBackAlert($msg, $isstop = 0)
  39. {
  40. global $s_lang;
  41. $msg = str_replace('"', '`', $msg);
  42. if ($isstop == 1) $msg = "<script>\r\n<!--\r\n alert(\"{$msg}\");\r\n-->\r\n</script>\r\n";
  43. else $msg = "<script>\r\n<!--\r\n alert(\"{$msg}\");history.go(-1);\r\n-->\r\n</script>\r\n";
  44. $msg = "<meta http-equiv=content-type content='text/html; charset={$s_lang}'>\r\n" . $msg;
  45. return $msg;
  46. }
  47. function TestWrite($d)
  48. {
  49. $tfile = '_dedet.txt';
  50. $d = preg_replace("#\/$#", '', $d);
  51. $fp = @fopen($d . '/' . $tfile, 'w');
  52. if (!$fp) return false;
  53. else {
  54. fclose($fp);
  55. $rs = @unlink($d . '/' . $tfile);
  56. if ($rs) return true;
  57. else return false;
  58. }
  59. }
  60. function ReWriteConfigAuto()
  61. {
  62. global $dsql;
  63. $configfile = DEDEDATA . '/config.cache.inc.php';
  64. if (!is_writeable($configfile)) {
  65. echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数!";
  66. //ClearAllLink();
  67. exit();
  68. }
  69. $fp = fopen($configfile, 'w');
  70. flock($fp, 3);
  71. fwrite($fp, "<" . "?php\r\n");
  72. $dsql->SetQuery("Select `varname`,`type`,`value`,`groupid` From `#@__sysconfig` order by aid asc ");
  73. $dsql->Execute();
  74. while ($row = $dsql->GetArray()) {
  75. if ($row['type'] == 'number') fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n");
  76. else fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n");
  77. }
  78. fwrite($fp, "?" . ">");
  79. fclose($fp);
  80. }
  81. //更新栏目缓存
  82. function UpDateCatCache()
  83. {
  84. global $conn, $cfg_multi_site, $dbprefix;
  85. $cache1 = DEDEDATA . "/cache/inc_catalog_base.inc";
  86. $rs = mysql_query("Select id,reid,channeltype,issend,typename From `" . $dbprefix . "arctype`", $conn);
  87. $fp1 = fopen($cache1, 'w');
  88. $phph = '?';
  89. $fp1Header = "<{$phph}php\r\nglobal \$cfg_Cs;\r\n\$cfg_Cs=array();\r\n";
  90. fwrite($fp1, $fp1Header);
  91. while ($row = mysql_fetch_array($rs)) {
  92. $row['typename'] = base64_encode($row['typename']);
  93. fwrite($fp1, "\$cfg_Cs[{$row['id']}]=array({$row['reid']},{$row['channeltype']},{$row['issend']},'{$row['typename']}');\r\n");
  94. }
  95. fwrite($fp1, "{$phph}>");
  96. fclose($fp1);
  97. }
  98. function IsDownLoad($url)
  99. {
  100. if (file_exists($url . '.xml')) {
  101. return true;
  102. } else {
  103. return false;
  104. }
  105. }