Пример #1
0
 function __construct($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
 {
     // Prepend $db_name with the path to the forum root directory
     $db_name = FORUM_ROOT . $db_name;
     $this->prefix = $db_prefix;
     if (!file_exists($db_name)) {
         @touch($db_name);
         @chmod($db_name, 0666);
         if (!file_exists($db_name)) {
             error('Unable to create new database \'' . $db_name . '\'. Permission denied', __FILE__, __LINE__);
         }
     }
     if (!is_readable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for reading. Permission denied', __FILE__, __LINE__);
     }
     if (!forum_is_writable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for writing. Permission denied', __FILE__, __LINE__);
     }
     @($this->link_id = new SQLite3($db_name, SQLITE3_OPEN_READWRITE));
     if (!$this->link_id) {
         error('Unable to open database \'' . $db_name . '\'.', __FILE__, __LINE__);
     } else {
         return $this->link_id;
     }
 }
Пример #2
0
 function __construct($db_host, $db_username, $db_password, $db_name, $db_prefix, $p_connect)
 {
     // Prepend $db_name with the path to the forum root directory
     $db_name = LUNA_ROOT . $db_name;
     $this->prefix = $db_prefix;
     if (!file_exists($db_name)) {
         @touch($db_name);
         @chmod($db_name, 0666);
         if (!file_exists($db_name)) {
             error('Unable to create new database \'' . $db_name . '\'. Permission denied', __FILE__, __LINE__);
         }
     }
     if (!is_readable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for reading. Permission denied', __FILE__, __LINE__);
     }
     if (!forum_is_writable($db_name)) {
         error('Unable to open database \'' . $db_name . '\' for writing. Permission denied', __FILE__, __LINE__);
     }
     if ($p_connect) {
         $this->link_id = @sqlite_popen($db_name, 0666, $sqlite_error);
     } else {
         $this->link_id = @sqlite_open($db_name, 0666, $sqlite_error);
     }
     if (!$this->link_id) {
         error('Unable to open database \'' . $db_name . '\'. SQLite reported: ' . $sqlite_error, __FILE__, __LINE__);
     } else {
         return $this->link_id;
     }
 }
Пример #3
0
function forum_is_writable($path)
{
    if (is_dir($path)) {
        $path = rtrim($path, '/') . '/';
        return forum_is_writable($path . uniqid(mt_rand()) . '.tmp');
    }
    // Check temporary file for read/write capabilities
    $rm = file_exists($path);
    $f = @fopen($path, 'a');
    if ($f === false) {
        return false;
    }
    fclose($f);
    if (!$rm) {
        @unlink($path);
    }
    return true;
}
Пример #4
0
    // Index the test post so searching for it works
    require PUN_ROOT . 'include/search_idx.php';
    update_search_index('post', 1, $message, $subject);
    $db->end_transaction();
    $alerts = array();
    // Check if we disabled uploading avatars because file_uploads was disabled
    if ($avatars == '0') {
        $alerts[] = $lang_install['Alert upload'];
    }
    // Add some random bytes at the end of the cookie name to prevent collisions
    $cookie_name = 'pun_cookie_' . random_key(6, false, true);
    // Generate the config.php file data
    $config = generate_config_file();
    // Attempt to write config.php and serve it up for download if writing fails
    $written = false;
    if (forum_is_writable(PUN_ROOT)) {
        $fh = @fopen(PUN_ROOT . 'config.php', 'wb');
        if ($fh) {
            fwrite($fh, $config);
            fclose($fh);
            $written = true;
        }
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
    echo $lang_install['FluxBB Installation'];
Пример #5
0
        if (!$ps->rowCount()) {
            $alerts[] = sprintf($lang_admin_index['No restrictions'], panther_link($panther_url['admin_restrictions']));
            break;
        }
    }
    $update_downloaded = file_exists(PANTHER_ROOT . 'include/updates/panther-update-patch-' . $updater->version_friendly($updater->panther_updates['version']) . '.zip') ? true : false;
    if (version_compare($panther_config['o_cur_version'], $updater->panther_updates['version'], '<') && !$update_downloaded) {
        $alerts[] = sprintf($lang_admin_index['New version'], $updater->panther_updates['version'], panther_link($panther_url['admin_updates']));
    }
    if ($update_downloaded) {
        $alerts[] = sprintf($lang_admin_index['update downloaded'], $updater->panther_updates['version'], panther_link($panther_url['admin_updates']));
    }
    $avatar_path = $panther_config['o_avatars_dir'] != '' ? $panther_config['o_avatars_path'] . '/' : PANTHER_ROOT . $panther_config['o_avatars_path'] . '/';
    $smiley_path = $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_path'] . '/' : PANTHER_ROOT . $panther_config['o_smilies_path'] . '/';
    if (!forum_is_writable(FORUM_CACHE_DIR)) {
        $alerts[] = sprintf($lang_admin_index['Alert cache'], FORUM_CACHE_DIR);
    }
    if (!forum_is_writable($avatar_path)) {
        $alerts[] = sprintf($lang_admin_index['Alert avatar'], $avatar_path);
    }
    if (!forum_is_writable($smiley_path)) {
        $alerts[] = sprintf($lang_admin_index['Alert smilies'], $smiley_path);
    }
}
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Index']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('index');
$tpl = load_template('admin_index.tpl');
echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_index' => $lang_admin_index, 'form_action' => panther_link($panther_url['save_notes']), 'panther_config' => $panther_config, 'upgrade_link' => panther_link($panther_url['check_upgrade']), 'stats_link' => panther_link($panther_url['admin_statistics']), 'alerts' => $alerts));
require PANTHER_ROOT . 'footer.php';
Пример #6
0
    Installer::insert_default_users($username, $password1, $email, $default_lang, $default_style);
    // users
    Installer::instert_default_menu();
    // menus
    Installer::insert_default_data();
    // other stuff, like ranks
    $alerts = array();
    // Check if we disabled uploading avatars because file_uploads was disabled
    if (!$avatars) {
        $alerts[] = __('<strong>File uploads appear to be disallowed on this server!</strong> If you want users to be able to upload their own avatar images you must enable the file_uploads configuration setting in PHP. Once file uploads have been enabled, avatar uploads can be enabled in Administration/Options/Features.', 'luna');
    }
    // Generate the config.php file data
    $config = Installer::generate_config_file($db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix);
    // Attempt to write config.php and serve it up for download if writing fails
    $written = false;
    if (forum_is_writable(FORUM_ROOT)) {
        $fh = @fopen(FORUM_ROOT . 'config.php', 'wb');
        if ($fh) {
            fwrite($fh, $config);
            fclose($fh);
            $written = true;
        }
    }
    ?>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><?php 
    _e('Luna Installation', 'luna');
    ?>
