/** * Clean all dictionaries */ function clean() { Z::c()->query("DELETE FROM t_dic"); Z::c()->query("DELETE FROM t_idx"); }
} else { echo json_encode(false); } break; case 'admin': if (!$_SESSION["is_admin"]) { redirect("?m=home"); } eval("?>" . getTemplate('admin') . "<?"); break; case 'admin.reindex': if (!$_SESSION["is_admin"]) { redirect("?m=home"); } $dic_path = array("D:/app/StarDict/dic/li12", "/home/ameoba32/stardict"); # Rescan dictionaries $scan = new DicScan(); $scan->DirArray($dic_path); $scan->clean(); $scan->save(); # Do index $index = new DicIndex(); $index->make(); $dic_list = Z::c()->query("select * from t_dic"); eval("?>" . getTemplate('admin.reindex') . "<?"); break; } $content = ob_get_contents(); ob_end_clean(); eval('?>' . $layout . '<?'); # If you like software like this, i can make it. email me: ameoba32@gmail.com
function savePrefix($dic_id, $rec) { # Prefix ended, save it $data = array("fchar" => $rec["prefix"], "fdic_id" => $dic_id, "fstart" => $rec["start"], "flength" => $rec["end"] - $rec["start"]); $sql = Z::c()->query("INSERT into t_idx (?#) VALUES (?a)", array_keys($data), array_values($data)); }
} # -------------------------------------------------------------------- # Initilization logic # -------------------------------------------------------------------- if (ini_get('magic_quotes_gpc')) { $_POST = strip_magic_slashes($_POST); } if (ini_get('magic_quotes_gpc')) { $_GET = strip_magic_slashes($_GET); } if (ini_get('magic_quotes_gpc')) { $_REQUEST = strip_magic_slashes($_REQUEST); } mb_internal_encoding("UTF8"); # Database setup Z::c(); # # Random seed # function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (double) $sec + (double) $usec * 100000; } srand(make_seed()); // # # Attach a debugger console # #if (!$_GET['ajax'] && $config["debug"]) { # require_once "HackerConsole/Main.php";