$host = $options['host'];
$user = $options['user'];

$password = is_string( $options['password'] ) ? $options['password'] : "";
$database = $options['database'];
$listMode = $options['list'];
$newType = $options["newtype"];
$usecopy = $options["usecopy"];

checkParameters( $cli, $script, $options, $host, $user, $password, $database, $listMode, $newType );
$db = connectToDatabase( $cli, $script, $host, $user, $password, $database );

// If the listMode parameter is set or no newType is assigned then show the list.
if ( $listMode || !isset( $newType ) )
{
    listTypes( $cli, $db );
}
else
{
    setNewType( $cli, $db, $newType, $usecopy );
}

/**
 *  Check whether the parameters are correctly set.
 */
function checkParameters( $cli, $script, $options, $host, $user, $password, $database, $listMode, $newType )
{
    // Extra parameters are not tolerated.
    if ( count ( $options['arguments'] ) != 0 )
    {
            $cli->error( "Unknown parameters" );
Exemplo n.º 2
0
									<div class="input-group">
										<select id="lstExt" class="form-control" name="extension" required>
											<?php 
listExtensions();
?>
										</select>
										<span class="input-group-btn">
											<button type="button" class="btn btn-info" onclick="document.location.href='gestionExtensions.php';">+</button>
										</span>
									</div>
								</div>
								<label for="lstType" class="col-lg-1 col-md-1 col-sm-1 control-label">Type :</label>
								<div class="col-lg-4 col-md-4 col-sm-4">
									<select id="lstType" name="type" class="form-control" onchange="change_type();" required>
										<?php 
listTypes();
?>
									</select>
								</div>
							</div>
						
							<!-- TEXTE -->
							<div class="form-group">
								<!--div class="col-lg-12 col-md-12 col-sm-12"-->
									<label for="txtTexte" class="col-lg-2 col-md-2 col-sm-2 control-label">Texte :</label>
									<div class="col-lg-10 col-md-10 col-sm-10">
										<textarea id="txtTexte" class="form-control" name="texte" rows="5" cols="100"><?php 
if (isset($_SESSION['ajoutCarte']['texte'])) {
    echo $_SESSION['ajoutCarte']['texte'];
}
?>