<?php error_reporting(0); //error_reporting(2047); define('M_COM', TRUE); define('M_ROOT', ''); $timestamp = time(); include_once M_ROOT . './base.inc.php'; include_once M_ROOT . './include/general.fun.php'; load_cache('sitemaps'); empty($sitemaps['google']) && exit; $sitemap = $sitemaps['google']; $cachefile = M_ROOT . './google.xml'; if (empty($sitemap['setting']['life']) || $timestamp - @filemtime($cachefile) > $sitemap['setting']['life'] * 3600 || !($datastr = file2str($cachefile))) { require M_ROOT . './dynamic/cache/mconfigs.cac.php'; @extract($mconfigs_0); include_once M_ROOT . './include/mysql.cls.php'; $db = new cls_mysql(); $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); include_once M_ROOT . './include/common.fun.php'; include_once M_ROOT . './include/sitemap.inc.php'; str2file($datastr, $cachefile); } echo $datastr; header("Content-type: application/xml"); exit;
function rtagval($tname) { global $rtags, $templatedir, $sid, $subsites; $rtag = read_tag('rtag', $tname); $sid && ($templatedir = $subsites[$sid]['templatedir']); //子站分别指定模板目录 $template = @file2str(M_ROOT . "template/{$templatedir}/" . @$rtag['template']); return $template ? $template : "{tpl\${$tname}}"; }
function convert_file($scode, $tcode, $sfile = '') { //gbk,big5,utf-8 if (!$sfile || !is_file($sfile)) { return; } if (empty($scode) || empty($tcode) || $scode == $tcode) { return; } $str = @file2str($sfile); $str && ($str = convert_encoding($scode, $tcode, $str)); str2file($str, $sfile); }
/** * 数据库还原 */ function import() { $filename = $_GET["file"]; $filelimit = explode("_", $filename); unset($filelimit[3]); $filenames = join("_", $filelimit); $sqlfile_paths = glob(ROOT_PATH . '/Backup/database/' . $filenames . '_*.sql'); for ($i = 0; $i < count($sqlfile_paths); $i++) { $sql = file2str(ROOT_PATH . '/Backup/database/' . $filenames . '_' . $i . '.sql'); $success = $this->exec_sql($sql, $msg, $sql_count); } if ($success) { $this->success("导入成功!共执行{$sql_count}条语句", U("import_list")); } else { header("Content-Type:text/html; charset=utf-8"); echo "<pre>"; echo $msg; echo "</pre>"; } }
echo "</form>\n"; } elseif (submitcheck('bdo')) { if (!dir_copy($subsetupdir . 'template/', $true_tpldir, 1, 1)) { amessage('telcopyerror'); } $tagsarr = $tplsarr = array(); $omtpls = oread_cache('mtpls', '', '', 'template'); foreach ($omtpls as $k => $v) { $tplsarr[] = $k; } $osptpls = oread_cache('sptpls', '', '', 'template'); foreach ($osptpls as $k => $v) { $tplsarr[] = $v; } foreach ($tplsarr as $v) { $str = @file2str($subsetupdir . 'template/' . $v); oreplace($str, 'p'); oreplace($str, 'c'); str2file($str, $true_tpldir . $v); } $tagsarr[] = array('mtpls', ''); $tagsarr[] = array('sptpls', ''); $tagsarr[] = array('rtags', ''); $ortags = oread_cache('rtags', '', '', 'template'); foreach ($ortags as $k => $v) { $tagsarr[] = array('rtag', $k); } $tagsarr[] = array('ptags', ''); $optags = oread_cache('ptags', '', '', 'template'); foreach ($optags as $k => $v) { $tagsarr[] = array('ptag', $k);
$filesnew = findfiles($true_tpldir); in_array($filenamenew, $filesnew) && amessage('filenamerepeat', M_REFERER); if (!copy($true_tpldir . $filename, $true_tpldir . $filenamenew)) { amessage('filecopyfailed', M_REFERER); } adminlog(lang('copy_file', $jsmode ? 'JS' : 'CSS')); amessage('filecopyfinish', axaction(6, $forward, $jsmode ? 'JS' : 'CSS')); } } elseif ($action == 'filedetail') { $forward = empty($forward) ? M_REFERER : $forward; $forwardstr = '&forward=' . rawurlencode($forward); if (empty($filename)) { amessage('pointfilename', M_REFERER); } if (!submitcheck('bfiledetail')) { $content = @file2str($true_tpldir . $filename); tabheader(($jsmode ? 'JS' : 'CSS') . lang('file_edit') . ' - ' . $filename, 'filedetail', "?entry=csstpls&action=filedetail&filename={$filename}{$param_suffix}&jsmode={$jsmode}{$forwardstr}"); echo "<tr class=\"txt\"><td colspan=\"2\"><textarea class=\"textarea\" style=\"width:700px;height:450px\" name=\"contentnew\" id=\"contentnew\">" . htmlspecialchars(str_replace("\t", " ", $content)) . "</textarea></td><tr>"; tabfooter('bfiledetail'); } else { @str2file(stripslashes($contentnew), $true_tpldir . $filename); adminlog(lang('detail_modify_file', $jsmode ? 'JS' : 'CSS')); amessage('filemodifyfinish', axaction(6, $forward), $jsmode ? 'JS' : 'CSS'); } } elseif ($action == 'filedel') { $forward = empty($forward) ? M_REFERER : $forward; $forwardstr = '&forward=' . rawurlencode($forward); if (empty($filename)) { amessage('pointfilename', M_REFERER); } if (empty($confirm)) {