本文整理汇总了PHP中writefile函数的典型用法代码示例。如果您正苦于以下问题:PHP writefile函数的具体用法?PHP writefile怎么用?PHP writefile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writefile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getlog
function getlog()
{
global $timestamp, $onlineip, $action, $sax_user;
if ($action) {
writefile(SABLOG_ROOT . 'data/log/adminlog.php', "<?PHP exit('Access Denied'); ?>\t{$timestamp}\t{$sax_user}\t{$onlineip}\t" . htmlspecialchars(trim($action)) . "\twap\n", 'a');
}
}
示例2: add
function add($key, $val, $exp = 0)
{
$this->_file = $this->get_file($key, 'add');
$value = array("Time" => time(), "Expires" => $exp, "Data" => $val);
$data = serialize($value);
$this->_cache_sock = '<?php exit;?>';
if ($this->_have_zlib && $this->_compress_enable) {
$this->_cache_sock .= gzcompress($data, 9);
} else {
$this->_cache_sock .= $data;
}
return writefile($this->_file, $this->_cache_sock);
}
示例3: export_db_go
public function export_db_go()
{
require COMMON_PATH . "tp_common.php";
//引入自定义的类
import("Think.Db.Db");
//D('');也可以
$db = DB::getInstance();
$tables = $db->getTables();
foreach ($tables as $tbname) {
$coumt = $db->getFields($tbname);
$modelname = str_replace(C('DB_PREFIX'), '', $tbname);
//msg($modelname);
$row = D($modelname);
$row = $row->findAll();
if ($_GET[dbform]) {
//同时备份表结构
msg('正在备份表结构......<br>', 0);
$sql = "DROP TABLE `{$tbname}`;\n";
$field = $db->query("show create table {$tbname}");
$sql .= $field[0]['Create Table'] . ";\n\n";
$dbdatasql .= $sql;
unset($sql);
msg('表:' . $tbname . '备份表结构信息成功!<br>');
}
if ($_GET[dbdata]) {
//只备份表数据
msg('正在备份表数据......<br>', 0);
$sql = "TRUNCATE `{$tbname}`;\n";
//写入清空表信息
msg('表:' . $tbname . '写入清空表信息成功!<br>');
$values = array();
foreach ($row as $value) {
$sql = "INSERT INTO `{$tbname}` VALUES (";
foreach ($value as $v) {
$sql_tmp[] = "'" . mysql_real_escape_string($v) . "'";
}
$sql .= join(',', $sql_tmp);
$sql .= ");\n";
$dbdatasql .= $sql;
unset($sql);
unset($sql_tmp);
}
msg('分析表:' . $tbname . '成功!<br>');
}
}
$sqlbody = $dbdatasql . "\n" . $dbdatasql . "\n\n\n";
writefile('./Backup/SQL/tpmaker_' . date('Ymd-His') . '.sql', $sqlbody);
msg('备份表数据成功.<br>', 0);
}
示例4: parse_template
function parse_template($tplfile, $objfile)
{
global $options;
$nest = 5;
if (!($template = loadfile($tplfile))) {
exit('Current template file not found or have no access!');
}
/*
elseif (!include_once lang('templates')) {
exit("Current template pack do not have a necessary language file 'templates.php' or have syntax error!");
}
*/
$var_regexp = "((\\\$[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)(\\[[a-zA-Z0-9_\\-\\.\"\\'\\[\\]\$-ÿ]+\\])*)";
$const_regexp = "([a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)";
$template = preg_replace("/([\n\r]+)\t+/s", "\\1", $template);
$template = preg_replace("/\\<\\!\\-\\-\\{(.+?)\\}\\-\\-\\>/s", "{\\1}", $template);
$template = preg_replace("/\\{lang\\s+(.+?)\\}/ies", "languagevar('\\1')", $template);
$template = preg_replace("/\\{(\\\$[a-zA-Z0-9_\\[\\]\\'\"\$\\.-ÿ]+)\\}/s", "<?=\\1?>", $template);
$template = preg_replace("/{$var_regexp}/es", "addquote('<?=\\1?>')", $template);
$template = preg_replace("/\\<\\?\\=\\<\\?\\={$var_regexp}\\?\\>\\?\\>/es", "addquote('<?=\\1?>')", $template);
$template = "<? if(!defined('SABLOG_ROOT')) exit('Access Denied'); ?>\n{$template}";
$template = preg_replace("/[\n\r\t]*\\{template\\s+([a-z0-9_]+)\\}[\n\r\t]*/is", "\n<? include template('\\1'); ?>\n", $template);
$template = preg_replace("/[\n\r\t]*\\{template\\s+(.+?)\\}[\n\r\t]*/is", "\n<? include template(\\1); ?>\n", $template);
$template = preg_replace("/[\n\r\t]*\\{eval\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? \\1; ?>\n','')", $template);
$template = preg_replace("/[\n\r\t]*\\{elseif\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? } elseif(\\1) { ?>\n','')", $template);
$template = preg_replace("/[\n\r\t]*\\{else\\}[\n\r\t]*/is", "\n<? } else { ?>\n", $template);
for ($i = 0; $i < $nest; $i++) {
$template = preg_replace("/[\n\r\t]*\\{loop\\s+(\\S+)\\s+(\\S+)\\}[\n\r]*(.+?)[\n\r]*\\{\\/loop\\}[\n\r\t]*/ies", "stripvtags('\n<? if(is_array(\\1)) { foreach(\\1 as \\2) { ?>','\n\\3\n<? } } ?>\n')", $template);
$template = preg_replace("/[\n\r\t]*\\{loop\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\}[\n\r\t]*(.+?)[\n\r\t]*\\{\\/loop\\}[\n\r\t]*/ies", "stripvtags('\n<? if(is_array(\\1)) { foreach(\\1 as \\2 => \\3) { ?>','\n\\4\n<? } } ?>\n')", $template);
$template = preg_replace("/[\n\r\t]*\\{if\\s+(.+?)\\}[\n\r]*(.+?)[\n\r]*\\{\\/if\\}[\n\r\t]*/ies", "stripvtags('\n<? if(\\1) { ?>','\n\\2\n<? } ?>\n')", $template);
}
$template = preg_replace("/\\{{$const_regexp}\\}/s", "<?=\\1?>", $template);
$template = preg_replace("/ \\?\\>[\n\r]*\\<\\? /s", " ", $template);
$template = preg_replace("/\"(http)?[\\w\\.\\/:]+\\?[^\"]+?&[^\"]+?\"/e", "transamp('\\0')", $template);
$template = str_replace('<?=', '<?php echo ', $template);
$template = str_replace('<? ', '<?php ', $template);
if (!writefile($objfile, $template)) {
exit('Directory \'./data/template/\' not found or have no access!');
}
}
示例5: all_doconfig_modify
function all_doconfig_modify($whereis){
global $dbhost2, $dbuser2, $dbpw2, $dbname2, $tablepre2,$dbcharset2;
if($whereis == 'is_dz') {
// /\$dbhost.+;/i
if(file_exists('./uc_server/data/config.inc.php')) {
$config = file_get_contents('./uc_server/data/config.inc.php');
writefile('./uc_server/data/config.bak.php.'.time(),$config);
$config = uc_doconfig_modify($config);
writefile('./uc_server/data/config.inc.php',$config);
}
$config = file_get_contents('./config.inc.php');
writefile('./forumdata/config.bak.php.'.date(ymd,time()),$config);
$config = preg_replace('/\$dbhost.+;/i','$dbhost = \''.$dbhost2.'\';',$config);
$config = preg_replace('/\$dbuser.+;/i','$dbuser = \''.$dbuser2.'\';',$config);
$config = preg_replace('/\$dbpw.+;/i','$dbpw = \''.$dbpw2.'\';',$config);
$config = preg_replace('/\$dbname.+;/i','$dbname = \''.$dbname2.'\';',$config);
$config = preg_replace('/\$tablepre.+;/i','$tablepre = \''.$tablepre2.'\';',$config);
$config = preg_replace('/\$dbcharset.+;/i','$dbcharset = \''.$dbcharset2.'\';',$config);
$config = uc_doconfig_modify($config);
if(writefile('./config.inc.php',$config)) {
show_tools_message('配置文件已经成功修改,原配置文件已经备份到forumdata目录下。','tools.php?action=all_config');
}
} elseif($whereis == 'is_uch' || $whereis == 'is_ss') {
$config = file_get_contents('./config.php');
writefile('./data/config.bak.php.'.date(ymd,time()),$config);
$config = preg_replace('/\$_SC\[\'dbhost\'\].+;/i','$_SC[\'dbhost\'] = \''.$dbhost2.'\';',$config);
$config = preg_replace('/\$_SC\[\'dbuser\'\].+;/i','$_SC[\'dbuser\'] = \''.$dbuser2.'\';',$config);
$config = preg_replace('/\$_SC\[\'dbpw\'\].+;/i','$_SC[\'dbpw\'] = \''.$dbpw2.'\';',$config);
$config = preg_replace('/\$_SC\[\'dbname\'\].+;/i','$_SC[\'dbname\'] = \''.$dbname2.'\';',$config);
$config = preg_replace('/\$_SC\[\'tablepre\'\].+;/i','$_SC[\'tablepre\'] = \''.$tablepre2.'\';',$config);
$config = preg_replace('/\$_SC\[\'dbcharset\'\].+;/i','$_SC[\'dbcharset\'] = \''.$dbcharset2.'\';',$config);
$config = uc_doconfig_modify($config);
if(writefile('./config.php',$config)) {
show_tools_message('配置文件已经成功修改,原配置文件已经备份到data目录下。','tools.php?action=all_config');
}
} elseif($whereis == 'is_uc') {
$config = file_get_contents('./data/config.inc.php');
writefile('./data/config.bak.php.'.date(ymd,time()),$config);
$config = uc_doconfig_modify($config);
if(writefile('./data/config.inc.php',$config)) {
show_tools_message('配置文件已经成功修改,原配置文件已经备份到data目录下。','tools.php?action=all_config');
}
}
}
示例6: writeconf
/**
* 写配置文件
* @param string $path
* @param string $content
* @param int $isappend 是否追加
*/
function writeconf($path, $content)
{
$o_content = (include $path);
$new_conf = $content;
if ($o_content) {
$new_conf = array_merge($content, $o_content);
}
$str = "<?php \r\n return " . var_export($new_conf, true) . "; \r\n?>";
return writefile($path, $str);
}
示例7: QueMessage
$max_uploads = (int) $max_uploads;
// please keep this formatted like this
$sSQL = "Update " . $pho_main . " set\n name='{$name}',\n description='{$description}',\n config_suffix='{$config_suffix}',\n parent={$parent},\n display={$display},\n moderation='{$moderation}',\n email_list='{$email_list}',\n email_return='{$email_return}',\n email_tag='{$email_tag}',\n check_dup={$check_dup},\n multi_level={$multi_level},\n collapse={$collapsed},\n flat={$rflat},\n lang='{$language_file}',\n html='{$allow_html}',\n table_width='{$table_width}',\n table_header_color='{$table_header_color}',\n table_header_font_color='{$table_header_font_color}',\n table_body_color_1='{$table_body_color_1}',\n table_body_color_2='{$table_body_color_2}',\n table_body_font_color_1='{$table_body_font_color_1}',\n table_body_font_color_2='{$table_body_font_color_2}',\n nav_color='{$nav_color}',\n nav_font_color='{$nav_font_color}',\n allow_uploads='{$allow_uploads}',\n upload_types='{$upload_types}',\n upload_size='{$upload_size}',\n max_uploads='{$max_uploads}',\n security='{$security}',\n showip='{$showip}',\n emailnotification={$emailnotification},\n body_color='{$body_color}',\n body_link_color='{$body_link_color}',\n body_alink_color='{$body_alink_color}',\n body_vlink_color='{$body_vlink_color}'\n where\n id={$num}";
} else {
$sSQL = "Update " . $pho_main . " set name='{$name}', description='{$description}', config_suffix='{$config_suffix}', lang='{$language_file}', parent={$parent}, table_width='{$table_width}', table_header_color='{$table_header_color}', table_header_font_color='{$table_header_font_color}', table_body_color_1='{$table_body_color_1}', table_body_font_color_1='{$table_body_font_color_1}', nav_color='{$nav_color}', nav_font_color='{$nav_font_color}', body_color='{$body_color}', body_link_color='{$body_link_color}', body_alink_color='{$body_alink_color}', body_vlink_color='{$body_vlink_color}' where id={$num}";
}
$q->query($DB, $sSQL);
$err = $q->error();
if ($err == "") {
if (!$folder && $AllowAttachments && $allow_uploads == 'Y') {
if (!file_exists("{$AttachmentDir}/{$table}") && !@mkdir("{$AttachmentDir}/{$table}", 0777)) {
QueMessage("The directory ({$AttachmentDir}/{$table}) for attachments could not be created.");
} else {
chmod("{$AttachmentDir}/{$table}", 0777);
}
if ($err = create_table($DB, "attachments", $table . "_attachments")) {
QueMessage("Could not create attachments table. Database server said \"{$err}\"");
}
}
$ForumName = stripslashes($name);
writefile($num);
include "{$PHORUM['settings_dir']}/{$num}.php";
QueMessage("{$ForumName} has been updated.");
} else {
QueMessage($err);
$page = $frompage;
}
} else {
QueMessage("You must provide a name for the forum.");
$option == "edit_prop";
}
示例8: makeprotpl
function makeprotpl($id)
{
//生成基本Action
$app_path = $this->getapppath();
//获取生成程序的根目录
$tpl_path = $this->gettplpath();
//获取程序模板的根目录
$data = $this->gettables($id);
$tablename = uplower($data['title']);
//第一个字母变成大写,其它变成小写
$caption = $data['caption'];
$fields = $this->getfieldsbytbid($id);
tpmk_dir($app_path . '/Tpl/default/' . $tablename . '/');
//生成目录
$islist = $data['list'] == 1 ? true : false;
//是否列表
$issearch = $data['search'] == 1 ? true : false;
//issearch
$isadd = $data['add'] == 1 ? true : false;
//是否增加
$isedit = $data['edit'] == 1 ? true : false;
//是否允许编辑
$isview = $data['view'] == 1 ? true : false;
//是否允许查看详细
$isdel = $data['del'] == 1 ? true : false;
//是否允许删除数据
//生成INDEX.HMTL包括LIST及SEARCH的
if ($islist) {
$filename = $app_path . '/Tpl/default/' . $tablename . '/index.html';
//生成的模板文件名
$tpl = new tpl($tpl_path . '/Html_tpl/index.html');
//源模板文件名
$tpl->tplsign('tablecaption', $caption);
//替换
$tpl->tplsign('tablelist', $tablename);
//替换表名
$filecontent = $tpl->tplreturn();
writefile($filename, $filecontent);
}
//生成ajaxlist.HMTL
if ($islist || $issearch) {
$filename = $app_path . '/Tpl/default/' . $tablename . '/ajaxlist.html';
//生成的模板文件名
$tpl = new tpl($tpl_path . '/Html_tpl/ajaxlist.html');
//源模板文件名
$listshowsort = $this->makerowslistsort($fields, 'islist');
$listshowtd = $this->makerowslisttd($fields, 'islist');
$tpl->tplblocksign('listshowsort', $listshowsort);
//替换
$tpl->tplblocksign('listshowtd', $listshowtd);
//替换
$tpl->tplissign('issearch', $issearch);
//替换是否搜索
$tpl->tplissign('isadd', $isadd);
//替换是否增加
$tpl->tplissign('isedit', $isedit);
//替换是否编辑
$tpl->tplissign('isview', $isview);
//替换查看详细
$tpl->tplissign('isdel', $isdel);
//替换删除数据
$tpl->tplsign('tablecaption', $caption);
//替换
$tpl->tplsign('tablelist', $tablename);
//替换表名
$filecontent = $tpl->tplreturn();
writefile($filename, $filecontent);
}
//生成Add.HMTL
if ($isadd) {
$filename = $app_path . '/Tpl/default/' . $tablename . '/add.html';
//生成的模板文件名
$tpl = new tpl($tpl_path . '/Html_tpl/add.html');
//源模板文件名
if (count($fields) > 0) {
foreach ($fields as $field) {
$vartype = $field['addtype'];
$varname = $this->maketags($field['addtype'], 'addtype', $field['name'], $field['indexvar'], $field['outkey'], $field['outkeyid'], $field['outkeyf'], $field['outkeywhere']);
$varcaption = $field['caption'];
$rows_contents[] = array("rows_type" => $vartype, "rows_name" => $varname, "rows_caption" => $varcaption);
//替换方式
}
}
$tpl->tplblocksign('rows_contents', $rows_contents);
$tpl->tplissign('issearch', $issearch);
//替换是否搜索
$tpl->tplissign('isadd', $isadd);
//替换是否增加
$tpl->tplissign('isedit', $isedit);
//替换是否编辑
$tpl->tplissign('isview', $isview);
//替换查看详细
$tpl->tplissign('isdel', $isdel);
//替换删除数据
$tpl->tplsign('tablecaption', $caption);
//替换
$tpl->tplsign('tablename', $tablename);
//替换表名
$filecontent = $tpl->tplreturn();
writefile($filename, $filecontent);
//.........这里部分代码省略.........
示例9: writefile
// "on" -> boolean
// XXX we assume there is no string called "on"
$config .= "gp_{$key}\t{$key}\tboolean\ttrue\n";
$typedef .= "\tboolean gp_{$key}=false\n";
} else {
// string otherwise
$config .= "gp_{$key}\t{$key}\tString\t{$val}\n";
$typedef .= "\tString gp_{$key}=\"{$val}\"\n";
}
}
}
}
}
}
#echo $typedef;
writefile($config, $uid . ".appconfig");
}
writeattributefile($gamedata, $uid . ".game");
if ($clearform) {
header("Location: fillgameform.php#form");
} else {
if ($badinput) {
header("Location: fillgameform.php?error=badinput#form");
} else {
if ($undefinput) {
header("Location: fillgameform.php?error=undefinput#form");
} else {
if ($counterror) {
header("Location: fillgameform.php?error=counterror#form");
} else {
header("Location: playgame.php");
示例10: dumpsql_action
function dumpsql_action()
{
global $db;
$dump = $this->dump;
/* 设置最长执行时间为5分钟 */
@set_time_limit(300);
$run_log = $this->path . '/run.log';
/* 初始化输入变量 */
if (empty($_REQUEST['sql_file_name'])) {
$sql_file_name = $dump->get_random_name();
} else {
$sql_file_name = str_replace("0xa", '', trim($_REQUEST['sql_file_name']));
// 过滤 0xa 非法字符
$pos = strpos($sql_file_name, '.sql');
if ($pos !== false) {
$sql_file_name = substr($sql_file_name, 0, $pos);
}
}
$max_size = empty($_REQUEST['vol_size']) ? 0 : intval($_REQUEST['vol_size']);
$vol = empty($_REQUEST['vol']) ? 1 : intval($_REQUEST['vol']);
$is_short = empty($_REQUEST['ext_insert']) ? false : true;
$dump->is_short = $is_short;
/* 变量验证 */
$allow_max_size = intval(@ini_get('upload_max_filesize'));
//单位M
if ($allow_max_size > 0 && $max_size > $allow_max_size * 1024) {
$max_size = $allow_max_size * 1024;
//单位K
}
if ($max_size > 0) {
$dump->max_size = $max_size * 1024;
}
/* 获取要备份数据列表 */
$type = empty($_POST['type']) ? '' : trim($_POST['type']);
$tables = array();
switch ($type) {
case 'full':
$query = $db->query("SHOW TABLES LIKE '" . $GLOBALS['table_prefix'] . "%'");
while ($t = $db->fetch_array($query)) {
$table = array_values($t);
$tables[$table[0]] = -1;
}
$dump->put_tables_list($run_log, $tables);
break;
case 'stand':
$temp = array('site', 'user', 'groups ', 'score');
foreach ($temp as $table) {
$tables[$GLOBALS['table_prefix'] . $table] = -1;
}
$dump->put_tables_list($run_log, $tables);
break;
case 'min':
$temp = array('site');
foreach ($temp as $table) {
$tables[$GLOBALS['table_prefix'] . $table] = -1;
}
$dump->put_tables_list($run_log, $tables);
break;
case 'custom':
foreach ($_POST['customtables'] as $table) {
$tables[$table] = -1;
}
$dump->put_tables_list($run_log, $tables);
break;
}
/* 开始备份 */
$tables = $dump->dump_table($run_log, $vol);
if ($tables === false) {
die($dump->errorMsg());
}
if (empty($tables)) {
/* 备份结束 */
if ($vol > 1) {
/* 有多个文件 */
if (!@writefile(ROOT_PATH . 'data/sqlbackup/' . $sql_file_name . '_' . $vol . '.sql', $dump->dump_sql)) {
sheader('index.php?con=database&act=backup', 3, $sql_file_name . '_' . $vol . '.sql文件写入失败', 'redirect', true);
}
$list = array();
for ($i = 1; $i <= $vol; $i++) {
$list[] = array('name' => $sql_file_name . '_' . $i . '.sql', 'href' => 'data/sqlbackup/' . $sql_file_name . '_' . $i . '.sql');
}
sheader('index.php?con=database&act=restore', 3, '文件备份完成', 'redirect', true);
} else {
/* 只有一个文件 */
if (!@writefile(ROOT_PATH . 'data/sqlbackup/' . $sql_file_name . '.sql', $dump->dump_sql)) {
sheader('index.php?con=database&act=backup', 3, $sql_file_name . '_' . $vol . '.sql文件写入失败', 'redirect', true);
}
$list = array(array('name' => $sql_file_name . '.sql', 'href' => 'data/sqlbackup/' . $sql_file_name . '.sql'));
sheader('index.php?con=database&act=restore', 3, '文件备份完成', 'redirect', true);
}
} else {
/* 下一个页面处理 */
if (!@writefile(ROOT_PATH . 'data/sqlbackup/' . $sql_file_name . '_' . $vol . '.sql', $dump->dump_sql)) {
sheader('index.php?con=database&act=backup', 3, $sql_file_name . '_' . $vol . '.sql文件写入失败', 'redirect', true);
}
$lnk = 'index.php?con=database&act=dumpsql&sql_file_name=' . $sql_file_name . '&vol_size=' . $max_size . '&vol=' . ($vol + 1);
sheader($lnk, 3, $sql_file_name . '_' . $vol . '.sql文件写入成功,进入下一个文件', 'redirect', true);
}
}
示例11: exit
if (!defined('IN_BRAND')) {
exit('Access Denied');
}
$goodcronfile = B_ROOT . './data/system/updategoodgrade.cache.php';
if (!file_exists($goodcronfile)) {
$goodcrontext = '$crongoodid=0';
writefile($goodcronfile, $goodcrontext, 'php');
}
@(include $goodcronfile);
$pernum = 1000;
$resultarr = array();
$wheresql = 'itemid>' . $crongoodid . ' AND';
$goodnum = DB::result_first('SELECT COUNT(itemid) FROM ' . tname('gooditems') . ' WHERE ' . $wheresql . ' grade>2 ORDER BY itemid ASC');
$query = DB::query('SELECT itemid, validity_end FROM ' . tname('gooditems') . ' WHERE ' . $wheresql . ' grade>2 ORDER BY itemid ASC LIMIT ' . $pernum);
while ($value = DB::fetch($query)) {
if (!empty($value['validity_end']) && $value['validity_end'] < $_G['timestamp']) {
DB::query('UPDATE ' . tname('gooditems') . ' SET grade=2 WHERE itemid=' . $value['itemid'], 'UNBUFFERED');
}
$resultarr[] = $value;
}
if ($goodnum > $pernum) {
$cronlastgood = array_pop($resultarr);
$crongoodid = $cronlastgood['itemid'];
$goodcrontext = '$crongoodid=' . $crongoodid;
writefile($goodcronfile, $goodcrontext, 'php');
runcron($cron['cronid']);
} else {
$goodcrontext = '$crongoodid=0';
writefile($goodcronfile, $goodcrontext, 'php');
cronnextrun(array($cron['cronid']));
}
示例12: check_security
<?php
check_security();
?>
<?php
// activate the current forum
$sSQL = "Update " . $pho_main . " set active=1 where id={$num}";
$q->query($DB, $sSQL);
$ForumActive = 1;
writefile($num, true);
示例13: unset
unset($resultmodels['mid']);
$resultcolumns = array();
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('modelcolumns') . ' WHERE mid = \'' . $_GET['mid'] . '\' ORDER BY displayorder, id');
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
unset($value['id']);
unset($value['mid']);
if (!empty($value['upid']) && $value['formtype'] == 'linkage') {
$value['upid'] = $cacheinfo['columnids'][$value['upid']];
}
$resultcolumns[] = $value;
}
$resultmodels['tpl'] = '';
$tarr = array('info' => array('version' => S_VER, 'charset' => $_SCONFIG['charset']), 'models' => $resultmodels, 'columns' => $resultcolumns, 'categories' => $cacheinfo['categoryarr']);
$modelsql = "/** SupeSite Dump\r\n" . " * Version: SupeSite " . S_VER . "\r\n" . " * Charset: " . $_SCONFIG['charset'] . "\r\n" . " * Time: {$time}\r\n" . " * From: {$_SCONFIG['sitename']} (" . S_URL . ")\r\n" . " * \r\n" . " * SupeSite: http://www.supesite.com\r\n" . " * Please visit our website for latest news about SupeSite\r\n" . " * --------------------------------------------------------*/\r\n\r\n\r\n";
$modelsql .= '$cacheinfo = ' . arrayeval($tarr) . ';';
if (!writefile($modelsqlfile, $modelsql, 'php')) {
fclose($fp);
deltree($datadir . '/' . $backupdir . '/');
showmessage('file_write_error');
} else {
fclose($fp);
$zipfilearr[] = $modelsqlfile;
}
$dberrorarr = array();
$createtable = $tabledump = '';
$_SGLOBAL['db']->query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
//ÎÞ±¨´íÖ´ÐйرÕÎҵĴ´½¨±íºÍÁÐʱ²»¼ÓÒýºÅ
foreach ($modeldbarr as $tmpvalue) {
$createtable = $_SGLOBAL['db']->query('SHOW CREATE TABLE ' . tname($resultmodels['modelname'] . $tmpvalue), 'SILENT');
if (!$_SGLOBAL['db']->errno()) {
$tabledump .= 'DROP TABLE IF EXISTS ' . tname($resultmodels['modelname'] . $tmpvalue) . ";\n";
示例14: ehtml
function ehtml($type, $updatetime = 0)
{
global $_SGLOBAL, $_SGET, $_SHTML, $_SCONFIG, $lang;
if ($type == 'get') {
$_SGLOBAL['htmlfile']['updatetime'] = $updatetime;
//if(empty($_SGET['php']) && !empty($_SGLOBAL['htmlfile']['path']) && file_exists($_SGLOBAL['htmlfile']['path'])) {
// sheader($_SGLOBAL['htmlfile']['url']);
//}
if (empty($_SGET['php']) && !empty($_SGLOBAL['htmlfile']['path']) && file_exists($_SGLOBAL['htmlfile']['path'])) {
if ($_SGLOBAL['htmlfile']['path'] == './html/index.html') {
include S_ROOT . './html/index.html';
exit;
} else {
sheader($_SGLOBAL['htmlfile']['url']);
}
}
} else {
if (empty($_SHTML['maxpage']) && !empty($_SGLOBAL['htmlfile']['path'])) {
$content = $_SGLOBAL['content'];
$theurl = S_URL_ALL . '/index.php?' . arraytostring($_SHTML);
$codearr = array('url' => rawurlencode($theurl), 'maketime' => $_SGLOBAL['timestamp'], 'updatetime' => $_SGLOBAL['htmlfile']['updatetime'], 'uid' => empty($_SHTML['uid']) ? 0 : $_SHTML['uid'], 'itemid' => empty($_SHTML['itemid']) ? 0 : $_SHTML['itemid'], 'action' => $_SHTML['action']);
$code = rawurlencode(implode('/', $codearr));
$content .= '
<script language="javascript">
<!--
var Modified = new Date(document.lastModified);
var copyright = document.getElementById("xspace-copyright");
if(copyright) {
copyright.innerHTML += "Last update: <a href=\\"' . $theurl . '/php/1\\" title=\\"' . $lang['the_page_can_be_updated_immediately_hits'] . '\\">"+(Modified.getYear()<200?(Modified.getYear()+1900):Modified.getYear())+"-"+(Modified.getMonth()+1)+"-"+Modified.getDate()+" "+Modified.getHours()+":"+Modified.getMinutes()+":"+Modified.getSeconds() + "</a><br>";
}
document.write(\'<script src="' . S_URL . '/batch.html.php?code=' . $code . '&lastmodified=\' + Modified.getTime() + \'" type="text\\/javascript" language="javascript"><\\/script>\');
//-->
</script>';
writefile($_SGLOBAL['htmlfile']['path'], $content);
}
}
}
示例15: showmessage
}
} else {
showmessage('bbs_db_error', CPURL . '?action=bbs&error=db');
}
$_SC['bbsurl'] = trim($_POST['bbsurl']);
$txt = sreadfile($_SC['bbsurl'] . '/index.php', 'r', 1);
if (strlen($txt) < 100) {
showmessage('bbs_url_error', CPURL . '?action=bbs&error=bbsurl');
}
//ÐÞ¸Äconfig.php
$file = S_ROOT . './config.php';
$configfile = sreadfile($file, 'r');
foreach (array('dbhost_bbs', 'dbuser_bbs', 'dbpw_bbs', 'dbname_bbs', 'tablepre_bbs', 'pconnect_bbs', 'dbcharset_bbs', 'bbsurl', 'bbsattachurl', 'bbsver') as $value) {
$configfile = preg_replace("/[\$]\\_SC\\[\\'" . $value . "\\'\\](\\s*)\\=\\s*[\"'].*?[\"']/is", "\$_SC['" . $value . "']\\1= '" . $_SC[$value] . "'", $configfile);
}
if (!writefile($file, $configfile)) {
showmessage('error: config.php have no access to write', $theurl);
}
$bbschenelarr = array('nameid' => 'bbs', 'name' => $alang['bbs'], 'type' => 'system', 'status' => 1);
inserttable('channels', $bbschenelarr, 0, true);
include_once S_ROOT . './function/cache.func.php';
dbconnect(1);
//Éý¼¶ÂÛ̳×Ö¶Î
updatebbstables();
//»º´æÂÛ̳ÉèÖÃ
updatebbssetting();
//»º´æÂÛ̳·ç¸ñÉèÖÃ
updatebbsstyle();
//»º´æÂÛ̳bbcode/smiles
updatebbsbbcode();
updatebbsstyle();