Запись [z:tests] < dev.sky.1.001
Версия 1.001
• N1: WRITE FILE: _dev/util/test_html.php
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 | <?php defined('START') and AUTH_OK or die; $TOP = '> <span id="links"> ' . menu(0, ['Result', 'Form', 'Presets'], 'javascript:sheet(%d)', ' < ') . ' (Esc)</span>'; ?> <form method="post" id="f1" style="display:none"><small>HTML code:</small> <textarea rows="20" id="txt" name="txt" style="width:95%"></textarea> <br> <div style="float:right;margin-right:50px"> <a href="javascript:$('txt').value=''">clear textarea</a></div> <input type="button" value="Show HTML - F9" onclick="key_F9()" /><br> </form> <div id="res" style="display:none"></div> <div id="tbl"></div> <script type="text/javascript"> var f1 = $('f1'), r = {}; function html_run(__code) { var __err = false, __code2 = __code.split(/[\r\n]{1,2}~js~[\r\n]{1,2}/g); html('res', __code2[0]); sheet(0); resized(); if (__code2[1]) try { eval(__code2[1]) } catch(e) { __err = e; } if (__err) text('res', 'be', '<hr>' + __err); } sheet(2); preset(''); var scr_h; function key_Esc() { var i = sheet() + 1; sheet(3 == i ? 0 : i); } function key_F4() { $$('button', 0).click(); } function key_F9() { if (!trim(f1.txt.value)) return mtop('Please write HTML!', red), setTimeout('mtop()', 2000); html_run(f1.txt.value) } function adjust(w, h) { scr_h = h; $('res', {width: w - 190, height: h - 350}); } </script> <style type="text/css"> #res { width:500px; overflow-x:auto } #tbl table { border-collapse:collapse; } #tbl td { border-right:1px solid silver; border-bottom:1px solid silver; padding:5px; vertical-align:top; } #tbl td:hover { cursor:pointer; background:#eef } #tbl pre { overflow:hidden; } </style> |
• N2: WRITE FILE: _dev/util/test_js.php
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 | <?php defined('START') and AUTH_OK or die; $TOP = '> <span id="links"> ' . menu(0, ['Result', 'Form', 'Presets'], 'javascript:sheet(%d)', ' < ') . ' (Esc)</span>'; ?> <form method="post" id="f1" style="display:none"><small>js code:</small> <textarea rows="20" id="txt" name="txt" style="width:95%"></textarea> <br> <div style="float:right;margin-right:50px"> <a href="javascript:$('txt').value=''">clear textarea</a></div> <input type="button" value="Run javascript - F9" onclick="key_F9()" /><br> </form> <pre id="res" style="display:none"></pre> <div id="tbl"></div> <script type="text/javascript"> var f1 = $('f1'); function js_run(__code) { var timer = out = '', f = 1; try { eval (__code); } catch(e) { out = e; } function put(out) { if (timer && f) html('res', 'ae', {height:scr_h - 500}, '<input type="button" value="stop timer" onclick="clearInterval(' + timer + ')">'); f = 0; html('res', __code + '<hr>'); html('res', 'be', '' + out); } if ('' !== out) put(out); sheet(0); resized(); } sheet(2); preset(''); var scr_h; function key_Esc() { var i = sheet() + 1; sheet(3 == i ? 0 : i); } function key_F4() { $$('button', 0).click(); } function key_F9() { if (!trim(f1.txt.value)) return mtop('Please write Javascript code', red), setTimeout('mtop()', 2000); js_run(f1.txt.value) } function adjust(w, h) { scr_h = h; $('res', {width: w - 190, height: h - 150}); } </script> <style type="text/css"> #res { width:500px; overflow-x:auto } #tbl table { border-collapse:collapse; } #tbl td { border-right:1px solid silver; border-bottom:1px solid silver; padding:5px; vertical-align:top } #tbl td:hover { cursor:pointer; background:#eef } #tbl pre { overflow:hidden } </style> |
• N3: WRITE FILE: _dev/util/test_php.php
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | <?php defined('START') and AUTH_OK or die; if (START == 'ajax'): switch (PAGE) { case 'php': ob_start(); eval($PVAL); printf("<pre>%s</pre><hr><pre>%s</pre>", html($PVAL), html(ob_get_clean())); break; case 'xd': set_time_limit(0); '<' == $PVAL[0] or $PVAL = "<?php\n$PVAL"; file_put_contents('_dev/temp/_xd.php', $PVAL); # .. in console # echo file_get_contents(LINK . '_dev/main/debugger.php'); # require '_dev/main/debugger.php'; break; case 'file': set_time_limit(0); ini_set('max_execution_time', '0'); usleep(200000); # 0.2 sec @file_get_contents(LINK . '_dev/temp/_xd.php?XDEBUG_SESSION_START=123'); echo 3; break; case 'com': $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or exit('socket_create false'); if (@socket_connect($sock, '127.0.0.1', 9001)) { socket_write($sock, $PVAL, strlen($PVAL)); $buf = socket_read($sock, 2048); list ($size, $buf) = explode("\0", $buf, 2); while (strlen($buf) < $size) $buf .= socket_read($sock, 2048); $ary = (array)json_decode($buf); if ($ary['file']) { $ary['code'] = Record::show_php($str = file_get_contents($ary['file']), str_pad('', 1 + substr_count($str, "\n"), '+')); } socket_close($sock); trace($ary); } else $ary = ['code' => iconv('windows-1251', ENC, socket_strerror(socket_last_error($sock))), 'vars' => -1]; header('Content-Type: application/json'); echo json_encode($ary); break; } else: # HTML PAGE $TOP = '> <span id="links"> ' . menu(0, ['Result', 'Form', 'Presets'], 'javascript:sheet(%d)', ' < ') . ' (Esc)</span><span id="xd_file"></span>'; ?> <form method="post" id="f1" style="display:none"><small>PHP code:</small> <textarea rows="20" id="txt" name="txt" style="width:95%"></textarea> <br> <div style="float:right;margin-right:50px"> <a href="javascript:$('txt').value=''">clear textarea</a></div> <input type="button" value="Run PHP - F9" onclick="key_F9()" /> <?if(extension_loaded('xdebug')):echo pad()?><input type="button" value="Debug PHP - F2" onclick="key_F2()" /> <?else:?><span style="color:red">Setup xdebugger for `Debug PHP` button</span><?endif?> <br> <div id="hist"></div> </form> <div id="res" style="display:none"></div> <div id="tbl" style="display:none"></div> <script type="text/javascript"> var f1 = $('f1'), thread = 0, breakp = 0, s_hist = 0, scr_h, xd = 0, lineno = 1, fileno; sheet(2); preset(''); function end_thread(r, err) { if (err) r = err; xd = 0; if (r == '1' || r == '3' || r == '7') r = parseInt(r), thread += r; else alert('Error: ' + v); sheet(1); $('res', {overflow:'auto'}); if (r == 1) { new ajax('&com=stop'); setTimeout(function() { if (1 != thread) alert('Thread = ' + thread); }, 500); } } function key_Esc() { if (xd) end_thread(1); else { var i = sheet() + 1; sheet(3 == i ? 0 : i); } } function breakpoint() { if (!xd) return; var line, isset = t$(this.$$('span', 'breakp', 0)), bp = this.$({background: isset ? '' : red}); $$('div', 'res', 'code', function(el, i) { if (el == bp) line = 1 + i; }); if (isset) { this.$$('span', 'breakp', 0).$(''), breakp--; //breakpoint_remove -d breakp_id } else { this.html('be', '<span class="breakp">●</span>'), breakp++; xd_com('breakpoint_set -t line -n ' + line); } } function xd_com(str) { if (!xd) return; new ajax('&com=' + e$(str), function(r, err) { if ('breakpoint_set' == str.substr(0,14)) return; var json = callback(r, err, '(xd) '), divs, xd = $('xd_code'), tmp; if (-1 == json.vars) return end_thread(json.code); if (json.file) fileno = json.file; else json.file = fileno; html('xd_file', ' > ' + json.where + ', ' + json.file + ', line: ' + json.line + ', breakpoints: ' + breakp); if (json.code) { html('xd_code', json.code); divs = $$('div', 'res', 'code'); for (var i = 0; i < divs.length; i++) divs[i].$({background: ''}, breakpoint); $$('table', 'xd_code', 0).$({width:'100%'}).$$('td', 1).$({width:'100%'}); } else { divs = $$('div', 'res', 'code'); divs[lineno].$({background:''}); } if (json.vars) html('xd_vars', json.vars); divs = divs[lineno = parseInt(json.line) - 1].$({background: 'ff7'}); tmp = xd.scrollTop; divs.scrollIntoView(true); // at Top if (xd.scrollTop - tmp > xd.clientHeight - 70 || tmp > xd.scrollTop) xd.scrollTop -= 35; else { divs.scrollIntoView(false); // at Bottom if (xd.scrollTop - tmp < 35) xd.scrollTop = tmp; else xd.scrollTop += 100; } }); } function key_F2() { if (xd) { xd_com('step_into'); } else { if (!trim(f1.txt.value)) return mtop('Please write PHP code', red), setTimeout('mtop()', 2000); xd = 1; ajax('&xd=' + e$(f1.txt.value), function(){}, 0); //end_thread sheet(0); $('res', {overflow:'hidden'}); html('res', '</div><br><div id="xd_code"></div>' + '<input type="button" value="Exit - Esc" onclick="key_Esc()"> ' + '<input type="button" value="Step into - F2" onclick="key_F2()">' + '<input type="button" value="Step out - F4" onclick="key_F4()">' + '<input type="button" value="Step over - F9" onclick="key_F9()"> ' + '<input type="button" value="Run" onclick="xd_com(\'run\')">' + '<hr><div id="xd_vars"></div>' ); var started = Date.now() / 1000 | 0; new ajax('&file=', function (r, err) { //end_thread // if ((Date.now() / 1000 | 0) - started < 5) alert('Returned (i<5) from up&file r=' + r + ', err=' + err); // else alert('Returned (i>=5) from up&file r=' + r + ', err=' + err); }); setTimeout(function() { xd_com('step_into'); }, 500); } } function key_F4() { if (xd) { xd_com('step_out'); } else { $$('button', 0).click(); } } function key_F9() { if (xd) { xd_com('step_over'); } else { if (!trim(f1.txt.value)) return mtop('Please write PHP code', red), setTimeout('mtop()', 2000); php_run(f1.txt.value); } } function php_run(str) { sheet(0); if (s_hist) { s_hist = 0; if ('' === html('hist')) html('hist', 'bb', '<h3>History:</h3>'); html('hist', 'ab', '<pre></pre>').$$('pre', 0, {text:str}).onclick = function() { f1.txt.value = this.text() } } ajax('&php=' + e$(str), function(r, err) { html('res', r); }); } function adjust(w, h) { scr_h = h; $('res', {width: w - 190, height: h - 150}); } </script><style type="text/css"> #res { width:500px; overflow:auto } #res table, #tbl table { border-collapse:collapse; } /* #res td { border:1px solid silver; padding:2px } */ #tbl td { border-right:1px solid silver; border-bottom:1px solid silver; padding:5px; vertical-align:top } #tbl td:hover { cursor:pointer; background:#eef } #tbl pre { overflow:hidden } .h { background: silver;font-weight:bold } .y { background: #ff7; cursor:pointer } td.y:hover { background: #dff; } .x { display:none } #whitd {text-align:left; padding:0; width:100%; left:30px; top: 30px; background: #fff; overflow:auto; height: 200px} #hist pre {margin:0; padding: 5px 0; border-top:1px solid silver } #hist pre:hover { cursor:pointer; background:#eef } #xd_file {height:20px;} #xd_code {overflow:auto; height:520px;} #xd_vars {overflow:auto; height:140px;} .code {width:98%;line-break: strict;} .breakp {color:red; float:right; margin:-1px 3px 0 0} </style> <?php endif; |
Записи Codebase (89)
Статус SKY.
Current version: 1.001
Coresky records: 22
Local (DEV) records: 89
Web (all) records: 105
Download: dev.php
Coresky records: 22
Local (DEV) records: 89
Web (all) records: 105
Download: dev.php