예제 #1
0
function installFinish($errorMessage = '')
{
    global $aConf, $confFirst, $aDbConf, $aGeneral;
    global $reversalDirectories, $reversalFiles;
    $sAdminName = $_REQUEST['admin_username'];
    $sAdminPassword = $_REQUEST['admin_password'];
    $resRunSQL = RunSQL($sAdminName, $sAdminPassword);
    $sRet = '';
    if ('done' == $resRunSQL) {
        $sRet = '
		<div class="formKeeper">
			<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
				<input type="image" src="images/next.gif" />
				<input type="hidden" name="action" value="step5" />
			</form>
		</div>
		<div class="clearBoth"></div>';
    } else {
        $sRet = $resRunSQL;
        $sRet .= '
		<div class="formKeeper">
			<form action="' . $_SERVER['PHP_SELF'] . '" method="post">
				<input type="image" src="images/back.gif" />';
        foreach ($_POST as $sKey => $sValue) {
            if ($sKey != "action") {
                $sRet .= '<input type="hidden" name="' . $sKey . '" value="' . $sValue . '" />';
            }
        }
        $sRet .= '<input type="hidden" name="action" value="step2" />
			</form>
		</div>
		<div class="clearBoth"></div>';
        return $sRet;
    }
    foreach ($confFirst as $key => $val) {
        $aConf['headerTempl'] = str_replace("%{$key}%", $_POST[$key], $aConf['headerTempl']);
    }
    foreach ($aDbConf as $key => $val) {
        $aConf['headerTempl'] = str_replace("%{$key}%", $_POST[$key], $aConf['headerTempl']);
    }
    foreach ($aGeneral as $key => $val) {
        $aConf['headerTempl'] = str_replace("%{$key}%", $_POST[$key], $aConf['headerTempl']);
    }
    $aConf['periodicTempl'] = str_replace("%site_email%", $_POST['site_email'], $aConf['periodicTempl']);
    $aConf['periodicTempl'] = str_replace("%dir_root%", $_POST['dir_root'], $aConf['periodicTempl']);
    $aConf['periodicTempl'] = str_replace("%dir_php%", $_POST['dir_php'], $aConf['periodicTempl']);
    $ret = '';
    $ret .= '<div class="position">Cron Jobs</div>';
    $ret .= '<div class="LeftRirght">';
    $fp = fopen($aConf['dolFile'], 'w');
    if ($fp) {
        fputs($fp, $aConf['headerTempl']);
        fclose($fp);
        chmod($aConf['dolFile'], 0666);
        //$ret .='Config file was successfully written to <strong>' . $aConf['dolFile'] . '</strong><br />';
    } else {
        $text = 'Warning!!! can not get write access to config file ' . $aConf['dolFile'] . '. Here is config file</font><br>';
        $ret .= printInstallError($text);
        $trans = get_html_translation_table(HTML_ENTITIES);
        $templ = strtr($aConf['headerTempl'], $trans);
        $ret .= '<textarea cols="20" rows="10" class="headerTextarea">' . $aConf['headerTempl'] . '</textarea>';
    }
    $fp = fopen($aConf['periodicFile'], 'w');
    if ($fp) {
        fputs($fp, $aConf['periodicTempl']);
        fclose($fp);
        chmod($aConf['dolFile'], 0666);
        //$ret .='Config file was successfully written to <strong>' . $aConf['periodicFile'] . '</strong><br />';
        $ret .= '<div class="left">
							Please, setup Cron Jobs as specified below. Helpful info about Cron Jobs is <a href="http://www.boonex.net/dolphin/wiki/DetailedInstall#SettingupCronjobs">available here</a>.';
        $ret .= '</div>';
        $ret .= '<div class="debug">';
        $aFileLines = file($aConf['periodicFile']);
        foreach ($aFileLines as $sLine) {
            $ret .= $sLine . '<br />';
        }
        $ret .= '</div>';
    } else {
        $text = '<font color=red>Warning!!! can not get write access to config file ' . $aConf['periodicFile'] . '. Here is config file</font><br>';
        $ret .= printInstallError($text);
        $trans = get_html_translation_table(HTML_ENTITIES);
        $templ = strtr($aConf['periodicTempl'], $trans);
        $ret .= '<textarea cols="20" rows="10" class="headerTextarea">' . $aConf['periodicTempl'] . '</textarea>';
    }
    @rewriteFile('[path_to]', $_POST['dir_root'], $aConf['cmdFile']);
    @rewriteFile('[path_to]', $_POST['dir_root'], $aConf['notifiesFile']);
    @rewriteFile('[path_to]', $_POST['dir_root'], $aConf['cupidFile']);
    //@rewriteFile( '[path_to]', $_POST['dir_root'], $aConf['tagsFile'] );
    @rewriteFile('[path_to]', $_POST['dir_root'], $aConf['rayHeader']);
    $ret .= $sRet;
    $ret .= '</div>';
    return $ret;
}
$filename = '/home/nlg/data/intakes.csv';
copy($filename, $filename . ".bak");
$msg = "";
if (isset($_REQUEST['email'])) {
    $data = readData();
    if ($_REQUEST['email'] == $data['email']) {
        $id = "";
        $name = "{$data['first_name']} {$data['last_name']}";
        if ($_REQUEST['id']) {
            $id = $_REQUEST['id'];
            $msg = "Updated {$name}";
        } else {
            $msg = "Created new arrest record for {$name}";
        }
        updateArrestee($data, $id);
        rewriteFile();
    }
}
if ($msg) {
    print "<div class='message'>{$msg}</div>";
}
$data = readData();
$contents = "";
foreach (array_keys($data) as $field) {
    $contents .= "<tr><td>{$field}</td><td>{$data[$field]}</td><td id='a_{$field}'></td></tr>";
}
?>
  Search for arrestee name: <input id='query_string'/>
  <table>
    <tr><th>Field</th><th>Webform value</th><th>DB Value</th></tr>
    <?php