Example #1
0
// Load cached bans
$pun_bans = $cache->get('bans');
if ($pun_bans === Flux_Cache::NOT_FOUND) {
    // Get the ban list from the DB
    $query = $db->select(array('id' => 'b.id', 'username' => 'b.username', 'ip' => 'b.ip', 'email' => 'b.email', 'message' => 'b.message', 'expire' => 'b.expire', 'ban_creator' => 'b.ban_creator'), 'bans AS b');
    $params = array();
    $pun_bans = $query->run($params);
    unset($query, $params);
    $cache->set('bans', $pun_bans);
}
// Check if current user is banned
check_bans();
// Update online list
update_users_online();
// Check to see if we logged in without a cookie being set
if ($pun_user['is_guest'] && isset($_GET['login'])) {
    message($lang->t('No cookie'));
}
// The maximum size of a post, in bytes, since the field is now MEDIUMTEXT this allows ~16MB but lets cap at 1MB...
if (!defined('PUN_MAX_POSTSIZE')) {
    define('PUN_MAX_POSTSIZE', 1048576);
}
if (!defined('PUN_SEARCH_MIN_WORD')) {
    define('PUN_SEARCH_MIN_WORD', 3);
}
if (!defined('PUN_SEARCH_MAX_WORD')) {
    define('PUN_SEARCH_MAX_WORD', 20);
}
if (!defined('FORUM_MAX_COOKIE_SIZE')) {
    define('FORUM_MAX_COOKIE_SIZE', 4048);
}
Example #2
0
// Load the cache module
require PUN_ROOT . 'modules/cache/src/Cache.php';
$cache = Flux_Cache::load('File', array('dir' => FORUM_CACHE_DIR), 'VarExport');
// TODO: Move this config into config.php
// TODO: according to the comment above - how do you want to move this to config when it doesn't exist? :)
// Load the language system
require PUN_ROOT . 'include/classes/lang.php';
$lang = new Flux_Lang();
// If we've been passed a default language, use it
$install_lang = isset($_REQUEST['install_lang']) ? trim($_REQUEST['install_lang']) : 'English';
$lang->setLanguage($install_lang);
// Load the install.php language file
$lang->load('install');
// If PUN is defined, config.php is probably valid and thus the software is installed
if (defined('PUN')) {
    exit($lang->t('Already installed'));
}
// Define PUN because email.php requires it
define('PUN', 1);
// Make sure we are running at least MIN_PHP_VERSION
if (!function_exists('version_compare') || version_compare(PHP_VERSION, MIN_PHP_VERSION, '<')) {
    exit($lang->t('You are running error', 'PHP', PHP_VERSION, FORUM_VERSION, MIN_PHP_VERSION));
}
// Load the DB module
require PUN_ROOT . 'modules/database/src/Database/Adapter.php';
//
// Generate output to be used for config.php
//
function generate_config_file()
{
    global $db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix, $cookie_name, $cookie_seed, $base_url;