-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimecard.class.php
More file actions
76 lines (68 loc) · 1.61 KB
/
Copy pathtimecard.class.php
File metadata and controls
76 lines (68 loc) · 1.61 KB
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
<?php /* HELPDESK $Id: timecard.class.php,v 1.5 2005/06/27 21:17:53 hstanton Exp $ */
require_once $AppUI->getSystemClass('dp');
//require_once $AppUI->getSystemClass('libmail');
// Function to build a where clause to be appended to any sql that will narrow
// down the returned data to only permitted entities
function getPermsWhereClause($mod, $mod_id_field)
{
global $AppUI, $perms;
//print "<pre>";
//print_r($perms);
//print "</pre>";
// Figure out the module and field
/* switch($mod){
case "companies":
$id_field = "company_id";
break;
case "users":
$id_field = "user_id";
break;
case "projects":
$id_field = "project_id";
break;
case "tasks":
$id_field = "task_id";
break;
case "helpdesk_items":
$id_field = "item_id";
break;
default:
return null;
}
if(
(isset($perms[$mod]['-1']) && ($perms[$mod]['-1']=='1' || $perms[$mod]['-1']=='-1')) ||
(isset($perms["all"]['-1']) && ($perms["all"]['-1']=='1' || $perms["all"]['-1']=='-1'))
) {
$sql = "SELECT $id_field FROM $mod";
$list = db_loadColumn( $sql );
} else {
$list = array();
}
$list[] = "''";
$list[] = "0";
if(isset($perms[$mod])){
foreach($perms[$mod] as $key => $value){
//-1 is all perms, so not a specific one
if($key=='-1')
continue;
switch($value){
case '-1': //edit
$list[] = $key;
break;
case '0'://deny
unset($list[array_search($key, $list)]);
break;
case '1'://read
$list[] = $key;
break;
default:
break;
}
}
}
$list = array_unique($list);
return " $mod_id_field in (".implode(",",$list).")";
*/
return "1 = 1";
}
?>