echo '<td><b>' . $project_info['project_name'] . '</b> '; if ($project_info['change']) { #cannot change it here if remote if ($uid_info['Did'] == $GLOBALS['Did']) { echo '<a href="' . $action['editproject'] . '" title="Edit project (' . $project_info['project_id'] . ')">Edit</a> '; } echo '<a href="' . $action['deleteproject'] . '" title="Delete project (' . $project_info['project_id'] . ')">Delete</a> '; } #if(count($resources)>0){ echo '<a href=# onclick="parent.ProjectsFrames.location.href = \'../frames/ProjectsFrames.php?project_id=' . $_REQUEST['project_id'] . '\'">Map (embed)</a>'; echo ' <a href=# onclick="window.open(\'' . $action['map'] . '\')" ' . $disable . '></B>Map<B></a></b></td>'; echo '</tr>'; #} echo '<tr class=""><td>Project Description: </td><td><b>' . $project_info['project_description'] . '</b></td>'; echo '</tr><tr class=""><td>Project Owner: </td><td><b>' . find_user_loginID(array('account_id' => $project_info['project_owner'], 'db' => $db)) . '</b></td></tr>'; echo '<tr class=""><td>Created By: </td><td><b>' . find_user_loginID(array('account_id' => $project_info['created_by'], 'db' => $db)) . '</b></td>'; echo '</tr><tr class=""><td>Created On: </td><td><b>' . $project_info['created_on'] . '</b></td>'; echo '</tr><tr class=""><td>Project_id: </td><td><b>' . $project_info['project_id'] . '</b></td></tr>'; ?> </table> </TD> </TR> <!-- Resources --> <TR> <TD>
function create_edge_set($O) { extract($O); #Create edges for regular resources $edge_set_str = sprintf("\t%s\n", '<EDGESET>'); #List all classes in project // $s3ql['db'] = $db; // $s3ql['user_id'] = $user_id; // $s3ql['select']='*'; // $s3ql['from']='classes'; // $s3ql['where']['project_id'] = $_REQUEST['project_id']; // #$resources = s3list($s3ql); // $resources = S3QLaction($s3ql); This was replaced by holding urles and collections in globals $resources = $GLOBALS['collections']; $C = grab_id('collection', $resources); $project_name = str_replace($toReplace, $replace, htmlentities($project_info['project_name'])); if (!empty($resources)) { if (is_array($resources)) { foreach ($resources as $resource_info) { $project_info = s3info('project', $_REQUEST['project_id'], $db); $projectNode = 'P' . $project_info['project_id']; $classNode = 'C' . $resource_info['resource_id']; $subject = str_replace($toReplace, $replace, htmlentities($resource_info['entity'])); if ($resource_info['project_id'] == $_REQUEST['project_id']) { $color = 'A0A0A0'; } else { $color = 'E9E9E9'; } $edge_set_str .= sprintf("\t\t%s\n", '<EDGE fromID="' . $projectNode . '" toID="' . $classNode . '" label="[Project ' . $project_name . '] has resource [' . $subject . ']" type="1" length="20" visible="false" color="' . $color . '"/>'); #create the edges between remote classes/rules and project_id if ($resource_info['project_id'] != $_REQUEST['project_id']) { $edge_set_str .= sprintf("\t\t%s\n", '<EDGE fromID="' . $classNode . '" toID="P' . $resource_info['project_id'] . '" label="[Project ' . $project_name . '] has resource [' . $subject . ']" type="1" length="20" visible="false" color="' . $color . '"/>'); } #build an array with class name as keys and class_id as values for use in the rules $classes[$resource_info['entity']] = $resource_info['resource_id']; } } } $rules = $GLOBALS['rules']; #$rules = include_all_class_id(compact('rules', 'project_id', 'user_id','db')); #echo '<pre>';print_r($rules); #for($i= 0; $i< count($rules); $i++) if (is_array($rules)) { foreach ($rules as $rule_info) { #echo $classes[$rules[$i]['subject']]; //echo $rules[$i]['subject']; if ($rule_info['project_id'] == $_REQUEST['project_id']) { $color = 'A0A0A0'; } else { $color = 'E9E9E9'; } if ($rule_info['object_id'] != '') { if (in_array($rule_info['object_id'], $C)) { $toID = 'C' . $rule_info['object_id']; } else { $toID = 'R' . $rule_info['rule_id']; } } else { $toID = 'R' . $rule_info['rule_id']; } #find the class_id where the rule will connect if (in_array($rule_info['subject_id'], $C)) { if ($rule_info['object'] != 'UID') { #$edge_set_str .= sprintf("\t\t%s\n", '<EDGE fromID="C'.$rule_info['subject_id'].'" toID="'.$toID.'" label="Rule: [('.$rule_info['subject'].') '.$rule_info['verb'].' ('.$rule_info['object'].')] was created_on '.substr($rule_info['created_on'], 0, 19).' by '.find_user_loginID(array('account_id'=>$rule_info['created_by'], 'db'=>$O['db'])).'" type="1" length="40" visible="true" color="'.$color.'"/>'); $edge_set_str .= sprintf("\t\t%s\n", '<EDGE fromID="C' . $rule_info['subject_id'] . '" toID="' . $toID . '" label="R' . $rule_info['rule_id'] . ' was created_on ' . substr($rule_info['created_on'], 0, 19) . ' by ' . find_user_loginID(array('account_id' => $rule_info['created_by'], 'db' => $O['db'])) . '" type="1" length="40" visible="true" color="' . $color . '"/>'); } } } } $edge_set_str .= sprintf("\t%s\n", '</EDGESET>'); return $edge_set_str; }
<table width="100%"> <tr style="color: navy; font-weight:bold"> <td width="30%">ID</td> <td width="20%">Entity</td> <td width="15%">Created On</td> <td width="15%">Created By</td> <td width="10%">Notes</td> <td> </td> </tr> <tr> <?php echo '<td>' . $instance_info['resource_id']; if ($instance_info['change']) { echo '<br /><a href="#" onclick="window.open(\'' . $action['editinstance'] . '\', \'editresource_' . $instance_id . '\', \'width=600, height=600, location=no, titlebar=no, scrollbars=yes, resizable=yes\')" title="Edit resource ' . $instance_id . ' )">Edit</a>'; echo ' <a href="#" onclick="window.open(\'' . $action['deleteinstance'] . '\', \'width=600, height=600, location=no, titlebar=no, scrollbars=yes, resizable=yes\')">Delete</a></td>'; } echo '</td>'; echo '<td><b>' . $instance_info['entity'] . '</b></td>'; echo '<td>' . $instance_info['created_on'] . '</td>'; echo '<td>' . find_user_loginID(array('account_id' => $instance_info['created_by'], 'db' => $db)) . '</td>'; echo '<td><font color=red><b>' . $instance_info['notes'] . '</b></td>'; ?> <td> </td> </tr> </table> </td></tr> <tr><td> <hr size="2" align="center" color="dodgerblue"></hr> </td></tr> </table>
function printLoginID($params) { extract($params); #echo '<pre>';print_r($params); if ($record['account_lid'] != '') { $user_uname = $record['account_lid']; } elseif ($record['login_id'] != '') { $user_uname = $record['login_id']; } else { if (is_object($_SESSION['db'])) { $user_uname = find_user_loginID($record['account_id']); } } return $user_uname; }
echo '<a href="' . $action['editclass'] . '">Edit</a> '; } echo '<a href="' . $action['deleteclass'] . '">Delete</a></td>'; } ?> </tr> <tr class=""> <td>Resource Description: </td> <?php echo '<td><b>' . $resource_info['notes'] . '</b></td>'; ?> </tr> <tr class=""> <td>Created By: </td> <?php echo '<td><b>' . find_user_loginID(array('account_id' => $resource_info['created_by'], 'db' => $db)) . '</b></td>'; ?> </tr> <tr cclass=""> <td>Created On: </td> <?php echo '<td><b>' . $resource_info['created_on'] . '</b></td>'; ?> </tr> <tr class=""> <td>Class ID: </td> <?php echo '<td><b>' . $class_id . '</b></td>'; ?> </tr> <tr class="">
echo '<font color="red">' . $done[2]['message'] . '</font>'; } } ?> <body onload="kill_me()"> <?php echo '<form action="' . $action['deletestatement'] . '" method="post" autocomplete="on"> <table border="0"> <tr> <td>Deleting statement #' . $statement_info['statement_id'] . '</td><td align="right"><font color="red"><b>' . $instance_info['notes'] . '</b></font></td> </tr> </table> <table> <tr> <td colspan="2"><hr color="navy" size="2"></hr></td> </tr> <tr> <td style="color: red" colspan="2"><br />Do you really want to delete the following statement?<br /><br /></td>'; $displayInfo = array('Project:' => $project_info['project_name'], 'ID:' => $statement_info['resource_id'], 'Subject' => $statement_info['subject'], 'Verb' => $statement_info['verb'], 'Object' => $statement_info['object'], 'Value' => viewStatementValue($statement_info), 'Notes' => $statement_info['notes'], 'Created On:' => $statement_info['created_on'], 'Created By:' => find_user_loginID(array('account_id' => $statement_info['created_by'], 'db' => $db)), 'Modified By:' => find_user_loginID(array('account_id' => $statement_info['modified_by'], 'db' => $db)), 'Modified On:' => $statement_info['modified_on']); foreach ($displayInfo as $title => $something) { echo '<tr>'; echo '<td>' . $title . '</td>'; echo '<td>' . $something . '</td>'; echo '</tr>'; } echo '<tr><td><input type="submit" name="delete_statement" value=" Delete "></td></tr> </table> </form> </body>'; }
function delete_rule($R) { extract($R); $account_lid = find_user_loginID(array('account_id' => $user_id, 'db' => $db)); #this is for rule_log #If this is a resource rule, update the resource_class to project_id = 0 and all the instances of resource, entity remains the same #find out all the statements inserted under this rule if (!is_array($statements)) { $s3ql = compact('user_id', 'db'); $s3ql['select'] = '*'; $s3ql['from'] = 'statements'; $s3ql['where']['rule_id'] = $rule_info['rule_id']; $statements = S3QLaction($s3ql); } #delete the statements (and log them... but that job i keep for delete statement) if (is_array($statements)) { for ($i = 0; $i < count($statements); $i++) { $s3ql = compact('user_id', 'db'); $s3ql['delete'] = 'statement'; $s3ql['where']['statement_id'] = $statements[$i]['statement_id']; $s3ql['where']['confirm'] = 'yes'; $done = S3QLaction($s3ql); } } #now delete the rule if ($rule_id == '') { return 'Rule ID is missing'; } $sql = "update s3db_rule set status = 'I', modified_on = now() where rule_id='" . $rule_id . "'"; $db->query($sql, __LINE__, __FILE__); $dbdata = get_object_vars($db); if ($dbdata['Errno'] == 0) { #update the access_rules table, other users must know the rule was deleted $otherProjs = ereg_replace('(^|_)' . $rule_info['project_id'] . '_', '', $rule_info['permission']); if ($otherProjs != '') { $sql = "update s3db_access_rules set status = 'deleted' where rule_id = '" . $rule_info['rule_id'] . "'"; $db->query($sql, __LINE__, __FILE__); } $inputs = array('newsubject' => '', 'newverb' => '', 'newobject' => '', 'newnotes' => ''); $oldvalues = array('oldsubject' => $rule_info['subject'], 'oldverb' => $rule_info['verb'], 'oldobject' => $rule_info['object'], 'oldnotes' => $rule_info['notes']); $action = 'delete'; $log = compact('rule_info', 'oldvalues', 'inputs', 'action', 'db', 'user_id'); #log the deleted rule $logged = insert_rule_log($log); return True; } else { return False; } }
if ($userviewed['account_type'] == 'u') { $account_type = 'User'; } if ($userviewed['account_type'] == 'p') { $account_type = 'Public User'; } $account_email = $userviewed['account_email']; $account_phone = $userviewed['account_phone']; $account_last_login_on = substr($userviewed['account_last_login_on'], 0, 19); $account_last_login_from = $userviewed['account_last_login_from']; $account_last_pwd_changed_on = substr($userviewed['account_last_pwd_changed_on'], 0, 19); $account_last_pwd_changed_by = find_user_loginID($userviewed['account_last_pwd_changed_by']); $created_on = substr($userviewed['created_on'], 0, 19); $created_by = find_user_loginID($userviewed['created_by']); $modified_on = substr($userviewed['modified_on'], 0, 19); $modified_by = find_user_loginID($userviewed['modified_by']); $addr1 = $userviewed['addr1']; $addr2 = $userviewed['addr2']; $city = $userviewed['city']; $state = $userviewed['state']; $postal_code = $userviewed['postal_code']; $country = $userviewed['country']; ?> <!-- BEGIN top --> <form method="POST" action="<?php $action['viewuser']; ?> "> <table class="top" align="center"> <tr><td> <table class="insidecontents" align="center" width="<?php
<?php echo '<form name="insertAcl" method="POST" action="' . $action['insertinstance'] . '" autocomplete="on">'; echo '<tr bgcolor="#FF9900"><td colspan="9" align="center">Add One <b>' . $resource_info['entity'] . '</b> at a time</td></tr>'; ?> <tr class="odd" align="center"> <td width="10%">Owner</td> <td width="10%">Resource<sup class="required"></sup></td> <td width="20%">Notes</td> <td width="10%">Action</td> </tr> <tr valign="top" align="center"> <?php echo '<td width="10%">' . find_user_loginID(array('db' => $db, 'account_id' => $user_id)) . '</td>'; echo '<td width="15%">' . $resource_info['entity'] . '</td>'; ?> <td width="30%"><textarea name="notes" style="background: lightyellow" rows="2" cols="40"></textarea></td> <td width="10%" align="center"> <?php echo '<input type="submit" name="add_resource" value="Add ' . $resource_info['entity'] . '"></td>'; ?> <tr><td colspan="9" align="center"><BR><BR></td></tr> <tr bgcolor="#FF9900"><td colspan="9" align="center">Users</td></tr> <?php echo $aclGrid; ?> </tr>
$tpl->set_var('section_num', '2'); $tpl->set_var('action_url', 'changeprofile.php'); $tpl->set_var('website_title', $GLOBALS['s3db_info']['server']['site_title'] . ' - change profile'); $tpl->set_var('edit_message', 'My Profile'); $tpl->set_var('content_width', '70%'); $tpl->set_var('action', '<input type="submit" name="submit" value="Update My Profile">'); $tpl->set_var('account_lid', $useredited['account_lid']); $tpl->set_var('account_status', $useredited['account_status'] == 'A' ? 'Active' : 'Inactive'); $tpl->set_var('account_uname', $useredited['account_uname']); $tpl->set_var('account_type', $useredited['account_type'] == 'u' ? 'User' : 'Group'); $tpl->set_var('account_last_login_on', substr($useredited['account_last_login_on'], 0, 19)); $tpl->set_var('account_last_login_from', $useredited['account_last_login_from']); $tpl->set_var('account_last_pwd_changed_on', substr($useredited['account_last_pwd_changed_on'], 0, 19)); $tpl->set_var('account_last_pwd_changed_by', $useredited['account_last_pwd_changed_by']); $tpl->set_var('created_on', substr($useredited['created_on'], 0, 19)); $tpl->set_var('created_by', find_user_loginID($useredited['created_by'])); $tpl->set_var('modified_by', find_user_loginID($useredited['modified_by'])); $tpl->set_var('modified_on', substr($useredited['modified_on'], 0, 19)); $tpl->set_var('addr1', $useredited['addr1']); $tpl->set_var('addr2', $useredited['addr2']); $tpl->set_var('city', $useredited['city']); $tpl->set_var('state', $useredited['state']); $tpl->set_var('postal_code', $useredited['postal_code']); $tpl->set_var('country', $useredited['country']); $tpl->set_var('account_email', $useredited['account_email']); $tpl->set_var('account_phone', $useredited['account_phone']); $tpl->fp('_output', 'top', True); $tpl->fp('_output', 'profile_edit', True); $tpl->fp('_output', 'bottom', True); $tpl->parse('_output', 'footer', True); $tpl->pfp('out', '_output');
function render_substatements_without_grid($exist_stats, $db) { $action = $GLOBALS['action']; $substats = '<table width="100%" border="0">'; if (is_array($exist_stats)) { #echo '<pre>';print_r($exist_stats);exit; foreach ($exist_stats as $i => $value) { #if(object_is_resource()) if ($exist_stats[$i]['file_name'] == '') { if ($exist_stats[$i]['object_id'] != '') { #if the value is not a file, put a button $substats .= '<tr><td colspan="6"><input type="button" size="10" value="' . $exist_stats[$i]['object_notes'] . '" onClick="window.open(\'' . $action['item'] . '&item_id=' . $exist_stats[$i]['value'] . '\', \'_blank\', \'width=700, height=600, location=no, titlebar=no, scrollbars=yes, resizable=yes\')"> <font size=1 color=navy> (Id ' . str_pad($exist_stats[$i]['value'], 6, '0', STR_PAD_LEFT) . ')</font></td></tr>'; } else { $substats .= "<tr><td colspan=6><font color=dodgerblue size=3><b>" . html_entity_decode($exist_stats[$i]['value']) . "</b></font></td></tr>"; } } else { $substats .= "<tr><td colspan=6><font color=dodgerblue size=3><b>File: <a href=" . $action['download'] . "&statement_id=" . $exist_stats[$i]['statement_id'] . ">" . $exist_stats[$i]['file_name'] . ($exist_stats[$i]['file_size'] != '' ? '(' . ceil($exist_stats[$i]['file_size'] / 1024) . ' kb)' : '') . "<a/></b></font></td></tr>"; } $substats .= "<tr><td width=50%> </td><td width=15%><font color=gray size=1>" . substr($exist_stats[$i]['created_on'], 0, 19) . "</font></td><td width=15%>"; if ($exist_stats[$i]['change']) { $action_link = printStatementActionLink($exist_stats[$i]['statement_id']); $substats .= "<font color=gray size=1>" . find_user_loginID(array('account_id' => $exist_stats[$i]['created_by'], 'db' => $db)) . "</font></td><td width=10%><font color=gray size=1>" . $exist_stats[$i]['notes'] . "</font></td><td width=10% align=right>" . $action_link . "</td></tr>"; } } $substats .= '</table>'; //echo $substats; return $substats; } }
$notes_input = $newrule['notes']; if (in_array('literal_object', array_keys($_REQUEST))) { $validation_input = $newrule['validation']; } else { $validation_input = 'UID'; $validation_disabled = " disabled"; } $displayed_rule_id = 'New'; $displayed_resource_id = $resource_info['id']; $edit_message = 'Create New Rule'; } else { $action_message = '* required'; $subject_required = '*'; $object_required = '*'; $verb_required = '*'; $owner = find_user_loginID(array('account_id' => $user_id, 'db' => $db)); $action_name = 'newrule'; $action_value = 'Create'; if ($resource_info != '') { $subject_input = $resource_info['entity']; } else { $subject_input = '<input name="subject" style="background: lightyellow" value="" size="10">'; } if (in_array('literal_object', array_keys($_REQUEST))) { $validation_input = ""; } else { $validation_input = 'UID'; $validation_disabled = " disabled"; } $verb_input_name = 'Verb'; $verb_input = '<input name="verb" style="background: lightyellow" value="" size="10">';
} ?> "> <?php echo '<form action="' . $action['editstatement'] . '&close_me=1" method="post" autocomplete="on" name="insertstatement"> <table border="0"> <tr> <td>Editing statement #' . $statement_id . '</td><td align="right"><font color="red"><b>' . $instance_info['notes'] . '</b></font></td> </tr> </table> <table> <tr> <td colspan="2"><hr color="navy" size="2"></hr></td> </tr> <tr> <td style="color: red" colspan="2"><br /></td> </tr>'; $displayInfo = array('Project:' => $project_info['project_name'], 'ID:' => $statement_info['resource_id'], 'Subject' => $statement_info['subject'], 'Verb' => $statement_info['verb'], 'Object' => $statement_info['object'], 'Value' => editInputStatementValue($statement_info, $action), 'Notes' => '<textarea style="background: lightyellow" rows="2" cols="40" name="notes" >' . $statement_info['notes'] . '</textarea>', 'Created On:' => $statement_info['created_on'], 'Created By:' => find_user_loginID(array('account_id' => $statement_info['created_by'], 'db' => $db)), 'Modified By:' => find_user_loginID(array('account_id' => $statement_info['modified_by'], 'db' => $db)), 'Modified On:' => $statement_info['modified_on']); foreach ($displayInfo as $title => $something) { echo '<tr>'; echo '<td>' . $title . '</td>'; echo '<td>' . $something . '</td>'; echo '</tr>'; } echo '<tr><td colspan="2"><br /> </td></tr>'; echo '<tr><td><input type="submit" name="edit_statement" value=" Update "></td></tr> </table> </form> </body>'; }
<tr><td class="message" colspan="9"><?php echo $message; ?> </td></tr> <tr bgcolor="#80BBFF"><td colspan="4" align="center">Edit Project</td></tr> <tr class="odd"> <td class="info" width="20%">Project Name</td> <td><input name="project_name" style="background: lightyellow" value= "<?php echo $project_info['project_name']; ?> "> </td> <td class="info" width="20%">Project Owner</td> <td class="info" width="25%"><b><?php echo $user_lid = find_user_loginID(array('account_id' => $project_info['project_owner'], 'db' => $db)); ?> <b></td> </tr> <tr class="even"> <td class="info" width="20%">Project Description<sup class="required"><?php echo $project_description_required; ?> </sup></td> <td class="info" colspan="3"><textarea name="project_description" style="background: lightyellow" rows="3" cols="60"><?php echo $project_info['project_description']; ?> </textarea></td> </tr> <tr><td><br /></td></tr> <?php
function replace_created_by($data, $db) { if (is_array($data)) { foreach ($data as $x) { $x['account_name'] = find_user_loginID(array('account_id' => $x['account_id'], 'db' => $db)); $x['created_byID'] = find_user_loginID(array('account_id' => $x['created_by'], 'db' => $db)); $x['project_owner'] = find_user_loginID(array('account_id' => $x['created_by'], 'db' => $db)); $z[] = $x; } } return $z; }
" method="POST"> <table class="middle" width="100%" align="center"> <tr><td> <table class="insidecontents" width="80%" align="center" border="0"> <tr bgcolor="#80BBFF"><td colspan="4" align="center">Create New Project</td></tr> <tr class="odd"> <td class="info" width="20%">Project Name</td> <td><input name="project_name" style="background: lightyellow" value= "<?php echo $project_name; ?> "> </td> <td class="info" width="20%">Project Owner</td> <td class="info" width="25%"><b><?php echo $user_lid = find_user_loginID(array('account_id' => $user_id, 'db' => $db)); ?> <b></td> </tr> <tr class="even"> <td class="info" width="20%">Project Description<sup class="required"><?php echo $project_description_required; ?> </sup></td> <td class="info" colspan="3"><textarea name="project_description" style="background: lightyellow" rows="3" cols="60"><?php echo $project_description; ?> </textarea></td> </tr> <tr><td><br /></td></tr> <?php