Exemplo n.º 1
0
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// check permissions
$perms =& $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$reset = (int) w2PgetParam($_GET, 'reset', 0);
if ($reset == 1) {
    $obj =& $AppUI->acl();
    $obj->recalcPermissions();
}
$w2Pcfg = new w2p_Core_Config();
// retrieve the system configuration data
$rs = $w2Pcfg->loadAll('config_group');
$tab = $AppUI->processIntState('ConfigIdxTab', $_GET, 'tab', 0);
$active = intval(!$AppUI->getState('ConfigIdxTab'));
$titleBlock = new w2p_Theme_TitleBlock('System Configuration', 'control-center.png', $m);
$titleBlock->addCrumb('?m=system', 'system admin');
$titleBlock->addCrumb('?m=system&a=addeditpref', 'default user preferences');
$titleBlock->show();
// prepare the automated form fields based on db system configuration data
$output = null;
$last_group = '';
foreach ($rs as $c) {
    $tooltip = $AppUI->_($c['config_name'] . '_tooltip');
    // extraparse the checkboxes and the select lists
    $extra = '';
Exemplo n.º 2
0
/**
 * Retrieves a configuration setting.
 * @param $key string The name of a configuration setting
 * @param $default string The default value to return if the key not found.
 * @return The value of the setting, or the default value if not found.
 */
function w2PgetConfig($key, $default = null)
{
    global $w2Pconfig, $AppUI;
    if (isset($w2Pconfig[$key])) {
        return $w2Pconfig[$key];
    } else {
        if (!is_null($default)) {
            $obj = new w2p_Core_Config();
            $obj->config_name = $key;
            $obj->config_value = $default;
            $obj->store($AppUI);
        }
        return $default;
    }
}
    $q->addTable('config');
    $q->addQuery("config_id");
    $q->addWhere("config_name = 'cal_day_start'");
    $id = $q->loadResult();
    $q->clear();
    $obj = new w2p_Core_Config();
    $obj->load($id);
    $obj->config_value = $newcal_day_start;
    if ($msg = $obj->store($AppUI)) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    }
}
$cal_day_end = w2PgetConfig("cal_day_end");
$newcal_day_end = w2PgetParam($_POST, "cal_day_end", $cal_day_end);
if ($newcal_day_end != $cal_day_end) {
    $q->addTable('config');
    $q->addQuery("config_id");
    $q->addWhere("config_name = 'cal_day_end'");
    $id = $q->loadResult();
    $q->clear();
    $obj = new w2p_Core_Config();
    $obj->load($id);
    $obj->config_value = $newcal_day_end;
    if ($msg = $obj->store($AppUI)) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    }
}
$AppUI->setMsg("Settings updated");
$AppUI->redirect();