コード例 #1
0
ファイル: install.php プロジェクト: buggithubs/FreshRSS
function printStep3()
{
    $system_default_config = Minz_Configuration::get('default_system');
    ?>
	<?php 
    $s3 = checkStep3();
    if ($s3['all'] == 'ok') {
        ?>
	<p class="alert alert-success"><span class="alert-head"><?php 
        echo _t('gen.short.ok');
        ?>
</span> <?php 
        echo _t('install.bdd.conf.ok');
        ?>
</p>
	<?php 
    } elseif ($s3['conn'] == 'ko') {
        ?>
	<p class="alert alert-error"><span class="alert-head"><?php 
        echo _t('gen.short.damn');
        ?>
</span> <?php 
        echo _t('install.bdd.conf.ko'), empty($_SESSION['bd_error']) ? '' : ' : ' . $_SESSION['bd_error'];
        ?>
</p>
	<?php 
    }
    ?>

	<form action="index.php?step=3" method="post">
		<legend><?php 
    echo _t('install.bdd.conf');
    ?>
</legend>
		<div class="form-group">
			<label class="group-name" for="type"><?php 
    echo _t('install.bdd.type');
    ?>
</label>
			<div class="group-controls">
				<select name="type" id="type" onchange="mySqlShowHide()" tabindex="1" >
				<?php 
    if (extension_loaded('pdo_mysql')) {
        ?>
				<option value="mysql"
					<?php 
        echo isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql' ? 'selected="selected"' : '';
        ?>
>
					MySQL
				</option>
				<?php 
    }
    ?>
				<?php 
    if (extension_loaded('pdo_sqlite')) {
        ?>
				<option value="sqlite"
					<?php 
        echo isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite' ? 'selected="selected"' : '';
        ?>
>
					SQLite
				</option>
				<?php 
    }
    ?>
				</select>
			</div>
		</div>

		<div id="mysql">
		<div class="form-group">
			<label class="group-name" for="host"><?php 
    echo _t('install.bdd.host');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="host" name="host" pattern="[0-9A-Za-z_.-]{1,64}" value="<?php 
    echo isset($_SESSION['bd_host']) ? $_SESSION['bd_host'] : $system_default_config->db['host'];
    ?>
" tabindex="2" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="user"><?php 
    echo _t('install.bdd.username');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="user" name="user" maxlength="16" pattern="[0-9A-Za-z_.-]{1,16}" value="<?php 
    echo isset($_SESSION['bd_user']) ? $_SESSION['bd_user'] : '';
    ?>
" tabindex="3" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="pass"><?php 
    echo _t('install.bdd.password');
    ?>
</label>
			<div class="group-controls">
				<input type="password" id="pass" name="pass" value="<?php 
    echo isset($_SESSION['bd_password']) ? $_SESSION['bd_password'] : '';
    ?>
" tabindex="4" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="base"><?php 
    echo _t('install.bdd');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="base" name="base" maxlength="64" pattern="[0-9A-Za-z_]{1,64}" value="<?php 
    echo isset($_SESSION['bd_base']) ? $_SESSION['bd_base'] : '';
    ?>
" tabindex="5" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="prefix"><?php 
    echo _t('install.bdd.prefix');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php 
    echo isset($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : $system_default_config->db['prefix'];
    ?>
" tabindex="6" />
			</div>
		</div>
		</div>
		<script>
			function mySqlShowHide() {
				document.getElementById('mysql').style.display = document.getElementById('type').value === 'mysql' ? 'block' : 'none';
				if (document.getElementById('type').value !== 'mysql') {
					document.getElementById('host').value = '';
					document.getElementById('user').value = '';
					document.getElementById('pass').value = '';
					document.getElementById('base').value = '';
					document.getElementById('prefix').value = '';
				}
			}
			mySqlShowHide();
		</script>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important" tabindex="7" ><?php 
    echo _t('gen.action.submit');
    ?>
</button>
				<button type="reset" class="btn" tabindex="8" ><?php 
    echo _t('gen.action.cancel');
    ?>
</button>
				<?php 
    if ($s3['all'] == 'ok') {
        ?>
				<a class="btn btn-important next-step" href="?step=4" tabindex="9" ><?php 
        echo _t('install.action.next_step');
        ?>
</a>
				<?php 
    }
    ?>
			</div>
		</div>
	</form>
<?php 
}
コード例 #2
0
ファイル: install.php プロジェクト: woshilapin/FreshRSS
function printStep3()
{
    ?>
	<?php 
    $s3 = checkStep3();
    if ($s3['all'] == 'ok') {
        ?>
	<p class="alert alert-success"><span class="alert-head"><?php 
        echo _t('ok');
        ?>
</span> <?php 
        echo _t('bdd_conf_is_ok');
        ?>
</p>
	<?php 
    } elseif ($s3['conn'] == 'ko') {
        ?>
	<p class="alert alert-error"><span class="alert-head"><?php 
        echo _t('damn');
        ?>
</span> <?php 
        echo _t('bdd_conf_is_ko'), empty($_SESSION['bd_error']) ? '' : ' : ' . $_SESSION['bd_error'];
        ?>
</p>
	<?php 
    }
    ?>

	<form action="index.php?step=3" method="post">
		<legend><?php 
    echo _t('bdd_configuration');
    ?>
</legend>
		<div class="form-group">
			<label class="group-name" for="type"><?php 
    echo _t('bdd_type');
    ?>
</label>
			<div class="group-controls">
				<select name="type" id="type">
				<option value="mysql"
					<?php 
    echo isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql' ? 'selected="selected"' : '';
    ?>
>
					MySQL
				</option>
				<!-- TODO : l'utilisation de SQLite n'est pas encore possible. Pour tester tout de même, décommentez ce bloc
				<option value="sqlite"
					<?php 
    echo isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite' ? 'selected="selected"' : '';
    ?>
>
					SQLite
				</option>-->
				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="host"><?php 
    echo _t('host');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="host" name="host" pattern="[0-9A-Za-z_.-]{1,64}" value="<?php 
    echo isset($_SESSION['bd_host']) ? $_SESSION['bd_host'] : 'localhost';
    ?>
" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="user"><?php 
    echo _t('username');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="user" name="user" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php 
    echo isset($_SESSION['bd_user']) ? $_SESSION['bd_user'] : '';
    ?>
" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="pass"><?php 
    echo _t('password');
    ?>
</label>
			<div class="group-controls">
				<input type="password" id="pass" name="pass" value="<?php 
    echo isset($_SESSION['bd_password']) ? $_SESSION['bd_password'] : '';
    ?>
" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="base"><?php 
    echo _t('bdd');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="base" name="base" maxlength="64" pattern="[0-9A-Za-z_]{1,64}" value="<?php 
    echo isset($_SESSION['bd_base']) ? $_SESSION['bd_base'] : '';
    ?>
" placeholder="freshrss" />
			</div>
		</div>

		<div class="form-group">
			<label class="group-name" for="prefix"><?php 
    echo _t('prefix');
    ?>
</label>
			<div class="group-controls">
				<input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php 
    echo isset($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : 'freshrss_';
    ?>
" />
			</div>
		</div>

		<div class="form-group form-actions">
			<div class="group-controls">
				<button type="submit" class="btn btn-important"><?php 
    echo _t('save');
    ?>
</button>
				<button type="reset" class="btn"><?php 
    echo _t('cancel');
    ?>
</button>
				<?php 
    if ($s3['all'] == 'ok') {
        ?>
				<a class="btn btn-important next-step" href="?step=4"><?php 
        echo _t('next_step');
        ?>
</a>
				<?php 
    }
    ?>
			</div>
		</div>
	</form>
<?php 
}