Запись [f:i_dev.php] < dev.sky.1.001
Версия 1.002
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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | <?php $lg = ''; $text = <<<DOC error Error~Ошибка title Initial deploy of DEV.SKY.~Первичное разворачивание DEV.SKY. desc DEV.SKY. destributed under %sSKY. license</a>~DEV.SKY. распространяется на основе %sлицензии SKY.</a> tests Tests~Тесты inst Install DEV.SKY.~Установка DEV.SKY. dbaccess Access data to mysql database~Данные доступа к БД mysql hname Enter hostname:<br><span>also you can write mysql port, example: localhost:3306</span>~Введите имя хоста:<br><span>также можно указать номер порта, например: localhost:3306</span> dbname Enter mysql database name~Введите имя БД mysql newdb Create new database~Создать новую БД lname Login~Логин pass Password~Пароль dostep Do step~Выполнить шаг dbver mysql version >= 5.0~Версия mysql >= 5.0 phpver php version >= 5.4~Версия php >= 5.4 bzip2 php module `Bzip2` existent~Наличие модуля php `Bzip2` mysql php module `mysqli` existent~Наличие модуля php `mysqli` dbsql Database related SQLs~SQL запросы к БД tbsql Table related SQLs~SQL запросы к таблицам rcsql Record related SQLs~SQL запросы к записям dircreate Directories creation~Создание дирректорий filecreate Files creation~Создание файлов bdfexists Import file existence~Наличие файла импорта loadb Load DEV.SKY. database from bz2 file~Загрузка БД DEV.SKY. из файла bz2 devapp Exec Codebase script a:dev_app~Выполнение записи Codebase a:dev.sky. notchecked Not checked~Не проверялось err_s1_1 User `%s` can't connect to mysql at host `%s`~Пользователь `%s` не может подключиться к mysql на хосте `%s` err_s1_2 Can't create database `%s`~Не могу создать БД `%s` err_s1_3 Can't connect to database `%s`~Не могу подсоединиться к БД `%s` err_s2_1 Can't create table~Не могу создать таблицу err_s2_2 Can't drop table~Не могу удалить таблицу err_s3_1 Can't insert row into table~Не могу вставить запись в таблицу err_s3_2 Can't update row in the table~Не могу обновить запись в таблице err_s3_3 Can't delete row from table~Не могу удалить запись из таблицы err_s4_1 Directory `%s` exists, delete it manualy, then run `STEP 1` again~Директория `%s` существует, удалите ее вручную и запустите `ШАГ 1` снова err_s4_2 Can't create directory `%s`~Не могу создать директорию `%s` err_s4_3 Can't delete directory `%s`~Не могу удалить директорию `%s` err_s5_1 File `%s` exists, delete it manualy, then run `STEP 1` again~Файл `%s` существует, удалите его вручную и запустите `ШАГ 1` снова err_s5_2 Can't create file `%s`~Не могу создать файл `%s` err_s5_3 Can't delete file `%s`~Не могу удалить файл `%s` err_s6 DEV.SKY. database file for import not found~Файл для импорта БД DEV.SKY. не найден err_sx Error in database uploading~Ошибка загрузки БД DOC; $gate = 'http://coresky.net/gate'; header('Content-Type: text/html; charset=utf-8'); if (!$_GET && $lg) header("Location: http://$_SERVER[HTTP_HOST]$_SERVER[SCRIPT_NAME]?$lg"); $lg or $lg = @key($_GET) or $lg = 'en'; foreach (preg_split("/\r?\n/", $text) as $str) if (preg_match("/^(\w+)\s+([^~]+)~?([^~]*)$/sm", $str, $m)) { define(strtoupper("L_$m[1]"), 'ru' == $lg && $m[3] ? $m[3] : $m[2]); } preg_match("#^(\w+):(\w*)@([^/]+)/(\w+)#", @$_COOKIE['dsn'], $dsn); if ($_POST): # AJAX $is_lang = 'lang' == key($_POST); $pval = current($_POST); $link = ''; $time = time(); $sqls = array( "create table `test` (v int) engine=myisam", # 0 "drop table `test`", # 1 "insert into `test` values(1)", # 2 "update `test` set v=2", # 3 "delete from `test`", # 4 "create database ", # 5 ); function ajax($msg = 1) { exit(in_array($msg, array(true, 1, '1'), true) ? '1' : $msg); } if ($pval > 3 && !$is_lang) { # login:pass@host:port/dbname if ($dsn) { $idc = @mysqli_init() or exit(sprintf(L_ERR_S1_1, $dsn[1], $dsn[3])); mysqli_options($idc, MYSQLI_INIT_COMMAND, "set names utf8"); @mysqli_real_connect($idc, $dsn[3], $dsn[1], $dsn[2]) or exit(mysqli_connect_error()); if ($pval > 4) { if ($pval == 5 && $_POST['createdb']) @mysqli_query($idc, $sqls[5].$dsn[4]) or exit(sprintf(L_ERR_S1_2, $dsn[4]) . "<br>SQL: $sqls[5]$dsn[4]"); mysqli_select_db($idc, $dsn[4]) or exit(sprintf(L_ERR_S1_3, $dsn[4])); } } else exit(L_ERROR . ' DSN'); } if ($is_lang) { if (!$pval) exit(file_get_contents("$gate?lang")); $file = array_map('rtrim', file(__FILE__)); array_splice($file, 0, array_search('DOC;', $file, true), trim(file_get_contents("$gate?lang=$pval"))); file_put_contents(__FILE__, implode("\n", $file)); } else switch($pval) { /* STEP 1 */ case '1': ajax(version_compare($v = PHP_VERSION, '5.4.2', '>=') ? 1 : "php $v"); case '2': ajax(function_exists('mysqli_error')); case '3': ajax(function_exists('bzerror')); case '4': ajax(version_compare($v = mysqli_get_server_info($idc), '5.0.0', '>=') ? 1 : "mysql $v"); case '5': ajax(); case '6': @mysqli_query($idc, $sqls[0]) or ajax(L_ERR_S2_1 . "<br>SQL: $sqls[0]"); @mysqli_query($idc, $sqls[1]) or ajax(L_ERR_S2_2 . "<br>SQL: $sqls[1]"); mysqli_query($idc, $sqls[0]); ajax(); case '7': @mysqli_query($idc, $sqls[2]) or ajax(L_ERR_S3_1 . "<br>SQL: $sqls[2]"); @mysqli_query($idc, $sqls[3]) or ajax(L_ERR_S3_2 . "<br>SQL: $sqls[3]"); @mysqli_query($idc, $sqls[4]) or ajax(L_ERR_S3_3 . "<br>SQL: $sqls[4]"); mysqli_query($idc, $sqls[1]); # drop ajax(); case '8': if (file_exists($dir = "test_dir.$time")) ajax(sprintf(L_ERR_S4_1, $dir)); @mkdir($dir) or ajax(sprintf(L_ERR_S4_2, $dir)); @rmdir($dir) or ajax(sprintf(L_ERR_S4_3, $dir)); ajax(); case '9': if (file_exists($fil = "test_file.$time")) ajax(sprintf(L_ERR_S5_1, $fil)); @file_put_contents($fil,'1') or ajax(sprintf(L_ERR_S5_2, $fil)); @unlink($fil) or ajax(sprintf(L_ERR_S5_3, $fil)); if (is_file('dev.php')) { is_dir('_arch') or @mkdir('_arch') or ajax(sprintf(L_ERR_S4_2, '_arch')); rename('dev.php', $fil = "_arch/dev.php.$time") or ajax(sprintf(L_ERR_S5_2, $fil)); } ajax(); case '10': if (glob('dev.sky.*')) ajax(); $filename = $bin = ''; if ($fr = fopen("$gate?dev", 'rb')) { $md = stream_get_meta_data($fr); foreach ($md['wrapper_data'] as $r) if (preg_match("/^.*?filename=\"([^\"]+)\"$/i", $r, $m)) $filename = $m[1]; if ($filename) for (; !feof($fr); $bin .= fread($fr, 8192)); } ajax($fr && $bin && file_put_contents($filename, $bin) ? 1 : L_ERR_S6); /* STEP 2 */ case '11': $list = glob('dev.sky.*'); for ($str = '', $i = 0, $bz = bzopen(end($list), 'r'); $str .= bzread($bz); $i++) for ( ; $pos = strpos($str, "\n"); $str = substr($str, $pos + 1)) @mysqli_query($idc, $sql = substr($str, 0, $pos)) or ajax(L_ERR_SX . '<br>SQL: ' . substr($sql, 0, 100) . '<br>ERROR: ' . mysqli_error($idc)); bzclose($bz); ajax($i ? 1 : L_ERR_SX); case '12': # run embryo code $ary = mysqli_fetch_row(mysqli_query($idc, "select code from _dev_codebase where id=1")); eval($ary[0]); exit; default: ajax(L_ERROR . '. ' . L_DOSTEP . $pval); } endif; # AJAX end $dsn or $dsn = array('', 'root', '', 'localhost', ''); ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <title><?=L_TITLE?></title> <style type="text/css"> .r input { width: 100%; } body { background: lightblue; } table, td { background: white; font-family: arial, verdana; font-size: 90% } a, h1 { color: #3d7098; } span { font-size: 9px } h1 { font-size: 25px; margin-top: 30px; border-bottom: 4px solid #3d7098; } h2 { font-size: 18px; color: gray; margin-bottom: 7px; } a:hover { text-decoration: none; color: white; background-color: #3d7098; } .r { float: right; width: 30%; } /* height: 30px; */ .n { clear: both; border-bottom: 3px solid #eee; padding: 5px 0; } #res1, #res2, #res3 { background: pink; padding: 10px; text-align: center; margin-bottom: 10px; display: none; } </style> <script type="text/javascript"> function ajax(post, func) { var ajax_req = null, ajax_to = null; if (ajax_req = new XMLHttpRequest()) { ajax_req.onreadystatechange = function() { if (ajax_req.readyState != 4) return; var err = ajax_req.status == 200 ? 0 : 1, r = err ? ajax_req.statusText : ajax_req.responseText; if (ajax_to) { clearTimeout(ajax_to); func(r, err); } } ajax_req.open('POST', '<?=basename(__FILE__)."?$lg"?>', true); ajax_req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajax_req.send(post); ajax_to = setTimeout(function() { func('ajax timeout error', 3) }, 8000); } else func('ajax object error', 2); } function more(cc, obj) { ajax('lang=' + cc, function(r) { if (cc) window.location.href = window.location.hash.replace('#', '?'); else obj.parentNode.innerHTML = r; }); } </script> </head> <body><table width="700" height="100%" align="center"><tr><td valign="top" height="100%"> <div style="margin-left:100;width:500px;"> <h1><?=L_TITLE?></h1> <?php if (!$_GET): ?> Please select language:<br> <ol><li><a href="?en">en - english</a></li><li><a href="?ru">ru - русский (Russian)</a></li></ol> <div id="more"><a href="#lang" onclick="more('', this)">More languages...</a> - You should have Internet connection!</div> <?php else: /* main page */ ?> <h2>1. <?=L_TESTS?></h2> <b><?=L_DBACCESS?>:</b> <br> <br> <form name="f1"> <div class="n" style="height: 22px"><div class="r"><input name="hname" value="<?=$dsn[3]?>" onkeyup="ku()" /></div><?=L_HNAME?></div> <div class="n" style="height: 42px"><div class="r"><input name="dbname" value="<?=$dsn[4]?>" onkeyup="ku()" /><br> <label><input type="checkbox" name="chk" style="width:20px" /> <span><?=L_NEWDB?></span></label> </div><?=L_DBNAME?>:</div> <div class="n" style="height: 22px"><div class="r"><input name="login" value="<?=$dsn[1]?>" onkeyup="ku()" /></div><?=L_LNAME?>:</div> <div class="n" style="height: 22px"><div class="r"><input name="pass" value="<?=$dsn[2]?>" onkeyup="ku()" /></div><?=L_PASS?>:</div> </form> <br> <center><input type="button" value="<?=L_DOSTEP?> 1" onclick="step_n()" id="bt1" /></center> <br> <div id="res1"></div> <div class="n"><div class="r"></div><?=L_PHPVER?>:</div> <div class="n"><div class="r"></div><?=L_MYSQL?>:</div> <div class="n"><div class="r"></div><?=L_BZIP2?>:</div> <div class="n"><div class="r"></div><?=L_DBVER?>:</div> <div class="n"><div class="r"></div><?=L_DBSQL?>:</div> <div class="n"><div class="r"></div><?=L_TBSQL?>:</div> <div class="n"><div class="r"></div><?=L_RCSQL?>:</div> <div class="n"><div class="r"></div><?=L_DIRCREATE?>:</div> <div class="n"><div class="r"></div><?=L_FILECREATE?>:</div> <div class="n"><div class="r"></div><?=L_BDFEXISTS?>:</div> <br> <br> <br> <h2>2. <?=L_INST?></h2> <br> <center><input type="button" value="<?=L_DOSTEP?> 2" onclick="step_n()" id="bt2" disabled /></center> <br> <div id="res2"></div> <div class="n"><div class="r"></div><?=L_LOADB?>:</div> <div class="n"><div class="r"></div><?=L_DEVAPP?>:</div> <br> <br> <script type="text/javascript"> function not_checked(obj) { obj.innerHTML = '<?=L_NOTCHECKED?>'; obj.style.textAlign = 'center'; obj.style.color = 'black'; obj.style.background = '#ff7'; } function ku() { document.getElementById('bt1').disabled = f1.hname.value.length < 4 || !f1.dbname.value || !f1.login.value; } ku(); var j = 1, sn = 1, stop = 1, ok = [], div = document.getElementsByTagName('div'); for (var i = 0; i < div.length ; i++) if (div[i].className == 'r' && !div[i].innerHTML) not_checked(ok[j++] = div[i]); function step_n(i) { var q, beg = [0, 1, 11], end = [0, 11, 13]; if (typeof(i) == 'undefined') { // button clicked var expires = new Date(), dsn = f1.login.value + ':' + f1.pass.value + '@' + f1.hname.value + '/' + f1.dbname.value; expires.setTime(expires.getTime() + 31536000000); // 1 year document.cookie = 'dsn=' + encodeURIComponent(dsn) + '; expires=' + expires.toGMTString(); // login:pass@host:port/dbname document.getElementById('bt' + sn).disabled = true; i = beg[sn]; if (stop) { stop = 0; document.getElementById('res' + sn).style.display = 'none'; for (var k = beg[sn]; k < end[sn]; k++) not_checked(ok[k]); return step_n(); } } if (i == end[sn]) { document.getElementById('bt' + ++sn).disabled = false; stop = 1; } if (stop) return; ajax(q = 'st=' + i + '&createdb=' + (f1.chk.checked ? 1 : 0), this.func = function(r, err) { var str, div = ok[i], bt = document.getElementById('res' + sn), fan = ['/', '--', '|']; if (err) { str = 'Ajax error: ' + err + ' r:' + r; } else if (12 == i) { try { eval('r = ' + r + ';'); if (r.err) { if ('green' == r.color) { div.style.background = '#7f7'; div.innerHTML = 'OK'; setTimeout("document.location.href = 'dev.php?settings=self'", 1000); return; } else r = r.err; } else { div.innerHTML = fan[j % 3] + ' ' + j++; ajax(q, this.func); return; } } catch(e) {} } else if (r == 1) { div.style.background = '#7f7'; div.innerHTML = 'OK'; setTimeout('step_n(' + ++i + ')', 150); return j = 1; } div.style.background = '#faa'; div.innerHTML = '<?=L_ERROR?>'; bt.innerHTML = err ? str : r; bt.style.display = 'block'; stop = 1; document.getElementById('bt' + sn).disabled = false; }); } </script> <?php endif /* main page */ ?> </div> </td></tr><tr> <td height="60" style="padding: 0 100px; color: gray;"><div style="border-top: 2px solid #3d7098;"></div> <?=sprintf(L_DESC, '<a href="http://coresky.net/license" target="_blank">')?> </td> </tr></table></body> </html> |
Записи 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