main
parent
4849678ab6
commit
d20bf44c2a
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 28.08.2017
|
||||
*
|
||||
* @copyright (c) 2011 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
// 1 => Text (will be rendered on display)
|
||||
|
||||
function displayDefines($request) {
|
||||
$defines = getDefines();
|
||||
|
||||
if (isset($request['persist'])) {
|
||||
foreach ($defines as $define) {
|
||||
if ($request[$define['key']] != $define['value']) {
|
||||
setDefine($define['key'], $request[$define['key']]);
|
||||
}
|
||||
}
|
||||
$defines = getDefines();
|
||||
}
|
||||
?>
|
||||
<form method="POST" action="">
|
||||
<input name="persist" value="true" type="hidden" />
|
||||
<table>
|
||||
<?php
|
||||
foreach ($defines as $define) {
|
||||
?>
|
||||
<tr>
|
||||
<th align="left"><?php echo $define['key']; ?></th>
|
||||
<td><input name="<?php echo $define['key']; ?>" value="<?php echo $define['value']; ?>" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr><td colspan="2"><input type="submit" value="ändern" /></td></tr>
|
||||
<tr>
|
||||
<td colspan="3"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 28.08.2017
|
||||
*
|
||||
* @copyright (c) 2011 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
function displayPresent($request) {
|
||||
$tables = getItemsMap();
|
||||
if (isset($request['persist'])) {
|
||||
$item = lookupItem($tables, $request['item']);
|
||||
$user = mysqli_fetch_assoc(db_query('SELECT id, nickname FROM user where id = '.$request['user']));
|
||||
if ($item && $user ) {
|
||||
logaction('Hat das item '.$item['name'].' von Tabelle '.$item['table_name'].' an User '.$user['nickname'].' verschenkt');
|
||||
if (createItemForUser($item, $user['id'])) {
|
||||
echo '<p>Das item '.$item['name'].' von Tabelle '.$item['table_name'].' an User '.$user['nickname'].' erfolgreich verschenkt!</p>';
|
||||
} else {
|
||||
echo '<p>FEHLER!! Das item '.$item['name'].' von Tabelle '.$item['table_name'].' an User '.$user['nickname'].' wurde nicht verschenkt!</p>';
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<form method="POST" action="">
|
||||
<input name="persist" value="true" type="hidden" />
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2">Verschenken von Items</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<td>
|
||||
<select name="item">
|
||||
<?php
|
||||
foreach ($tables as $table) {
|
||||
foreach ($table as $item) {
|
||||
echo '<option value="'.item2Value($item).'">'.item2Name($item).'</option>'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<td>
|
||||
<select name="user">
|
||||
<?php
|
||||
$qry = db_query('SELECT id, nickname FROM `user` ORDER BY nickname');
|
||||
while ($row = mysqli_fetch_assoc($qry)) {
|
||||
echo '<option value="'.$row['id'].'">'.$row['nickname'].'</option>'."\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center"><input type="submit" value="verschenken" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">Bedenke, dass das Verschenken aufgezeichnet wird, also nicht cheaten!!</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 28.08.2017
|
||||
*
|
||||
* @copyright (c) 2011 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
// 1 => Text (will be rendered on display)
|
||||
|
||||
function displayTutorial($request) {
|
||||
if (isset($request['data'])) {
|
||||
$content = encodeNoHTMLNoBB($request['data']);
|
||||
db_query('UPDATE tutorial SET content = "'.$content.'" WHERE id = 1');
|
||||
if (db_affected_rows() == 0) {
|
||||
silent_query('INSERT INTO tutorial(id, content) value(1, "'.$content.'")');
|
||||
}
|
||||
}
|
||||
$content = mysqli_fetch_row(db_query('SELECT content FROM tutorial WHERE id = 1'))[0];
|
||||
?>
|
||||
|
||||
<form method="POST" action="">
|
||||
<p><textarea name="data" style="width: 90%;height: 80%"><?php echo $content; ?></textarea></p>
|
||||
|
||||
<p><input type="submit" value="ändern" /></p>
|
||||
<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a></p>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/*
|
||||
* Created on 01.09.2016
|
||||
*
|
||||
* @copyright (c) 2016 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
function getItemTopicsMap() {
|
||||
$qry = db_query('SELECT * from sp_set_topics ORDER BY id');
|
||||
$topics_map = array();
|
||||
|
||||
while( $row = mysqli_fetch_assoc($qry) ) {
|
||||
$topics_map[$row['id']] = $row;
|
||||
}
|
||||
|
||||
return $topics_map;
|
||||
}
|
||||
|
||||
function getItemsMap() {
|
||||
$items_map = array();
|
||||
$qry = db_query('SELECT * from sp_item WHERE type != \'Teufels Frucht\'');
|
||||
while( $row = mysqli_fetch_assoc($qry) ) {
|
||||
$row['table_name'] = 'sp_item';
|
||||
$items_map['sp_item'][$row['id']] = $row;
|
||||
}
|
||||
|
||||
$qry = db_query('SELECT * from item');
|
||||
while( $row = mysqli_fetch_assoc($qry)) {
|
||||
$row['table_name'] = 'item';
|
||||
$items_map['item'][$row['id']] = $row;
|
||||
}
|
||||
|
||||
$qry = db_query('SELECT * from wochen_markt');
|
||||
while( $row = mysqli_fetch_assoc($qry) ) {
|
||||
$row['name'] = $row['item'];
|
||||
$row['table_name'] = 'wochen_markt';
|
||||
$items_map['wochen_markt'][$row['id']] = $row;
|
||||
}
|
||||
return $items_map;
|
||||
}
|
||||
|
||||
function item2Name($item) {
|
||||
return $item['name'].'('.$item['table_name'].')';
|
||||
}
|
||||
|
||||
function item2Value($item) {
|
||||
return $item['id'].'_'.$item['table_name'];
|
||||
}
|
||||
|
||||
function getSetDefinitions() {
|
||||
$items_map = getItemsMap();
|
||||
$topics_map = getItemTopicsMap();
|
||||
|
||||
$qry = db_query('SELECT * from sp_sets order by set_topic_id');
|
||||
$sets = array();
|
||||
while( $row = mysqli_fetch_assoc($qry) ) {
|
||||
$set = array();
|
||||
$set['item'] = $items_map[$row['table_name']][$row['item_id']];
|
||||
$dep_items = array();
|
||||
$qry2 = db_query('SELECT * from sp_set_ingredient WHERE set_id = '.$row['set_id']);
|
||||
while( $row2 = mysqli_fetch_assoc($qry2) ) {
|
||||
$dep_items[] = $items_map[$row2['table_name']][$row2['item_id']];
|
||||
}
|
||||
$set['deps'] = $dep_items;
|
||||
$set['id'] = $row['set_id'];
|
||||
$set['topic_id'] = $row['set_topic_id'];
|
||||
if ( $set['topic_id'] !== NULL ) {
|
||||
$set['topic'] = $topics_map[$set['topic_id']]['name'];
|
||||
}
|
||||
$sets[] = $set;
|
||||
}
|
||||
return $sets;
|
||||
}
|
||||
|
||||
function get_set_definitions() {
|
||||
return getSetDefinitions();
|
||||
}
|
||||
|
||||
function getSetDefinition($set_id) {
|
||||
$sets = get_set_definitions();
|
||||
foreach ($sets as $set) {
|
||||
if ($set['id'] == $set_id) {
|
||||
return $set;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
function lookupItem($items, $itemIdHash) {
|
||||
$pair = explode('_', $itemIdHash, 2);
|
||||
return $items[$pair[1]][$pair[0]];
|
||||
}
|
||||
|
||||
function itemEquals($lhs, $rhs) {
|
||||
return $lhs['id'] == $rhs['id'] && $lhs['table_name'] == $rhs['table_name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return, true in case item creation was successful!
|
||||
*/
|
||||
function createItemForUser($item, $user_id, $amount = 1) {
|
||||
$ware_table=array('item' => 'ware', 'sp_item' => 'sp_ware', 'wochen_markt' => 'wochen_ware');
|
||||
if ( $ware_table[$item['table_name']] == 'ware' ) {
|
||||
$ru = $item['s_type']=='Trank'?' ':'1';
|
||||
db_query('INSERT ware(user,item_id,ru_mal) values('.$user_id.', '.$item['id'].', \''.$ru.'\')');
|
||||
} else {
|
||||
db_query('INSERT '.$ware_table[$item['table_name']].'(user, item) values('.$user_id.', '.$item['id'].')');
|
||||
}
|
||||
return db_affected_rows() > 0;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* @copyright (c) 2010 animegame.eu
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
|
||||
*
|
||||
*/
|
||||
|
||||
include_once('path.inc.php'); // get the path ;)
|
||||
include_once (ROOT_PATH . '/include/config.inc.php');
|
||||
include_once (ROOT_PATH . '/include/parse.inc.php');
|
||||
|
||||
|
||||
$content = mysqli_fetch_row(db_query('SELECT content FROM tutorial WHERE id = 1'))[0];
|
||||
|
||||
?>
|
||||
<table border="0">
|
||||
<tr><td width="500px"><?php echo encodeNoHTMLWithBB($content); ?></td></tr>
|
||||
</table>
|
Loading…
Reference in new issue