Пример #7
0
    $db->insert('topics', $insert);
    $insert = array('poster' => $username, 'poster_id' => 2, 'poster_ip' => get_remote_address(), 'message' => $lang_install['Message'], 'posted' => $now, 'topic_id' => 1);
    $db->insert('posts', $insert);
    // Index the test post so searching for it works
    require PANTHER_ROOT . 'include/search_idx.php';
    update_search_index('post', 1, $lang_install['Message'], $lang_install['Test post']);
    $db->end_transaction();
    // Check if we disabled uploading avatars because file_uploads was disabled
    if ($avatars == '0') {
        $alerts[] = $lang_install['Alert upload'];
    }
    // Generate the config.php file data
    $file = generate_config_file($config);
    // Attempt to write config.php and serve it up for download if writing fails
    $written = false;
    if (forum_is_writable(PANTHER_ROOT . 'include')) {
        $fh = @fopen(PANTHER_ROOT . 'include/config.php', 'wb');
        if ($fh) {
            fwrite($fh, $file);
            fclose($fh);
            $written = true;
        }
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
    echo $lang_install['Panther Installation'];
Пример #8
0
    $db->query('INSERT INTO ' . $db_prefix . 'forums (forum_name, forum_desc, num_topics, num_posts, last_post, last_post_id, last_poster, disp_position, cat_id) VALUES(\'' . $db->escape($lang_install['Test forum']) . '\', \'' . $db->escape($lang_install['This is just a test forum']) . '\', 1, 1, ' . $now . ', 1, \'' . $db->escape($username) . '\', 1, 1)') or error('Unable to insert into table ' . $db_prefix . 'forums. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
    $db->query('INSERT INTO ' . $db_prefix . 'topics (poster, subject, posted, first_post_id, last_post, last_post_id, last_poster, forum_id) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', 1, ' . $now . ', 1, \'' . $db->escape($username) . '\', 1)') or error('Unable to insert into table ' . $db_prefix . 'topics. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
    $db->query('INSERT INTO ' . $db_prefix . 'posts (poster, poster_id, poster_ip, message, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', 2, \'' . $db->escape(get_remote_address()) . '\', \'' . $db->escape($message) . '\', ' . $now . ', 1)') or error('Unable to insert into table ' . $db_prefix . 'posts. Please check your configuration and try again', __FILE__, __LINE__, $db->error());
    $db->end_transaction();
    $alerts = array();
    // Check if we disabled uploading avatars because file_uploads was disabled
    if ($avatars == '0') {
        $alerts[] = $lang_install['Alert upload'];
    }
    // Add some random bytes at the end of the cookie name to prevent collisions
    $cookie_name = 'feather_cookie_' . random_key(6, false, true);
    // Generate the config.php file data
    $config = generate_config_file();
    // Attempt to write config.php and serve it up for download if writing fails
    $written = false;
    if (forum_is_writable(FEATHER_ROOT)) {
        $fh = @fopen(FEATHER_ROOT . 'include/config.php', 'wb');
        if ($fh) {
            fwrite($fh, $config);
            fclose($fh);
            $written = true;
        }
    }
    // Rename htaccess if rewrite is possible
    if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules())) {
        rename(FEATHER_ROOT . '.htaccess.dist', FEATHER_ROOT . '.htaccess');
    }
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
Пример #9
0
    Installer::insert_default_users($username, $password1, $email, $default_lang, $default_style);
    // users
    Installer::instert_default_menu();
    // menus
    Installer::insert_default_data();
    // other stuff, like ranks
    $alerts = array();
    // Check if we disabled uploading avatars because file_uploads was disabled
    if (!$avatars) {
        $alerts[] = __('<strong>File uploads appear to be disallowed on this server!</strong> If you want users to be able to upload their own avatar images you must enable the file_uploads configuration setting in PHP. Once file uploads have been enabled, avatar uploads can be enabled in Administration/Options/Features.', 'luna');
    }
    // Generate the config.php file data
    $config = Installer::generate_config_file($db_type, $db_host, $db_name, $db_username, $db_password, $db_prefix);
    // Attempt to write config.php and serve it up for download if writing fails
    $written = false;
    if (forum_is_writable(LUNA_ROOT)) {
        $fh = @fopen(LUNA_ROOT . 'config.php', 'wb');
        if ($fh) {
            fwrite($fh, $config);
            fclose($fh);
            $written = true;
        }
    }
    ?>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title><?php 
    _e('Luna Installation', 'luna');
    ?>