Ejemplo n.º 1
0
 public function setConfig()
 {
     $file = USER . 'data/editor_config.php';
     if (!is_writeable($file)) {
         //配置不可写
         show_json($this->L['no_permission_write_file'], false);
     }
     $key = $this->in['k'];
     $value = $this->in['v'];
     if ($key != '' && $value != '') {
         $sql = new fileCache($file);
         if (!$sql->update($key, $value)) {
             $sql->add($key, $value);
             //没有则添加一条
         }
         show_json($this->L["setting_success"]);
     } else {
         show_json($this->L['error'], false);
     }
 }
Ejemplo n.º 2
0
function init_setting()
{
    $member = new fileCache(USER_SYSTEM . 'member.php');
    // from environment variables
    $username = '******';
    $password = '******';
    $user = array('name' => $username, 'password' => md5($password), 'role' => 'default', 'status' => 0);
    $member->add($username, $user);
    initDaoCloudUser($username);
    $setting_file = USER_SYSTEM . 'system_setting.php';
    if (!file_exists($setting_file)) {
        //不存在则建立
        $setting = $GLOBALS['config']['setting_system_default'];
        $setting['menu'] = $GLOBALS['config']['setting_menu_default'];
        fileCache::save($setting_file, $setting);
    } else {
        $setting = fileCache::load($setting_file);
    }
    if (!is_array($setting)) {
        $setting = $GLOBALS['config']['setting_system_default'];
    }
    if (!is_array($setting['menu'])) {
        $setting['menu'] = $GLOBALS['config']['setting_menu_default'];
    }
    $GLOBALS['app']->setDefaultController($setting['first_in']);
    //设置默认控制器
    $GLOBALS['app']->setDefaultAction('index');
    //设置默认控制器函数
    $GLOBALS['config']['setting_system'] = $setting;
    //全局
    $GLOBALS['L']['kod_name'] = $setting['system_name'];
    $GLOBALS['L']['kod_name_desc'] = $setting['system_desc'];
    if (isset($setting['powerby'])) {
        $GLOBALS['L']['kod_power_by'] = $setting['powerby'];
    }
}