コード例 #1
0
ファイル: xCache.php プロジェクト: dariushha/zinux
 public function fetch($key, $meta = false, $timestamp = false)
 {
     if ($this->_session_cache->isCached($key)) {
         self::$session_hit_count++;
         if (!$this->_file_cache->isCached($key)) {
             # sync file with session
             $this->_file_cache->save($key, $this->_session_cache->fetch($key));
         }
     } elseif ($this->_file_cache->isCached($key)) {
         self::$file_hit_count++;
         # sync session with file
         $this->_session_cache->save($key, $this->_file_cache->fetch($key));
     } else {
         self::$missed_count++;
         # no key found
         return NULL;
     }
     # we made sure that the $_SESSION & FILE is synced
     return $this->_session_cache->fetch($key, $meta, $timestamp);
 }
コード例 #2
0
 /**
  * 参数设置
  * 可以同时修改多个:key=a,b,c&value=1,2,3
  */
 public function set()
 {
     $key = $this->in['k'];
     $value = $this->in['v'];
     if ($key != '' && $value != '') {
         $conf = $this->config['user'];
         $arr_k = explode(',', $key);
         $arr_v = explode(',', $value);
         $num = count($arr_k);
         for ($i = 0; $i < $num; $i++) {
             $conf[$arr_k[$i]] = $arr_v[$i];
         }
         fileCache::save($this->config['user_seting_file'], $conf);
         show_json($this->L["setting_success"]);
     } else {
         show_json($this->L['error'], false);
     }
 }
コード例 #3
0
ファイル: util.php プロジェクト: ck8275411/KODExplorer
function init_setting()
{
    $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'];
    }
}
コード例 #4
0
 /**
  *初始化用户数据和配置。
  */
 public function _initUser($name)
 {
     $root = array('home', 'recycle', 'data');
     $home = array('desktop', 'doc', 'download', 'image', 'movie', 'music');
     $user_path = USER_PATH . $name . '/';
     mk_dir($user_path);
     foreach ($root as $dir) {
         mk_dir($user_path . $dir);
     }
     foreach ($home as $dir) {
         mk_dir($user_path . 'home/' . $dir);
     }
     fileCache::save($user_path . 'data/config.php', $this->config['setting_default']);
 }
コード例 #5
0
ファイル: util.php プロジェクト: ajhalls/KODExplorer
function init_setting()
{
    $setting_file = USER_SYSTEM . 'system_setting.php';
    if (!file_exists($setting_file)) {
        //It does not exist
        $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']);
    //Set the default controller
    $GLOBALS['app']->setDefaultAction('index');
    //Set the default controller function
    $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'];
    }
    //Customized load
    $setting_user = BASIC_PATH . 'config/setting_user.php';
    if (file_exists($setting_user)) {
        include $setting_user;
    }
}
コード例 #6
0
ファイル: setting.class.php プロジェクト: ajhalls/KODExplorer
 /**
 * parameter settings
  * You can edit multiple: key = a, b, c & value = 1,2,3
 */
 public function set()
 {
     $file = $this->config['user_seting_file'];
     if (!is_writeable($file)) {
         //Configuration can not be written
         show_json($this->L['no_permission_write_file'], false);
     }
     $key = $this->in['k'];
     $value = $this->in['v'];
     if ($key != '' && $value != '') {
         $conf = $this->config['user'];
         $arr_k = explode(',', $key);
         $arr_v = explode(',', $value);
         $num = count($arr_k);
         for ($i = 0; $i < $num; $i++) {
             $conf[$arr_k[$i]] = $arr_v[$i];
         }
         fileCache::save($file, $conf);
         show_json($this->L["setting_success"]);
     } else {
         show_json($this->L['error'], false);
     }
 }
コード例 #7
0
ファイル: member.class.php プロジェクト: fangbei/KODExplorer
 /**
  *初始化用户数据和配置。
  */
 public function _initUser($name)
 {
     $root = array('home', 'recycle', 'data');
     $new_user_folder = $this->config['setting_system']['new_user_folder'];
     $home = explode(',', $new_user_folder);
     $user_path = USER_PATH . $name . '/';
     mk_dir($user_path);
     foreach ($root as $dir) {
         mk_dir($user_path . $dir);
     }
     foreach ($home as $dir) {
         mk_dir($user_path . 'home/' . $dir);
     }
     fileCache::save($user_path . 'data/config.php', $this->config['setting_default']);
 }
コード例 #8
0
ファイル: util.php プロジェクト: huangtao728/KODExplorer
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'];
    }
}
コード例 #9
0
ファイル: debug.class.php プロジェクト: longmore/KODExplorer
 function _initUser()
 {
     echo '<br/>开始创建用户';
     flush();
     $root = array('home', 'recycle', 'data');
     $home = array('desktop', 'doc', 'download', 'image', 'movie', 'music');
     $user = array('admin' => array('admin', 'root'), 'demo' => array('demo', 'default'), 'guest' => array('guest', 'guest'));
     foreach ($user as $name => $v) {
         $user_path = $this->path_to . '/data/User/' . $name . '/';
         mk_dir($user_path);
         foreach ($root as $dir) {
             mk_dir($user_path . $dir);
         }
         foreach ($home as $dir) {
             mk_dir($user_path . 'home/' . $dir);
         }
         fileCache::save($user_path . 'data/config.php', $this->config['setting_default']);
     }
     $this->_initUserData();
 }