本文整理汇总了PHP中F_print_error函数的典型用法代码示例。如果您正苦于以下问题:PHP F_print_error函数的具体用法?PHP F_print_error怎么用?PHP F_print_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了F_print_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetError
/**
* Replace the default SetError
* @param $msg (string) error message
* @public
* @return void
*/
public function SetError($msg)
{
$this->error_count++;
$this->ErrorInfo = $msg;
F_print_error('ERROR', $msg);
exit;
}
示例2: F_check_form_fields
/**
* Check Form Fields.
* see: F_check_required_fields, F_check_fields_format
* @return false in case of error, true otherwise
*/
function F_check_form_fields()
{
require_once '../config/tce_config.php';
global $l;
$formfields = F_decode_form_fields();
//decode form fields
//check missing fields
if ($missing_fields = F_check_required_fields($formfields)) {
F_print_error('WARNING', $l['m_form_missing_fields'] . ': ' . $missing_fields);
F_stripslashes_formfields();
return FALSE;
}
//check fields format
if ($wrong_fields = F_check_fields_format($formfields)) {
F_print_error('WARNING', $l['m_form_wrong_fields'] . ': ' . $wrong_fields);
F_stripslashes_formfields();
return FALSE;
}
return TRUE;
}
示例3: addQuestion
/**
* Add a new question if not exist.
* @private
*/
private function addQuestion()
{
global $l, $db;
require_once '../config/tce_config.php';
if ($this->level_data['module']['module_id'] === false) {
return;
}
if ($this->level_data['subject']['subject_id'] === false) {
return;
}
if (isset($this->level_data['question']['question_id']) and $this->level_data['question']['question_id'] > 0) {
return;
}
// check if this question already exist
$sql = 'SELECT question_id
FROM ' . K_TABLE_QUESTIONS . '
WHERE ';
if (K_DATABASE_TYPE == 'ORACLE') {
$sql .= 'dbms_lob.instr(question_description,\'' . $this->level_data['question']['question_description'] . '\',1,1)>0';
} else {
$sql .= 'question_description=\'' . $this->level_data['question']['question_description'] . '\'';
}
$sql .= ' AND question_subject_id=' . $this->level_data['subject']['subject_id'] . ' LIMIT 1';
if ($r = F_db_query($sql, $db)) {
if ($m = F_db_fetch_array($r)) {
// get existing question ID
$this->level_data['question']['question_id'] = $m['question_id'];
return;
}
} else {
F_display_db_error();
}
if (K_DATABASE_TYPE == 'MYSQL') {
// this section is to avoid the problems on MySQL string comparison
$maxkey = 240;
$strkeylimit = min($maxkey, strlen($this->level_data['question']['question_description']));
$stop = $maxkey / 3;
while (in_array(md5(strtolower(substr($this->level_data['subject']['subject_id'] . $this->level_data['question']['question_description'], 0, $strkeylimit))), $this->questionhash) and $stop > 0) {
// a similar question was already imported from this XML, so we change it a little bit to avoid duplicate keys
$this->level_data['question']['question_description'] = '_' . $this->level_data['question']['question_description'];
$strkeylimit = min($maxkey, $strkeylimit + 1);
$stop--;
// variable used to avoid infinite loop
}
if ($stop == 0) {
F_print_error('ERROR', 'Unable to get unique question ID');
return;
}
}
$sql = 'START TRANSACTION';
if (!($r = F_db_query($sql, $db))) {
F_display_db_error();
}
// insert question
$sql = 'INSERT INTO ' . K_TABLE_QUESTIONS . ' (
question_subject_id,
question_description,
question_explanation,
question_type,
question_difficulty,
question_enabled,
question_position,
question_timer,
question_fullscreen,
question_inline_answers,
question_auto_next
) VALUES (
' . $this->level_data['subject']['subject_id'] . ',
\'' . $this->level_data['question']['question_description'] . '\',
' . F_empty_to_null($this->level_data['question']['question_explanation']) . ',
\'' . $this->qtype[$this->level_data['question']['question_type']] . '\',
\'' . $this->level_data['question']['question_difficulty'] . '\',
\'' . $this->boolval[$this->level_data['question']['question_enabled']] . '\',
' . F_zero_to_null($this->level_data['question']['question_position']) . ',
\'' . $this->level_data['question']['question_timer'] . '\',
\'' . $this->boolval[$this->level_data['question']['question_fullscreen']] . '\',
\'' . $this->boolval[$this->level_data['question']['question_inline_answers']] . '\',
\'' . $this->boolval[$this->level_data['question']['question_auto_next']] . '\'
)';
if (!($r = F_db_query($sql, $db))) {
F_display_db_error(false);
} else {
// get new question ID
$this->level_data['question']['question_id'] = F_db_insert_id($db, K_TABLE_QUESTIONS, 'question_id');
if (K_DATABASE_TYPE == 'MYSQL') {
$this->questionhash[] = md5(strtolower(substr($this->level_data['subject']['subject_id'] . $this->level_data['question']['question_description'], 0, $strkeylimit)));
}
}
$sql = 'COMMIT';
if (!($r = F_db_query($sql, $db))) {
F_display_db_error();
}
}
示例4: F_print_error
}
break;
case 'add':
// Add
if ($formstatus = F_check_form_fields()) {
// check submitted form fields
// check for loop connection
if ($cab_a_obj_id == $cab_b_obj_id) {
F_print_error('WARNING', $l['m_connection_loop']);
$formstatus = false;
F_stripslashes_formfields();
break;
}
// check if the connection is unique
if (!F_check_unique(K_TABLE_CABLES, 'cab_a_obj_id=' . $cab_a_obj_id . ' AND cab_b_obj_id=' . $cab_b_obj_id . ' AND cab_cbt_id=' . $cab_cbt_id)) {
F_print_error('WARNING', $l['m_duplicate_connection']);
$formstatus = false;
F_stripslashes_formfields();
break;
}
$sql = 'INSERT INTO ' . K_TABLE_CABLES . ' (
cab_a_obj_id,
cab_b_obj_id,
cab_cbt_id,
cab_color
) VALUES (
' . $cab_a_obj_id . ',
' . $cab_b_obj_id . ',
' . $cab_cbt_id . ',
\'' . F_escape_sql($cab_color) . '\'
)';
示例5: F_login_form
/**
* Display login page.
* NOTE: This function calls exit() after execution.
*/
function F_login_form()
{
global $l, $thispage_title;
global $xuser_name, $xuser_password;
require_once '../config/tce_config.php';
require_once '../../shared/config/tce_httpbasic.php';
if (K_HTTPBASIC_ENABLED and (!isset($_SESSION['logout']) or !$_SESSION['logout'])) {
// force HTTP Basic Authentication
header('WWW-Authenticate: Basic realm="TCExam"');
header('HTTP/1.0 401 Unauthorized');
require_once '../code/tce_page_header.php';
F_print_error('WARNING', $l['m_authorization_denied']);
require_once '../code/tce_page_footer.php';
exit;
//break page here
}
require_once '../../shared/code/tce_functions_form.php';
$thispage_title = $l['t_login_form'];
//set page title
require_once '../code/tce_page_header.php';
echo F_loginForm($_SERVER['SCRIPT_NAME'], 'form_login', 'post', 'multipart/form-data', $xuser_name, $xuser_password, 20);
require_once '../code/tce_page_footer.php';
exit;
//break page here
}
示例6: VALUES
usrgrp_group_id
) VALUES (
\'' . $user_id . '\',
\'' . $group_id . '\'
)';
if (!($r = F_db_query($sql, $db))) {
F_display_db_error(false);
}
}
if (K_USRREG_EMAIL_CONFIRM) {
// require email confirmation
require_once '../../shared/code/tce_functions_user_registration.php';
F_send_user_reg_email($user_id, $user_email, $user_verifycode);
F_print_error('MESSAGE', $user_email . ': ' . $l['m_user_verification_sent']);
} else {
F_print_error('MESSAGE', $l['m_user_registration_ok']);
echo K_NEWLINE;
}
echo '<div class="container">' . K_NEWLINE;
echo '<strong><a href="index.php" title="' . $l['h_index'] . '">' . $l['h_index'] . ' ></a></strong>' . K_NEWLINE;
echo '</div>' . K_NEWLINE;
require_once '../code/tce_page_footer.php';
exit;
}
}
}
//end of add
// --- Initialize variables
if (isset($_REQUEST['user_name'])) {
$user_name = htmlspecialchars($_REQUEST['user_name'], ENT_COMPAT, $l['a_meta_charset']);
} else {
示例7: intval
$sts_id = 0;
$rck_id = 0;
} else {
if (isset($_REQUEST['sts_id']) and (!isset($_REQUEST['change_datacenter']) or empty($_REQUEST['change_datacenter']))) {
$sts_id = intval($_REQUEST['sts_id']);
$sts_perm = F_getUserPermission($user_id, K_TABLE_SUITE_GROUPS, $sts_id);
if ($sts_perm == 0) {
F_print_error('ERROR', $l['m_not_authorized_to_view']);
$sts_id = 0;
$rck_id = 0;
} else {
if (isset($_REQUEST['rck_id']) and (!isset($_REQUEST['change_suite']) or empty($_REQUEST['change_suite']))) {
$rck_id = intval($_REQUEST['rck_id']);
$user_permissions = F_getUserPermission($user_id, K_TABLE_RACK_GROUPS, $rck_id);
if ($user_permissions == 0) {
F_print_error('ERROR', $l['m_not_authorized_to_view']);
$rck_id = 0;
}
} else {
$rck_id = 0;
}
}
} else {
$sts_id = 0;
$rck_id = 0;
}
}
} else {
$dcn_id = 0;
$sts_id = 0;
$rck_id = 0;
示例8: VALUES
cpsession_id,
cpsession_expiry,
cpsession_data
) VALUES (
\'' . $fingerprintkey . '\',
\'' . date(K_TIMESTAMP_FORMAT, time() + $wait) . '\',
\'' . $wait . '\'
)';
if (!F_db_query($sqls, $db)) {
F_display_db_error();
}
$bruteforce = false;
}
}
if ($bruteforce) {
F_print_error('WARNING', $l['m_login_brute_force'] . ' ' . $wait);
} else {
$xuser_password = getPasswordHash($_POST['xuser_password']);
// one-way password encoding
// check if submitted login information are correct
$sql = 'SELECT * FROM ' . K_TABLE_USERS . ' WHERE user_name=\'' . F_escape_sql($_POST['xuser_name']) . '\' AND user_password=\'' . $xuser_password . '\'';
if ($r = F_db_query($sql, $db)) {
if ($m = F_db_fetch_array($r)) {
// check One Time Password
$otp = false;
if (K_OTP_LOGIN) {
$mtime = microtime(true);
if (isset($_POST['xuser_otpcode']) and !empty($_POST['xuser_otpcode']) and ($_POST['xuser_otpcode'] == F_getOTP($m['user_otpkey'], $mtime) or $_POST['xuser_otpcode'] == F_getOTP($m['user_otpkey'], $mtime - 30) or $_POST['xuser_otpcode'] == F_getOTP($m['user_otpkey'], $mtime + 30))) {
// check if this OTP token has been alredy used
$sqlt = 'SELECT cpsession_id FROM ' . K_TABLE_SESSIONS . ' WHERE cpsession_id=\'' . $_POST['xuser_otpcode'] . '\' LIMIT 1';
if ($rt = F_db_query($sqlt, $db)) {
示例9: intval
$enddate = '';
}
if (isset($_REQUEST['mode']) and $_REQUEST['mode'] > 0) {
$mode = intval($_REQUEST['mode']);
} else {
$mode = 0;
}
if (isset($_REQUEST['display_mode'])) {
$display_mode = max(0, min(5, intval($_REQUEST['display_mode'])));
} else {
$display_mode = 0;
}
if (isset($_REQUEST['show_graph'])) {
$show_graph = intval($_REQUEST['show_graph']);
if ($show_graph and $display_mode == 0) {
$display_mode = 1;
}
} else {
$show_graph = 0;
}
require_once 'tce_functions_email_reports.php';
echo '<div class="pagehelp">' . $l['hp_sending_in_progress'] . '</div>' . K_NEWLINE;
flush();
// force browser output
F_send_report_emails($test_id, $user_id, $testuser_id, $group_id, $startdate, $enddate, $mode, $display_mode, $show_graph);
F_print_error('MESSAGE', $l['m_process_completed']);
echo '</div>' . K_NEWLINE;
require_once '../code/tce_page_footer.php';
//============================================================+
// END OF FILE
//============================================================+
示例10: F_stripslashes_formfields
case 'deldir':
F_stripslashes_formfields();
// Delete
if ($_SESSION['session_user_level'] < K_AUTH_ADMIN_DIRS) {
F_print_error('WARNING', $l['m_authorization_denied']);
break;
}
if (!F_isAuthorizedDir($dir, $root_dir, $authdirs)) {
F_print_error('WARNING', $l['m_authorization_denied']);
break;
}
if (F_deleteMediaDir($dir)) {
$dir = $root_dir;
F_print_error('MESSAGE', $l['m_deleted']);
} else {
F_print_error('ERROR', $l['m_delete_file_error']);
}
break;
default:
break;
}
//end of switch
echo '<div class="container">' . K_NEWLINE;
echo '<div class="contentbox">' . K_NEWLINE;
echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_filemanager">' . K_NEWLINE;
echo '<div>' . K_NEWLINE;
echo '<input type="hidden" name="frm" id="frm" value="' . $callingform . '" />' . K_NEWLINE;
echo '<input type="hidden" name="fld" id="fld" value="' . $callingfield . '" />' . K_NEWLINE;
// current dir
echo '<input type="hidden" name="d" id="d" value="' . $dir . '" />' . K_NEWLINE;
echo '<fieldset>' . K_NEWLINE;
示例11: F_display_db_error
F_display_db_error(false);
break;
}
}
break;
case 'add':
// Add
if ($formstatus = F_check_form_fields()) {
// check if alternate key is unique
if (K_DATABASE_TYPE == 'ORACLE') {
$chksql = 'dbms_lob.instr(question_description,\'' . F_escape_sql($question_description) . '\',1,1)>0';
} else {
$chksql = 'question_description=\'' . F_escape_sql($question_description) . '\'';
}
if (!F_check_unique(K_TABLE_QUESTIONS, $chksql . ' AND question_subject_id=' . $question_subject_id . '')) {
F_print_error('WARNING', $l['m_duplicate_question']);
$formstatus = FALSE;
F_stripslashes_formfields();
break;
}
$sql = 'START TRANSACTION';
if (!($r = F_db_query($sql, $db))) {
F_display_db_error(false);
break;
}
// adjust questions ordering
if ($question_position > 0) {
$sql = 'UPDATE ' . K_TABLE_QUESTIONS . ' SET
question_position=question_position+1
WHERE question_subject_id=' . $question_subject_id . '
AND question_position>=' . $question_position . '';
示例12: intval
} else {
$sts_id = 0;
$rck_id = 0;
}
}
} else {
$dcn_id = 0;
$sts_id = 0;
$rck_id = 0;
}
// selected or default object
if (isset($_REQUEST['obj_id']) and (!isset($_REQUEST['change_datacenter']) or empty($_REQUEST['change_datacenter'])) and (!isset($_REQUEST['change_suite']) or empty($_REQUEST['change_suite'])) and (!isset($_REQUEST['change_rack']) or empty($_REQUEST['change_rack']))) {
$obj_id = intval($_REQUEST['obj_id']);
$user_permissions = F_getUserPermission($user_id, K_TABLE_OBJECT_GROUPS, $obj_id);
if ($user_permissions == 0) {
F_print_error('ERROR', $l['m_not_authorized_to_edit']);
$obj_id = 0;
}
if ($obj_id > 0 and ($dcn_id == 0 or $sts_id == 0 or $rck_id == 0)) {
// retrive location values
$sql = 'SELECT dcn_id, sts_id, rck_id
FROM ' . K_TABLE_DATACENTERS . ', ' . K_TABLE_SUITES . ', ' . K_TABLE_RACKS . ', ' . K_TABLE_LOCATIONS . ', ' . K_TABLE_OBJECTS . '
WHERE loc_obj_id=obj_id AND loc_rack_id=rck_id AND rck_sts_id=sts_id AND sts_dcn_id=dcn_id AND obj_id=' . $obj_id . ' LIMIT 1';
if ($r = F_db_query($sql, $db)) {
if ($m = F_db_fetch_array($r)) {
$dcn_id = $m['dcn_id'];
$sts_id = $m['sts_id'];
$rck_id = $m['rck_id'];
}
} else {
F_display_db_error();
示例13: F_read_file_size
/**
* returns the file size in bytes
* @author Nicola Asuni
* @since 2001-11-19
* @param $filetocheck (string) file to check (local path or URL)
* @return mixed file size in bytes or false in case of error
*/
function F_read_file_size($filetocheck)
{
global $l;
require_once '../config/tce_config.php';
$filesize = 0;
if ($fp = fopen($filetocheck, 'rb')) {
$s_array = fstat($fp);
if ($s_array['size']) {
$filesize = $s_array['size'];
} else {
//read size from remote file (very slow function)
while (!feof($fp)) {
$content = fread($fp, 1);
$filesize++;
}
}
fclose($fp);
return $filesize;
}
F_print_error('ERROR', basename($filetocheck) . ': ' . $l['m_openfile_not']);
return FALSE;
}
示例14: F_error_handler
/**
* Custom PHP error handler function.
* @param $errno (int) The first parameter, errno, contains the level of the error raised, as an integer.
* @param $errstr (string) The second parameter, errstr, contains the error message, as a string.
* @param $errfile (string) The third parameter is optional, errfile, which contains the filename that the error was raised in, as a string.
* @param $errline (int) The fourth parameter is optional, errline, which contains the line number the error was raised at, as an integer.
*/
function F_error_handler($errno, $errstr, $errfile, $errline)
{
if (ini_get('error_reporting') == 0) {
// this is required to ignore supressed error messages with '@'
return;
}
$messagetoprint = '[' . $errno . '] ' . $errstr . ' | LINE: ' . $errline . ' | FILE: ' . $errfile . '';
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
F_print_error('ERROR', $messagetoprint, true);
break;
case E_WARNING:
case E_USER_WARNING:
F_print_error('ERROR', $messagetoprint, false);
break;
case E_NOTICE:
case E_USER_NOTICE:
default:
F_print_error('WARNING', $messagetoprint, false);
break;
}
}
示例15: F_error_handler
/**
* Custom PHP error handler function.
* @param $errno (int) The first parameter, errno, contains the level of the error raised, as an integer.
* @param $errstr (string) The second parameter, errstr, contains the error message, as a string.
* @param $errfile (string) The third parameter is optional, errfile, which contains the filename that the error was raised in, as a string.
* @param $errline (int) The fourth parameter is optional, errline, which contains the line number the error was raised at, as an integer.
*/
function F_error_handler($errno, $errstr, $errfile, $errline)
{
$messagetoprint = '[' . $errno . '] ' . $errstr . ' | LINE: ' . $errline . ' | FILE: ' . $errfile . '';
switch ($errno) {
case E_ERROR:
case E_USER_ERROR:
F_print_error('ERROR', $messagetoprint, true);
break;
case E_WARNING:
case E_USER_WARNING:
F_print_error('ERROR', $messagetoprint, false);
break;
case E_NOTICE:
case E_USER_NOTICE:
default:
F_print_error('WARNING', $messagetoprint, false);
break;
}
}