function main() { //RES 0sql 1err 2aff-row 3sele-rows 4time 5col 6data global $SIDU; $conn = $SIDU['conn'][$SIDU[0]]; $link = @explode(',', $_GET['id']); $SIDU['gridMode'] = $_POST['sqlmore']; foreach ($SIDU['RES'] as $i => $res) { echo "<div id='sql{$i}' style='padding:0 2px 30px'>"; $str = "<a href='#' class='grey' title='" . @lang(3103) . "' onclick=\"showHide('sql{$i}')\">" . @html8(@substr($res[0], 0, 200)) . "</a>"; if ($res[1]) { echo "{$str}<br/><pre><span class='red' style='font-family:monospace'>{$res['1']}</span></pre>"; } else { if (isset($res[2]) || $res[5][0][0] == '') { echo "{$str}<br/>", @lang(3104, "<u>" . ($res[2] + 0) . "</u>"); } else { if ($_POST['sqlmore'] || isset($SIDU[6]) && $SIDU[6] == $i) { @cout_sql_res($SIDU, $res); } echo "{$str}<br/>", @lang(3105, "<u>" . ($res[3] + 0) . "</u>"); } echo " : ", @lang(3106, $res[4] > 1000 ? "<u class='blue'>" . @round($res[4] / 1000, 1) . "</u>s" : "<u>{$res['4']}</u>ms"); } echo "</div>"; } }
function main() { global $SIDU; if (@substr($_FILES['fsql']['type'], 0, 4) == 'text' && $_FILES['fsql']['size'] && !$_FILES['fsql']['error']) { $file = @html8(@file_get_contents($_FILES['fsql']['tmp_name'])); } elseif ($SIDU['eng'] == 'sl') { $file = "SELECT * FROM sqlite_master\nLIMIT 10;"; } else { $file = "SELECT now();"; } echo "<textarea id='sqltxt' style='width:100%;border:0;padding:0;margin:0' spellcheck='false' cols='30' rows='2'>{$file}</textarea>\n\t<form name='sqlrun' action='sql.php?id={$_GET['id']}' target='main' method='post'>" . @html_form("hidden", "sqlcur") . @html_form("hidden", "sqlmore") . "</form>\n<script type='text/javascript'>\nwindow.onresize=gridInit;window.onload=gridInit;\nfunction gridInit(){\n\tif (self.innerHeight) h=self.innerHeight;\n\telse if (document.documentElement && document.documentElement.clientHeight) h=document.documentElement.clientHeight;//ie6\n\telse if (document.body) h=document.body.clientHeight;//other ie\n\tdocument.getElementById('sqltxt').style.height=h-35+'px';\n}\nfunction getSelectedText(box){\n\tif (box.setSelectionRange) return box.value.substring(box.selectionStart,box.selectionEnd);// Mozilla and compatible\n\telse if (document.selection) return document.selection.createRange().text;// IE and compatible\n\telse return;// Other broswers can't do it\n}\nfunction sidu_sql(mode,id){\n\tvar sql;\n\tif (mode=='r' || mode=='m') sql=getSelectedText(document.getElementById('sqltxt'));\n\tif (!sql || mode=='a') sql=getv('sqltxt');\n\tif (sql){\n\t\tdocument.sqlrun.sqlcur.value=sql;\n\t\tif (mode=='m') document.sqlrun.sqlmore.value=1;\n\t\tdocument.sqlrun.submit();\n\t\tdocument.sqlrun.sqlmore.value=0;\n\t\tdocument.getElementById('sqltxt').focus();\n\t}\n}\n</script>\n<div id='openfile' class='blobDiv' style='display:none;top:32px'><div class='web box'>", @html_img("img/tool-close.gif", @lang(3435) . " - Fn+L", "class='right' onclick=\"showHide('openfile')\""), "\n<form action='sqls.php?id={$SIDU['0']}' method='post' enctype='multipart/form-data'>\n<p><b>", @lang(3432), ":</b></p>\n<input type='file' name='fsql'/> <input type='button' name='cmd' value='", @lang(3433), "' onclick=\"showHide('openfile')\"/> <input type='submit' name='cmd' value='", @lang(3434), "'/>\n</form></div></div>"; }
function main() { global $SIDU; $typ = @array("B" => @lang(1705), "S" => "SQL", "E" => @lang(1706), "D" => @lang(1707)); $css = @array("B" => "grey", "S" => "", "E" => "red", "D" => "green"); if ($_POST['cmd']) { @save_data($_POST['cmd'], $SIDU[0]); } echo "<form id='dataTab' name='dataTab' action='his.php?id={$SIDU['0']}' method='post'>\n\t<table class='grid' id='dataTable'><tr class='th'><td class='cbox'><input type='checkbox' onclick='checkedAll()'/></td>\n\t<td align='right'><a href='his.php?id={$SIDU['0']}", $_GET['sort'] ? "" : "&sort=a", "'>ID</a></td><td>", @lang(1708), "</td><td>", @lang(1709), "</td><td align='right'>ms</td><td>", @lang(1710), "</td></tr>"; foreach ($_SESSION['siduhis'][$SIDU[0]] as $i => $his) { $arr = @explode(" ", $his, 5); $cur = "<tr><td class='cbox'><input type='checkbox' name='his[]' value='{$i}'/></td><td align='right'>{$i}</td><td>{$arr['1']}</td><td>{$typ[$arr[2]]}</td><td align='right'>{$arr['3']}</td><td class='{$css[$arr[2]]}'>" . @nl2br(@html8($arr[4])) . "</td></tr>"; $str = $_GET['sort'] ? $str . $cur : $cur . $str; } echo $str, "</table><input type='hidden' name='cmd' id='cmd'/></form>"; }
function main_form($SIDU, $exp, $mode) { @uppe(); $obj = $SIDU[3] == 'r' ? @lang(1502) : @lang(1503); echo "<form action='exp.php' method='get'>", @html_form("hidden", "id", "{$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']}"), "\n\t\t<div class='web'><p class='dot'><b>SIDU ", @lang(1501), ":</b> <i class='b red'>{$mode}</i></p>"; if ($mode == "SQL") { echo "<p class='green'>", @nl2br(@html8($_GET['sql'])), "</p>", @html_form("hidden", "sql", $_GET['sql']); } elseif ($_GET['tab']) { echo "<p>{$obj} = <span class='green'>", @str_replace(",", ", ", $_GET['tab']), "</span></p>", @html_form("hidden", "tab", $_GET['tab']); } elseif (!$SIDU[4]) { echo "<p class='err'>", @lang(1504, $obj), "</p></div></form>"; return; } $arr_ext = @array("html" => "HTML", "csv" => "CSV"); if ($mode != "SQL") { $arr_ext['sql'] = "SQL"; echo "<p class='dot b'>", @lang(1505), "</p><p>"; if ($SIDU['eng'] != 'sl') { echo @html_form("checkbox", "exp[db]", $exp['db'], "", "", "", @array(1 => 'Use ')), $SIDU['eng'] == 'my' ? 'DB' : 'Sch', ' '; } echo @html_form("checkbox", "exp[drop]", $exp['drop'], "", "", "", @array(1 => @lang(1506, $obj) . ' ')), @html_form("checkbox", "exp[desc]", $exp['desc'], "", "", "", @array(1 => @lang(1507, $obj) . ' ')), @html_form("checkbox", "exp[data]", $exp['data'], "", "", "", @array(1 => @lang(1508, $obj))), "</p>"; } echo "<p class='dot b'>", @lang(1509), "</p><p>", @html_form("radio", "exp[ext]", $exp['ext'], " ", "", "", $arr_ext), " ", @html_form("checkbox", "exp[zip]", $exp['zip'], "", "", "", @array(1 => @lang(1510))), "</p>"; if ($mode != "SQL" && !$exp['sql'][1]) { echo "<p class='b dot'>", @lang(1511, $obj), ": <i class='red'>{$exp[tabs][0]}</i></p><p>"; foreach ($exp['tab_col'] as $v) { echo "<input type='checkbox' name='exp[col][]' value='{$v}'", !isset($exp['col']) || @in_array($v, $exp['col']) ? " checked='checked'" : "", "/> {$v} "; } echo "</p><p>where ", @html_form("text", "exp[where]", $exp['where'], 300), "</p>"; } echo "<p class='dot'></p><p>", @html_form("submit", "cmd", @lang(1501)), " Max 25290 Lines</p>"; echo "</div></form>"; @down(); }
function main_desc($SIDU, $link, $conn) { if ($SIDU['eng'] == 'pg' && $SIDU['tabinfo'][2] == 't') { unset($SIDU['col'][0]); } echo "<table class='grid'>\n\t<tr class='th'><td>", @lang(3724), "</td><td>", @lang(3725), "</td><td>Null</td><td>", @lang(3726), "</td><td>", @lang(3727), "</td><td>", @lang(3728), "</td><td title='", @lang(3729), "'>", @lang(3730), "</td><td title='", @lang(3731), "'>", @lang(3732), "</td><td title='", @lang(3733), "'>", @lang(3734), "</td><td title='", @lang(3735), "'>", @lang(3736), "</td><td>", @lang(3737), "</td></tr>"; if ($SIDU[10]) { foreach ($SIDU['col'] as $col) { $coln = @goodname($col[0]); $colz = @is_type_int($col[1]) ? $coln : "length({$coln})"; $sql .= ",count(" . ($SIDU['eng'] == 'sl' ? "" : "distinct ") . "{$coln}),min({$colz}),max({$colz}),avg({$colz})\n"; } $sql = "SELECT " . @substr($sql, 1) . " FROM " . @goodname($SIDU[4]); $stat = @sql2arr($sql, -1); $stat = $stat[0]; } foreach ($SIDU['col'] as $i => $col) { echo "<tr><td><a href='sql.php?id={$SIDU['0']}&sql=STATScol:{$col['0']}'>{$col['0']}</a></td><td>"; if (@strlen($col[1]) > 50) { echo "<input type='text' value='", @html8($col[1]), "' size='1' style='width:100%;background:#ddc'/>"; } else { echo $col[1]; } echo "</td><td>", $col[2] == "YES" || $col[2] == "f" ? "NULL" : "", "</td><td>{$col['3']}</td><td>"; if ($col[7] == 'PRI' || $col[7] == 'p') { echo "<span class='blue'>PK</span>"; } elseif ($col[7] == 'f') { echo "<span class='red'>FK</span>"; } elseif ($col[7] == 'u' || $col[7] == 'UNI') { echo "<span class='green'>UK</span>"; } else { echo $col[7]; } $distinct = @ceil($stat[4 * $i]); echo "</td><td>{$col['5']}</td>\n\t\t<td align='right'", $distinct < $SIDU[10] && $distinct ? " class='green'" : "", ">{$distinct}</td>\n\t\t<td align='right'>", @ceil($stat[4 * $i + 1]), "</td>\n\t\t<td align='right'>", @ceil($stat[4 * $i + 2]), "</td>\n\t\t<td align='right'>", @ceil($stat[4 * $i + 3]), "</td>\n\t\t<td>{$col['6']}</td></tr>"; } echo "</table>"; if ($link[3] == 'v') { return @main_desc_view($link, $conn[1], $SIDU['tabinfo'][0]); } if ($conn[1] != 'pg') { if ($conn[1] == 'my') { $desc = @mysql_fetch_row(@tm("SQL", "SHOW CREATE TABLE `{$link['1']}`.`{$link['4']}`")); } else { $desc = @sqlite_fetch_array(@tm("SQL", "SELECT name,sql FROM sqlite_master WHERE name=tbl_name AND name='{$link['4']}' LIMIT 1"), SQLITE_NUM); } $typ = @array('char', 'varchar', 'text', 'blob', 'smallint', 'int', 'timestamp', 'datetime', 'date', 'time', 'enum', 'tinyint', 'unsigned', 'bigint', 'mediumtext', 'longblob', 'set', 'longtext', 'decimal', 'float'); foreach ($typ as $t) { $mytran[" {$t}"] = " <span class='green'>{$t}</span>"; } $mytran[' DEFAULT '] = " <span class='blue'>DEFAULT</span> "; $mytran[' default '] = " <span class='blue'>default</span> "; $mytran[' CHARACTER SET '] = " <span class='red'>CHARACTER SET</span> "; $typ = @array('PRIMARY KEY', 'UNIQUE KEY', 'KEY'); foreach ($typ as $t) { $mytran[$t] = "<b>{$t}</b>"; } $desc[1] = @strtr($desc[1], $mytran); if ($conn[1] == 'sl') { $res = @tm("SQL", "SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name='{$link['4']}' AND sql IS NOT NULL"); while ($row = @sqlite_fetch_array($res, SQLITE_NUM)) { $idx .= "<i class='green'>{$row['0']};</i>\n"; } } } else { $tran = @array("'" => "''", "\\" => "\\\\"); if ($SIDU['tabinfo'][3]) { $comm = "\n<b class='blue'>COMMENT ON TABLE \"{$link['4']}\" IS '" . @strtr($SIDU['tabinfo'][3], $tran) . "';</b>"; } $desc[1] = "<i class='grey'>--PG desc table is experimental--oid={$SIDU[tabinfo][0]}</i>\nCREATE TABLE \"{$link['4']}\"("; foreach ($SIDU['col'] as $i => $v) { $desc[1] .= "\n\t\"{$v['0']}\" <i class='green'>{$v['1']}</i>"; if ($v[2] == 't') { $desc[1] .= " NOT NULL"; } if ($v[3] != '') { if (!@is_numeric($v[3]) && @substr($v[3], 0, 8) != 'nextval(' && $v[3] != 'now()' && $v[3] != 'true' && $v[3] != 'false') { $v[3] = "'" . @strtr($v[3], $tran) . "'"; } $desc[1] .= " <span class='blue'>DEFAULT</span> {$v['3']}"; } elseif ($v[11]) { $desc[1] .= " <span class='blue'>DEFAULT</span> {$v['11']}"; } $desc[1] .= ","; if ($v[6] != '') { $comm .= "\n<i class='blue'>COMMENT ON COLUMN \"{$link['4']}\".\"{$v['0']}\" IS '" . @strtr($v[6], $tran) . "';</i>"; } } $fkmatch = @array("f" => "FULL", "p" => "PARTIAL", "u" => "SIMPLE"); $fkact = @array("a" => "NO ACTION", "r" => "RESTRICT", "c" => "CASCADE", "n" => "SET NULL", "d" => "SET DEFAULT"); $res = @tm("SQL", "SELECT *,pg_get_constraintdef(oid,TRUE) AS kstr FROM pg_constraint\nWHERE conrelid={$SIDU[tabinfo][0]} AND connamespace={$SIDU[tabinfo][1]}"); while ($row = @pg_fetch_assoc($res)) { $desc[1] .= "\nCONSTRAINT \"<i class='green'>{$row['conname']}</i>\" <b>{$row['kstr']}</b>"; if ($row['contype'] == 'f') { $desc[1] .= " MATCH {$fkmatch[$row[confmatchtype]]}\n\tON UPDATE {$fkact[$row[confupdtype]]} ON DELETE {$fkact[$row[confdeltype]]},"; } else { $desc[1] .= ","; } } $desc[1] = @substr($desc[1], 0, -1) . "\n) WITH (OIDS=" . ($SIDU['tabinfo'][2] == 't' ? "TRUE" : "FALSE") . ");"; $res = @tm("SQL", "SELECT pg_get_indexdef(indexrelid) FROM pg_index\nWHERE indrelid={$SIDU[tabinfo][0]} AND indisprimary='f'"); while ($row = @pg_fetch_row($res)) { $idx .= "<i class='green'>{$row['0']};</i>\n"; } } echo "<pre>\n\n{$desc['1']}{$comm}\n\n{$idx}\n********** Grants not ready in this version **********\n\n********** SQL HELP **********\n"; if ($conn[1] == 'my') { echo "\n<b>RENAME</b> TABLE {$SIDU['4']} <b>TO</b> new_name\nALTER TABLE {$SIDU['4']} <b>ADD COLUMN</b> a INT(2),ADD COLUMN b INT(3),<b>DROP COLUMN</b> c\nALTER TABLE {$SIDU['4']} <b>CHANGE</b> a newname VARCHAR(10) NOT NULL DEFAULT '' <b>AFTER</b> c\nALTER TABLE {$SIDU['4']} <b>ADD PRIMARY KEY</b> (b)\nALTER TABLE {$SIDU['4']} <b>DROP PRIMARY KEY</b>\n\nALTER TABLE {$SIDU['4']} <b>ADD UNIQUE</b> uk (c)\nALTER TABLE {$SIDU['4']} <b>DROP KEY</b> uk\nALTER TABLE {$SIDU['4']} <b>ADD INDEX</b> idx (a,b)\nALTER TABLE {$SIDU['4']} <b>DROP KEY</b> idx"; } else { echo "\nALTER TABLE {$SIDU['4']} <b>RENAME COLUMN</b> column TO new_column\nALTER TABLE {$SIDU['4']} <b>RENAME TO</b> new_name\nALTER TABLE {$SIDU['4']} SET SCHEMA new_schema\n\nALTER TABLE {$SIDU['4']} <b>ADD COLUMN</b> column type\nALTER TABLE {$SIDU['4']} <b>DROP COLUMN</b> column [ RESTRICT | CASCADE ]\nALTER TABLE {$SIDU['4']} <b>ALTER COLUMN</b> column TYPE type\nALTER TABLE {$SIDU['4']} ALTER COLUMN column <b>SET DEFAULT</b> expression\nALTER TABLE {$SIDU['4']} ALTER COLUMN column <b>DROP DEFAULT</b>\nALTER TABLE {$SIDU['4']} ALTER COLUMN column { SET | DROP } <b>NOT NULL</b>\nALTER TABLE {$SIDU['4']} <b>DROP CONSTRAINT</b> constraint_name [ RESTRICT | CASCADE ]\nALTER TABLE {$SIDU['4']} SET WITH OIDS\nALTER TABLE {$SIDU['4']} SET WITHOUT OIDS\nALTER TABLE {$SIDU['4']} OWNER TO new_owner\nALTER TABLE {$SIDU['4']} SET TABLESPACE new_tablespace\n\nCREATE UNIQUE INDEX idx ON {$SIDU['4']} (col1,col2);\nCREATE INDEX lower_title_idx ON {$SIDU['4']} ((lower(title)));\nCREATE INDEX title_idx_nulls_low ON {$SIDU['4']} (title NULLS FIRST);\nCREATE INDEX code_idx ON {$SIDU['4']} (code) TABLESPACE indexspace;\n\nALTER INDEX distributors RENAME TO suppliers;\nALTER INDEX distributors SET TABLESPACE fasttablespace;"; } echo "</pre>"; }
function cout_data($SIDU, $link, $conn, $sql) { if ($_POST['cmd'] == 'data_save' || $_POST['cmd'] == 'data_del') { @save_data($SIDU, $conn[1], $_POST['cmd']); } $url = !$sql ? "tab" : "sql"; echo "<form id='dataTab' name='dataTab' action='{$url}.php?id={$link['0']},{$link['1']},{$link['2']},{$link['3']},{$link['4']},{$SIDU['5']},{$SIDU['6']}' method='post'>"; if (!$sql) { echo "<p style='padding:3px'>where ", @html_form("text", "f[sql]", $SIDU['f']['sql'], 300), " <img src='img/tool-run.png' onclick=\"submitForm('cmd','p1')\" class='vm'/> eg col='abc'</p>"; foreach ($SIDU['g'] as $j => $gSize) { if ($gSize == -1) { $hidden .= "<a href='#' onclick=\"submitForm('showCol',{$j})\">{$SIDU[col][$j][0]}</a> "; } } if ($hidden) { echo "<p>", @lang(104), ": {$hidden}</p>"; } } if (isset($SIDU['pk'])) { $pk = $SIDU['pk']; } foreach ($SIDU['col'] as $j => $v) { $disp[$j] = $SIDU['g'][$j] == -1 ? " style='display:none'" : ""; $title = "{$v['0']} " . @str_replace("'", "", $v[1]); $color = ''; if (@in_array($j, $SIDU['pk'])) { $title = "PK {$title}"; $color = '06c'; } if ($v[5] == 'auto_increment' || $v[1] == 'serial' || $v[1] == 'bigserial') { $color = 'c00'; } $colH .= "<td class='td{$j}' title='{$title}'{$disp[$j]}><div class='gridH' id='gH{$j}'" . (!$SIDU['gridMode'] ? " style='width:{$SIDU[g][$j]}px'" : "") . ">"; if (!$sql) { $colH .= "<a" . @get_sort_css($v[0], $SIDU[5], $SIDU[6]) . " href='#' onclick=\"submitForm('sidu7','{$v['0']}')\">" . ($color ? "<span style='color:#{$color}'>{$v['0']}</span>" : $v[0]) . "</a>"; } else { $colH .= "<a>{$v['0']}</a>"; } $colH .= "</div></td>"; $jsStr .= "xHRD.init('gH{$j}',10);"; $filter .= "<td class='td{$j}'{$disp[$j]}><input type='text' size='1' id='f{$j}' name='f[{$j}]' value='" . @html8($SIDU['f'][$j]) . "'/></td>"; $grid .= "<td class='td{$j}'{$disp[$j]}><input type='text' size='1' name='g[{$j}]' id='g{$j}' value='" . $SIDU['g'][$j] . "'/></td>"; if (!$sql) { $gridShow .= "<td class='td{$j}'{$disp[$j]}><img src='img/tool-sys.png' title='" . @lang(124) . "' onclick=\"submitForm('sidu7','del:{$v['0']}')\"/> <a href='#' onclick=\"submitForm('hideCol',{$j})\">" . @html_img('img/tool-x') . "</a></td>"; } if ($v[3] == 'CURRENT_TIMESTAMP' || $v[3] == 'now()') { $v[3] = "'+his.getFullYear()+'-'+(parseInt(his.getMonth())+1)+'-'+his.getDate()+' '+his.getHours()+':'+his.getMinutes()+':'+his.getSeconds()+'"; } elseif (@substr($v[3], 0, 9) == "nextval('") { $v[3] = ''; } else { $v[3] = @html8($v[3] ? $v[3] : ($v[2] == 'YES' || $v[2] == 'f' ? 'NULL' : '')); } $align = $SIDU['col'][$j][8] == 'i' ? ' style="text-align:right"' : ''; $id = 'data_new\'+id+\'_' . $j; $is_blob = @is_blob($SIDU['col'][$j]) ? ' onclick="editBlob(\\\'' . $id . '\\\')"' : ''; $jsColNew .= '<td class="blue td' . $j . '"' . @str_replace("'", "\"", $disp[$j]) . '>'; if ($is_blob) { $jsColNew .= '<input type="hidden" name="' . $id . '" id="' . $id . '" value="' . $v[3] . '"/><input type="text" value="' . $v[3] . '" size="1" id="blob' . $id . '"' . $is_blob . ' style="background:#ddc"/></td>'; } else { $jsColNew .= '<input type="text" size="1" name="' . $id . '" id="' . $id . '" value="' . $v[3] . '"' . $align . $is_blob . ' onchange="document.dataTab.cbox_data_new\'+id+\'.checked=\\\'checked\\\'"/></td>'; } if (!isset($SIDU['pk'])) { $pk[] = $j; } //no pk table with blob col will be slow here } echo "\n<table class='grid' id='dataTable'>"; if (!$sql) { echo "\n<tr id='trhide' title='", @lang(105), "' style='opacity:0.6", $SIDU['gridShow'] ? "" : ";display:none", "'><td class='cbox'></td>{$gridShow}</tr>"; } echo "\n<tr class='th'><td class='cbox'><input type='checkbox' onclick='checkedAll()'/></td>{$colH}</tr>"; if (!$sql) { echo "\n<tr id='trgrid' title='", @lang(106), "'", $SIDU['gridShow'] ? "" : " style='display:none'", " class='grey'><td class='cbox'></td>{$grid}</tr>\n\t\t<tr class='gridf' title='", @lang(107), " eg: =12'><td class='cbox'><a href='tab.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']}' title='", @lang(108), "'>", @html_img("img/tool-find"), "</a></td>{$filter}</tr>"; } foreach ($SIDU['data'] as $i => $row) { echo "\n<tr id='tr_{$i}'><td class='cbox'><input type='checkbox' name='cbox_data_{$i}'/></td>"; foreach ($row as $j => $v) { $align = $SIDU['col'][$j][8] == 'i' ? " style='text-align:right'" : ""; if (is_null($v)) { $v = 'NULL'; $classNull = " null"; } else { $classNull = ""; } $v8 = @html8($v); $id = "data_{$i}" . "_{$j}"; $is_blob = @is_blob($SIDU['col'][$j]) ? " onclick=\"editBlob('{$id}')\"" : ""; echo "<td class='td{$j}{$classNull}'{$disp[$j]}{$align}>"; if ($SIDU['gridMode']) { if ($is_blob || $sql) { echo @nl2br($v8); } else { $v8str = $v8 === 'NULL' ? "IS NULL" : "=\\'" . @strtr($v8, @array("'" => "\\'\\'", "\\" => "\\\\\\\\")) . "\\'"; echo "<a href='#' onclick=\"setv('f{$j}','{$v8str}');submitForm('cmd','p1')\">" . @nl2br($v8) . "</a>"; } } else { if ($is_blob) { echo "<input type='hidden' name='{$id}' id='{$id}' value='{$v8}'/><input type='text' value='" . @substr($v8, 0, 30) . "' size='1' id='blob{$id}'{$is_blob} style='background:#ddc", $classNull ? ";color:#888;font-style:italic" : "", "'/>"; } else { echo "<input type='text' size='1'", $classNull ? " class='null'" : "", " name='{$id}' id='{$id}' value='{$v8}' onchange=\"document.dataTab.cbox_data_{$i}.checked='checked'\"{$align}/>"; } } if (!$sql && @in_array($j, $pk)) { echo "<input type='hidden' name='pkV[{$i}][{$j}]' value='{$v8}'/>"; } echo "</td>"; } echo "</tr>"; } echo "\n</table>"; $arrH = @array('cmd', 'sidu7', 'sidu8', 'sidu9', 'showCol', 'hideCol'); foreach ($arrH as $v) { echo @html_form("hidden", $v); } echo "<input type='hidden' id='gridShow' name='gridShow' value='{$SIDU['gridShow']}'/><input type='hidden' id='gridMode' name='gridMode' value='{$SIDU['gridMode']}'/>"; echo "</form>\n<div id='blobDiv' style='display:none;width:99%;max-width:700px'>\n<input type='button' value='", @lang(109), "' onclick='editBlobSave()'/><input type='button' value='", @lang(110), "' onclick=\"showHide('blobDiv',-1)\"/><input type='hidden' id='blobTxtID'/>\n<br/><textarea id='blobTxt' style='width:99%;height:280px'></textarea>\n</div>\n<iframe name='hiddenfr' src='#' style='width:600px;height:200px;display:none'></iframe>\n<script type='text/javascript'>\nwindow.onload = function(){" . $jsStr . "}"; if (!$sql) { echo "\nfunction addRow(){\n\tvar his = new Date();\n\tvar id = his.getHours()+his.getMinutes()+his.getSeconds();\n\tvar row = document.getElementById('dataTable').insertRow(4);\n\trow.innerHTML='<td class=\"cbox\"><input type=\"checkbox\" name=\"cbox_data_new'+id+'\"></td>{$jsColNew}';\n}"; } echo "</script>"; }
function cout_obj($SIDU, $link, $arr, $col) { $arr = @sort_arr($arr, $SIDU[5], $SIDU[6]); $right = @array('Rows', 'Avg', 'Size', 'Auto', 'Index'); $slink = "db.php?id={$link['0']},{$link['1']},{$link['2']},{$link['3']},{$link['4']},{$SIDU['5']},{$SIDU['6']}"; echo "<table class='grid'><tr class='th'><td class='cbox'><input type='checkbox' onclick='checkedAll()'/></td>"; if ($SIDU['page']['lang'] != 'en') { $colStr = @lang(1432); } foreach ($col as $k => $v) { $align[$k] = @in_array($k, $right) ? " align='right'" : ""; echo "<td><a", @get_sort_css($k, $SIDU[5], $SIDU[6]), " href='{$slink},{$k}'>", $colStr[$k] ? $colStr[$k] : $k, "</a></td>"; } echo "</tr>"; $obj = $SIDU[3] == 'r' ? 'Table' : ($SIDU[3] == 'v' ? 'View' : ($SIDU[3] == 'S' ? 'Seq' : 'Func')); foreach ($arr as $i => $row) { echo "<tr><td class='cbox'><input type='checkbox' name='objs[]' value='", @html8($row[$obj]), "'", @in_array($row[$obj], $_POST['objs']) ? " checked='checked'" : "", "/></td>"; foreach ($col as $k => $v) { $url = "tab.php?id={$link['0']},{$link['1']},{$link['2']},{$link['3']}," . $row[$k]; if ($k == 'Table' || $k == 'View') { $row[$k] = "<a href='{$url}&desc=1'>" . @html_img("img/x{$SIDU['3']}", @lang(1433), "class='vm'") . "</a> <a href='{$url}'>{$row[$k]}</a>"; } elseif ($k == 'Size' || $k == 'Index' || $k == 'Avg') { $row[$k] = @size2str($row[$k]); } elseif ($k == 'Definition') { $row[$k] = "<input id='{$k_}{$i}' type='hidden' value='" . @html8($row[$k]) . "'/><input type='text' style='width:200px;background:#ddc' size='1' value='" . @html8(@substr($row[$k], 0, 100)) . "' onclick=\"showHide('blobDiv',1);setv('blobTxt',getv('{$k_}{$i}'))\"/>"; } echo "<td{$align[$k]}", $k == 'Rows' || $k == 'PK' ? " class='green'" : ($k == 'Auto' && $row[$k] > 2000000000 ? " class='red'" : ""), ">{$row[$k]}</td>"; } echo "</tr>"; } echo "</table>\n<div id='blobDiv' style='display:none'>\n", @html_img("img/tool-close.gif", "Close", "onclick=\"showHide('blobDiv',-1)\""), "\n<br/><textarea id='blobTxt' style='width:490px;height:295px'></textarea>\n</div>"; }