function _update_gameworld_value() { global $game_kv; $gameworld_info = array(); $sql = "SELECT * FROM s_game_kv"; $rst = mysql_x_query($sql); while ($row = mysql_fetch_assoc($rst)) { $gameworld_info[$row['key']] = $row['value']; } set_cache('', 'gameworld_info', $gameworld_info); $game_kv = $gameworld_info; return $gameworld_info; }
function _update_all_areas() { global $g_xcache_enabled; $sql = "SELECT * FROM s_map_area"; $rst = mysql_x_query($sql); while ($row = mysql_fetch_assoc($rst)) { $all_areas[$row['area_type']][$row['area_id']] = $row; } if ($g_xcache_enabled) { set_xcache('sys', 'all_area', $all_areas, 0); } else { set_cache('sys', 'all_area', $all_areas, 0); } return $all_areas; }
function gen_file($path, $dir, $lang, $file_name, $file_ext) { if ($file_handle = @fopen($path . "/" . $file_name . "." . $file_ext, 'r')) { null; } else { $file_handle = fopen($path . "/" . $file_name . "." . $file_ext, 'w'); } $sql = "SELECT k.`t_key`, i.`t_value`\r\n FROM trans_file_key k\r\n LEFT JOIN `trans_item` i ON i.`t_key_id` = k.`id` AND i.`lang`='{$lang}'\r\n WHERE k.`dir` = '{$dir}'\r\n AND k.`filename` = '{$file_name}'\r\n AND k.`filetyp` = '{$file_ext}'"; $rst = mysql_x_query($sql); if ($file_ext == 'php') { fwrite($file_handle, "<?php\n\n"); while ($row = mysql_fetch_assoc($rst)) { if ($row['t_key'] != '') { insert_date_to_file($file_name, $file_handle, $row); } } fwrite($file_handle, "\n\n?>"); } elseif ($file_ext == 'js') { while ($row = mysql_fetch_assoc($rst)) { if ($row['t_key'] != '') { fwrite($file_handle, "var {$row['t_key']} = '{$row['t_value']}'\n"); } } } fclose($file_handle); }
exit; } include_once MR . $g_module . '/' . $g_action . '.php'; //读取界面文件 if ($g_view == PAGE) { $v_title = 'Demo!'; include_once VR . $g_module . '/' . $g_action . '.php'; } elseif ($g_view == HTML) { include_once VR . $g_module . '/block/' . $g_action . '.php'; } elseif ($g_view == JSON) { if (isset($_GET['callback'])) { print $_GET['callback'] . '(' . json_encode($json_rst) . ');'; } else { print json_encode($json_rst); } } } if ($g_debug_time) { $stop_time = microtime(1); $escape = round(($stop_time - $start_time) * 1000, 1); $sql = "SELECT pv FROM st_page_op WHERE module='{$g_module}' AND action = '{$g_action}' AND access_mode = {$g_access_mode}"; $rst = mysql_x_query($sql); if ($row = mysql_fetch_array($rst)) { $sql = "UPDATE st_page_op SET escape = escape + {$escape}, pv=pv+1 WHERE module='{$g_module}' AND action = '{$g_action}' AND access_mode = {$g_access_mode}"; mysql_x_query($sql); } else { $sql = "INSERT INTO st_page_op (module,action,pv,escape,access_mode) VALUES ('{$g_module}','{$g_action}',1,{$escape},{$g_access_mode})"; mysql_x_query($sql); } } exit;
function mysql_w_query($sql) { return mysql_x_query($sql); }