Example #1
0
/**
 * Return combination of default and user compile options (flags)
 *
 * Initial compile options are in a global called $flag_table.
 * Compile options may have been changed via form input. We return
 * an array with either the default value of each option or a user
 * supplied value from form input.
 *
 * @return array combined default and user supplied compile options (flags)
 */
function get_flags ()
{
    global $flag_table;

    $flags = default_flags ();

    if ( ! isset ( $_POST["use_flags"] ) )
        return $flags;

    foreach ( $flag_table as $key => $props ) {

        $flag = $props["flag"];
        $type = $props["type"];

        if ( isset ( $_POST["$flag"] ) ) {
            $flags[$flag] = $_POST["$flag"];
            if ( $type == "integer-hex" ) {
                if ( strtolower ( substr ( $flags[$flag], 0, 2 ) ) != "0x" ) {
                    $flags[$flag] = "0x" . $flags[$flag];
                }
            }
        } else if ( $type == "on/off" ) {
			// Unchecked checkboxes don't pass any POST value
			// so we must check for them specially.  At this
			// point we know that there is no $_POST value set
			// for this option.  If it is a checkbox, this means
			// it is unchecked, so record that in $flags so we
			// can later generate an #undef for this option.
            $flags[$flag] = "off";
        }
    }
    return $flags;
}
Example #2
0
 * published by the Free Software Foundation; either version 2 of the
 * License, or any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
// Get utility functions and set globals
require_once "utils.php";
// Prepare settable compile options for presentation to user
$flags = default_flags();
$build = "<input type=\"submit\" name=\"A\" value=\"Get Image\">";
$restart = "<input type=\"submit\" name=\"A\" value=\"Start Over\">";
// Begin html output
include_once $top_inc;
?>

<form action="build.php" method=POST>
  <input type="hidden" name="version" value = "<?php 
echo $version;
?>
">
  <input type="hidden" name="use_flags" value="1">
  <h3>
    Make changes below and press <?php 
echo $build;