aboutsummaryrefslogtreecommitdiffstats
path: root/models/models.go
Commit message (Collapse)AuthorAgeFilesLines
* fix #1902Unknwon2015-11-071-1/+1
|
* fix import path, fix #1782Unknwon2015-10-151-2/+1
|
* print log every time regulater timezoneUnknwon2015-10-101-1/+2
|
* add log when cannot regulate timeUnknwon2015-10-091-0/+2
|
* drop oauth2 feature supportUnknwon2015-09-171-2/+2
|
* simplify namesUnknwon2015-09-161-1/+1
|
* #1500 only regulateTimeZone for MySQLUnknwon2015-09-131-1/+1
|
* add tidb supportUnknwon2015-09-121-1/+3
|
* #1500 timezone minutes offsetUnknwon2015-09-111-3/+4
|
* more minor fix on 1581Unknwon2015-09-101-1/+1
|
* finish all new user settings UIUnknwon2015-09-101-1/+1
|
* new user profile settings UIUnknwon2015-09-061-0/+9
| | | | Signed-off-by: Unknwon <u@gogs.io>
* #1569 force InnoDB for MySQLUnknwon2015-09-031-1/+1
|
* PR: nothing to commit and has pull request checkUnknwon2015-09-021-1/+1
|
* work on PR conversationUnknwon2015-09-011-2/+2
|
* #1021 Forked repo unavailable after deleting original repoUnknwon2015-09-011-1/+1
|
* #1526 URL escape for username and passwordUnknwon2015-08-291-1/+2
|
* add webhook recent deliveriesUnknwon2015-08-271-0/+5
|
* fix release created timezone issueUnknwon2015-08-241-1/+3
|
* fix timezone!Unknwon2015-08-201-0/+21
|
* add migrate from issue.label_ids to issue_labelUnknwon2015-08-101-1/+2
|
* #334: Add Deployment Key SupportUnknwon2015-08-061-2/+2
|
* fix mysql parsetime argUnknwon2015-08-051-2/+2
|
* better wordingUnknwon2015-08-021-3/+3
|
* #1400 use new connstr format for postgresUnknwon2015-07-311-1/+1
|
* Add mysql unix socket support.Tomcat2015-03-141-2/+7
| | | | If the host setting looks like a unix socket (leading by char '/'), will use unix(host) as connection string
* v4 migration, merge 'dev', clean code and mirror fixUnknwon2015-02-231-2/+3
|
* Merge branch 'dev' of github.com:gogits/gogs into accessUnknwon2015-02-221-2/+2
|\ | | | | | | | | | | | | | | | | Conflicts: gogs.go models/models.go models/user.go templates/.VERSION templates/org/home.tmpl
| * models: fix XORM API breakUnknwon2015-02-141-1/+1
| | | | | | | | cmd/web.go: check version after load config
| * templates/user/auth/signin.tmpl: hide sign up prompt when registration is ↵Unknwon2015-02-121-4/+4
| | | | | | | | disabled #884
* | code fix #941 caution: undertestUnknwon2015-02-131-0/+10
| |
* | first pass work on migration #925Unknwon2015-02-111-7/+12
| |
* | Merge branch 'dev' of github.com:gogits/gogs into accessUnknwon2015-02-111-0/+3
|\|
| * models: make code change for session issue with SQLite3 #739Unknwon2015-02-101-0/+3
| |
* | Merge branch 'dev' into newcollaborationPeter Smit2015-02-051-8/+8
|\|
| * cmd: CMD option for port number of `gogs web` to prevent first time run conflictUnknwon2015-02-011-8/+8
| | | | | | | | | | - routers: use new binding convention to simplify code - templates: able to set HTTP port number in install page
* | Introducing Collaboration StructPeter Smit2015-01-231-1/+6
|/
* Create db migrations frameworkPeter Smit2015-01-221-0/+6
|
* fix #801Unknwon2014-12-311-7/+8
|
* Add alternative email addresses to the modelPeter Smit2014-12-171-1/+1
| | | | | | | | | | A new struct is created named EmailAddress that contains alternative email addresses for users. Also the email related methods; IsEmailUsed and GetUserByEmail are updated. DeleteUser deletes the extra email addresses and DeleteInactivateUsers also deletes inactive accounts. This could be factored out, but should do it for now.
* Fix spelling errors in comments.Joseph Crail2014-12-061-1/+1
|
* add personal access token panel #12Unknwon2014-11-121-1/+2
|
* force the use of InnoDB as db engine for all tables, fixes #59luto2014-10-281-1/+1
|
* Able to fork repo to individualsUnknwon2014-10-191-2/+10
|
* Merge remote-tracking branch 'upstream/dev'evolvedlight2014-10-131-5/+5
|\ | | | | | | | | Conflicts: models/repo.go
| * Fix #532, add system noticeUnknwon2014-10-081-5/+5
| |
* | Initial cut of git forkevolvedlight2014-10-041-1/+0
|/
* Fix minor typoevolvedlight2014-09-281-2/+2
|
* fix https://github.com/go-xorm/xorm/issues/161Unknwon2014-09-121-1/+1
|
* add showinfo for xormlunnyxiao2014-09-081-0/+1
|
value='backport/48623/stable29'>backport/48623/stable29 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/smb.php
blob: c769d29032dd8d6524a82e62192ba6c4debd95c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
 * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

require_once('smb4php/smb.php');

class OC_FileStorage_SMB extends OC_Filestorage_Common{
	private $password;
	private $user;
	private $host;
	private $root;

	private static $tempFiles=array();

	public function __construct($params){
		$this->host=$params['host'];
		$this->user=$params['user'];
		$this->password=$params['password'];
		$this->root=isset($params['root'])?$params['root']:'/';

		//create the root folder if necesary
		$this->mkdir('');
	}

	public function constructUrl($path){
		if(substr($path,-1)=='/'){
			$path=substr($path,0,-1);
		}
		return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->root.$path;
		
	}

	public function mkdir($path){
		return mkdir($this->constructUrl($path));
	}

	public function rmdir($path){
		if($this->file_exists($path)){
			$succes=rmdir($this->constructUrl($path));
			clearstatcache();
			return $succes;
		}else{
			return false;
		}
	}

	public function opendir($path){
		return opendir($this->constructUrl($path));
	}

	public function filetype($path){
		return filetype($this->constructUrl($path));
	}

	public function is_readable($path){
		return true;//not properly supported
	}

	public function is_writable($path){
		return true;//not properly supported
	}

	public function file_exists($path){
		return file_exists($this->constructUrl($path));
	}

	public function unlink($path){
		$succes=unlink($this->constructUrl($path));
		clearstatcache();
		return $succes;
	}

	public function fopen($path,$mode){
		return fopen($this->constructUrl($path),$mode);
	}

	public function writeBack($tmpFile){
		if(isset(self::$tempFiles[$tmpFile])){
			$this->uploadFile($tmpFile,self::$tempFiles[$tmpFile]);
			unlink($tmpFile);
		}
	}

	public function free_space($path){
		return 0;
	}

	public function touch($path,$mtime=null){
		if(is_null($mtime)){
			$fh=$this->fopen($path,'a');
			fwrite($fh,'');
			fclose($fh);
		}else{
			return false;//not supported
		}
	}

	public function getFile($path,$target){
		return copy($this->constructUrl($path),$target);
	}

	public function uploadFile($path,$target){
		return copy($path,$this->constructUrl($target));
	}

	public function rename($path1,$path2){
		return rename($this->constructUrl($path1),$this->constructUrl($path2));
	}

	public function stat($path){
		return stat($this->constructUrl($path));
	}
	

	
}