forked from artursudnik/webpagetest-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateShare.php
40 lines (35 loc) · 1.05 KB
/
updateShare.php
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
<?php
require("login/login.php");
include 'monitor.inc';
$folderId = $_REQUEST['tableItemId'];
$tableName = $_REQUEST['tableName'];
$shareId = $_REQUEST['id'];
if ( !$_REQUEST['active'] ){
$active = false;
} else {
$active = true;
}
try
{
if ( $shareId ){
$shareTable = Doctrine_Core::getTable('Share');
$share = $shareTable->find($shareId);
}
if ( !$share ){
$share = new Share();
}
$share['Active'] =$active;
$share['UserId'] =getCurrentUserId();
$share['ShareWithUserId'] =$_REQUEST['shareWithUserId'];
$share['TheTableName'] =$_REQUEST['tableName'];
$share['TableItemId'] =$_REQUEST['tableItemId'];
$share['Permissions'] =$_REQUEST['permissions'];
$share->save();
} catch (Exception $e) {
error_log("[WPTMonitor] Failed while updating share: ".$id. " message: " . $e->getMessage());
echo $e->getMessage();
exit;
}
header("Location: listShares.php?folderId=".$folderId."&folder=".$folder."&tableName=".$tableName);
exit;
?>