コード例 #1
0
 /**
  * A wrapper to set a user preference that is module specific.
  * this method only applies to admin users.
  *
  * @param string $pref_name The preference name
  * @param string $value The preference value.
  */
 public function CGSetUserPreference($pref_name, $value)
 {
     $key = '__' . $this->GetName() . '_' . $pref_name;
     return cms_userprefs::set($key, $value);
 }
コード例 #2
0
 public static function set_cwd($path)
 {
     $config = cmsms()->GetConfig();
     if (startswith($path, $config['root_path'])) {
         $path = substr($path, strlen($config['root_path']) + 1);
     }
     $advancedmode = self::check_advanced_mode();
     // validate the path.
     $prefix = $config['root_path'];
     $tmp = self::join_path($prefix, $path);
     $tmp = realpath($tmp);
     if (!is_dir($tmp)) {
         throw new Exception('Cannot set current working directory to an invalid path');
     }
     if (!self::test_invalid_path($tmp)) {
         throw new Exception('Cannot set current working directory to an invalid path');
     }
     $path = str_replace('\\', '/', substr($tmp, strlen($prefix) + 1));
     cms_userprefs::set('filemanager_cwd', $path);
 }