?> </div> <!-- sidebar End --> <div id="content"> <div class="pqMain"> <div class="pqTitle"><a href="#">Quiz Menu</a></div> <div class="pqSubTitle">Select Quiz Type.</div> <!-- Error Display Box Start --> <?php include 'error.php'; ?> <!-- Error Box End --> <div class="cntHolder"> <?php $modules_arr = getSettingsArr($db, 'modules'); foreach ($modules_arr as $modulesf) { $modulesf2 = explode("|", $modulesf['details']); if (!$modulesf['value']) { $suffix = "d"; } else { $suffix = ""; } ?> <div class="iconBox<?php echo $suffix; ?> "> <a title="<?php echo $modulesf2[0] . " - " . $modulesf2[1]; ?>
******************************************************************/ function getSettingsGroup($db) { $sql = "SELECT DISTINCT `group` FROM " . SETTINGS; return $db->fetch_all_array($sql); } function getSettingsArr($db, $group = 'all') { $sql = "SELECT * FROM " . SETTINGS; if ($group != 'all') { $sql .= " WHERE `group` = '" . $group . "'"; } return $db->fetch_all_array($sql); } if ($_GET['subaction'] == 'editsett') { $all_sett = getSettingsArr($db, 'all'); foreach ($all_sett as $setts) { if ($setts['value'] != $_POST[$setts['name']]) { $data['value'] = $_POST[$setts['name']]; $db->query_update(SETTINGS, $data, " `name` = '" . $setts['name'] . "'"); } } print_r($_POST); } function getSettings($db, $name) { $sql = "SELECT `value` FROM " . SETTINGS . " WHERE `name` = '" . $name . "'"; $data = $db->query_first($sql); return $data['value']; } function getSettParam($db, $name)
function updateSettings() { $fn = _upgrader_ . "/data/sql/core_setting_default.sql"; importSqlFile($fn); $new_setting = getSettingsArr('core_setting_default'); // Unset Old settings unset($core_cfg['core_version']); unset($learning_cfg['lms_version']); $core_cfg = getSettingsArr('core_setting'); $learning_cfg = getSettingsArr('learning_setting'); $conference_cfg = getSettingsArr('conference_setting'); $old_cfg = array_merge($core_cfg, $learning_cfg, $conference_cfg); // Update the platform url $https = isset($_SERVER["HTTPS"]) ? $_SERVER["HTTPS"] : FALSE; $base_url = ($https ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . dirname($_SERVER['PHP_SELF']) . "/"; $base_url = preg_replace("/upgrade\\/\$/", "", $base_url); $default_cfg['url']['param_value'] = $base_url; // empty the core_setting $qtxt = "TRUNCATE TABLE core_setting"; $q = mysql_query($qtxt); if (!$q) { $GLOBALS['debug'] .= mysql_error() . "\n"; } // Store config (we'll keep only the core_setting table) foreach ($new_setting as $key => $val) { $fields = array(); foreach ($val as $fk => $fv) { if ($fk == 'param_value') { $fields[] = $fk . "='" . (isset($old_cfg[$fk]) ? $old_cfg[$fk][$fv] : $fv) . "'"; } else { $fields[] = $fk . "='" . $fv . "'"; } } $fields_qtxt = implode(', ', $fields); $qtxt = "INSERT INTO core_setting SET " . $fields_qtxt; $q = mysql_query($qtxt); if (!$q) { $GLOBALS['debug'] .= mysql_error() . "\n"; } } $qtxt = "DROP TABLE IF EXISTS `core_setting_default`;"; mysql_query($qtxt); }
<form action="<?php echo $_SERVER['PHP_SELF'] . '?action=getpage&page=settings&subaction=editsett'; ?> " enctype="multipart/form-data" method="post" id="settings"> <?php $group_arr = getSettingsGroup($db); foreach ($group_arr as $value) { ?> <fieldset> <legend><?php echo $value['group']; ?> </legend> <ul> <?php $sett_arr = getSettingsArr($db, $value['group']); foreach ($sett_arr as $sett) { if ($sett['type'] == 'checkbox') { if ($sett['value']) { $check = 'checked="checked"'; } else { $check = ""; } if ($sett['param'] != 'installed') { $disabled = ' disabled="disabled"'; } else { $disabled = ''; } $ansval = '1'; } else { $ansval = $sett['value'];