Checkstyle

This commit is contained in:
Laurent Destailleur 2012-07-29 15:28:39 +02:00
parent b43c7e1b35
commit e8b2489c1c
8 changed files with 74 additions and 76 deletions

View File

@ -632,27 +632,27 @@ else if ($action == 'addline' && $user->rights->commande->creer)
{
// Insert line
$result = $object->addline(
$object->id,
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx,
$localtax2_tx,
GETPOST('idprod'),
GETPOST('remise_percent'),
$info_bits,
0,
$price_base_type,
$pu_ttc,
$date_start,
$date_end,
$type,
-1,
'',
GETPOST('fk_parent_line'),
GETPOST('np_fournprice'),
GETPOST('np_buying_price')
$object->id,
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx,
$localtax2_tx,
GETPOST('idprod'),
GETPOST('remise_percent'),
$info_bits,
0,
$price_base_type,
$pu_ttc,
$date_start,
$date_end,
$type,
-1,
'',
GETPOST('fk_parent_line'),
GETPOST('np_fournprice'),
GETPOST('np_buying_price')
);
if ($result > 0)

View File

@ -43,9 +43,9 @@ class RemiseCheque extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function RemiseCheque($DB)
function RemiseCheque($db)
{
$this->db = $DB;
$this->next_id = 0;

View File

@ -44,7 +44,7 @@ function SetXmlHeaders()
header('Pragma: no-cache');
// 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 )
@ -58,7 +58,7 @@ function CreateXmlHeader( $command, $resourceType, $currentFolder )
echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ;
// 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 ;
}
@ -68,14 +68,21 @@ function CreateXmlFooter()
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' )
SendUploadResults( $number, "", "", $text );
SendUploadResults($number, "", "", $text);
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
{
SendErrorNode( $number, $text );
SendErrorNode($number, $text);
CreateXmlFooter();
}
else
@ -87,17 +94,17 @@ function SendError( $number, $text )
echo '<Connector>' ;
SendErrorNode( $number, $text );
SendErrorNode($number, $text);
echo '</Connector>' ;
}
exit ;
}
function SendErrorNode( $number, $text )
function SendErrorNode($number, $text)
{
if ($text)
echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ;
echo '<Error number="' . $number . '" text="' . htmlspecialchars($text) . '" />' ;
else
echo '<Error number="' . $number . '" />' ;
}

View File

@ -29,10 +29,9 @@ require('./util.php');
require('./io.php');
require('./basexml.php');
require('./commands.php');
require('./phpcompat.php');
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();
@ -50,33 +49,33 @@ function DoResponse()
$sCurrentFolder = GetCurrentFolder();
// Check if it is an allowed command
if ( ! IsAllowedCommand( $sCommand ) )
SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' );
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' );
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 );
FileUpload($sResourceType, $sCurrentFolder, $sCommand);
return ;
}
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder );
CreateXmlHeader($sCommand, $sResourceType, $sCurrentFolder);
// Execute the required command.
switch ( $sCommand )
{
case 'GetFolders' :
GetFolders( $sResourceType, $sCurrentFolder );
GetFolders($sResourceType, $sCurrentFolder);
break ;
case 'GetFoldersAndFiles' :
GetFoldersAndFiles( $sResourceType, $sCurrentFolder );
GetFoldersAndFiles($sResourceType, $sCurrentFolder);
break ;
case 'CreateFolder' :
CreateFolder( $sResourceType, $sCurrentFolder );
CreateFolder($sResourceType, $sCurrentFolder);
break ;
}

View File

@ -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') ? '\\' : '/');
}

View File

@ -26,17 +26,16 @@ require('./config.php');
require('./util.php');
require('./io.php');
require('./commands.php');
require('./phpcompat.php');
function SendError( $number, $text )
{
SendUploadResults( $number, '', '', $text );
SendUploadResults($number, '', '', $text);
}
// 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' );
SendUploadResults('1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file');
$sCommand = 'QuickUpload' ;
@ -46,12 +45,12 @@ $sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
$sCurrentFolder = "/" ;
// Is enabled the upload?
if ( ! IsAllowedCommand( $sCommand ) )
SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' );
if (! IsAllowedCommand($sCommand))
SendUploadResults('1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed');
// Check if it is an allowed type.
if ( !IsAllowedType( $sType ) )
SendUploadResults( 1, '', '', 'Invalid type specified' );
if (! IsAllowedType($sType))
SendUploadResults(1, '', '', 'Invalid type specified');
// DOL_CHANGE

View File

@ -25,15 +25,20 @@
function RemoveFromStart( $sourceString, $charToRemove )
{
$sPattern = '|^' . $charToRemove . '+|' ;
return preg_replace( $sPattern, '', $sourceString );
return preg_replace($sPattern, '', $sourceString);
}
function RemoveFromEnd( $sourceString, $charToRemove )
function RemoveFromEnd( $sourceString, $charToRemove)
{
$sPattern = '|' . $charToRemove . '+$|' ;
return preg_replace( $sPattern, '', $sourceString );
return preg_replace($sPattern, '', $sourceString);
}
/**
* FindBadUtf8
*
* @param unknown_type $string String
*/
function FindBadUtf8( $string )
{
$regex =
@ -57,6 +62,11 @@ function FindBadUtf8( $string )
return false;
}
/**
* ConvertToXmlAttribute
*
* @param unknown_type $value
*/
function ConvertToXmlAttribute( $value )
{
if ( defined( 'PHP_OS' ) )
@ -173,10 +183,9 @@ function DetectHtml( $filePath )
* Currently this function validates only image files.
* Returns false if file is invalid.
*
* @param string $filePath absolute path to file
* @param string $extension file extension
* @param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images
* @return boolean
* @param string $filePath Absolute path to file
* @param string $extension File extension
* @return boolean True or false
*/
function IsImageValid( $filePath, $extension )
{
@ -206,11 +215,11 @@ function IsImageValid( $filePath, $extension )
}
}
if ( !in_array( $extension, $imageCheckExtensions ) ) {
if (!in_array($extension, $imageCheckExtensions) ) {
return true;
}
if ( @getimagesize( $filePath ) === false ) {
if (@getimagesize($filePath) === false) {
return false ;
}

View File

@ -700,7 +700,7 @@ function write_main_file($mainfile,$main_dir)
{
clearstatcache();
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, '?>');
fclose($fp);
@ -722,7 +722,7 @@ function write_master_file($masterfile,$main_dir)
{
clearstatcache();
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, '?>');
fclose($fp);