* fixed some php fatal error on spells page

* changed spells.vocations field in db size to 300
* please reload your spells after this update!
This commit is contained in:
slawkens1 2017-10-22 23:36:05 +02:00
parent 2b6d65e955
commit 87a3d1e5d1
4 changed files with 18 additions and 15 deletions

View File

@ -28,7 +28,7 @@ session_start();
define('MYAAC', true);
define('MYAAC_VERSION', '0.6.5');
define('DATABASE_VERSION', 15);
define('DATABASE_VERSION', 16);
define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true));
define('MYAAC_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? 'WINDOWS' : (strtoupper(PHP_OS) == 'DARWIN' ? 'MAC' : 'LINUX'));

View File

@ -11,29 +11,27 @@
defined('MYAAC') or die('Direct access not allowed!');
class Usage_Statistics {
private static $report_url = 'http://my-aac.org/report_usage.php';
public static function report() {
$url = 'http://my-acc.org/report_usage.php';
//$url = BASE_URL . 'report_usage.php';
$data = json_encode(self::getStats());
$options = array(
'http' => array(
'header' => 'Content-type: application/json',
'header' => 'Content-type: application/json' . "\r\n"
. 'Content-Length: ' . strlen($data) . "\r\n",
'method' => 'POST',
'content' => $data
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === false) {
return false;
}
return true;
$result = file_get_contents(self::$report_url, false, $context);
//var_dump($result);
return $result !== false;
}
public static function getStats() {
global $config, $db;

5
system/migrations/16.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// change size of spells.vocations
$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` MODIFY `vocations` VARCHAR(300) NOT NULL DEFAULT '';");
?>

View File

@ -53,7 +53,7 @@ $spells = array();
$spells_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'spells` WHERE `hidden` != 1 AND `type` < 3 ORDER BY ' . $order . ', level');
if((string)$vocation_id != 'all') {
foreach($spells_db->fetchAll() as &$spell) {
foreach($spells_db->fetchAll() as $spell) {
$spell_vocations = json_decode($spell['vocations'], true);
if(in_array($vocation_id, $spell_vocations) || count($spell_vocations) == 0) {
$spell['vocations'] = null;
@ -62,7 +62,7 @@ if((string)$vocation_id != 'all') {
}
}
else {
foreach($spells_db->fetchAll() as &$spell) {
foreach($spells_db->fetchAll() as $spell) {
$vocations = json_decode($spell['vocations'], true);
foreach($vocations as &$tmp_vocation) {
@ -72,7 +72,7 @@ else {
$tmp_vocation = 'Unknown';
}
$spell['vocations'] = implode('</br>', $vocations);
$spell['vocations'] = implode('<br/>', $vocations);
$spells[] = $spell;
}
}