mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 17:59:22 +02:00
Database towns table support for TFS 1.3
This commit is contained in:
parent
f85fad447e
commit
668387e372
1
TODO
1
TODO
@ -83,7 +83,6 @@ x.x - At any time between (version not specified)
|
|||||||
* possibility to add extra cache engines with plugins
|
* possibility to add extra cache engines with plugins
|
||||||
* preferably configurable (enable/disable) forum TinyMCE editor
|
* preferably configurable (enable/disable) forum TinyMCE editor
|
||||||
* OTAdmin support in Admin Panel
|
* OTAdmin support in Admin Panel
|
||||||
* database towns table support for TFS 1.3
|
|
||||||
* two factor authentication for TFS 1.x
|
* two factor authentication for TFS 1.x
|
||||||
* support for .yml plugin file specification
|
* support for .yml plugin file specification
|
||||||
* display password strength
|
* display password strength
|
||||||
|
@ -159,6 +159,7 @@ $config = array(
|
|||||||
'character_name_max_length' => 21,
|
'character_name_max_length' => 21,
|
||||||
|
|
||||||
// list of towns
|
// list of towns
|
||||||
|
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (generated from your .OTBM map)
|
||||||
'towns' => array(
|
'towns' => array(
|
||||||
0 => 'No town',
|
0 => 'No town',
|
||||||
1 => 'Sample town'
|
1 => 'Sample town'
|
||||||
|
@ -171,4 +171,41 @@ else {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
?>
|
|
||||||
|
////////////////////////////////////////
|
||||||
|
// load towns from database (TFS 1.3) //
|
||||||
|
////////////////////////////////////////
|
||||||
|
|
||||||
|
$towns = array();
|
||||||
|
if($cache->enabled() && $cache->fetch('towns', $tmp)) {
|
||||||
|
$towns = unserialize($tmp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if($db->hasTable('towns')) {
|
||||||
|
$query = $db->query('SELECT `id`, `name` FROM `towns`;')->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
foreach($query as $town) {
|
||||||
|
$towns[$town['id']] = $town['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($query);
|
||||||
|
if($cache->enabled()) {
|
||||||
|
$cache->set('towns', serialize($towns), 600);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if($cache->enabled()) {
|
||||||
|
$cache->set('towns', serialize(array()), 600);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$configTowns = config('towns');
|
||||||
|
if($configTowns !== null && (!isset($configTowns[1]) || $configTowns[1] !== 'Sample town')) {
|
||||||
|
$towns = array_replace(
|
||||||
|
$towns, $configTowns
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
config(['towns', $towns]);
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
// END - load towns from database (TFS 1.3) //
|
||||||
|
//////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user