コード例 #1
0
 $result = mysql_query($query) or do_error($query, 'mysql_query() failed', mysql_error(), __FILE__, __LINE__);
 do_caption("Full name");
 do_caption("Date of birth");
 do_caption("Gender");
 do_caption("Insurance");
 do_caption("Facility contact");
 do_caption("Facility id");
 do_caption("Catchment Area");
 do_caption("Ring Fence");
 do_caption("Exclusion Zone");
 $query = "ALTER TABLE `{$GLOBALS['mysql_prefix']}tracks_hh` CHANGE `from` `from` VARCHAR( 16 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL";
 $result = mysql_query($query);
 $query = "ALTER TABLE `{$GLOBALS['mysql_prefix']}responder` ADD `ogts` TINYINT( 2 ) NOT NULL DEFAULT 0 COMMENT 'value = 1 iff unit uses OpenGTS tracking' AFTER `instam`;";
 $result = mysql_query($query);
 // 7/29/09
 do_setting('ogts_info', '');
 // 7/5/11
 $query = "ALTER TABLE `{$GLOBALS['mysql_prefix']}tracks_hh` ADD `closest_city` VARCHAR( 200 ) NULL DEFAULT NULL AFTER `status`";
 $result = mysql_query($query);
 if (table_exists("mmarkup") == 0) {
     //	6/10/11
     $query = "CREATE TABLE IF NOT EXISTS `{$GLOBALS['mysql_prefix']}mmarkup` (\n\t\t\t  `id` bigint(4) NOT NULL AUTO_INCREMENT,\n\t\t\t  `line_name` varchar(32) NOT NULL,\n\t\t\t  `line_status` int(2) NOT NULL DEFAULT '0' COMMENT '0 => show, 1 => hide',\n\t\t\t  `line_type` varchar(1) DEFAULT NULL COMMENT 'poly, circle, banner, ellipse',\n\t\t\t  `line_ident` varchar(10) DEFAULT NULL,\n\t\t\t  `line_cat_id` int(3) NOT NULL DEFAULT '0',\n\t\t\t  `line_data` varchar(4096) NOT NULL,\n\t\t\t  `use_with_bm` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'use with base map',\n\t\t\t  `use_with_r` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'use with regions',\t\t  \n\t\t\t  `use_with_f` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'use with facilities',\n\t\t\t  `use_with_u_ex` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'use with units - exclusion zone',\n\t\t\t  `use_with_u_rf` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'use with units - ringfence',\n\t\t\t  `line_color` varchar(8) DEFAULT NULL,\n\t\t\t  `line_opacity` float DEFAULT NULL,\n\t\t\t  `line_width` int(2) DEFAULT NULL,\n\t\t\t  `fill_color` varchar(8) DEFAULT NULL,\n\t\t\t  `fill_opacity` float DEFAULT NULL,\n\t\t\t  `filled` int(1) DEFAULT '0',\n\t\t\t  `_by` int(7) NOT NULL DEFAULT '0',\n\t\t\t  `_from` varchar(16) DEFAULT NULL,\n\t\t\t  `_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  UNIQUE KEY `ID` (`id`)\n\t\t\t) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COMMENT='Lines and borders';";
     $result = mysql_query($query);
     // 8/2/11
     $query = "CREATE TABLE IF NOT EXISTS `{$GLOBALS['mysql_prefix']}mmarkup_cats` (\n\t\t\t  `id` bigint(4) NOT NULL AUTO_INCREMENT,\n\t\t\t  `category` varchar(24) COLLATE utf8_unicode_ci NOT NULL,\n\t\t\t  `_by` int(7) NOT NULL DEFAULT '0',\n\t\t\t  `_from` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,\n\t\t\t  `_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t  PRIMARY KEY (`id`),\n\t\t\t  UNIQUE KEY `ID` (`id`)\n\t\t\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Map markup categories' ;";
     $result = mysql_query($query);
     $now = mysql_format_date(time() - intval(get_variable('delta_mins') * 60));
     $query_insert = "INSERT INTO `{$GLOBALS['mysql_prefix']}mmarkup_cats` (`id`, `category`, `_by`, `_from`, `_on`) VALUES\n\t\t\t(1, 'Region Boundary', '1', 'install routine', '{$now}'),\n\t\t\t(2, 'Banners', '1', 'install routine', '{$now}'),\n\t\t\t(3, 'Facility Catchment', '1', 'install routine', '{$now}'),\n\t\t\t(4, 'Ring Fence', '1', 'install routine', '{$now}'),\n\t\t\t(5, 'Exclusion Zone', '1', 'install routine', '{$now}');";
     $result_insert = mysql_query($query_insert) or do_error($query_insert, 'mysql query failed', mysql_error(), basename(__FILE__), __LINE__);
     //	6/10/11
 }
<?php

require "../settings.php";
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = change_setting_confirm($_POST);
            break;
        default:
            $OUTPUT = do_setting();
    }
} elseif (isset($_GET["change"])) {
    $OUTPUT = change_setting();
} else {
    $OUTPUT = do_setting();
}
require "../template.php";
function change_setting($err = "")
{
    db_connect();
    $inv_set = getCSetting("NEWINV_SETTING");
    $sel1 = "";
    $sel2 = "";
    if ($inv_set == "yes") {
        $sel1 = "checked='yes'";
    } else {
        $sel2 = "checked='yes'";
    }
    $display = "\n\t\t<h2>Change Navigation Setting</h2>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t{$err}\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Change Setting</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='radio' name='setting' value='yes' {$sel1}>Automatically Create New Invoice After Processing One.</td>\n\t\t\t\t<td><input type='radio' name='setting' value='no' {$sel2}>Go To Complete Screen. (Less Incomplete Invoices)</td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td><input type='submit' value='Save Setting'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
    return $display;
}