예제 #1
0
 function create($inner = false)
 {
     $data = array();
     $pass = s(t(v('password')));
     $pri = s(t(v('prifold')));
     $stat = get_var("select 1 from users where username='******'");
     if (!$stat && $this->name) {
         if ($pri == 'open') {
             include_once AROOT . 'controller' . DS . 'api_admin_folder.class.php';
             $folder = new api_admin_folderController($this->name);
             $rs = $folder->create(true, 'private');
         }
         $digest = md5($this->name . ':' . 'SabreDAV' . ':' . $pass);
         $sql = "insert into users (username,password,digesta1) values ('" . $this->name . "','" . $pass . "','" . $digest . "')";
         $db = run_sql($sql);
         if ($db) {
             $data['code'] = 0;
             $data['data'][] = array('id' => last_id(), 'username' => $this->name, 'password' => $pass);
         }
     } else {
         $data['code'] = 301;
         $data['message'] = 'user exesit';
     }
     if ($inner) {
         return json_encode($data);
     } else {
         render($data, 'rest');
     }
 }
예제 #2
0
 public function index()
 {
     include_once AROOT . 'controller' . DS . 'api_admin_folder.class.php';
     $folder = new api_admin_folderController();
     echo $folder->getlist();
     render($this->data);
 }