$result = mysql_query($updateSQL, $brewing); //echo $updateSQL."<br>"; $updateSQL = "ALTER TABLE `" . $prefix . "judging_scores" . $suffix_current . "` CHANGE `scoreEntry` `scoreEntry` DECIMAL( 11, 2 ) NULL DEFAULT NULL COMMENT 'Numerical score assigned by judges';"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result = mysql_query($updateSQL, $brewing); //echo $updateSQL."<br>"; } if (check_setup($prefix . "brewer" . $suffix_current, $database)) { $updateSQL = "ALTER TABLE `" . $prefix . "brewer" . $suffix_current . "` ADD `brewerDropOff` INT(4) NULL DEFAULT NULL COMMENT 'Location where brewer will drop off their entries; 0=shipping or relational to dropoff table';"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result = mysql_query($updateSQL, $brewing); //echo $updateSQL."<br>"; } if (check_setup($prefix . "brewing" . $suffix_current, $database)) { $updateSQL = "ALTER TABLE `" . $prefix . "brewing" . $suffix_current . "` ADD `brewBoxNum` VARCHAR(10) NULL DEFAULT NULL COMMENT 'The box where the entry is located after sorting';"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result = mysql_query($updateSQL, $brewing); //echo $updateSQL."<br>"; // Update character counts for ingredient columns to keep under 65000 threshold $updateSQL = "ALTER TABLE `" . $prefix . "brewing" . $suffix_current . "` CHANGE `brewMead1` `brewMead1` VARCHAR(25) NULL DEFAULT NULL;"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result = mysql_query($updateSQL, $brewing); //echo $updateSQL."<br>"; $updateSQL = "ALTER TABLE `" . $prefix . "brewing" . $suffix_current . "` CHANGE `brewMead2` `brewMead2` VARCHAR(25) NULL DEFAULT NULL;"; mysql_select_db($database, $brewing); mysql_real_escape_string($updateSQL); $result = mysql_query($updateSQL, $brewing);
$setup_success = TRUE; // The following line will need to change with future conversions if (!check_setup($prefix . "mods", $database) && !check_setup($prefix . "preferences", $database)) { /* */ $setup_success = FALSE; $setup_relocate = "Location: " . $base_url . "setup.php?section=step0"; } // For older versions (pre-1.3.0.0) if (!check_setup($prefix . "mods", $database) && check_setup($prefix . "preferences", $database)) { $setup_success = FALSE; $setup_relocate = "Location: " . $base_url . "update.php"; } elseif (MAINT) { $setup_success = FALSE; $setup_relocate = "Location: " . $base_url . "maintenance.php"; } if (check_setup($prefix . "system", $database)) { mysql_select_db($database, $brewing); $query_version_check = sprintf("SELECT version FROM %s WHERE id='1'", $prefix . "system"); $version_check = mysql_query($query_version_check, $brewing) or die(mysql_error()); $row_version_check = mysql_fetch_assoc($version_check); // For 2.0.1.0 and update is NOT needed // For updating to 2.0.0, check if "sponsorEnable" column is in the sponsors table // If so, run the update if (!check_update("sponsorEnable", $prefix . "sponsors")) { $update_required = TRUE; $setup_success = FALSE; $setup_relocate = "Location: " . $base_url . "update.php"; } if ($row_version_check['version'] != $current_version) { // Run update scripts if required if ($update_required) {
$query_version = "SELECT version FROM {$system_db_table}"; $version = mysql_query($query_version, $brewing) or die(mysql_error()); $row_version = mysql_fetch_assoc($version); $version = $row_version['version']; } if ($action == "default" && $version != $current_version) { ?> <div class="error">BCOE&M <?php echo $current_version; ?> Database Update Script must be run to update the database.</div><?php } ?> <?php if (check_setup($prefix . "preferences", $database)) { if (isset($_SESSION['loginUsername'])) { $query_user_level = sprintf("SELECT userLevel FROM %s WHERE user_name='%s'", $users_db_table, $_SESSION['loginUsername']); $user_level = mysql_query($query_user_level, $brewing) or die(mysql_error()); $row_user_level = mysql_fetch_assoc($user_level); $totalRows_user_level = mysql_num_rows($user_level); } if (isset($_SESSION['loginUsername']) && $row_user_level['userLevel'] <= 1) { if ($current_version != $version) { if ($action == "default") { ?> <div class="error">You should <u>BACK UP</u> your MySQL Database before performing this upgrade.</div> <h2>This script will update your BCOE&M database from its current version, <?php echo $version; ?> , to the latest version, <?php
function oneportalcloud_AdminServicesTabFields($params) { check_setup($params); $op = new OnePortalCloud($params['configoption1'], $params['configoption2'], $params['configoption3']); $server_id = $params['customfields']['Server ID']; if (empty($server_id)) { return 'Unable to determine Server ID to suspend'; } if (substr(strtoupper($server_id), 0, 3) != 'LSN') { $server_id = 'LSN-' . $server_id; } $server = $op->serverlist($server_id); if (empty($server)) { return 'Server cancelled or not provisioned yet.'; } //Get console $consolearea = "<link rel=\"stylesheet\" href=\"../modules/servers/oneportalcloud/includes/css/adminArea.css\"/>\n\t<a class='btn' href='{$params['configoption3']}/server/{$server_id}/console' target='_blank'>Open Server Console</a>"; // Get hardware $hardware = $op->gethardware($server_id); $status = $op->getStatus($server_id); $fw_rules = $op->getFireWallRules($server_id); // Get IP addresses $ips = oneportalcloud_ipaddresses($params); $statusarea = ""; if (empty($status->error)) { if ($status->booted) { $statusarea .= "<span class=\"label label-default power label-success\">Online</span>"; } else { $statusarea .= "<span class=\"label label-default offline label-success\">Offline</span>"; } if ($status->suspended) { $statusarea .= "<span class=\"label label-default suspended label-success\">Suspended</span>"; } if ($status->locked) { $statusarea .= "<span class=\"label label-default suspended label-success\">Locked</span>"; } $statusarea .= "<style>.power { background-color: #5cb85c; } .label{ margin-left: 10px;} .offline{ background-color: #FF0000}</style>"; } if (empty($hardware->error)) { $hwtable = '<table id="serverhwtable"><tr><th>Category</th><th>Item</th></tr>'; foreach ($hardware as $item) { $hwtable .= "<tr><td>{$item->category}</td><td>{$item->option}</td></tr>"; } $hwtable .= '</table>'; } if (!empty($ips)) { $var3 = '<table id="serveriptable"><tr><th>Network</th><th>IP Address</th><th>IP Type</th><th>Reverse DNS</th></tr>'; foreach ($ips as $nettype => $network) { $nettype = ucfirst($nettype); foreach ($network as $ip) { if ($nettype == 'Private' || $ip['type'] == 'network' || $ip['type'] == 'gateway' || $ip['type'] == 'broadcast') { $var3 .= "<tr><td>{$nettype}</td><td>{$ip['ipaddress']}</td><td>{$ip['type']}</td><td> </td></tr>"; } else { $var3 .= "<tr><td>{$nettype}</td><td>{$ip['ipaddress']}</td><td>{$ip['type']}</td><td>{$ip['ptr']}</td></tr>"; } } } $var3 .= '</table>'; } else { $var3 = '<p>Unable to determine IP Addresses</p>'; } ob_start(); $has_rules = array(); foreach ($fw_rules->firewall_by_network as $id => $network) { ?> <h3>Firewall Rules for <?php echo $fw_rules->network_interface_obj->{$id}->label; ?> </h3> <?php $has_rules[$id] = true; ?> <table class="serverfwtable" id="fw_rules_<?php echo $id; ?> "> <thead> <tr> <th>Address</th> <th>Command</th> <th>Port</th> <th>Protocol</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($network as $fw) { ?> <tr data-value='<?php echo $fw->id; ?> ' data-rule-position='<?php echo $fw->position; ?> ' id='rule_<?php echo $fw->id; ?> ' class='fw_rule'> <td><?php echo $fw->address; ?> </td> <td><?php echo $fw->command; ?> </td> <td><?php echo $fw->port; ?> </td> <td><?php echo $fw->protocol; ?> </td> <td><button type='button' class='btn btn-small btn-danger btn-submit rule_remove' id='<?php echo $fw->id; ?> ' data-network-id='<?php echo $id; ?> '>Remove</button></td> </tr> <?php } ?> </tbody> <tfoot> <tr> <td colspan="4"></td> <td colspan="1"> <button class="add-row btn btn-small btn-success btn-submit" type="button" data-network-id="<?php echo $id; ?> ">Add</button> </td> </tr> </tfoot> </table> <?php } ?> <?php foreach ($fw_rules->network_interface_obj as $nic) { if (!isset($has_rules[$nic->id])) { ?> <h3>Firewall Rules for <?php echo $nic->label; ?> </h3> <table class="serverfwtable" id="fw_rules_<?php echo $nic->id; ?> "> <thead> <tr> <th>Address</th> <th>Command</th> <th>Network Interface</th> <th>Port</th> <th>Protocol</th> <th>Action</th> </tr> </thead> <tbody> <tr id="sry"> <td colspan="5">You have no additional rules configured.</td> </tr> <tfoot> <tr> <td colspan="4"></td> <td colspan="1"> <button class="add-row btn btn-small btn-success btn-submit" type="button" data-network-id="'.$nic->id.'">Add</button> </td> </tr> </tfoot> </tbody> </table> <?php } ?> <?php } ?> <table class='serverdeftable'> <thead> <tr> <th>Network Interface</th> <th>Default Firewall Rule</th> </tr> </thead> <tbody> <?php foreach ($fw_rules->network_interface_obj as $nic) { $default = $nic->default_firewall_rule; $accept_select = $default == 'ACCEPT' ? 'selected' : ''; $drop_select = $default == 'DROP' ? 'selected' : ''; ?> <tr> <td><?php echo $nic->label; ?> </td> <td> <select name='default_rule_<?php echo $nic->id; ?> ' data-network-id='<?php echo $nic->id; ?> '> <option <?php echo $accept_select; ?> value='accept'>ACCEPT</option> <option <?php echo $drop_select; ?> value='drop'>DROP</option> </select> </td> </tr> <?php } ?> </tbody> </table> <div align='center'> <button id="save-changes" class="fw_save btn btn-primary" >Save Firewall changes</button> </div> <div id='save_dialog' title='Save Firewall changes?'> <p>Are you sure you want to make these changes to the firewall? Changes may take up to 5 minutes to become visible.</p> </div> <input type="hidden" name="deletedRules" value="" id="deletedRules"> <script type="text/javascript"> var userid = '<?php echo $params['userid']; ?> '; var serviceid = '<?php echo $params['serviceid']; ?> '; </script> <script type="text/javascript" src="../modules/servers/oneportalcloud/includes/js/adminArea.js"></script> <?php $fwarea = ob_get_contents(); ob_end_clean(); // Send what we've made $fieldsarray = array('Server Console' => $consolearea, 'Server status' => $statusarea, 'Package Items' => $hwtable, 'IP Addresses' => $var3, 'Firewall Information' => $fwarea); return $fieldsarray; }
<?php include_once PATH_ETC . "errorcodes.def.php"; include_once PATH_ETC . "permissions.def.php"; require_once PATH_LIB . "database_access.inc.php"; require_once PATH_LIB . "cache_handling.inc.php"; require_once PATH_LIB . "sessioncache.inc.php"; require_once PATH_LIB . "format_handling.inc.php"; include_once PATH_LIB . "toolkit.php"; if (DEVELOPMENT_MODE) { if (strpos(strtolower($_SERVER["REQUEST_URI"]), "phpinfo")) { phpinfo(); die; } else { if (strpos(strtolower($_SERVER["REQUEST_URI"]), "checksetup")) { check_setup(); die; } } } // ERROR-HANDLING if (!isPhpCli() && !isAjaxRequest()) { include_once PATH_LIB . "error_handler.inc.php"; include_once PATH_LIB . "exception_handler.inc.php"; set_error_handler("myErrorHandler"); register_shutdown_function("shutdown"); set_exception_handler("send_http_error"); } //clean disconnect handling register_shutdown_function(function () { if (isset($GLOBALS["STEAM"])) {
function get_setup_percentage() { $p = 10; if (check_cron_active()) { $p = $p + 30; } if (check_setup('networks')) { $p = $p + 20; } if (check_setup('publication')) { $p = $p + 20; } if (check_setup('campaign')) { $p = $p + 20; } return $p; }
<li><a <?php if (check_setup('networks')) { ?> style="text-decoration:line-through;"<?php } ?> href="ad_networks.php">Setup Ad Networks</a></li> <li><a <?php if (check_setup('publication')) { ?> style="text-decoration:line-through;"<?php } ?> href="add_publication.php">Add a Publication</a></li> <li><a <?php if (check_setup('campaign')) { ?> style="text-decoration:line-through;"<?php } ?> href="create_campaign.php">Add a Campaign</a></li> </ul> </div> <?php } ?> <?php if (getconfig_var('update_check') == 1) { $box_url = 'http://network.madserve.org/newsbox.php?dv=' . urlencode(getconfig_var('db_install_version')) . '&cv=' . urlencode(MAD_VERSION) . ''; if (getconfig_var('allow_statistical_info') == 1) {