'Advanced configuration disabled'); } elseif (!validToken('chair')) { // Check for valid submission $res = array('error' => 'Invalid Token'); } elseif (isset($_POST['m']) && (($_POST['m'] == 'OC') || in_array($_POST['m'], $OC_activeModulesAR)) && isset($_POST['s']) && array_key_exists($_POST['s'], $OC_configAR) && isset($_POST['v'])) { if ($OC_configAR[$_POST['s']] == $_POST['v']) { $res = array('error' => 'Setting unchanged'); } else { $q = "UPDATE `" . OCC_TABLE_CONFIG . "` SET `value`='" . safeSQLstr(urldecode($_POST['v'])) . "' WHERE `module`='" . safeSQLstr($_POST['m']) . "' AND `setting`='" . safeSQLstr($_POST['s']) . "' LIMIT 1"; if ($r = ocsql_query($q)) { if (mysql_affected_rows() != 1) { $res = array('error' => 'Setting failed to update properly'); } else { $res = array('error' => '', 'success' => 'Setting updated'); } } else { $res = array('error' => 'DB Error: ' . safeHTMLstr(mysql_error())); } } } else { $res = array('error' => 'Invalid module, setting, or value'); } echo json_encode($res); exit; ?>