Checkstyle
This commit is contained in:
parent
b43c7e1b35
commit
e8b2489c1c
@ -632,27 +632,27 @@ else if ($action == 'addline' && $user->rights->commande->creer)
|
|||||||
{
|
{
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$object->id,
|
$object->id,
|
||||||
$desc,
|
$desc,
|
||||||
$pu_ht,
|
$pu_ht,
|
||||||
GETPOST('qty'),
|
GETPOST('qty'),
|
||||||
$tva_tx,
|
$tva_tx,
|
||||||
$localtax1_tx,
|
$localtax1_tx,
|
||||||
$localtax2_tx,
|
$localtax2_tx,
|
||||||
GETPOST('idprod'),
|
GETPOST('idprod'),
|
||||||
GETPOST('remise_percent'),
|
GETPOST('remise_percent'),
|
||||||
$info_bits,
|
$info_bits,
|
||||||
0,
|
0,
|
||||||
$price_base_type,
|
$price_base_type,
|
||||||
$pu_ttc,
|
$pu_ttc,
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end,
|
$date_end,
|
||||||
$type,
|
$type,
|
||||||
-1,
|
-1,
|
||||||
'',
|
'',
|
||||||
GETPOST('fk_parent_line'),
|
GETPOST('fk_parent_line'),
|
||||||
GETPOST('np_fournprice'),
|
GETPOST('np_fournprice'),
|
||||||
GETPOST('np_buying_price')
|
GETPOST('np_buying_price')
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
|
|||||||
@ -43,9 +43,9 @@ class RemiseCheque extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $DB Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function RemiseCheque($DB)
|
function RemiseCheque($db)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->next_id = 0;
|
$this->next_id = 0;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ function SetXmlHeaders()
|
|||||||
header('Pragma: no-cache');
|
header('Pragma: no-cache');
|
||||||
|
|
||||||
// Set the response format.
|
// Set the response format.
|
||||||
header( 'Content-Type: text/xml; charset=utf-8' );
|
header('Content-Type: text/xml; charset=utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateXmlHeader( $command, $resourceType, $currentFolder )
|
function CreateXmlHeader( $command, $resourceType, $currentFolder )
|
||||||
@ -58,7 +58,7 @@ function CreateXmlHeader( $command, $resourceType, $currentFolder )
|
|||||||
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
|
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
|
||||||
|
|
||||||
// Add the current folder node.
|
// Add the current folder node.
|
||||||
echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ;
|
echo '<CurrentFolder path="' . ConvertToXmlAttribute($currentFolder) . '" url="' . ConvertToXmlAttribute(GetUrlFromPath($resourceType, $currentFolder, $command)) . '" />' ;
|
||||||
|
|
||||||
$GLOBALS['HeaderSent'] = true ;
|
$GLOBALS['HeaderSent'] = true ;
|
||||||
}
|
}
|
||||||
@ -68,14 +68,21 @@ function CreateXmlFooter()
|
|||||||
echo '</Connector>' ;
|
echo '</Connector>' ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SendError( $number, $text )
|
/**
|
||||||
|
* SendError
|
||||||
|
*
|
||||||
|
* @param unknown_type $number Number
|
||||||
|
* @param unknown_type $text Text
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function SendError($number, $text)
|
||||||
{
|
{
|
||||||
if ( $_GET['Command'] == 'FileUpload' )
|
if ( $_GET['Command'] == 'FileUpload' )
|
||||||
SendUploadResults( $number, "", "", $text );
|
SendUploadResults($number, "", "", $text);
|
||||||
|
|
||||||
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
|
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
|
||||||
{
|
{
|
||||||
SendErrorNode( $number, $text );
|
SendErrorNode($number, $text);
|
||||||
CreateXmlFooter();
|
CreateXmlFooter();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -87,17 +94,17 @@ function SendError( $number, $text )
|
|||||||
|
|
||||||
echo '<Connector>' ;
|
echo '<Connector>' ;
|
||||||
|
|
||||||
SendErrorNode( $number, $text );
|
SendErrorNode($number, $text);
|
||||||
|
|
||||||
echo '</Connector>' ;
|
echo '</Connector>' ;
|
||||||
}
|
}
|
||||||
exit ;
|
exit ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SendErrorNode( $number, $text )
|
function SendErrorNode($number, $text)
|
||||||
{
|
{
|
||||||
if ($text)
|
if ($text)
|
||||||
echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
|
echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
|
||||||
else
|
else
|
||||||
echo '<Error number="' . $number . '" />' ;
|
echo '<Error number="' . $number . '" />' ;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,10 +29,9 @@ require('./util.php');
|
|||||||
require('./io.php');
|
require('./io.php');
|
||||||
require('./basexml.php');
|
require('./basexml.php');
|
||||||
require('./commands.php');
|
require('./commands.php');
|
||||||
require('./phpcompat.php');
|
|
||||||
|
|
||||||
if ( !$Config['Enabled'] )
|
if ( !$Config['Enabled'] )
|
||||||
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' );
|
SendError(1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
|
||||||
|
|
||||||
DoResponse();
|
DoResponse();
|
||||||
|
|
||||||
@ -50,33 +49,33 @@ function DoResponse()
|
|||||||
$sCurrentFolder = GetCurrentFolder();
|
$sCurrentFolder = GetCurrentFolder();
|
||||||
|
|
||||||
// Check if it is an allowed command
|
// Check if it is an allowed command
|
||||||
if ( ! IsAllowedCommand( $sCommand ) )
|
if (! IsAllowedCommand($sCommand))
|
||||||
SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' );
|
SendError(1, 'The "' . $sCommand . '" command isn\'t allowed');
|
||||||
|
|
||||||
// Check if it is an allowed type.
|
// Check if it is an allowed type.
|
||||||
if ( !IsAllowedType( $sResourceType ) )
|
if (! IsAllowedType($sResourceType))
|
||||||
SendError( 1, 'Invalid type specified' );
|
SendError(1, 'Invalid type specified');
|
||||||
|
|
||||||
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
// File Upload doesn't have to Return XML, so it must be intercepted before anything.
|
||||||
if ( $sCommand == 'FileUpload' )
|
if ( $sCommand == 'FileUpload' )
|
||||||
{
|
{
|
||||||
FileUpload( $sResourceType, $sCurrentFolder, $sCommand );
|
FileUpload($sResourceType, $sCurrentFolder, $sCommand);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder );
|
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
|
||||||
|
|
||||||
// Execute the required command.
|
// Execute the required command.
|
||||||
switch ( $sCommand )
|
switch ( $sCommand )
|
||||||
{
|
{
|
||||||
case 'GetFolders' :
|
case 'GetFolders' :
|
||||||
GetFolders( $sResourceType, $sCurrentFolder );
|
GetFolders($sResourceType, $sCurrentFolder);
|
||||||
break ;
|
break ;
|
||||||
case 'GetFoldersAndFiles' :
|
case 'GetFoldersAndFiles' :
|
||||||
GetFoldersAndFiles( $sResourceType, $sCurrentFolder );
|
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
|
||||||
break ;
|
break ;
|
||||||
case 'CreateFolder' :
|
case 'CreateFolder' :
|
||||||
CreateFolder( $sResourceType, $sCurrentFolder );
|
CreateFolder($sResourceType, $sCurrentFolder);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if ( !isset( $_SERVER ) ) {
|
|
||||||
$_SERVER = $HTTP_SERVER_VARS ;
|
|
||||||
}
|
|
||||||
if ( !isset( $_GET ) ) {
|
|
||||||
$_GET = $HTTP_GET_VARS ;
|
|
||||||
}
|
|
||||||
if ( !isset( $_FILES ) ) {
|
|
||||||
$_FILES = $HTTP_POST_FILES ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! defined('DIRECTORY_SEPARATOR'))
|
|
||||||
{
|
|
||||||
define('DIRECTORY_SEPARATOR', strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/');
|
|
||||||
}
|
|
||||||
@ -26,17 +26,16 @@ require('./config.php');
|
|||||||
require('./util.php');
|
require('./util.php');
|
||||||
require('./io.php');
|
require('./io.php');
|
||||||
require('./commands.php');
|
require('./commands.php');
|
||||||
require('./phpcompat.php');
|
|
||||||
|
|
||||||
function SendError( $number, $text )
|
function SendError( $number, $text )
|
||||||
{
|
{
|
||||||
SendUploadResults( $number, '', '', $text );
|
SendUploadResults($number, '', '', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if this uploader has been enabled.
|
// Check if this uploader has been enabled.
|
||||||
if ( !$Config['Enabled'] )
|
if ( !$Config['Enabled'] )
|
||||||
SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' );
|
SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
|
||||||
|
|
||||||
$sCommand = 'QuickUpload' ;
|
$sCommand = 'QuickUpload' ;
|
||||||
|
|
||||||
@ -46,12 +45,12 @@ $sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
|
|||||||
$sCurrentFolder = "/" ;
|
$sCurrentFolder = "/" ;
|
||||||
|
|
||||||
// Is enabled the upload?
|
// Is enabled the upload?
|
||||||
if ( ! IsAllowedCommand( $sCommand ) )
|
if (! IsAllowedCommand($sCommand))
|
||||||
SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' );
|
SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
|
||||||
|
|
||||||
// Check if it is an allowed type.
|
// Check if it is an allowed type.
|
||||||
if ( !IsAllowedType( $sType ) )
|
if (! IsAllowedType($sType))
|
||||||
SendUploadResults( 1, '', '', 'Invalid type specified' );
|
SendUploadResults(1, '', '', 'Invalid type specified');
|
||||||
|
|
||||||
|
|
||||||
// DOL_CHANGE
|
// DOL_CHANGE
|
||||||
|
|||||||
@ -25,15 +25,20 @@
|
|||||||
function RemoveFromStart( $sourceString, $charToRemove )
|
function RemoveFromStart( $sourceString, $charToRemove )
|
||||||
{
|
{
|
||||||
$sPattern = '|^' . $charToRemove . '+|' ;
|
$sPattern = '|^' . $charToRemove . '+|' ;
|
||||||
return preg_replace( $sPattern, '', $sourceString );
|
return preg_replace($sPattern, '', $sourceString);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RemoveFromEnd( $sourceString, $charToRemove )
|
function RemoveFromEnd( $sourceString, $charToRemove)
|
||||||
{
|
{
|
||||||
$sPattern = '|' . $charToRemove . '+$|' ;
|
$sPattern = '|' . $charToRemove . '+$|' ;
|
||||||
return preg_replace( $sPattern, '', $sourceString );
|
return preg_replace($sPattern, '', $sourceString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FindBadUtf8
|
||||||
|
*
|
||||||
|
* @param unknown_type $string String
|
||||||
|
*/
|
||||||
function FindBadUtf8( $string )
|
function FindBadUtf8( $string )
|
||||||
{
|
{
|
||||||
$regex =
|
$regex =
|
||||||
@ -57,6 +62,11 @@ function FindBadUtf8( $string )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ConvertToXmlAttribute
|
||||||
|
*
|
||||||
|
* @param unknown_type $value
|
||||||
|
*/
|
||||||
function ConvertToXmlAttribute( $value )
|
function ConvertToXmlAttribute( $value )
|
||||||
{
|
{
|
||||||
if ( defined( 'PHP_OS' ) )
|
if ( defined( 'PHP_OS' ) )
|
||||||
@ -173,10 +183,9 @@ function DetectHtml( $filePath )
|
|||||||
* Currently this function validates only image files.
|
* Currently this function validates only image files.
|
||||||
* Returns false if file is invalid.
|
* Returns false if file is invalid.
|
||||||
*
|
*
|
||||||
* @param string $filePath absolute path to file
|
* @param string $filePath Absolute path to file
|
||||||
* @param string $extension file extension
|
* @param string $extension File extension
|
||||||
* @param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images
|
* @return boolean True or false
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
function IsImageValid( $filePath, $extension )
|
function IsImageValid( $filePath, $extension )
|
||||||
{
|
{
|
||||||
@ -206,11 +215,11 @@ function IsImageValid( $filePath, $extension )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !in_array( $extension, $imageCheckExtensions ) ) {
|
if (!in_array($extension, $imageCheckExtensions) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( @getimagesize( $filePath ) === false ) {
|
if (@getimagesize($filePath) === false) {
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -700,7 +700,7 @@ function write_main_file($mainfile,$main_dir)
|
|||||||
{
|
{
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
fputs($fp, '<?php'."\n");
|
fputs($fp, '<?php'."\n");
|
||||||
fputs($fp, "# Wrapper to include main into htdocs\n");
|
fputs($fp, "// Wrapper to include main into htdocs\n");
|
||||||
fputs($fp, "include_once('".$main_dir."/main.inc.php');\n");
|
fputs($fp, "include_once('".$main_dir."/main.inc.php');\n");
|
||||||
fputs($fp, '?>');
|
fputs($fp, '?>');
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@ -722,7 +722,7 @@ function write_master_file($masterfile,$main_dir)
|
|||||||
{
|
{
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
fputs($fp, '<?php'."\n");
|
fputs($fp, '<?php'."\n");
|
||||||
fputs($fp, "# Wrapper to include master into htdocs\n");
|
fputs($fp, "// Wrapper to include master into htdocs\n");
|
||||||
fputs($fp, "include_once('".$main_dir."/master.inc.php');\n");
|
fputs($fp, "include_once('".$main_dir."/master.inc.php');\n");
|
||||||
fputs($fp, '?>');
|
fputs($fp, '?>');
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user