本文整理汇总了PHP中safe_output函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_output函数的具体用法?PHP safe_output怎么用?PHP safe_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_download_type_icon
function get_download_type_icon($id_type)
{
$type = get_db_row("tdownload_type", "id", $id_type);
if ($type) {
$image = print_image("images/download_type/" . $type["icon"], true, array('title' => safe_output($type["name"]), 'alt' => ''));
} else {
$image = print_image("images/download_type/default.png", true, array('title' => __('Without type'), 'alt' => ''));
}
return $image;
}
示例2: create
function create($array)
{
switch ($array['type']) {
case 'file_not_found':
break;
case 'sql_type_unsupported':
break;
case 'sql_connect_error':
break;
case 'sql_prepare_error':
break;
case 'sql_execute_error':
break;
case 'security_error':
break;
}
echo '<p><strong>Support Ticket Error</strong><br />Type: ' . safe_output($array['type']) . '<br />Message: ' . safe_output($array['message']) . '</p>';
exit(1);
}
示例3: print_select
/**
* OLD VERSION.
* Prints an array of fields in a popup menu of a form.
*
* Based on choose_from_menu() from Moodle
*
* $fields Array with dropdown values. Example: $fields["value"] = "label"
* $name Select form name
* $selected Current selected value.
* $script Javascript onChange code.
* $nothing Label when nothing is selected.
* $nothing_value Value when nothing is selected
*/
function print_select($fields, $name, $selected = '', $script = '', $nothing = 'select', $nothing_value = '0', $return = false, $multiple = 0, $sort = true, $label = false, $disabled = false, $style = '')
{
$output = "\n";
if ($label) {
$output .= print_label($label, $name, 'select', true);
}
$attributes = $script ? 'onchange="' . $script . '"' : '';
if ($multiple) {
$attributes .= ' multiple="yes" size="' . $multiple . '" ';
}
if ($disabled) {
$disabledText = 'disabled';
} else {
$disabledText = '';
}
if ($style == "") {
$output .= '<select style="width: 170px" ' . $disabledText . ' id="' . $name . '" name="' . $name . '" ' . $attributes . ">\n";
} else {
$output .= '<select style="' . $style . '" ' . $disabledText . ' id="' . $name . '" name="' . $name . '" ' . $attributes . ">\n";
}
if ($nothing != '') {
$output .= ' <option value="' . $nothing_value . '"';
if ($nothing_value == $selected) {
$output .= " selected";
}
$output .= '>' . $nothing . "</option>\n";
}
if (!empty($fields)) {
if ($sort) {
asort($fields);
}
foreach ($fields as $value => $label) {
$optlabel = $label;
if (is_array($label)) {
if (!isset($lastopttype) || $label['optgroup'] != $lastopttype) {
if (isset($lastopttype) && $lastopttype != '') {
$output .= '</optgroup>';
}
$output .= '<optgroup label="' . $label['optgroup'] . '">';
$lastopttype = $label['optgroup'];
}
$optlabel = $label['name'];
}
$output .= ' <option value="' . $value . '"';
if (safe_output($value) == safe_output($selected)) {
$output .= ' selected';
}
if ($optlabel === '') {
$output .= '>' . $value . "</option>\n";
} else {
$output .= '>' . $optlabel . "</option>\n";
}
}
}
$output .= "</select>\n";
if ($return) {
return $output;
}
echo $output;
}
示例4: check_email
for ($i = 0; $i < sizeof($send); $i++) {
$ch = check_email($send[$i]);
if ($ch == "") {
$error[] = format_lang('error', 'incorrect_format_email') . " - " . $send[$i];
}
}
}
/**subject */
$_SESSION['share']['subject'] = $subject = safe_output($_POST['txt_subject']);
if ($subject == "") {
$subject = "Re: " . $job->job_title;
}
/** comments */
$_SESSION['share']['notes'] = $notes .= safe_output($_POST['txt_comments']);
/**from email address*/
$_SESSION['share']['from_send'] = $from_send = safe_output($_POST['txt_email1']);
if ($from_send == "") {
$error[] = format_lang("error", 'email');
}
if ($from_send != "") {
$from_send = check_email($from_send);
if ($from_send == "") {
$error[] = format_lang('errormsg', 39);
}
}
if (ENABLE_SPAM_SHARE && ENABLE_SPAM_SHARE == 'Y' && !$session->get_job_seeker()) {
if (strtolower($_POST['spam_code']) != strtolower($_SESSION['spam_code']) || (!isset($_SESSION['spam_code']) || $_SESSION['spam_code'] == NULL)) {
$error[] = format_lang('error', 'spam_wrong_word');
}
}
/**if no errors found then do this*/
示例5: substr
header ('Content-Type: text/csv; charset=UTF-8');
header ('Content-Disposition: attachment; filename="'.$filename.'.csv"');
$os_csv = substr(PHP_OS, 0 , 1);
echo "\xEF\xBB\xBF";
$rows = get_db_all_rows_sql (clean_output ($report['sql']));
if ($rows === false)
return;
// Header
echo safe_output (implode (';', array_keys (str_replace($search, " ", $rows[0]))))."\n";
$standard_encoding = (bool) $config['csv_standard_encoding'];
// Item / data
foreach ($rows as $row) {
$line = safe_output(implode(';', $row));
if (!$standard_encoding){
if($os_csv != "W"){
echo mb_convert_encoding($line, 'UTF-16LE', 'UTF-8'). "\n";
} else {
echo $line . "\n";
}
}else{
echo $line . "\n";
}
}
exit;
}
示例6: graph_workunit_project
function graph_workunit_project($width, $height, $id_project, $ttl = 1)
{
global $config;
$data = array();
$res = mysql_query("SELECT SUM(duration), ttask.name\n\t\tFROM tworkunit, tworkunit_task, ttask, tproject \n\t\tWHERE tproject.id = '{$id_project}' AND \n\t\t\ttworkunit.id = tworkunit_task.id_workunit AND \n\t\t\ttworkunit_task.id_task = ttask.id AND\n\t\t\ttproject.id = ttask.id_project \n\t\tGROUP BY ttask.name\n\t\tORDER BY SUM(duration) DESC\n\t\tLIMIT 7");
$data = NULL;
while ($row = mysql_fetch_array($res)) {
$row[1] = substr(safe_output($row[1]), 0, 22);
$data[$row[1]] = $row[0];
}
if ($data == NULL) {
return __("There is no data to show");
} else {
return pie3d_graph($config['flash_charts'], $data, $width, $height, __('others'), $config["base_url"], "", $config['font'], $config['fontsize'], $ttl);
}
}
示例7: json_encode
if ($project_name != $old_project_name) {
// Exists. Validation error
echo json_encode(false);
return;
}
}
// Does not exist
echo json_encode(true);
return;
} elseif ($search_existing_task) {
require_once 'include/functions_db.php';
$project_id = (int) get_parameter('project_id');
$operation_type = (string) get_parameter('type');
if ($operation_type == "create") {
$tasks_names = get_parameter('task_name');
$tasks_names = safe_output($tasks_names);
$tasks_names = preg_split("/\n/", $tasks_names);
foreach ($tasks_names as $task_name) {
$task_name = safe_input($task_name);
$query_result = get_db_value_filter("name", "ttask", array('name' => $task_name, 'id_project' => $project_id));
if ($query_result) {
// Exists. Validation error
echo json_encode(false);
return;
}
}
} elseif ($operation_type == "view") {
$task_name = get_parameter('task_name');
$old_task_id = get_parameter('task_id');
if (!$project_id) {
$project_id = get_db_value("id_project", "ttask", "id", $old_task_id);
示例8: check_login
check_login ();
include_once('include/functions_crm.php');
include_once('include/functions_incidents.php');
$id = (int) get_parameter ('id');
$contact = get_db_row ('tcompany_contact', 'id', $id);
$read = check_crm_acl ('other', 'cr', $config['id_user'], $contact['id_company']);
if (!$read) {
audit_db($config["id_user"], $config["REMOTE_ADDR"], "ACL Violation","Trying to access to contact tickets without permission");
include ("general/noaccess.php");
exit;
}
$email = safe_output($contact["email"]);
$email = trim($email);
$email = safe_input($email);
$incidents = incidents_get_by_notified_email ($email);
if (!$incidents) {
echo ui_print_error_message (__("This contact doesn't have any ticket associated"), '', true, 'h3', true);
} else {
$table->class = "listing";
$table->width = "99%";
$table->head[0] = __("ID");
$table->head[1] = __("Ticket");
$table->head[2] = __("Status");
$table->head[3] = __("Priority");
示例9: while
while ($row1 = mysql_fetch_array($result1)) {
echo dame_perfil($row1["id_perfil"]) . "/ ";
echo dame_grupo($row1["id_grupo"]) . "<br>";
}
} else {
echo __('This user doesn\'t have any assigned profile/group');
}
}
echo "</font></span></a>";
echo "</td>";
echo "<td>";
if (give_acl($config["id_user"], 0, "UM")) {
echo "<a href='index.php?sec=users&sec2=godmode/usuarios/configurar_usuarios&update_user={$nombre}'>";
}
if (strlen(safe_output($nombre)) > 21) {
echo "" . ucfirst(substr(safe_output($nombre), 0, 21)) . "..</b>";
} else {
echo ucfirst($nombre) . "</b>";
}
if (give_acl($config["id_user"], 0, "IM")) {
echo "</a>";
}
echo "<td style='font-size:9px'>" . $usuario["nombre_real"] . "</td>";
$company_name = (string) get_db_value('name', 'tcompany', 'id', $usuario['id_company']);
echo "<td style='font-size:9px'>" . $company_name . "</td>";
echo "<td>";
// Full report
echo "<a href='index.php?sec=users&sec2=operation/user_report/report_full&only_projects=1&wu_reporter={$nombre}'>";
echo "<img title='" . __("Full report") . "' src='images/page_white_stack.png'>";
echo "</a>";
// Workunit report (detailed)
示例10: give_acl
exit;
}
$manager = give_acl($config["id_user"], 0, "CN");
$id = (int) get_parameter('id');
$create = (bool) get_parameter('create');
$disable = (bool) get_parameter('disable');
$delete = (bool) get_parameter('delete');
$multiple_delete = (bool) get_parameter('multiple_delete');
// CREATE
if ($create) {
$data = get_parameter("data");
$id_newsletter = get_parameter("id_newsletter");
$datetime = date("Y-m-d H:i:s");
$id_group = get_db_sql("SELECT id_group FROM tnewsletter WHERE id = {$id_newsletter}");
// Parse chunk data from the textarea
$data = safe_output($data);
$data_array = preg_split("/\n/", $data);
$total = 0;
$invalid = 0;
foreach ($data_array as $data_item) {
$data2 = preg_split("/,/", $data_item);
$data2[0] = trim($data2[0]);
// We have parsed data, ok, lets go
if (check_email_address($data2[0])) {
// It's duped ?
$duped = get_db_sql("SELECT COUNT(id) FROM tnewsletter_address WHERE id_newsletter = {$id_newsletter} AND email = '" . $data2[0] . "'");
// OK, good data !
if ($duped == 0) {
$total++;
$sql = sprintf('INSERT INTO tnewsletter_address (id_newsletter, email, status, name, datetime) VALUES (%d, "%s", "%s", "%s", "%s")', $id_newsletter, $data2[0], 0, $data2[1], $datetime);
$id = process_sql($sql, 'insert_id');
示例11: get_db_row
$email_info = get_db_row ("tusuario", "direccion", $email);
if ($email_info) {
$contact_info = array("id" => $email_info["id_usuario"],
"type" => "user",
"id_company" => $email_info["id_company"],
"company" => get_db_value("name", "tcompany", "id", $email_info["id_company"]),
"inventory" => __("N/A"),
"fullname" => $email_info["nombre_real"],
"email" => $email_info["direccion"],
"phone" => $email_info["telefono"],
"mobile" => __("N/A"),
"position" => __("N/A"));
} else {
//Search for contact
$email_aux = safe_output($email);
$email_aux = trim($email_aux);
$email_info = get_db_row("tcompany_contact", "email", $email_aux);
if ($email_info) {
$contact_info= $email_info;
$contact_info["type"] = "contact";
$contact_info["inventory"] = __("N/A");
$contact_info["company"] = get_db_value("name", "tcompany", "id", $contact_info["id_company"]);
} else {
//We only have email address
$contact_info = array("id" => $email,
"fullname" => $email,
"type" => "email",
"company" => __("N/A"),
示例12: foreach
if ($diff) {
foreach ($diff as $key => $values) {
$max_rows[$key] = " ";
}
}
}
$max_rows_prepare = $max_rows;
foreach ($rows as $row) {
//head
$csv_head = implode(';', array_keys($max_rows_prepare));
//inicialice $line
$line = array();
//loop that compares whether a field
foreach ($max_rows_prepare as $k => $v) {
if (array_key_exists($k, $row)) {
$cell = str_replace($search, " ", safe_output($row[$k]));
} else {
$cell = " ";
}
// Change ; !!
$cell = str_replace(";", ",", $cell);
$line[] = $cell;
}
$line = implode(';', $line);
$csv_lines[] = $line;
}
ob_end_clean();
// CSV Output
header('Content-Type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
// Header
示例13: get_project_access
// -----------
// Upload file
// -----------
if ($operation == "attachfile") {
// ACL
$task_access = get_project_access ($config["id_user"], $id_project, $id_task, false, true);
if (!$task_access["write"]) {
// Doesn't have access to this page
audit_db($id_user, $config["REMOTE_ADDR"], "ACL Violation", "Trying to attach a file to a task without permission");
no_permission();
}
$filename = $_FILES['userfile'];
$filename_real = safe_output($filename['name']);
$filename_safe = str_replace (" ", "_", $filename_real);
if ($filename['error'] === 0){ //if file
if (isset($_POST["file_description"]))
$description = $_POST["file_description"];
else
$description = "No description available";
// Insert into database
$file_temp = $filename['tmp_name'];
$filesize = $filename['size'];
$sql = " INSERT INTO tattachment (id_task, id_usuario, filename, description, size ) VALUES (".$id_task.", '".$id_user." ','".$filename_safe."','".$description."',".$filesize.") ";
$id_attachment = process_sql ($sql, 'insert_id');
//project_tracking ( $id_inc, $id_usuario, 3);
示例14: users_get_groups_for_select
function users_get_groups_for_select($id_user, $privilege = "IR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null, $keys_field = 'id_grupo')
{
if ($id_groups === false) {
$id_groups = null;
}
$user_groups = get_user_groups($id_user, $privilege, $returnAllGroup, $returnAllColumns);
/*
$user_groups_flag_si = get_user_groups ($id_user, "SI", $returnAllGroup, $returnAllColumns);
if (!empty($user_groups_flag_si)) {
foreach ($user_groups_flag_si as $group_flag) {
array_push ($user_groups, $group_flag);
}
}
*/
if ($id_groups !== null) {
$childrens = groups_get_childrens($id_groups);
foreach ($childrens as $child) {
unset($user_groups[$child['id_grupo']]);
}
unset($user_groups[$id_groups]);
}
if (empty($user_groups)) {
$user_groups_tree = array();
} else {
// First group it's needed to retrieve its parent group
$repair = array_slice($user_groups, 0, 1);
$first_group = reset($repair);
$parent_group = $first_group['parent'];
$user_groups_tree = groups_get_groups_tree_recursive($user_groups, $parent_group);
}
$fields = array();
foreach ($user_groups_tree as $group) {
//$groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false);
$groupName = safe_output($group['nombre']);
$fields[$group[$keys_field]] = str_repeat(" ", $group['deep']) . $groupName;
}
return $fields;
}
示例15: redirect_to
<?php
/** if user already logged in take them to index page */
if ($session->get_job_seeker()) {
redirect_to(BASE_URL . "account/");
die;
}
if (isset($_POST['bt_resend'])) {
$email = safe_output($_POST['txtresend']);
if (empty($email) || !check_email($email)) {
$message = "<div class='error'>" . format_lang("error", 'email') . "</div>";
} elseif (ENABLE_SPAM_RSC && ENABLE_SPAM_RSC == 'Y') {
if (strtolower($_POST['spam_code']) != strtolower($_SESSION['spam_code']) || (!isset($_SESSION['spam_code']) || $_SESSION['spam_code'] == NULL)) {
$message = "<div class='error'>" . format_lang('error', 'spam_wrong_word') . "</div>";
}
} else {
$employee = Employee::find_by_email($email);
//print_r( $employee );
//die;
if ($employee->is_active == "Y") {
$session->message("<div class='error'>" . format_lang('errormsg', 60) . "</div>");
redirect_to(BASE_URL . "login/");
exit;
} else {
// if found
//echo sizeof($employee);
//die;
if ($employee) {
$reg_email = $employee->email_address;
$reg_key = $employee->actkey;
$username = $employee->username;