stylesheet 잘못 불러오는 문제 해결.

jquery.redirect 추가.
global 변수 extract 우회가 제대로 동작하지 않던 문제 해결
This commit is contained in:
2018-04-09 02:56:45 +09:00
parent 2a814dbbf9
commit 269a40ca9d
14 changed files with 216 additions and 26 deletions
+152
View File
@@ -0,0 +1,152 @@
/*
jQuery Redirect v1.1.1
Copyright (c) 2013-2017 Miguel Galante
Copyright (c) 2011-2013 Nemanja Avramovic, www.avramovic.info
Licensed under CC BY-SA 4.0 License: http://creativecommons.org/licenses/by-sa/4.0/
This means everyone is allowed to:
Share - copy and redistribute the material in any medium or format
Adapt - remix, transform, and build upon the material for any purpose, even commercially.
Under following conditions:
Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
ShareAlike - If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
*/
(function ($) {
'use strict';
/**
* jQuery Redirect
* @param {string} url - Url of the redirection
* @param {Object} values - (optional) An object with the data to send. If not present will look for values as QueryString in the target url.
* @param {string} method - (optional) The HTTP verb can be GET or POST (defaults to POST)
* @param {string} target - (optional) The target of the form. "_blank" will open the url in a new window.
* @param {boolean} traditional - (optional) This provides the same function as jquery's ajax function. The brackets are omitted on the field name if its an array. This allows arrays to work with MVC.net among others.
* @param {boolean} redirectTop - (optional) If its called from a iframe, force to navigate the top window.
*/
$.redirect = function (url, values, method, target, traditional, redirectTop) {
redirectTop = redirectTop || false;
var generatedForm = $.redirect.getForm(url, values, method, target, traditional);
$('body', redirectTop ? window.top.document : undefined).append(generatedForm.form);
generatedForm.submit();
};
$.redirect.getForm = function (url, values, method, target, traditional) {
method = (method && ["GET", "POST", "PUT", "DELETE"].indexOf(method.toUpperCase()) !== -1) ? method.toUpperCase() : 'POST';
url = url.split("#");
var hash = url[1] ? ("#" + url[1]) : "";
url = url[0];
if (!values) {
var obj = $.parseUrl(url);
url = obj.url;
values = obj.params;
}
values = removeNulls(values);
var form = $('<form>')
.attr("method", method)
.attr("action", url + hash);
if (target) {
form.attr("target", target);
}
var submit = form[0].submit;
iterateValues(values, [], form, null, traditional);
return { form: form, submit: function () { submit.call(form[0]); } };
}
//Utility Functions
/**
* Url and QueryString Parser.
* @param {string} url - a Url to parse.
* @returns {object} an object with the parsed url with the following structure {url: URL, params:{ KEY: VALUE }}
*/
$.parseUrl = function (url) {
if (url.indexOf('?') === -1) {
return {
url: url,
params: {}
};
}
var parts = url.split('?'),
query_string = parts[1],
elems = query_string.split('&');
url = parts[0];
var i, pair, obj = {};
for (i = 0; i < elems.length; i += 1) {
pair = elems[i].split('=');
obj[pair[0]] = pair[1];
}
return {
url: url,
params: obj
};
};
//Private Functions
var getInput = function (name, value, parent, array, traditional) {
var parentString;
if (parent.length > 0) {
parentString = parent[0];
var i;
for (i = 1; i < parent.length; i += 1) {
parentString += "[" + parent[i] + "]";
}
if (array) {
if (traditional)
name = parentString;
else
name = parentString + "[" + name + "]";
} else {
name = parentString + "[" + name + "]";
}
}
return $("<input>").attr("type", "hidden")
.attr("name", name)
.attr("value", value);
};
var iterateValues = function (values, parent, form, isArray, traditional) {
var i, iterateParent = [];
Object.keys(values).forEach(function (i) {
if (typeof values[i] === "object") {
iterateParent = parent.slice();
iterateParent.push(i);
iterateValues(values[i], iterateParent, form, Array.isArray(values[i]), traditional);
} else {
form.append(getInput(i, values[i], parent, isArray, traditional));
}
});
};
var removeNulls = function (values) {
var propNames = Object.getOwnPropertyNames(values);
for (var i = 0; i < propNames.length; i++) {
var propName = propNames[i];
if (values[propName] === null || values[propName] === undefined) {
delete values[propName];
} else if (typeof values[propName] === 'object') {
values[propName] = removeNulls(values[propName]);
} else if (values[propName].length < 1) {
delete values[propName];
}
}
return values;
};
}(window.jQuery || window.Zepto || window.jqlite));
+1
View File
@@ -20,6 +20,7 @@ if(!$v->validate()){
Error($v->errorStr());
}
$btn = Util::getReq('btn');
$minute = Util::getReq('minute', 'int');
$minute2 = Util::getReq('minute2', 'int');
+1 -1
View File
@@ -45,7 +45,7 @@ $(function(){
});
</script>
<link href="../d_shared/common.css" red="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link href="css/normalize.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/map.css" rel="stylesheet">
+1 -1
View File
@@ -72,7 +72,7 @@ $(function(){
});
</script>
<link href="css/normalize.css" rel="stylesheet">
<link href="../d_shared/common.css" red="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/map.css" rel="stylesheet">
+1 -1
View File
@@ -47,7 +47,7 @@ $me = MYDB_fetch_array($result);
<head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>내정보</title>
<link href="../d_shared/common.css" red="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link rel=stylesheet href="css/common.css">
<script type="text/javascript">
function go(type) {
+30 -13
View File
@@ -694,9 +694,8 @@ function command_Single($turn, $command) {
}
$query = "update general set {$str} where owner='{$userID}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//echo "<script>location.replace('commandlist.php');</script>";
echo 'commandlist.php';//TODO:debug all and replace
header('location:commandlist.php');
}
function command_Chief($turn, $command) {
@@ -724,18 +723,36 @@ function command_Chief($turn, $command) {
}
function command_Other($turn, $commandtype) {
$db = DB::db();
$connect=$db->get();
echo "<form name=form1 action=processing.php method=post target=_parent>";
$count = count($turn);
for($i=0; $i < $count; $i++) {
echo "<input type=hidden name=turn[] value=$turn[$i]>";
$target = "processing.php?commandtype={$commandtype}";
foreach($turn as $turnItem){
$target.="&turn[]={$turnItem}";
}
echo "<input type=hidden name=commandtype value={$commandtype}>";
echo "</form>";
echo "a"; // 없으면 파폭에서 아래 스크립트 실행 안됨
echo "<script>form1.submit();</script>";
$target.="&".mt_rand();
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script>
parent.moveProcessing(<?=$commandtype?>, <?=Json::encode($turn)?>);
</script>
</head>
<body style="background-color:black;">
</body>
</html>
<?php
/*
<form name='form1' action='processing.php' method='post' target=_parent>
<?php foreach($turn as $turnItem): ?>
<input type='hidden' name='turn[]' value='<?=$turnItem?>'>
<?php endforeach; ?>
<input type=hidden name=commandtype value=<?=$commandtype?>>
</form>&nbsp;
<script>*/
}
+3 -2
View File
@@ -68,6 +68,7 @@ $scenario = $admin['scenario_text'];
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="../e_lib/jquery.redirect.js"></script>
<script src="../d_shared/common_path.js"></script>
<script src="js/common.js"></script>
<script src="js/main.js"></script>
@@ -81,7 +82,7 @@ $(function(){
});
</script>
<link href="css/normalize.css" rel="stylesheet">
<link href="../d_shared/common.css" red="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link href="css/map.css" rel="stylesheet">
@@ -223,7 +224,7 @@ if ($session->userGrade >= 5) {
<td width=698 height=520 colspan=2>
<?=getMapHtml()?>
</td>
<td width=298 rowspan=4><iframe name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
<td width=298 rowspan=4><iframe seamless="seamless" sandbox="allow-same-origin allow-top-navigation allow-forms allow-scripts" name=commandlist src='commandlist.php' width=298 height=700 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no></iframe></td>
</tr>
<form name=form2 action=preprocessing.php method=post target=commandlist>
<tr>
+1 -1
View File
@@ -31,7 +31,7 @@ $connect=$db->get();
<head>
<title>장수생성</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link href="../d_shared/common.css" red="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link rel='stylesheet' href="css/common.css">
<script type="text/javascript" src="../e_lib/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/join.js"></script>
+5
View File
@@ -39,6 +39,11 @@ function refreshing(obj, arg1, arg2) {
}
}
function moveProcessing(commandtype, turn){
console.log(commandtype, turn);
$.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post');
}
function go(type) {
if(type == 1) location.replace('b_nationboard.php');
else if(type == 2) location.replace('b_troop.php');
+12 -2
View File
@@ -102,13 +102,23 @@ function extractSuperGlobals()
if (isset($_POST) && count($_POST) > 0) {
LogText($_SERVER['REQUEST_URI'], $_POST);
extract($_POST, EXTR_SKIP);
foreach($_POST as $key=>$val){
if(isset($GLOBALS[$key])){
continue;
}
$GLOBALS[$key]=$val;
}
}
if (isset($_GET) && count($_GET) > 0) {
LogText($_SERVER['REQUEST_URI'], $_GET);
extract($_POST, EXTR_SKIP);
foreach($_GET as $key=>$val){
if(isset($GLOBALS[$key])){
continue;
}
$GLOBALS[$key]=$val;
}
}
}
+1
View File
@@ -11,6 +11,7 @@ $db = DB::db();
$connect=$db->get();
$turn = Util::getReq('turn', 'array_int');
$sel = Util::getReq('sel', 'int');
$commandtype = Util::getReq('commandtype', 'int');
increaseRefresh("턴입력", 1);
+5 -2
View File
@@ -4,6 +4,10 @@ namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$commandtype = Util::getReq('commandtype', 'int', 0);
$turn = Util::getReq('turn', 'array_int', [0]);
$session = Session::requireGameLogin()->setReadOnly();
$db = DB::db();
@@ -120,7 +124,6 @@ function starter($name, $type=0) {
<script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="../d_shared/common_path.js"></script>
<script src="js/common.js"></script>
<script src="js/main.js"></script>
<script src="js/base_map.js"></script>
<script src="js/map.js"></script>
<script>
@@ -139,7 +142,7 @@ $(function(){
});
</script>
<link href="css/normalize.css" rel="stylesheet">
<link href="../d_shared/common.css" red="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
<link href="css/map.css" rel="stylesheet">
+2 -2
View File
@@ -19,7 +19,7 @@ class RegNPC extends \sammo\Event\Action{
int $death = 300,
$ego = null,
string $char = '',
string $text = ''
$text = ''
){
$this->npc = new \sammo\Scenario\NPC(
$affinity,
@@ -34,7 +34,7 @@ class RegNPC extends \sammo\Event\Action{
$death,
$ego,
$char,
$text
$text?:''
);
}
+1 -1
View File
@@ -23,7 +23,7 @@ class EventHandler{
$resultAction = [];
foreach($this->actions as $action){
$resultAction[] = $action->run();
$resultAction[] = $action->run($env);
}
$result['action'] = $resultAction;