本文整理汇总了PHP中allowed函数的典型用法代码示例。如果您正苦于以下问题:PHP allowed函数的具体用法?PHP allowed怎么用?PHP allowed使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了allowed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: section_node
/**
* Node section
*
* @param array $§
*
* @return string
*/
function section_node(array &$§) : string
{
if (empty($§['vars']['crit']) || !($menu = one('menu', $§['vars']['crit'])) || !($data = all('node', ['root_id' => $menu['id'], 'project_id' => $menu['project_id']]))) {
return '';
}
$data = array_filter($data, function ($item) use($data) {
if (strpos($item['target'], 'http') === 0) {
return true;
}
if ($item['target']) {
return allowed(privilege_url($item['target']));
}
foreach ($data as $i) {
if ($i['lft'] > $item['lft'] && $i['rgt'] < $item['rgt'] && $i['target'] && allowed(privilege_url($i['target']))) {
return true;
}
}
return false;
});
$count = count($data);
$level = 0;
$i = 0;
$html = '';
foreach ($data as $item) {
$attrs = [];
$class = '';
if ($item['target'] === request('path')) {
$attrs['class'] = 'active';
$class .= ' class="active"';
}
if ($item['level'] > $level) {
$html .= '<ul><li' . $class . '>';
} elseif ($item['level'] < $level) {
$html .= '</li>' . str_repeat('</ul></li>', $level - $item['level']) . '<li' . $class . '>';
} else {
$html .= '</li><li' . $class . '>';
}
if ($item['target']) {
$attrs['href'] = $item['target'];
$html .= html_tag('a', $attrs, $item['name']);
} else {
$html .= html_tag('span', [], $item['name']);
}
$html .= ++$i === $count ? str_repeat('</li></ul>', $item['level']) : '';
$level = $item['level'];
}
return $html;
}
示例2: printEdit
function printEdit()
{
global $prefs;
$admin = allowed($this->getDataInt('id_case'), 'a');
// FIXME
$edit = allowed($this->getDataInt('id_case'), 'e');
// FIXME
$write = allowed($this->getDataInt('id_case'), 'w');
// FIXME (put in constructor)
// FIXME: not sure whether this works as previously
$dis = isDisabled(!($admin || $edit));
echo '<table class="tbl_usr_dtl" width="99%">' . "\n";
echo '<tr><td>';
echo f_err_star('date_start') . _T('fu_input_date_start');
echo "</td>\n";
echo "<td>";
$name = $admin || $edit ? 'start' : '';
echo get_date_inputs($name, $this->data['date_start'], false);
echo ' ' . _T('time_input_time_at') . ' ';
echo get_time_inputs($name, $this->data['date_start']);
echo "</td>\n";
echo "</tr>\n";
echo "<tr><td>";
echo f_err_star('date_end') . ($prefs['time_intervals'] == 'absolute' ? _T('fu_input_date_end') : _T('fu_input_time_length'));
echo "</td>\n";
echo '<td>';
if ($prefs['time_intervals'] == 'absolute') {
// Buggy code, so isolated most important cases
if ($this->data['id_followup'] == 0) {
$name = 'end';
} elseif ($edit) {
$name = 'end';
} else {
// user can 'finish' entering data
$name = $admin || $edit && $this->data['date_end'] == '0000-00-00 00:00:00' ? 'end' : '';
}
echo get_date_inputs($name, $this->data['date_end']);
echo ' ';
echo _T('time_input_time_at') . ' ';
echo get_time_inputs($name, $this->data['date_end']);
} else {
$name = '';
// Buggy code, so isolated most important cases
if ($this->getDataInt('id_followup') == 0) {
$name = 'delta';
} elseif ($edit) {
$name = 'delta';
} else {
// user can 'finish' entering data
$name = $admin || $edit && $this->getDataString('date_end') == '0000-00-00 00:00:00' ? 'delta' : '';
}
if (empty($_SESSION['errors'])) {
$interval = $this->getDataString('date_end') != '0000-00-00 00:00:00' ? strtotime($this->getDataString('date_end')) - strtotime($this->getDataString('date_start')) : 0;
echo get_time_interval_inputs($name, $interval);
} else {
echo get_time_interval_inputs_from_array($name, $this->data);
}
}
echo "</td>\n";
echo "</tr>\n";
// Show 'conclusion' options
if ($this->show_conclusion) {
$kws_conclusion = get_keywords_in_group_name('conclusion');
$kws_result = get_keywords_in_group_name('_crimresults');
echo "<tr>\n";
echo "<td>" . _Ti('fu_input_conclusion') . "</td>\n";
echo '<td>';
// Result
if (read_meta('case_result') == 'yes') {
echo '<select ' . $dis . ' name="result" size="1" class="sel_frm">' . "\n";
$default = '';
if ($this->data['result']) {
$default = $this->data['result'];
}
foreach ($kws_result as $kw) {
$sel = isSelected($kw['name'] == $default);
echo '<option ' . $sel . ' value="' . $kw['name'] . '">' . _T(remove_number_prefix($kw['title'])) . "</option>\n";
}
echo "</select><br/>\n";
}
// Conclusion
echo '<select ' . $dis . ' name="conclusion" size="1" class="sel_frm">' . "\n";
$default = '';
if ($this->data['conclusion']) {
$default = $this->data['conclusion'];
}
foreach ($kws_conclusion as $kw) {
$sel = isSelected($kw['name'] == $default);
echo '<option ' . $sel . ' value="' . $kw['name'] . '">' . _T(remove_number_prefix($kw['title'])) . "</option>\n";
}
echo "</select>\n";
echo "</td>\n";
echo "</tr>\n";
// If guilty, what sentence?
$kws_sentence = get_keywords_in_group_name('sentence');
echo "<tr>\n";
echo "<td>" . _Ti('fu_input_sentence') . "</td>\n";
echo '<td>';
echo '<select ' . $dis . ' name="sentence" size="1" class="sel_frm">' . "\n";
$default = '';
//.........这里部分代码省略.........
示例3: action_view
/**
* View Action
*
* @param array $entity
*
* @return void
*/
function action_view(array $entity) : void
{
// Item does not exist or is inactive
if (!($item = one($entity['id'], ['id' => request('id')])) || !empty($entity['attr']['active']) && empty($item['active']) && !allowed('edit')) {
action_error();
return;
}
// Preview
if (!empty($entity['attr']['active']) && empty($item['active'])) {
message(_('Preview'));
}
layout_load();
vars('content', ['item' => $item]);
vars('head', ['title' => $item['name']]);
}
示例4: show_attachments_list
function show_attachments_list($type, $id_type, $id_author = 0)
{
if (!($type == 'case' || $type == 'client' || $type == 'org')) {
lcm_panic("unknown type -" . $type . "-");
}
$q = "SELECT * \n\t\t\tFROM lcm_" . $type . "_attachment \n\t\t\tWHERE content IS NOT NULL ";
if ($id_type) {
$q .= " AND id_" . $type . " = " . intval($id_type);
}
if ($id_author) {
$q .= " AND id_author = " . intval($id_author);
}
$result = lcm_query($q);
$i = lcm_num_rows($result);
if ($i > 0) {
echo '<table border="0" align="center" class="tbl_usr_dtl" width="99%">' . "\n";
echo "<tr>\n";
if ($id_author) {
echo '<th class="heading" width="1%">' . _Th($type . '_input_id') . "</th>\n";
}
echo '<th class="heading">' . _Th('file_input_type') . "</th>\n";
echo '<th class="heading">' . _Th('file_input_description') . "</th>\n";
echo '<th class="heading">' . _Th('file_input_size') . "</th>\n";
echo '<th class="heading">' . "</th>\n";
echo "</tr>\n";
for ($i = 0; $row = lcm_fetch_array($result); $i++) {
echo "<tr>\n";
if ($id_author) {
echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '" align="left">';
echo '<a href="' . $type . '_det.php?' . $type . '=' . $row['id_' . $type] . '" class="content_link">' . $row['id_' . $type] . '</a>';
echo "</td>\n";
}
// Mimetype
// [ML] We were using the mimetype sent by the browser, but it
// ends up being rather useless, since MSIE and Firefox don't agree on
// the mimetypes.. ex: .jpg = image/jpeg (FFx), but under MSIE is image/pjeg
// So may as well just use the extention of the file, even if not reliable.
echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '" align="left">';
echo '<a title="' . $row['type'] . '" ' . 'href="view_file.php?type=' . $type . '&file_id=' . $row['id_attachment'] . '">';
if (preg_match("/\\.([a-zA-Z0-9]+)\$/", $row['filename'], $regs) && is_file("images/mimetypes/" . strtolower($regs[1]) . ".png")) {
echo '<img src="images/mimetypes/' . $regs[1] . '.png" border="0" alt="' . $row['type'] . '" />';
} else {
echo '<img src="images/mimetypes/unknown.png" border="0" alt="' . $row['type'] . '" />';
}
echo '</a>';
echo '</td>';
// File name (or description, if any)
echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '">' . '<a title="' . $row['filename'] . '" ' . 'href="view_file.php?type=' . $type . '&file_id=' . $row['id_attachment'] . '" class="content_link">';
echo trim($row['description']) ? $row['description'] : $row['filename'];
echo '</a></td>';
// Size
echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '">' . size_in_bytes($row['size']) . '</td>';
// Delete icon
echo '<td class="tbl_cont_' . ($i % 2 ? "dark" : "light") . '">';
if ($GLOBALS['author_session']['status'] == 'admin' || $row['id_author'] == $GLOBALS['author_session']['id_author'] && ($type == 'case' ? allowed($id_type, 'e') : true)) {
echo '<label for="id_rem_file' . $row['id_attachment'] . '">';
echo '<img src="images/jimmac/stock_trash-16.png" width="16" height="16" ' . 'alt="' . _T('file_info_delete') . '" title="' . _T('file_info_delete') . '" />';
echo '</label> ';
echo '<input type="checkbox" onclick="lcm_show(\'btn_delete\')" ' . 'id="id_rem_file' . $row['id_attachment'] . '" name="rem_file[]" ' . 'value="' . $row['id_attachment'] . '" />';
}
echo '</td>';
echo "</tr>\n";
}
echo "</table>\n";
echo '<p align="right" style="visibility: hidden">';
echo '<input type="submit" name="submit" id="btn_delete" value="' . _T('button_validate') . '" class="search_form_btn" />';
echo "</p>\n";
} else {
echo '<p class="normal_text">' . _T('file_info_emptylist') . "</p>\n";
}
}
示例5: foreach
<div class="span12">
<div class="span3">
<label for="form-field-select-1">Station name</label>
<select class="span12" id="station" name="station">
<option value="" />
<option value="<?php
echo $this->session->userdata('stationname');
?>
" ><?php
echo $this->session->userdata('stationname');
?>
</option>
<?php
if (allowed($see, 'manage')) {
if (is_array($stations) && count($stations)) {
foreach ($stations as $loop) {
?>
<option value="<?php
echo $loop->name;
?>
" /><?php
echo $loop->name;
?>
示例6: include_all
//.........这里部分代码省略.........
$element_info['filter'] = $hp;
}
}
if (is_array($element_info)) {
$element_info = array_diff_key($element_info, array('account_pwd' => ''));
}
$user_id_who_asks = $user_id;
$uid = 'U' . $element_info['user_id'];
$shared_with = $user_id_who_asks;
$strictuid = 1;
$strictsharedwith = 1;
$onPermissions = compact('user_id', 'shared_with', 'db', 'uid', 'key', 'strictsharedwith', 'strictuid');
if ($element_info['acl'] == '') {
$element_info['acl'] = userAcl(compact('key', 'element_info', 'user_id_who_asks', 'db'));
}
}
if ($letter == 'P') {
$element_info['name'] = $element_info['project_name'];
$element_info['description'] = $element_info['project_description'];
$id = 'P' . $element_info['project_id'];
$uid = 'P' . $element_info['project_id'];
}
if ($letter == 'C') {
$element_info['class_id'] = $element_info['resource_id'];
$element_info['collection_id'] = $element_info['class_id'];
$element_info['name'] = $element_info['entity'];
$element_info['description'] = $element_info['notes'];
#project_id to search for rule_id will be the same from the class
$uid = 'C' . $element_info['resource_id'];
}
#if element is a rule, return the class_id of the subject. If the object is a class, return the object_id... to discuss with jonas
if ($letter == 'R') {
$uid = 'R' . $element_info['rule_id'];
}
#if this is an instance, return the class_id => ASSUMING THAT EVERY S3DB THAT HAS SHARED RULES HAS RESOURCECLASSID IN INSTANCE.
if ($letter == 'I') {
if ($element_info['resource_class_id'] != '') {
$element_info['class_id'] = $element_info['resource_class_id'];
}
$element_info['instance_id'] = $element_info['resource_id'];
$element_info['item_id'] = $element_info['instance_id'];
$element_info['collection_id'] = $element_info['class_id'];
$instance_id = $element_info['instance_id'];
$uid = 'I' . $element_info['instance_id'];
}
if ($letter == 'S') {
$uid = 'S' . $element_info['statement_id'];
$info[$id] = $element_info;
$statement_id = $element_info['statement_id'];
$element_info['instance_id'] = $element_info['resource_id'];
$element_info['item_id'] = $element_info['instance_id'];
$element_info['instance_notes'] = $info['I' . $element_info['instance_id']]['notes'];
if ($info['R' . $element_info['rule_id']] == '') {
$info['R' . $element_info['rule_id']] = s3info('rule', $element_info['rule_id'], $db);
}
$element_info['object_notes'] = notes($element_info['value'], $db);
$element_info['project_folder'] = $element_info['value'];
$element_info = include_fileLinks($element_info, $db);
$element_info['subject'] = $info['R' . $element_info['rule_id']]['subject'];
$element_info['verb'] = $info['R' . $element_info['rule_id']]['verb'];
$element_info['object'] = $info['R' . $element_info['rule_id']]['object'];
$element_info['subject_id'] = $info['R' . $element_info['rule_id']]['subject_id'];
$element_info['verb_id'] = $info['R' . $element_info['rule_id']]['verb_id'];
$element_info['object_id'] = $info['R' . $element_info['rule_id']]['object_id'];
}
$strictuid = 1;
$strictsharedwith = 1;
$shared_with = 'U' . $user_id;
$toFindInfo = $element_info;
$onPermissions = compact('user_id', 'shared_with', 'db', 'uid', 'key', 'strictsharedwith', 'strictuid', 'timer', 'toFindInfo');
if ($element_info['acl'] == '') {
$element_info['acl'] = permission4Resource($onPermissions);
}
$element_info['permission_level'] = $element_info['acl'];
if (!$element_info['effective_permission']) {
$element_info['effective_permission'] = $element_info['acl'];
}
if (!$element_info['assigned_permission']) {
$pp = array('uid' => $uid, 'shared_with' => $shared_with);
$tmp = has_permission($pp, $db);
if ($tmp) {
$element_info['assigned_permission'] = $tmp;
} else {
$element_info['assigned_permission'] = '---';
}
}
#Define if ser can view or not view data. View is the first number in the 3d code.
$permission2user = permissionModelComp($element_info['permission_level']);
##According to the model, change the values of assigned_permission from prevous versions
$element_info['assigned_permission'] = str_replace(array('0', '1', '2'), str_split($model), $element_info['assigned_permission']);
$isOwner = $element_info['created_by'] == $user_id;
$element_info['view'] = allowed($permission2user, 0, $isOwner, $state = 3, $model);
$element_info['change'] = allowed($permission2user, 1, $isOwner, $state = 3, $model);
$element_info['propagate'] = allowed($permission2user, 2, $isOwner, $state = 3, $model);
#create the element "delete", in case it is eventually created...For now it is the same as change
$element_info['delete'] = $element_info['change'];
$element_info['delete_data'] = $element_info['add_data'];
$element_info['add_data'] = $element_info['propagate'];
return $element_info;
}
示例7: session_start
<!DOCTYPE html>
<html>
<head lang="en">
<?php
include 'php/security.php';
session_start();
$allowed = allowed();
if ($allowed == true) {
} else {
header("Location: login.html");
}
?>
<script src="javascript/jquery.js"></script>
<script src="javascript/bootstrap/bootstrap.js"></script>
<script src="javascript/dashboard.js"></script>
<script src="javascript/sweetalert.min.js"></script>
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/sweetalert.css" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" href="css/bootstrap/bootstrap-theme.css" />
<meta charset="UTF-8">
<title>Dashboard</title>
<script>
$(document).ready(function() {
$("#editAgentDiv, #newPropertyDiv, #editPropertyDiv, #generateURLDiv").css("display", "none");
// Loads the options for the edit agent select
loadAgentList("#editAgentSelect");
loadAgentList("#propertyAgentSelect");
loadPropertyList();
示例8: allowed
<?php
/* Another admin page, so admin rights are checked right off the bat. If everything checks out, the manufacturers and cars are loaded from database and placed
in $carsarray and $manarray variables */
Atomik::needed('logincheck');
allowed();
$manufacturers = A("db: select manufacturerid as manid, name from manufacturer");
$cars = A("db: select carid, name from car");
$carsarray = $cars->fetchAll();
$manarray = $manufacturers->fetchAll();
示例9: lcm_query_subst_time
$q = "SELECT fu.*, a.name_first, a.name_middle, a.name_last, " . lcm_query_subst_time('fu.date_start', 'fu.date_end') . " as length\n\t\tFROM lcm_followup as fu, lcm_author as a\n\t\tWHERE id_followup = {$followup}\n\t\t\tAND fu.id_author = a.id_author";
$result = lcm_query($q);
if ($row = lcm_fetch_array($result)) {
foreach ($row as $key => $value) {
$fu_data[$key] = $value;
}
} else {
die("There's no such follow-up!");
}
} else {
die("Which follow-up?");
}
// For 'edit case' button + 'undelete' message
$case_allow_modif = read_meta('case_allow_modif');
$edit = allowed($fu_data['id_case'], 'e');
$admin = allowed($fu_data['id_case'], 'a');
lcm_page_start(_T('title_fu_view'), '', '', 'cases_followups');
echo '<fieldset class="info_box">';
// Show a bit of background on the case
$case = $fu_data['id_case'];
show_context_start();
show_context_case_title($fu_data['id_case']);
show_context_case_stage($fu_data['id_case'], $fu_data['id_followup']);
show_context_case_involving($fu_data['id_case']);
// Show parent appointment, if any
// [ML] todo put in inc_presentation
$q = "SELECT app.*\n\t\tFROM lcm_app_fu as af, lcm_app as app\n\t\tWHERE af.id_followup = {$followup} \n\t\t AND af.id_app = app.id_app \n\t\t AND af.relation = 'child'";
$res_app = lcm_query($q);
if ($app = lcm_fetch_array($res_app)) {
echo '<li style="list-style-type: none;">' . _T('fu_input_parent_appointment') . ' ';
echo '<a class="content_link" href="app_det.php?app=' . $app['id_app'] . '">' . _Tkw('appointments', $app['type']) . ' (' . $app['title'] . ') from ' . format_date($app['start_time']) . "</a></li>\n";
示例10:
<?php
echo "<div id=\"navi\">\n";
echo "<h2>Navigation</h2>\n";
echo "<ul>\n";
echo "<li id=\"tab_record\">";
echo "<a href=\"index.php?page=record1\">recording</a></li>\n";
echo "<li id=\"tab_postings\"><a href=\"index.php?page=postings\">";
echo "postings</a></li>\n";
if (allowed(3, "")) {
echo "<li id=\"tab_comments\"><a href=\"index.php?page=comments\">";
echo "comments</a></li>\n";
echo "<li id=\"tab_organisation\">";
echo "<a href=\"index.php?page=organisation\">organisation</a></li>\n";
echo "<li id=\"tab_settings\">";
echo "<a href=\"index.php?page=settings\">settings</a></li>\n";
}
echo "<li id=\"tab_logout\"><a href=\"index.php?do=logout\">logout</a></li>\n";
echo "</ul>\n";
echo "</div>\n";
?>
示例11: printEdit
function printEdit()
{
// Read site configuration preferences
$case_assignment_date = read_meta('case_assignment_date');
$case_alledged_crime = read_meta('case_alledged_crime');
$case_legal_reason = read_meta('case_legal_reason');
$case_allow_modif = read_meta('case_allow_modif');
echo '<table class="tbl_usr_dtl">' . "\n";
// Case ID (if editing existing case)
if ($this->getDataInt('id_case')) {
echo "<tr>" . "<td>" . _T('case_input_id') . "</td>" . "<td>" . $this->getDataInt('id_case') . '<input type="hidden" name="id_case" value="' . $this->getDataInt('id_case') . '" />' . "</td></tr>\n";
}
echo '<tr><td><label for="input_case_title">' . f_err_star('title') . _T('case_input_title') . "</label></td>\n";
echo '<td><input size="35" name="title" id="input_case_title" value="' . clean_output($this->getDataString('title')) . '" class="search_form_txt" />';
echo "</td></tr>\n";
// Date of earlier assignment
if ($case_assignment_date == 'yes') {
echo "<tr>\n";
echo "<td>" . f_err_star('date_assignment') . _Ti('case_input_date_assigned') . "</td>\n";
echo "<td>" . get_date_inputs('assignment', $this->getDataString('date_assignment'), false) . "</td>\n";
echo "</tr>\n";
}
// Legal reason
if (substr($case_legal_reason, 0, 3) == 'yes') {
echo '<tr><td><label for="input_legal_reason">' . f_err_star('legal_reason') . _T('case_input_legal_reason') . "</label>" . ($case_legal_reason == 'yes_mandatory' ? '<br/>(' . _T('keywords_input_policy_mandatory') . ')' : '') . "</td>\n";
echo '<td>';
echo '<textarea name="legal_reason" id="input_legal_reason" class="frm_tarea" rows="2" cols="60">';
echo clean_output($this->getDataString('legal_reason'));
echo "</textarea>";
echo "</td>\n";
echo "</tr>\n";
}
// Alledged crime
if (substr($case_alledged_crime, 0, 3) == 'yes') {
echo '<tr><td><label for="input_alledged_crime">' . f_err_star('alledged_crime') . _T('case_input_alledged_crime') . "</label>" . ($case_alledged_crime == 'yes_mandatory' ? '<br/>(' . _T('keywords_input_policy_mandatory') . ')' : '') . "</td>\n";
echo '<td>';
echo '<textarea name="alledged_crime" id="input_alledged_crime" class="frm_tarea" rows="2" cols="60">';
echo clean_output($this->getDataString('alledged_crime'));
echo '</textarea>';
echo "</td>\n";
echo "</tr>\n";
}
// Keywords (if any)
show_edit_keywords_form('case', $this->getDataInt('id_case'));
$id_stage = 0;
// new case, stage not yet known
if ($this->getDataString('stage')) {
$stage = get_kw_from_name('stage', $this->getDataString('stage', '__ASSERT__'));
$id_stage = $stage['id_keyword'];
}
show_edit_keywords_form('stage', $this->getDataInt('id_case'), $id_stage);
// Notes
echo "<tr>\n";
echo "<td><label for='input_case_notes'>" . f_err_star('case_notes') . _Ti('case_input_notes') . "</label></td>\n";
echo '<td><textarea name="case_notes" id="input_case_notes" class="frm_tarea" rows="3" cols="60">' . clean_output($this->getDataString('notes')) . "</textarea>\n" . "</td>\n";
echo "</tr>\n";
// Case status
echo '<tr><td><label for="input_status">' . f_err_star('status') . _Ti('case_input_status') . "</label></td>\n";
echo '<td>';
echo '<select name="status" id="input_status" class="sel_frm">' . "\n";
$statuses = $this->getDataInt('id_case') ? array('draft', 'open', 'suspended', 'closed', 'merged') : array('draft', 'open');
foreach ($statuses as $s) {
$sel = $s == $this->getDataString('status') ? ' selected="selected"' : '';
echo '<option value="' . $s . '"' . $sel . ">" . _T('case_status_option_' . $s) . "</option>\n";
}
echo "</select></td>\n";
echo "</tr>\n";
// Case stage
if (!$this->getDataString('stage')) {
$this->data['stage'] = get_suggest_in_group_name('stage');
}
$kws = get_keywords_in_group_name('stage');
echo '<tr><td><label for="input_stage">' . f_err_star('stage') . _T('case_input_stage') . "</label></td>\n";
echo '<td><select name="stage" id="input_stage" class="sel_frm">' . "\n";
foreach ($kws as $kw) {
$sel = $kw['name'] == $this->data['stage'] ? ' selected="selected"' : '';
echo "\t\t\t\t<option value='" . $kw['name'] . "'" . "{$sel}>" . _T(remove_number_prefix($kw['title'])) . "</option>\n";
}
echo "</select></td>\n";
echo "</tr>\n";
// Public access rights
// FIXME FIXME FIXME
if ($this->data['admin'] || read_meta('case_read_always') != 'yes' || read_meta('case_write_always') != 'yes') {
$dis = isDisabled(!allowed($this->getDataInt('id_case'), 'a'));
echo '<tr><td colspan="2">' . _T('case_input_collaboration') . ' <br /><ul>';
if (read_meta('case_read_always') != 'yes' || $GLOBALS['author_session']['status'] == 'admin') {
echo '<li style="list-style-type: none;">';
echo '<input type="checkbox" name="public" id="case_public_read" value="yes"';
if ($_SESSION['form_data']['public']) {
echo ' checked="checked"';
}
echo "{$dis} />";
echo '<label for="case_public_read">' . _T('case_input_collaboration_read') . "</label></li>\n";
}
if (read_meta('case_write_always') != 'yes' || _session('admin')) {
echo '<li style="list-style-type: none;">';
echo '<input type="checkbox" name="pub_write" id="case_public_write" value="yes"';
if (_session('pub_write')) {
echo ' checked="checked"';
}
//.........这里部分代码省略.........
示例12: include_lcm
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
$Id: add_client.php,v 1.9 2007/11/16 16:29:08 mlutfy Exp $
*/
include 'inc/inc.php';
include_lcm('inc_acc');
$case = intval(_request('case'));
$_SESSION['errors'] = array();
$destination = "case_det.php?case={$case}";
// Test access rights (unlikely to happen, unless hack attempt)
if (!($case && allowed($case, 'a'))) {
$_SESSION['errors']['generic'] = "Access denied";
// TRAD
header("Location: " . $destination);
exit;
}
// Add client to case
if (isset($_REQUEST['clients'])) {
foreach ($_REQUEST['clients'] as $key => $value) {
$clients[$key] = intval($value);
}
if ($clients) {
foreach ($clients as $client) {
$q = "INSERT INTO lcm_case_client_org\n\t\t\t\tSET id_case={$case},id_client={$client}";
$result = lcm_query($q);
}
示例13: include_lcm
include_lcm('inc_acc');
// Get request parameters
$file_id = intval($_REQUEST['file_id']);
$type = clean_input($_REQUEST['type']);
switch ($type) {
//
// View case attachment
//
case 'case':
$q = "SELECT ca.*, c.public\n\t\t\tFROM lcm_case_attachment as ca, lcm_case as c\n\t\t\tWHERE ca.id_case = c.id_case\n\t\t\t\tAND id_attachment = {$file_id}";
$result = lcm_query($q);
if (lcm_num_rows($result) == 0) {
die("There is no such file");
}
$row = lcm_fetch_array($result);
if (!($GLOBALS['author_session']['status'] == 'admin' || $row['public'] || allowed($row['id_case'], 'r'))) {
die(_T('error_no_read_permission'));
}
break;
//
// View client attachment
//
//
// View client attachment
//
case 'client':
$q = "SELECT *\n\t\t\tFROM lcm_client_attachment\n\t\t\tWHERE id_attachment={$file_id}";
$result = lcm_query($q);
if (lcm_num_rows($result) == 0) {
die("There is no such file!");
}
示例14: include_lcm
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
$Id: edit_auth.php,v 1.18 2006/07/27 15:31:22 mlutfy Exp $
*/
include 'inc/inc.php';
include_lcm('inc_acc');
include_lcm('inc_filters');
// Initialise variables
$case = intval($_GET['case']);
if (!($case > 0)) {
lcm_page_start(_T('title_error'));
echo "<p>" . _T('error_no_case_specified') . "</p>\n";
lcm_page_end();
exit;
}
if (!allowed($case, 'a')) {
die("You don't have permission to edit this case's access rights.");
}
$q = "SELECT *\n\tFROM lcm_case_author,lcm_author\n\tWHERE (id_case={$case}\n\t AND lcm_case_author.id_author=lcm_author.id_author";
if ($author > 0) {
$q .= " AND lcm_author.id_author={$author}";
}
$q .= ')';
$result = lcm_query($q);
lcm_page_start(_T('title_case_edit_ac'));
lcm_bubble('case_ac');
show_context_start();
show_context_case_title($case);
show_context_case_involving($case);
show_context_end();
?>
示例15: includeAllData
function includeAllData($pack)
{
extract($pack);
$element2query = $element2query == '' ? $s3ql['from'] : $element2query;
#echo '<pre>';print_r($data);exit;
$letter = letter($element2query);
$element = $GLOBALS['s3codes'][$letter];
if ($user_id != '1') {
if (count($data) >= 4) {
if (!ereg('^U|^G', $letter)) {
$Z = compact('user_id', 'db', 'uidQuery', 'timer', 'WhereInfo', 'shared_with_query');
$Z['toFind'] = $letter;
$Z['shared_with_user'] = 'U' . $user_id;
$ids = permissionPropagation($Z);
}
}
}
if (ereg('^U|^G', $letter) && $WhereInfo) {
$whereId = array_keys($WhereInfo);
if (count($whereId) > 1) {
$array = array();
return $array;
} else {
$whereId = $whereId[0];
#Tlist provides the list of resources that are shared with the uid of interest, including users & groups
$Hlist = bottom_up_propagation_list($whereId, $db);
$Tlist = user_included_bottom_up_propagation_list('U', $whereId, $user_id, $db);
$resourceUsers = s3dbPercolate($Hlist, $Tlist, $letter);
if ($_REQUEST['su3d']) {
}
}
}
##Remove from data the uids that do not exist in ids
$str = $GLOBALS['s3ids'][$GLOBALS['s3codes'][$letter]];
$re_issued = array();
if (is_array($data)) {
foreach ($data as $ind => $array) {
$uid = $letter . $array[$str];
if ($uid != '') {
if ($user_id != '1') {
if (is_array($ids)) {
if (!ereg('^U|^G', $letter)) {
if ($ids[$uid] != '') {
$array['acl'] = $ids[$uid];
} else {
$array = array();
}
} else {
if ($resourceUsers) {
if (in_array($uid, array_keys($resourceUsers))) {
$array['permissionOnResource'] = $resourceUsers[$uid];
} else {
$array = array();
}
}
#else {
# $array=array();
#}
}
} else {
$strictuid = 1;
$strictsharedwith = 1;
$shared_with = 'U' . $user_id;
$P = compact('uid', 'shared_with', 'user_id', 'db', 'strictuid', 'strictsharedwith', 'stream', 'timer');
if (!ereg('^U|^G', $letter)) {
$array['acl'] = permission4Resource($P);
$array['permission_level'] = $array['acl'];
$permission2user = permissionModelComp($array['permission_level']);
$isOwner = $array['created_by'] == $user_id;
$array['view'] = allowed($permission2user, 0, $isOwner);
$array['change'] = allowed($permission2user, 1, $isOwner);
$array['propagate'] = allowed($permission2user, 2, $isOwner);
#create the element "delete", in case it is eventually created...For now it is the same as change
$array['delete'] = $array['change'];
$array['add_data'] = $array['propagate'];
$array['delete_data'] = $array['add_data'];
} else {
if ($resourceUsers) {
if (in_array($uid, array_keys($resourceUsers))) {
$array['permissionOnResource'] = $resourceUsers[$uid];
} else {
$array = array();
}
}
#else {
# $array=array();
#}
}
}
} else {
$array['acl'] = 'yyy';
if (ereg('^U|^G', $letter) && $resourceUsers) {
if ($resourceUsers) {
if (in_array($uid, array_keys($resourceUsers))) {
$array['permissionOnResource'] = $resourceUsers[$uid];
} else {
$array = array();
}
}
#else {
//.........这里部分代码省略.........