diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 0787807f813..63adffea5ba 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -528,6 +528,7 @@ class ActionComm extends CommonObject
/**
* Load all objects with filters
*
+ * @param DoliDb $db Database handler
* @param int $socid Filter by thirdparty
* @param int $fk_element Id of element action is linked to
* @param string $elementtype Type of element action is linked to
diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php
index 6c01cb343fe..19185d01515 100755
--- a/htdocs/core/filemanagerdol/connectors/php/commands.php
+++ b/htdocs/core/filemanagerdol/connectors/php/commands.php
@@ -25,27 +25,27 @@
function GetFolders( $resourceType, $currentFolder )
{
// Map the virtual path to the local server path.
- $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' );
+ $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFolders');
// Array that will hold the folders names.
$aFolders = array();
- $oCurrentFolder = @opendir( $sServerDir );
+ $oCurrentFolder = @opendir($sServerDir);
if ($oCurrentFolder !== false)
{
- while ( $sFile = readdir( $oCurrentFolder ) )
+ while ( $sFile = readdir($oCurrentFolder) )
{
- if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
- $aFolders[] = '' ;
+ if ( $sFile != '.' && $sFile != '..' && is_dir($sServerDir . $sFile) )
+ $aFolders[] = '' ;
}
- closedir( $oCurrentFolder );
+ closedir($oCurrentFolder);
}
// Open the "Folders" node.
echo "" ;
- natcasesort( $aFolders );
+ natcasesort($aFolders);
foreach ( $aFolders as $sFolder )
echo $sFolder ;
@@ -56,44 +56,44 @@ function GetFolders( $resourceType, $currentFolder )
function GetFoldersAndFiles( $resourceType, $currentFolder )
{
// Map the virtual path to the local server path.
- $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' );
+ $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
// Arrays that will hold the folders and files names.
$aFolders = array();
$aFiles = array();
- $oCurrentFolder = @opendir( $sServerDir );
+ $oCurrentFolder = @opendir($sServerDir);
if ($oCurrentFolder !== false)
{
- while ( $sFile = readdir( $oCurrentFolder ) )
+ while ( $sFile = readdir($oCurrentFolder) )
{
if ( $sFile != '.' && $sFile != '..' )
{
- if ( is_dir( $sServerDir . $sFile ) )
- $aFolders[] = '' ;
+ if ( is_dir($sServerDir . $sFile) )
+ $aFolders[] = '' ;
else
{
- $iFileSize = @filesize( $sServerDir . $sFile );
+ $iFileSize = @filesize($sServerDir . $sFile);
if ( !$iFileSize ) {
$iFileSize = 0 ;
}
if ( $iFileSize > 0 )
{
- $iFileSize = round( $iFileSize / 1024 );
+ $iFileSize = round($iFileSize / 1024);
if ( $iFileSize < 1 )
$iFileSize = 1 ;
}
- $aFiles[] = '' ;
+ $aFiles[] = '' ;
}
}
}
- closedir( $oCurrentFolder );
+ closedir($oCurrentFolder);
}
// Send the folders
- natcasesort( $aFolders );
+ natcasesort($aFolders);
echo '' ;
foreach ( $aFolders as $sFolder )
@@ -102,7 +102,7 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
echo '' ;
// Send the files
- natcasesort( $aFiles );
+ natcasesort($aFiles);
echo '' ;
foreach ( $aFiles as $sFiles )
@@ -122,20 +122,20 @@ function CreateFolder( $resourceType, $currentFolder )
if ( isset( $_GET['NewFolderName'] ) )
{
$sNewFolderName = $_GET['NewFolderName'] ;
- $sNewFolderName = SanitizeFolderName( $sNewFolderName );
+ $sNewFolderName = SanitizeFolderName($sNewFolderName);
- if ( strpos( $sNewFolderName, '..' ) !== FALSE )
+ if (strpos($sNewFolderName, '..') !== FALSE)
$sErrorNumber = '102' ; // Invalid folder name.
else
{
// Map the virtual path to the local server path of the current folder.
- $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' );
+ $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'CreateFolder');
- if ( is_writable( $sServerDir ) )
+ if ( is_writable($sServerDir) )
{
$sServerDir .= $sNewFolderName ;
- $sErrorMsg = CreateServerFolder( $sServerDir );
+ $sErrorMsg = CreateServerFolder($sServerDir);
switch ( $sErrorMsg )
{
@@ -172,8 +172,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$sErrorNumber = '0' ;
$sFileName = '' ;
- if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] )
- # This is for the QuickUpload tab box
+ if ( isset( $_FILES['NewFile'] ) && !is_null($_FILES['NewFile']['tmp_name'])
+ // This is for the QuickUpload tab box
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
{
global $Config ;
@@ -181,21 +181,21 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];
// Map the virtual path to the local server path.
- $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand );
+ $sServerDir = ServerMapFolder($resourceType, $currentFolder, $sCommand);
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
- $sFileName = SanitizeFileName( $sFileName );
+ $sFileName = SanitizeFileName($sFileName);
$sOriginalFileName = $sFileName ;
// Get the extension.
- $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) );
- $sExtension = strtolower( $sExtension );
+ $sExtension = substr($sFileName, (strrpos($sFileName, '.') + 1));
+ $sExtension = strtolower($sExtension);
if ( isset( $Config['SecureImageUploads'] ) )
{
- if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false )
+ if ( ( $isImageValid = IsImageValid($oFile['tmp_name'], $sExtension) ) === false )
{
$sErrorNumber = '202' ;
}
@@ -203,15 +203,15 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
if ( isset( $Config['HtmlExtensions'] ) )
{
- if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) &&
- ( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true )
+ if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) &&
+ ($detectHtml = DetectHtml($oFile['tmp_name'])) === true)
{
$sErrorNumber = '202' ;
}
}
// Check if it is an allowed extension.
- if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) )
+ if ( !$sErrorNumber && IsAllowedExt($sExtension, $resourceType) )
{
$iCounter = 0 ;
@@ -219,17 +219,17 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
{
$sFilePath = $sServerDir . $sFileName ;
- if ( is_file( $sFilePath ) )
+ if ( is_file($sFilePath) )
{
$iCounter++ ;
- $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
+ $sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ;
}
else
{
- move_uploaded_file( $oFile['tmp_name'], $sFilePath );
+ move_uploaded_file($oFile['tmp_name'], $sFilePath);
- if ( is_file( $sFilePath ) )
+ if ( is_file($sFilePath) )
{
if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] )
{
@@ -244,25 +244,25 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
}
$oldumask = umask(0);
- chmod( $sFilePath, $permissions );
- umask( $oldumask );
+ chmod($sFilePath, $permissions);
+ umask($oldumask);
}
break ;
}
}
- if ( file_exists( $sFilePath ) )
+ if ( file_exists($sFilePath) )
{
//previous checks failed, try once again
- if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false )
+ if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false )
{
- @unlink( $sFilePath );
+ @unlink($sFilePath);
$sErrorNumber = '202' ;
}
- else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true )
+ else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml($sFilePath) === true )
{
- @unlink( $sFilePath );
+ @unlink($sFilePath);
$sErrorNumber = '202' ;
}
}
@@ -274,8 +274,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$sErrorNumber = '202' ;
- $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder );
- $sFileUrl = CombinePaths( $sFileUrl, $sFileName );
+ $sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
+ $sFileUrl = CombinePaths($sFileUrl, $sFileName);
// DOL_CHANGE
@@ -283,18 +283,18 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
if($CKEcallback == '')
{
// this line already exists so wrap the if block around it
- SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
+ SendUploadResults($sErrorNumber, $sFileUrl, $sFileName);
}
else
- {
- //issue the CKEditor Callback
- SendCKEditorResults (
- $CKEcallback,
- $sFileUrl,
- ($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful')
- );
- }
+ {
+ //issue the CKEditor Callback
+ SendCKEditorResults(
+ $CKEcallback,
+ $sFileUrl,
+ ($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful')
+ );
+ }
- exit ;
+ exit;
}
?>
diff --git a/htdocs/core/filemanagerdol/connectors/php/util.php b/htdocs/core/filemanagerdol/connectors/php/util.php
index b8679668743..4f479c1ce7b 100755
--- a/htdocs/core/filemanagerdol/connectors/php/util.php
+++ b/htdocs/core/filemanagerdol/connectors/php/util.php
@@ -22,13 +22,27 @@
* Utility functions for the File Manager Connector for PHP.
*/
-function RemoveFromStart( $sourceString, $charToRemove )
+/**
+ * RemoveFromStart
+ *
+ * @param string $sourceString Source
+ * @param string $charToRemove Char to remove
+ * @return string Result
+ */
+function RemoveFromStart($sourceString, $charToRemove)
{
$sPattern = '|^' . $charToRemove . '+|' ;
return preg_replace($sPattern, '', $sourceString);
}
-function RemoveFromEnd( $sourceString, $charToRemove)
+/**
+ * RemoveFromEnd
+ *
+ * @param string $sourceString Source
+ * @param string $charToRemove Rhar to remove
+ * @return string Result
+ */
+function RemoveFromEnd($sourceString, $charToRemove)
{
$sPattern = '|' . $charToRemove . '+$|' ;
return preg_replace($sPattern, '', $sourceString);
@@ -37,12 +51,12 @@ function RemoveFromEnd( $sourceString, $charToRemove)
/**
* FindBadUtf8
*
- * @param unknown_type $string String
+ * @param unknown_type $string String
+ * @return boolean
*/
-function FindBadUtf8( $string )
+function FindBadUtf8($string)
{
- $regex =
- '([\x00-\x7F]'.
+ $regex = '([\x00-\x7F]'.
'|[\xC2-\xDF][\x80-\xBF]'.
'|\xE0[\xA0-\xBF][\x80-\xBF]'.
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
@@ -65,11 +79,12 @@ function FindBadUtf8( $string )
/**
* ConvertToXmlAttribute
*
- * @param unknown_type $value
+ * @param string $value Value
+ * @return string
*/
function ConvertToXmlAttribute( $value )
{
- if ( defined( 'PHP_OS' ) )
+ if ( defined('PHP_OS') )
{
$os = PHP_OS ;
}
@@ -78,35 +93,35 @@ function ConvertToXmlAttribute( $value )
$os = php_uname();
}
- if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) )
+ if (strtoupper(substr($os, 0, 3)) === 'WIN' || FindBadUtf8($value))
{
- return ( utf8_encode( htmlspecialchars( $value ) ) );
+ return (utf8_encode(htmlspecialchars($value)));
}
else
{
- return ( htmlspecialchars( $value ) );
+ return (htmlspecialchars($value));
}
}
/**
* Check whether given extension is in html etensions list
*
- * @param string $ext
- * @param array $formExtensions
- * @return boolean
+ * @param string $ext Extension
+ * @param array $formExtensions Array of extensions
+ * @return boolean
*/
function IsHtmlExtension( $ext, $formExtensions )
{
- if ( !$formExtensions || !is_array( $formExtensions ) )
+ if (!$formExtensions || !is_array($formExtensions) )
{
return false ;
}
$lcaseHtmlExtensions = array();
foreach ( $formExtensions as $key => $val )
{
- $lcaseHtmlExtensions[$key] = strtolower( $val );
+ $lcaseHtmlExtensions[$key] = strtolower($val);
}
- return in_array( $ext, $lcaseHtmlExtensions );
+ return in_array($ext, $lcaseHtmlExtensions);
}
/**
@@ -119,28 +134,28 @@ function IsHtmlExtension( $ext, $formExtensions )
*/
function DetectHtml( $filePath )
{
- $fp = @fopen( $filePath, 'rb' );
+ $fp = @fopen($filePath, 'rb');
//open_basedir restriction, see #1906
- if ( $fp === false || !flock( $fp, LOCK_SH ) )
+ if ( $fp === false || !flock($fp, LOCK_SH) )
{
return -1 ;
}
- $chunk = fread( $fp, 1024 );
- flock( $fp, LOCK_UN );
- fclose( $fp );
+ $chunk = fread($fp, 1024);
+ flock($fp, LOCK_UN);
+ fclose($fp);
- $chunk = strtolower( $chunk );
+ $chunk = strtolower($chunk);
if (!$chunk)
{
return false ;
}
- $chunk = trim( $chunk );
+ $chunk = trim($chunk);
- if ( preg_match( "/= 4.0.7
- if ( function_exists( 'version_compare' ) ) {
+ if ( function_exists('version_compare') ) {
$sCurrentVersion = phpversion();
- if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
+ if ( version_compare($sCurrentVersion, "4.2.0") >= 0 ) {
$imageCheckExtensions[] = "tiff";
$imageCheckExtensions[] = "tif";
}
- if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
+ if ( version_compare($sCurrentVersion, "4.3.0") >= 0 ) {
$imageCheckExtensions[] = "swc";
}
- if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
+ if ( version_compare($sCurrentVersion, "4.3.2") >= 0 ) {
$imageCheckExtensions[] = "jpc";
$imageCheckExtensions[] = "jp2";
$imageCheckExtensions[] = "jpx";
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 3bea22b4e95..66f3ef30ca8 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -129,6 +129,13 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
*/
class FPDI_DolExtended extends FPDI
{
+ /**
+ * __call
+ *
+ * @param string $method Method
+ * @param mixed $args Arguments
+ * @return void
+ */
public function __call($method, $args)
{
if (isset($this->$method)) {
@@ -137,6 +144,22 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
}
}
+ /**
+ * writeHTMLCell
+ *
+ * @param unknown_type $w Width
+ * @param unknown_type $h Height
+ * @param unknown_type $x X
+ * @param unknown_type $y Y
+ * @param unknown_type $html Html
+ * @param unknown_type $border Border
+ * @param unknown_type $ln Ln
+ * @param unknown_type $fill Fill
+ * @param unknown_type $reseth Reseth
+ * @param unknown_type $align Align
+ * @param unknown_type $autopadding Autopadding
+ * @return void
+ */
public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true)
{
$this->SetXY($x,$y);
diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php
index ab5a1eea74c..4fd8452f970 100644
--- a/htdocs/core/modules/syslog/mod_syslog_file.php
+++ b/htdocs/core/modules/syslog/mod_syslog_file.php
@@ -107,7 +107,6 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
* Export the message
*
* @param array $content Array containing the info about the message
- * @param int $ident 1=Increase ident of 1, -1=Decrease ident of 1
* @return void
*/
public function export($content)
diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php
index 4e284fc0be4..0e126f5b86b 100644
--- a/htdocs/holiday/fiche.php
+++ b/htdocs/holiday/fiche.php
@@ -53,7 +53,7 @@ $now=dol_now();
if ($action == 'create')
{
$cp = new Holiday($db);
-
+
// Si pas le droit de créer une demande
if(!$user->rights->holiday->write)
{
@@ -69,7 +69,7 @@ if ($action == 'create')
if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2;
else if ($starthalfday == 'afternoon') $halfday=-1;
else if ($endhalfday == 'morning') $halfday=1;
-
+
$valideur = GETPOST('valideur');
$description = trim(GETPOST('description'));
$userID = GETPOST('userID');
@@ -124,7 +124,7 @@ if ($action == 'create')
$cp->date_fin = $date_fin;
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
-
+
$verif = $cp->create($user_id);
// Si pas d'erreur SQL on redirige vers la fiche de la demande
@@ -152,7 +152,7 @@ if ($action == 'update')
if ($starthalfday == 'afternoon' && $endhalfday == 'morning') $halfday=2;
else if ($starthalfday == 'afternoon') $halfday=-1;
else if ($endhalfday == 'morning') $halfday=1;
-
+
// Si pas le droit de modifier une demande
if(!$user->rights->holiday->write)
{
@@ -209,7 +209,7 @@ if ($action == 'update')
$cp->date_fin = $date_fin;
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
-
+
// Update
$verif = $cp->update($user->id);
if ($verif > 0)
@@ -636,9 +636,9 @@ if (empty($id) || $action == 'add' || $action == 'request')
print '