Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
getsessionid.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Get DAV session
8  *
9  * @author Anakeen
10  * @version $Id: getsessionid.php,v 1.4 2007/03/08 16:35:35 eric Exp $
11  * @package FDL
12  * @subpackage DAV
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 include_once ("DAV/Class.FdlDav.php");
19 /**
20  * Get DAV session id for current user
21  * @param Action &$action current action
22  */
24 {
25  header('Content-type: text/xml; charset=utf-8');
26 
27  $mb = microtime();
28  $vid = GetHttpVars("vid");
29  $docid = GetHttpVars("docid");
30 
31  $action->lay->set("warning", "");
32  $action->lay->set("CODE", "OK");
33  $sessid = dav_sessionid($docid, $vid);
34  $action->lay->set("sessid", $sessid);
35  $action->lay->set("count", 1);
36  $action->lay->set("delay", microtime_diff(microtime() , $mb));
37 }
38 
39 function dav_sessionid($docid, $vid)
40 {
41  global $action;
42  $s = new HTTP_WebDAV_Server_Freedom($action->dbaccess);
43  $s->setFolderMaxItem(getParam('WEBDAV_FOLDERMAXITEM'));
44  $sid = $s->getSession($docid, $vid, $action->user->login);
45  if (!$sid) {
46  $sid = md5(uniqid($vid));
47  $s->addsession($sid, $vid, $docid, $action->user->login, time() + 3600);
48  if (!$s) $action->lay->set("CODE", "KO");
49  }
50  return "$docid-$vid-$sid";
51 }
52 function dav_getdavurl($docid, $vid)
53 {
54  global $action;
55  $dbaccess = $action->dbaccess;
57  $sdav = getParam("FREEDAV_SERVEUR", false);
58  if ($sdav && $vf->Show($vid, $info) == "") {
59  return sprintf("asdav://%s/freedav/vid-%s/%s", $sdav, dav_sessionid($docid, $vid) , $info->name);
60  }
61  return false;
62 }
global $action
newFreeVaultFile($dbaccess)
Definition: Lib.Util.php:17
dav_getdavurl($docid, $vid)
if($famId) $s
$docid
Definition: cleanFamily.php:13
getParam($name, $def="")
must be in core or global type
Definition: Lib.Common.php:193
microtime_diff($a, $b)
Definition: Lib.Common.php:302
dav_sessionid($docid, $vid)
$vf
Definition: geticon.php:28
$dbaccess
Definition: checkVault.php:17
$info
Definition: geticon.php:30
getsessionid(Action &$action)
$sessid
Definition: pack.php:51
← centre documentaire © anakeen