本文整理汇总了PHP中SendError函数的典型用法代码示例。如果您正苦于以下问题:PHP SendError函数的具体用法?PHP SendError怎么用?PHP SendError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SendError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendResponse
protected function SendResponse($answer)
{
header('Content-type: application/json');
$json_string = json_encode($answer, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$last_er = json_last_error();
if ($last_er != JSON_ERROR_NONE) {
SendError(new Exception("Error has occurred during serialization in JSON. " . GetJsonErrorExplanation($last_er)));
}
echo $json_string;
}
示例2: DoResponse
function DoResponse()
{
global $Config;
if (!isset($_GET)) {
global $_GET;
}
if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
return;
}
// Get the main request informaiton.
$sCommand = $_GET['Command'];
$sResourceType = $_GET['Type'];
$sCurrentFolder = GetCurrentFolder();
// Check if it is an allowed command
if (!IsAllowedCommand($sCommand)) {
SendError(1, 'Команда "' . $sCommand . '" недоступна');
}
// Check if it is an allowed type.
if (!IsAllowedType($sResourceType)) {
SendError(1, 'Неверный тип');
}
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ($sCommand == 'FileUpload') {
FileUpload($sResourceType, $sCurrentFolder, $sCommand);
return;
}
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
// Execute the required command.
switch ($sCommand) {
case 'GetFolders':
GetFolders($sResourceType, $sCurrentFolder);
break;
case 'GetFoldersAndFiles':
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
break;
case 'CreateFolder':
CreateFolder($sResourceType, $sCurrentFolder);
break;
case 'FileDelete':
if ($Config['Delete']) {
FileDelete($sResourceType, $sCurrentFolder, $sCommand);
}
break;
case 'FolderDelete':
if ($Config['Delete']) {
FolderDelete($sResourceType, $sCurrentFolder, $sCommand);
}
break;
}
CreateXmlFooter();
exit;
}
示例3: DoResponse
function DoResponse()
{
if (!isset($_GET)) {
global $_GET;
}
if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) )
return ;
// Get the main request informaiton.
$sCommand = $_GET['Command'] ;
$sResourceType = $_GET['Type'] ;
$sCurrentFolder = GetCurrentFolder() ;
// Check if it is an allowed command
if ( ! IsAllowedCommand( $sCommand ) )
SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ;
// Check if it is an allowed type.
if ( !IsAllowedType( $sResourceType ) )
SendError( 1, 'Invalid type specified' ) ;
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ( $sCommand == 'FileUpload' )
{
FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ;
return ;
}
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ;
// Execute the required command.
switch ( $sCommand )
{
case 'GetFolders' :
GetFolders( $sResourceType, $sCurrentFolder ) ;
break ;
case 'GetFoldersAndFiles' :
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ;
break ;
case 'CreateFolder' :
CreateFolder( $sResourceType, $sCurrentFolder ) ;
break ;
}
CreateXmlFooter() ;
exit ;
}
示例4: DoResponse
function DoResponse()
{
if (!isset($_GET)) {
global $_GET;
}
if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
return;
}
// Get the main request informaiton.
$sCommand = urlencode($_GET['Command']);
$sResourceType = urlencode($_GET['Type']);
$sCurrentFolder = GetCurrentFolder();
// Check if it is an allowed command
if (!IsAllowedCommand($sCommand)) {
SendError(1, 'FileBrowserError_Command' . ';;' . $sCommand);
}
// Check if it is an allowed type.
if (!IsAllowedType($sResourceType)) {
SendError(1, 'FileBrowserError_Type' . ';;' . $sResourceType);
}
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ($sCommand == 'FileUpload') {
FileUpload($sResourceType, $sCurrentFolder, $sCommand);
return;
}
if ($sCommand == 'GetDwfckNs') {
GetDwfckNs();
return;
}
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
// Execute the required command.
switch ($sCommand) {
case 'GetFolders':
GetFolders($sResourceType, $sCurrentFolder);
break;
case 'GetFoldersAndFiles':
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
break;
case 'CreateFolder':
CreateFolder($sResourceType, $sCurrentFolder);
break;
case 'UnlinkFile':
UnlinkFile($sResourceType, $sCurrentFolder, $sCommand, $_GET['file']);
break;
}
CreateXmlFooter();
exit;
}
示例5: DoResponse
function DoResponse()
{
if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
return;
}
// Get the main request informaiton.
$sCommand = $_GET['Command'];
$sResourceType = $_GET['Type'];
$sCurrentFolder = $_GET['CurrentFolder'];
// Check if it is an allowed type.
if (!in_array($sResourceType, array('File', 'Image', 'Flash', 'Media'))) {
return;
}
// Check the current folder syntax (must begin and start with a slash).
if (!ereg('/$', $sCurrentFolder)) {
$sCurrentFolder .= '/';
}
if (strpos($sCurrentFolder, '/') !== 0) {
$sCurrentFolder = '/' . $sCurrentFolder;
}
// Check for invalid folder paths (..)
if (strpos($sCurrentFolder, '..')) {
SendError(102, "");
}
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ($sCommand == 'FileUpload') {
FileUpload($sResourceType, $sCurrentFolder);
return;
}
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
// Execute the required command.
switch ($sCommand) {
case 'GetFolders':
GetFolders($sResourceType, $sCurrentFolder);
break;
case 'GetFoldersAndFiles':
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
break;
case 'CreateFolder':
CreateFolder($sResourceType, $sCurrentFolder);
break;
}
CreateXmlFooter();
exit;
}
示例6: DoResponse
function DoResponse()
{
if (!isset($_GET)) {
global $_GET;
}
if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
return;
}
//require_once(GetRootPath() . '\\conlive_8_12\\site\\config\\project.php');
//$con = new Project();
$f = fopen("cok2.txt", "w");
fprintf($f, $_SESSION['em']);
// Get the main request informaiton.
$sCommand = $_GET['Command'];
$sResourceType = $_GET['Type'];
$sCurrentFolder = GetCurrentFolder();
// Check if it is an allowed command
if (!IsAllowedCommand($sCommand)) {
SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
}
// Check if it is an allowed type.
if (!IsAllowedType($sResourceType)) {
SendError(1, 'Invalid type specified');
}
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ($sCommand == 'FileUpload') {
FileUpload($sResourceType, $sCurrentFolder, $sCommand);
return;
}
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
// Execute the required command.
switch ($sCommand) {
case 'GetFolders':
GetFolders($sResourceType, $sCurrentFolder);
break;
case 'GetFoldersAndFiles':
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
break;
case 'CreateFolder':
CreateFolder($sResourceType, $sCurrentFolder);
break;
}
CreateXmlFooter();
exit;
}
示例7: ConnectInternal
function ConnectInternal()
{
$dbHost = $this->DBHost;
$dbPort = null;
if (($pos = strpos($dbHost, ":")) !== false) {
$dbPort = intval(substr($dbHost, $pos + 1));
$dbHost = substr($dbHost, 0, $pos);
}
$persistentPrefix = DBPersistent && !$this->bNodeConnection ? "p:" : "";
$this->db_Conn = mysqli_connect($persistentPrefix . $dbHost, $this->DBLogin, $this->DBPassword, $this->DBName, $dbPort);
if (!$this->db_Conn) {
$error = "[" . mysqli_connect_errno() . "] " . mysqli_connect_error();
if ($this->debug || @session_start() && $_SESSION["SESS_AUTH"]["ADMIN"]) {
echo "<br><font color=#ff0000>Error! mysqli_connect()</font><br>" . $error . "<br>";
}
SendError("Error! mysqli_connect()\n" . $error . "\n");
return false;
}
return true;
}
示例8: DoResponse
function DoResponse()
{
if (!isset($_GET)) {
global $_GET;
}
if (!isset($_GET['Command']) || !isset($_GET['Type']) || !isset($_GET['CurrentFolder'])) {
return;
}
$sCommand = $_GET['Command'];
$sResourceType = $_GET['Type'];
$sCurrentFolder = GetCurrentFolder();
if (!IsAllowedCommand($sCommand)) {
SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
}
if (!IsAllowedType($sResourceType)) {
SendError(1, 'Invalid type specified');
}
if ($sCommand == 'FileUpload') {
FileUpload($sResourceType, $sCurrentFolder, $sCommand);
return;
}
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
switch ($sCommand) {
case 'GetFolders':
GetFolders($sResourceType, $sCurrentFolder);
break;
case 'GetFoldersAndFiles':
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
break;
case 'CreateFolder':
CreateFolder($sResourceType, $sCurrentFolder);
break;
}
CreateXmlFooter();
exit;
}
示例9: ConnectInternal
public function ConnectInternal()
{
if (DBPersistent && !$this->bNodeConnection) {
$this->db_Conn = @mysql_pconnect($this->DBHost, $this->DBLogin, $this->DBPassword);
} else {
$this->db_Conn = @mysql_connect($this->DBHost, $this->DBLogin, $this->DBPassword, true);
}
if (!$this->db_Conn) {
$s = DBPersistent && !$this->bNodeConnection ? "mysql_pconnect" : "mysql_connect";
if ($this->debug || @session_start() && $_SESSION["SESS_AUTH"]["ADMIN"]) {
echo "<br><font color=#ff0000>Error! " . $s . "()</font><br>" . mysql_error() . "<br>";
}
SendError("Error! " . $s . "()\n" . mysql_error() . "\n");
return false;
}
if (!mysql_select_db($this->DBName, $this->db_Conn)) {
if ($this->debug || @session_start() && $_SESSION["SESS_AUTH"]["ADMIN"]) {
echo "<br><font color=#ff0000>Error! mysql_select_db(" . $this->DBName . ")</font><br>" . mysql_error($this->db_Conn) . "<br>";
}
SendError("Error! mysql_select_db(" . $this->DBName . ")\n" . mysql_error($this->db_Conn) . "\n");
return false;
}
return true;
}
示例10: GetCurrentFolder
function GetCurrentFolder()
{
if (!isset($_GET)) {
global $_GET;
}
$sCurrentFolder = isset($_GET['CurrentFolder']) ? $_GET['CurrentFolder'] : '/';
// Check the current folder syntax (must begin and start with a slash).
if (!ereg('/$', $sCurrentFolder)) {
$sCurrentFolder .= '/';
}
if (strpos($sCurrentFolder, '/') !== 0) {
$sCurrentFolder = '/' . $sCurrentFolder;
}
// Ensure the folder path has no double-slashes
while (strpos($sCurrentFolder, '//') !== false) {
$sCurrentFolder = str_replace('//', '/', $sCurrentFolder);
}
// Check for invalid folder paths (..)
if (strpos($sCurrentFolder, '..')) {
SendError(102, '');
}
return $sCurrentFolder;
}
示例11: elseif
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Configuration file for the File Manager Connector for PHP.
*/
global $Config;
if (isset($_SERVER["ConfigFile"]) && is_file($_SERVER["ConfigFile"])) {
include $_SERVER["ConfigFile"];
} elseif (is_file('../../../../../../../../config/config.php')) {
include "../../../../../../../../config/config.php";
} else {
SendError(1, 'unable to load phplist config file');
print "Error, cannot find config file\n";
exit;
}
// SECURITY: You must explicitelly enable this "connector". (Set it to "true").
if (!defined('FCKIMAGES_DIR') && !defined('UPLOADIMAGES_DIR')) {
$Config['Enabled'] = false;
} elseif (defined('UPLOADIMAGES_DIR')) {
$imgdir = $_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/';
$Config['Enabled'] = is_dir($imgdir) && is_writeable($imgdir);
$Config['UserFilesPath'] = '/' . UPLOADIMAGES_DIR . '/';
} else {
$imgdir = $_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/' . FCKIMAGES_DIR . '/';
$Config['Enabled'] = is_dir($imgdir) && is_writeable($imgdir);
// Path to user files relative to the document root.
if (!preg_match('#/$#', $GLOBALS["pageroot"])) {
示例12: SendError
*
* == END LICENSE ==
*
* This is the "File Uploader" for PHP.
*/
require './config.php';
require './util.php';
require './io.php';
require './commands.php';
require './phpcompat.php';
function SendError($number, $text)
{
SendUploadResults($number, '', '', $text);
}
if (!$Config['Enabled']) {
SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/phplist/config.php" file');
}
// Check if this uploader has been enabled.
if (!$Config['Enabled']) {
SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
}
$sCommand = 'QuickUpload';
// The file type (from the QueryString, by default 'File').
$sType = isset($_GET['Type']) ? $_GET['Type'] : 'File';
$sCurrentFolder = GetCurrentFolder();
// Is enabled the upload?
if (!IsAllowedCommand($sCommand)) {
SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
}
// Check if it is an allowed type.
if (!IsAllowedType($sType)) {
示例13: define
define('FCK_FILE_PREFIX', '');
// not in use now
define('FCK_DIGITS4USERDIR', 0);
define('FCK_USER_SELFDELETE_LIMIT', 3600);
// set the time limit by sec. 0 means normal users cannot delete files uploaded by themselves
define('FCK_USER_PREFIX', 'uid%06d_');
define('FCK_CHECK_USER_PREFIX4NORMAL', true);
define('FCK_CHECK_USER_PREFIX4ADMIN', false);
$fck_uploadable_groups = array();
// specify groups can upload images
//define( 'FCK_FUNCTION_AFTER_IMGUPLOAD' , 'fck_resize_by_imagemagick' ) ;
$fck_resource_type_extensions = array('File' => array(), 'Image' => array('jpeg', 'jpg', 'png', 'gif'), 'Flash' => array('swf', 'fla'), 'Media' => array('jpeg', 'jpg', 'png', 'gif', 'swf', 'fla', 'avi', 'mpg', 'mpeg', 'mov'));
$fck_allowed_extensions = array();
// check directory for uploading
if (!is_dir(FCK_UPLOAD_PATH_BASE)) {
SendError('1', '', '', 'Create ' . htmlspecialchars(FCK_UPLOAD_URL_BASE) . ' first');
}
if (!is_object($xoopsUser)) {
// guests
$fck_isadmin = false;
$fck_canupload = false;
$uid = 0;
} else {
// users
$uid = $xoopsUser->getVar('uid');
// check isadmin
if (defined('XOOPS_CUBE_LEGACY')) {
// for Cube 2.1 (check if legacy module admin)
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname('legacy');
$fck_isadmin = $xoopsUser->isAdmin($module->getVar('mid'));
示例14: die
}
if (!CModule::IncludeModule("sale")) {
die('sale module not found');
}
IncludeModuleLangFile(__FILE__);
if (!CModule::IncludeModule("rficb.payment")) {
die('rficb.payment module not found');
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$module_id = "rficb.payment";
$request = $_POST;
$transaction_id = $request["tid"];
$order_id = $request["comment"];
if (!($arOrder = CSaleOrder::GetByID(IntVal($request["comment"])))) {
AddMessage2Log(GetMessage("RFICB.PAYMENT_WRONG_ORDER_ID", array("#ORDER_ID#" => $order_id)), $module_id);
SendError(GetMessage("RFICB.PAYMENT_WRONG_ORDER_ID", array("#ORDER_ID#" => $order_id)), $module_id);
mail('support@rficb.ru', $_SERVER["SERVER_NAME"], GetMessage("RFICB.PAYMENT_WRONG_ORDER_ID"));
} else {
if (!CRficbPayment::VerifyCheck($request, $arOrder["LID"])) {
$strStatus = "";
$strStatus .= GetMessage("RFICB.PAYMENT_PAYMENT_ID", array("#TRANSACTION_ID#" => $transaction_id));
$strStatus .= GetMessage("RFICB.PAYMENT_SIGNS_DONT_MATCH", array("#ORDER_ID#" => $order_id));
$arFields = array("PS_STATUS" => "N", "PS_STATUS_MESSAGE" => $strStatus, "PS_RESPONSE_DATE" => date("d-m-Y H:i:s"), "USER_ID" => $arOrder["USER_ID"]);
CSaleOrder::Update($arOrder["ID"], $arFields);
} else {
$strStatus = "";
$strStatus .= GetMessage("RFICB.PAYMENT_PAYMENT_ID", array("#TRANSACTION_ID#" => $transaction_id));
$strStatus .= GetMessage("RFICB.PAYMENT_PAYMENT_FOR_ORDER_SUCCESFUL", array("#ORDER_ID#" => $order_id));
if ($arOrder["PRICE"] <= $request["system_income"]) {
$payed = "Y";
CSaleOrder::PayOrder($arOrder["ID"], "Y");
示例15: Query
public function Query($strSql, $bIgnoreErrors = false, $error_position = "", $arOptions = array())
{
global $DB;
$this->DoConnect();
$this->db_Error = "";
if ($this->DebugToFile || $DB->ShowSqlStat) {
$start_time = microtime(true);
}
//We track queries for DML statements
//and when there is no one we can choose
//to run query against master connection
//or replicated one
$connectionPool = \Bitrix\Main\Application::getInstance()->getConnectionPool();
if ($connectionPool->isMasterOnly()) {
//We requested to process all queries
//by master connection
} elseif ($this->bModuleConnection) {
//In case of dedicated module database
//were is nothing to do
} elseif (isset($arOptions["fixed_connection"])) {
//We requested to process this query
//by current connection
} elseif ($this->bNodeConnection) {
//It is node so nothing to do
} else {
if (isset($arOptions["ignore_dml"])) {
$connectionPool->ignoreDml(true);
}
$connection = $connectionPool->getSlaveConnection($strSql);
if (isset($arOptions["ignore_dml"])) {
$connectionPool->ignoreDml(false);
}
if ($connection !== null) {
if (!isset($this->obSlave)) {
$nodeId = $connection->getNodeId();
ob_start();
$conn = CDatabase::GetDBNodeConnection($nodeId, true);
ob_end_clean();
if (is_object($conn)) {
$this->obSlave = $conn;
} else {
self::$arNodes[$nodeId]["ONHIT_ERROR"] = true;
CClusterDBNode::SetOffline($nodeId);
}
}
if (is_object($this->obSlave)) {
return $this->obSlave->Query($strSql, $bIgnoreErrors, $error_position, $arOptions);
}
}
}
$result = $this->QueryInternal($strSql);
if ($this->DebugToFile || $DB->ShowSqlStat) {
/** @noinspection PhpUndefinedVariableInspection */
$exec_time = round(microtime(true) - $start_time, 10);
if ($DB->ShowSqlStat) {
$DB->addDebugQuery($strSql, $exec_time, $connectionPool->isSlavePossible() ? $this->node_id : -1);
}
if ($this->DebugToFile) {
$this->startSqlTracker()->writeFileLog($strSql, $exec_time, "CONN: " . $this->getThreadId());
}
}
if (!$result) {
$this->db_Error = $this->GetError();
$this->db_ErrorSQL = $strSql;
if (!$bIgnoreErrors) {
AddMessage2Log($error_position . " MySql Query Error: " . $strSql . " [" . $this->db_Error . "]", "main");
if ($this->DebugToFile) {
$this->startSqlTracker()->writeFileLog("ERROR: " . $this->db_Error, 0, "CONN: " . $this->getThreadId());
}
if ($this->debug || @session_start() && $_SESSION["SESS_AUTH"]["ADMIN"]) {
echo $error_position . "<br><font color=#ff0000>MySQL Query Error: " . htmlspecialcharsbx($strSql) . "</font>[" . htmlspecialcharsbx($this->db_Error) . "]<br>";
}
$error_position = preg_replace("#<br[^>]*>#i", "\n", $error_position);
SendError($error_position . "\nMySQL Query Error:\n" . $strSql . " \n [" . $this->db_Error . "]\n---------------\n\n");
if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/dbquery_error.php")) {
include $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/dbquery_error.php";
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/dbquery_error.php")) {
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/dbquery_error.php";
} else {
die("MySQL Query Error!");
}
die;
}
return false;
}
$res = new CDBResult($result);
$res->DB = $this;
if ($DB->ShowSqlStat) {
$res->SqlTraceIndex = count($DB->arQueryDebug) - 1;
}
return $res;
}