CMS  Version 3.9
toggle_share.inc
Go to the documentation of this file.
1 <?php
2 Fakoli::using("sharing");
3 $share_id = checkNumeric($_GET["share_id"]);
4 $work_area_id = checkNumeric($_GET["work_area_id"]);
5 
6 if (!$work_area_id || !$share_id)
7 {
8  Fakoli::end("Missing Parameter");
9 }
10 
11 $workArea = new WorkArea($work_area_id);
13 
14 if (!checkRole("admin,data") && $user->user_id != $share->user_id && !$workArea->isManager())
15 {
16  Fakoli::end("Permission Denied");
17 }
18 
19 $share->active = !$share->active;
20 $share->last_updated = now();
21 $share->last_updated_by_id = $user->user_id;
22 $share->save();
23 
24 Fakoli::end("OK");
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
static end($message="")
Use this method to terminate execution of a script instead of using the php keywords exit() or die().
Definition: core.inc:1149
global $user
$share_id
Definition: toggle_share.inc:3
if(! $work_area_id||! $share_id) $workArea
$share
$work_area_id
Definition: toggle_share.inc:4