mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-06-16 09:44:30 +02:00
Item parser + functions
This commit is contained in:
parent
b098bb6be6
commit
070f5d32d5
35
engine/function/itemparser/itemlistparser.php
Normal file
35
engine/function/itemparser/itemlistparser.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function getItemNameById($id) {
|
||||||
|
|
||||||
|
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
|
||||||
|
|
||||||
|
foreach ($item_list as $items) {
|
||||||
|
|
||||||
|
$item_array = explode('@', $items);
|
||||||
|
|
||||||
|
if ($item_array[0] == $id) {
|
||||||
|
|
||||||
|
echo ucfirst($item_array[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemIdByName($name) {
|
||||||
|
|
||||||
|
$item_list = explode(PHP_EOL, file_get_contents('item_list.txt'));
|
||||||
|
|
||||||
|
foreach ($item_list as $items) {
|
||||||
|
|
||||||
|
$item_array = explode('@', $items);
|
||||||
|
|
||||||
|
if ($item_array[1] == $name) {
|
||||||
|
|
||||||
|
echo ucfirst($item_array[0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
18
engine/function/itemparser/itemparser.php
Normal file
18
engine/function/itemparser/itemparser.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$items = simplexml_load_file($config['server_path'].'/data/items/items.xml');
|
||||||
|
|
||||||
|
// Create our parsed item list
|
||||||
|
$item_list = fopen('item_list.txt', 'w');
|
||||||
|
|
||||||
|
foreach ($items->children() as $item) {
|
||||||
|
|
||||||
|
if ($item['id'] && $item['name'] != NULL) {
|
||||||
|
|
||||||
|
fwrite($item_list, $item['id'].'@'.$item['name'].PHP_EOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($item_list);
|
||||||
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Verify the PHP version, gives tutorial if fail.
|
// Verify the PHP version, gives tutorial if fail.
|
||||||
if (version_compare(phpversion(), '5.3.3', '<')) die('PHP 5.3.3 is required<br><br>WINDOWS:<br>Download and use the latest Uniform Server.<br><a href="http://www.uniformserver.com/">CLICK ME</a> to get to their website. <br> XAMPP sucks and is insecure. Kthxbye.<br><br>LINUX DEBIAN:<br>Edit /etc/apt/sources.list<br>etc if you use nano text editor, make sure you are root and do<br>nano /etc/apt/sources.list<br><br>At the bottom, add this:<br><br>deb http://packages.dotdeb.org stable all<br>deb-src http://packages.dotdeb.org stable all<br><br>save file. <br><br>Then in terminal, do these 2 commands:<br>gpg --keyserver keys.gnupg.net --recv-key 89DF5277<br><br>gpg -a --export 89DF5277 | sudo apt-key add -<br><br>And then do these 2 commands:<br><br>apt-get update<br>apt-get upgrade<br><br>You now have the latest stable PHP version.<br>');
|
if (version_compare(phpversion(), '5.3.3', '<')) die('PHP 5.3.3 is required<br><br>WINDOWS:<br>Download and use the latest Uniform Server.<br><a href="http://www.uniformserver.com/">CLICK ME</a> to get to their website. <br> XAMPP sucks and is insecure. Kthxbye.<br><br>LINUX DEBIAN:<br>Edit /etc/apt/sources.list<br>etc if you use nano text editor, make sure you are root and do<br>nano /etc/apt/sources.list<br><br>At the bottom, add this:<br><br>deb http://packages.dotdeb.org stable all<br>deb-src http://packages.dotdeb.org stable all<br><br>save file. <br><br>Then in terminal, do these 2 commands:<br>gpg --keyserver keys.gnupg.net --recv-key 89DF5277<br><br>gpg -a --export 89DF5277 | sudo apt-key add -<br><br>And then do these 2 commands:<br><br>apt-get update<br>apt-get upgrade<br><br>You now have the latest stable PHP version.<br>');
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ require 'function/general.php';
|
|||||||
require 'function/users.php';
|
require 'function/users.php';
|
||||||
require 'function/cache.php';
|
require 'function/cache.php';
|
||||||
require 'function/token.php';
|
require 'function/token.php';
|
||||||
|
require 'function/itemparser/itemlistparser.php';
|
||||||
|
|
||||||
if (isset($_SESSION['token'])) {
|
if (isset($_SESSION['token'])) {
|
||||||
$_SESSION['old_token'] = $_SESSION['token'];
|
$_SESSION['old_token'] = $_SESSION['token'];
|
||||||
|
6398
item_list.txt
Normal file
6398
item_list.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user