Menu

[r52]: / src / functions / checks.cs  Maximize  Restore  History

Download this file

91 lines (83 with data), 3.9 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#function check_on part right
#set check_on='($part_rights[\'' ^ part ^ '/' ^ right ^ '\']==1)'
#end
#function check_off part right
#set check_off='($part_rights[\'' ^ part ^ '/' ^ right ^ '\']==0)'
#end
#function check_field field right
#print '$sql->Item(\"SELECT COUNT(*) AS allowed FROM user_field\n'
#print ' LEFT JOIN user_rights ON user_rights.user_ID=$user_ID AND rights_user_ID=user_field.user_ID\n'
#print ' WHERE field=' ^ field ^ ' AND right=\"' ^ right ^ '\" AND\n'
#print ' (rights_user_ID IS NOT NULL OR user_field.user_ID=$user_ID);\n'
#print '$check=$sql->data[allowed]>0;\n'
#end
#function page_header type project screen_id
#query select `sql` as db_nm, Rights from `project` where project=?project?
#print '<?php\n'
#print 'session_start();\n'
#print '$user_ID=$_SESSION[user_ID];\n'
#print 'if (!$user_ID || $user_ID==\'0\')\n'
#print '{\n'
#print ' header(\'location: index.php\');\n'
#print ' die(\'Login failed\');\n'
#print '}\n'
#print 'require(\"util.php\");\n'
#print '$sql = new MySQL_class;\n'
#print '$sql->Create(\"' ^ db_nm ^ '\");\n'
#print '$esql = new MySQL_class;\n'
#print '$esql->Create(\"' ^ db_nm ^ '\");\n'
#if type='edit' or type='add'
#record select distinct SessionVar from `field` where SessionVar<>'' and field.sql<>'' and field.`table`=?screen_id?
#print 'if ($_GET[' ^ SessionVar ^ ']) { $_SESSION[var_' ^ SessionVar ^ '] = $_GET[' ^ SessionVar ^ ']; }\n'
#end
#end
#if type='screen'
#record select distinct SessionVar from `part` left join `field` on field.`table`=part.`table` where SessionVar<>'' and field.sql<>'' and part.screen=?screen_id?
#print 'if ($_GET[' ^ SessionVar ^ ']) { $_SESSION[var_' ^ SessionVar ^ '] = $_GET[' ^ SessionVar ^ ']; }\n'
#end
#record select distinct SessionVar from `part` left join `field` on field.`table`=part.`table` where SessionVar<>'' and part.screen=?screen_id?
#print '$' ^ SessionVar ^ '=$_SESSION[var_' ^ SessionVar ^ '];\n'
#end
#if Rights='dynamic'
#print '$part_rights=array();\n'
#print 'function get_part($part) {\n'
#print 'global $sql, $user_ID;\n'
#print '$sql->Query(\"SELECT user_part.part, user_part.right, count(user_rights.user) AS allowed FROM user_part\n'
#print ' LEFT JOIN user_rights ON user_rights.user=\'$user_ID\' AND user_rights.right=user_part.user\n'
#print ' WHERE user_part.part=$part GROUP BY user_part.part, user_part.right\");\n'
#print 'for ($i = 0; $i < $sql->rows; $i++)\n'
#print '{\n'
#print ' $sql->Fetch($i);\n'
#print ' echo \"$sql->data[part]/$sql->data[right]=$sql->data[allowed]<br>\";\n'
#print ' if ($sql->data[allowed]<>\'0\') {\n'
#print ' $part_rights[$sql->data[part].\'/\'.$sql->data[right]]=1;\n'
#print ' }\n'
#print '}\n'
#print '}\n'
#record select part from `part` where screen=?screen_id?
#print 'get_part (' ^ part ^ '); '
#end
#print '\n'
#end
#else
#set id_field=''
#query select id_field from `table` where `table`=?screen_id?
#set name=''
#query select sessionvar from `field`where field.`table`=?screen_id? and field.sql=?id_field?
#if name<>''
#print 'if ($_GET[' ^ sessionvar ^ ']) { $_SESSION[var_' ^ sessionvar ^ '] = $_GET[' ^ sessionvar ^ ']; }\n'
#end
#record select distinct SessionVar from `field`where field.`table`=?screen_id? and SessionVar<>''
#if SessionVar<>''
#print '$' ^ SessionVar ^ '=$_SESSION[var_' ^ SessionVar ^ '];\n'
#end
#end
#end
#print '?>\n'
#end
#function part_rights_link part type
#print '<input type=button value=\"' ^ type ^ '\" onClick=\"w(\'part_rights.php?part=' ^ part ^ '&right=' ^ type ^ '\',\'Part ' ^ type ^ '\',660,680); return false;\">\n'
#end
#function field_rights_link field type
#print '<input type=button value=\"' ^ type ^ '\" onClick=\"w(\'field_rights.php?field=' ^ field ^ '&right=' ^ type ^ '\',\'Field ' ^ type ^ '\',660,680); return false;\">\n'
#end
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.