function printS($id) { $ci =& get_instance(); $s = new Section(); $s->get_by_id($id); $s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit'); $s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete'); $output = "<li>"; $output .= $s->id . '|'; $output .= $s->name; $output .= addS($id, 0, "add first child for {$s->name}"); $output .= '|'; $output .= $s->e; $output .= '|'; $output .= $s->d; $c = new Section(); $c->where('parent_section', $id); $c->order_by('sort', 'asc'); $c->get(); if (count($c->all) > 0) { $output .= "<ul>"; foreach ($c->all as $item) { $output .= printS($item->id); $output .= "<li>" . addS($id, $item->sort + 1) . "</li>"; } $output .= "</ul>"; } $output .= "</li>"; return $output; }
function addS(&$array) { if (is_array($array)) { foreach ($array as $key => $value) { addS($array[$key]); } } elseif (is_string($array)) { $array = addslashes($array); } }
/* # 判断是否存在安装锁 */ if (file_exists(THINKSNS_ROOT . '/data/install.lock')) { echo $i_message['install_lock']; exit; /* # 判断安装sql文件是否可读 */ } elseif (!is_readable($installfile)) { echo $i_message['install_dbFile_error']; exit; } $quit = false; $msg = $alert = $link = $sql = $allownext = ''; $PHP_SELF = addslashes(htmlspecialchars($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'])); set_magic_quotes_runtime(0); if (!get_magic_quotes_gpc()) { addS($_POST); addS($_GET); } @extract($_POST); @extract($_GET); ?> <html> <head> <title><?php echo $i_message['install_title']; ?> </title> <meta http-equiv=Content-Type content="text/html; charset=utf-8"> <link href="images/style.css" rel="stylesheet" type="text/css" /> <body> <div id='content'> <div id='pageheader'>