// no date submitted, so set $date and $enddate to today
    $date = $_GET['date'];
    $enddate = $_GET['enddate'];
}
$od = new OccupancyData($date, $enddate);
$formattedDate = date("m-d-y", strtotime($date));
$formattedEndDate = date("m-d-y", strtotime($enddate));
// String of this date, including the weekday and such
if ($od instanceof OccupancyData) {
    include_once "dataView.inc";
} else {
    echo "<h3>Occupancy Data for " . $formattedDate . " to " . $formattedEndDate . " not found</h3><br>";
}
export_data($od, $date, $enddate, $formattedDate, $formattedEndDate);
// options to export data or select a different date range
show_options();
?>
			<!--  the footer goes here now -->
			<?php 
include_once "footer.inc";
?>
		</div>
	</div>
</body>
</html>

<?php 
function export_data($od, $date, $enddate, $formattedDate, $formattedEndDate)
{
    // download the data to the desktop
    $filename = "dataexport.csv";
Example #2
0
    case 'compare':
        if (count($dbs_config) < 2) {
            $schema1 = @$_POST['schema1'];
            $schema2 = @$_POST['schema2'];
            if (get_magic_quotes_gpc()) {
                // sigh...
                $schema1 = stripslashes($schema1);
                $schema2 = stripslashes($schema2);
            }
        } else {
            $schema1 = $dbs_config[@$_POST['schema1']];
            $schema2 = $dbs_config[@$_POST['schema2']];
            $schema1 = serialize(DbDiff::export($schema1['config'], $schema1['name']));
            $schema2 = serialize(DbDiff::export($schema2['config'], $schema2['name']));
        }
        do_compare($schema1, $schema2);
        echo '<p><a href="?">&laquo; Back to main page</a></p>';
        break;
    default:
        show_options($dbs_config);
}
?>

<div id="footer">
	<p>More information on this tool is available from the corresponding <a href="http://joefreeman.co.uk/blog/2009/07/php-script-to-compare-mysql-database-schemas/">blog post</a>.</p>
</div>

</div>

</body>
</html>
Example #3
0
        } else {
            $limArray = array('gen_user_id' => intval($_POST['inbox_count'][$id]), 'gen_ip' => intval($_POST['outbox_count'][$id]), 'gen_intdata' => intval($_POST['inbox_size'][$id]), 'gen_chardata' => intval($_POST['outbox_size'][$id]));
            if ($sql->update('generic', array('data' => $limArray, 'WHERE' => 'gen_id = ' . $id))) {
                e107::getLog()->logArrayAll('PM_ADM_06', $limArray);
                $mes->addSuccess($id . ADLAN_PM_11);
            } else {
                e107::getLog()->log_event('PM_ADM_09', '');
                $mes->addError($id . ADLAN_PM_7);
            }
        }
    }
}
$ns->tablerender($caption, $mes->render() . $text);
switch ($action) {
    case 'main':
        $ns->tablerender(ADLAN_PM_12, show_options($pm_prefs));
        break;
    case 'limits':
        $ns->tablerender(ADLAN_PM_14, show_limits($pm_prefs));
        $ns->tablerender(ADLAN_PM_15, add_limit($pm_prefs));
        break;
    case 'maint':
        $ns->tablerender(ADLAN_PM_60, show_maint($pm_prefs));
        break;
}
require_once e_ADMIN . 'footer.php';
function show_options($pm_prefs)
{
    $frm = e107::getForm();
    $txt = "\n\t<fieldset id='plugin-pm-prefs'>\n\t<form method='post' action='" . e_SELF . "'>\n\t<table class='table adminform'>\n\t<colgroup span='2'>\n\t\t<col class='col-label' />\n\t\t<col class='col-control' />\n\t</colgroup>\n\t<tbody>\n\t<tr>\n\t\t<td>" . ADLAN_PM_16 . "</td>\n\t\t<td>" . $frm->text('pm_option-title', $pm_prefs['title'], '50') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_17 . "</td>\n\t\t<td>" . $frm->radio_switch('pm_option-animate', $pm_prefs['animate'], LAN_YES, LAN_NO) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_18 . "</td>\n\t\t<td>" . $frm->radio_switch('pm_option-dropdown', $pm_prefs['dropdown'], LAN_YES, LAN_NO) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_19 . "</td>\n\t\t<td>" . $frm->text('pm_option-read_timeout', $pm_prefs['read_timeout'], '5', array('class' => 'tbox input-text')) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_20 . "</td>\n\t\t<td>" . $frm->text('pm_option-unread_timeout', $pm_prefs['unread_timeout'], '5', array('class' => 'tbox input-text')) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_21 . "</td>\n\t\t<td>" . $frm->radio_switch('pm_option-popup', $pm_prefs['popup'], LAN_YES, LAN_NO) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_22 . "</td>\n\t\t<td>" . $frm->text('pm_option-popup_delay', $pm_prefs['popup_delay'], '5', array('class' => 'tbox input-text')) . " " . ADLAN_PM_44 . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_23 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-pm_class', $pm_prefs['pm_class'], 'member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_24 . "</td>\n\t\t<td>" . $frm->text('pm_option-perpage', $pm_prefs['perpage'], '5', array('class' => 'tbox input-text')) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_25 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-notify_class', $pm_prefs['notify_class'], 'nobody,member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_26 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-receipt_class', $pm_prefs['receipt_class'], 'nobody,member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_27 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-attach_class', $pm_prefs['attach_class'], 'nobody,member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_28 . "</td>\n\t\t<td>" . $frm->text('pm_option-attach_size', $pm_prefs['attach_size'], '8', array('class' => 'tbox input-text')) . " kB</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_29 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-sendall_class', $pm_prefs['sendall_class'], 'nobody,member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_30 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-multi_class', $pm_prefs['multi_class'], 'nobody,member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_31 . "</td>\n\t\t<td>" . e107::getUserClass()->uc_dropdown('pm_option-opt_userclass', $pm_prefs['opt_userclass'], 'nobody,member,admin,classes') . "</td>\n\t</tr>\n\t<tr>\n\t\t<td>" . ADLAN_PM_81 . "</td>\n\t\t<td>" . $frm->text('pm_option-pm_max_send', $pm_prefs['pm_max_send'], '5', array('class' => 'tbox input-text')) . "<span class='field-help'>" . ADLAN_PM_82 . "</span></td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<div class='buttons-bar center'>\n\t\t" . $frm->admin_button('update_prefs', 'no-value', 'update', LAN_UPDATE) . "\n\t</div>\n\t</form>\n\t</fieldset>\n\t";
    return $txt;
function init(array $options = array())
{
    global $databases;
    if (!isset($databases['drupal6'])) {
        die(drush_set_error(dt('Unable to find Drupal 6 database.')));
    }
    $trace = debug_backtrace();
    $caller = isset($trace[0]['file']) ? $trace[0]['file'] : __FILE__;
    $task = drush_get_option('task');
    //$default_commands = default_commands();
    //$commands = array_merge($default_commands, $options['commands']);
    $commands = $options['commands'];
    // Add exit command to end of the commands options
    $commands[] = array('label' => t('Exit'), 'callback' => array('drush_exit'));
    prepare($caller);
    if ($task) {
        foreach ($commands as $key => $command) {
            if ($commands[$key]['label'] == $task) {
                $action = $key;
            }
        }
        if ($action) {
            run($action, $commands);
        } else {
            drush_log('Unable to load task', 'error');
        }
    } else {
        show_options($commands);
    }
}