Fix: Checkstyle
This commit is contained in:
parent
78a1354a52
commit
e39ec132e5
@ -528,6 +528,7 @@ class ActionComm extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Load all objects with filters
|
* Load all objects with filters
|
||||||
*
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
* @param int $socid Filter by thirdparty
|
* @param int $socid Filter by thirdparty
|
||||||
* @param int $fk_element Id of element action is linked to
|
* @param int $fk_element Id of element action is linked to
|
||||||
* @param string $elementtype Type of element action is linked to
|
* @param string $elementtype Type of element action is linked to
|
||||||
|
|||||||
@ -25,27 +25,27 @@
|
|||||||
function GetFolders( $resourceType, $currentFolder )
|
function GetFolders( $resourceType, $currentFolder )
|
||||||
{
|
{
|
||||||
// Map the virtual path to the local server path.
|
// 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.
|
// Array that will hold the folders names.
|
||||||
$aFolders = array();
|
$aFolders = array();
|
||||||
|
|
||||||
$oCurrentFolder = @opendir( $sServerDir );
|
$oCurrentFolder = @opendir($sServerDir);
|
||||||
|
|
||||||
if ($oCurrentFolder !== false)
|
if ($oCurrentFolder !== false)
|
||||||
{
|
{
|
||||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
while ( $sFile = readdir($oCurrentFolder) )
|
||||||
{
|
{
|
||||||
if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
|
if ( $sFile != '.' && $sFile != '..' && is_dir($sServerDir . $sFile) )
|
||||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
|
||||||
}
|
}
|
||||||
closedir( $oCurrentFolder );
|
closedir($oCurrentFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the "Folders" node.
|
// Open the "Folders" node.
|
||||||
echo "<Folders>" ;
|
echo "<Folders>" ;
|
||||||
|
|
||||||
natcasesort( $aFolders );
|
natcasesort($aFolders);
|
||||||
foreach ( $aFolders as $sFolder )
|
foreach ( $aFolders as $sFolder )
|
||||||
echo $sFolder ;
|
echo $sFolder ;
|
||||||
|
|
||||||
@ -56,44 +56,44 @@ function GetFolders( $resourceType, $currentFolder )
|
|||||||
function GetFoldersAndFiles( $resourceType, $currentFolder )
|
function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||||
{
|
{
|
||||||
// Map the virtual path to the local server path.
|
// 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.
|
// Arrays that will hold the folders and files names.
|
||||||
$aFolders = array();
|
$aFolders = array();
|
||||||
$aFiles = array();
|
$aFiles = array();
|
||||||
|
|
||||||
$oCurrentFolder = @opendir( $sServerDir );
|
$oCurrentFolder = @opendir($sServerDir);
|
||||||
|
|
||||||
if ($oCurrentFolder !== false)
|
if ($oCurrentFolder !== false)
|
||||||
{
|
{
|
||||||
while ( $sFile = readdir( $oCurrentFolder ) )
|
while ( $sFile = readdir($oCurrentFolder) )
|
||||||
{
|
{
|
||||||
if ( $sFile != '.' && $sFile != '..' )
|
if ( $sFile != '.' && $sFile != '..' )
|
||||||
{
|
{
|
||||||
if ( is_dir( $sServerDir . $sFile ) )
|
if ( is_dir($sServerDir . $sFile) )
|
||||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />' ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$iFileSize = @filesize( $sServerDir . $sFile );
|
$iFileSize = @filesize($sServerDir . $sFile);
|
||||||
if ( !$iFileSize ) {
|
if ( !$iFileSize ) {
|
||||||
$iFileSize = 0 ;
|
$iFileSize = 0 ;
|
||||||
}
|
}
|
||||||
if ( $iFileSize > 0 )
|
if ( $iFileSize > 0 )
|
||||||
{
|
{
|
||||||
$iFileSize = round( $iFileSize / 1024 );
|
$iFileSize = round($iFileSize / 1024);
|
||||||
if ( $iFileSize < 1 )
|
if ( $iFileSize < 1 )
|
||||||
$iFileSize = 1 ;
|
$iFileSize = 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
|
$aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />' ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir( $oCurrentFolder );
|
closedir($oCurrentFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the folders
|
// Send the folders
|
||||||
natcasesort( $aFolders );
|
natcasesort($aFolders);
|
||||||
echo '<Folders>' ;
|
echo '<Folders>' ;
|
||||||
|
|
||||||
foreach ( $aFolders as $sFolder )
|
foreach ( $aFolders as $sFolder )
|
||||||
@ -102,7 +102,7 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
|
|||||||
echo '</Folders>' ;
|
echo '</Folders>' ;
|
||||||
|
|
||||||
// Send the files
|
// Send the files
|
||||||
natcasesort( $aFiles );
|
natcasesort($aFiles);
|
||||||
echo '<Files>' ;
|
echo '<Files>' ;
|
||||||
|
|
||||||
foreach ( $aFiles as $sFiles )
|
foreach ( $aFiles as $sFiles )
|
||||||
@ -122,20 +122,20 @@ function CreateFolder( $resourceType, $currentFolder )
|
|||||||
if ( isset( $_GET['NewFolderName'] ) )
|
if ( isset( $_GET['NewFolderName'] ) )
|
||||||
{
|
{
|
||||||
$sNewFolderName = $_GET['NewFolderName'] ;
|
$sNewFolderName = $_GET['NewFolderName'] ;
|
||||||
$sNewFolderName = SanitizeFolderName( $sNewFolderName );
|
$sNewFolderName = SanitizeFolderName($sNewFolderName);
|
||||||
|
|
||||||
if ( strpos( $sNewFolderName, '..' ) !== FALSE )
|
if (strpos($sNewFolderName, '..') !== FALSE)
|
||||||
$sErrorNumber = '102' ; // Invalid folder name.
|
$sErrorNumber = '102' ; // Invalid folder name.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Map the virtual path to the local server path of the current folder.
|
// 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 ;
|
$sServerDir .= $sNewFolderName ;
|
||||||
|
|
||||||
$sErrorMsg = CreateServerFolder( $sServerDir );
|
$sErrorMsg = CreateServerFolder($sServerDir);
|
||||||
|
|
||||||
switch ( $sErrorMsg )
|
switch ( $sErrorMsg )
|
||||||
{
|
{
|
||||||
@ -172,8 +172,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
$sErrorNumber = '0' ;
|
$sErrorNumber = '0' ;
|
||||||
$sFileName = '' ;
|
$sFileName = '' ;
|
||||||
|
|
||||||
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] )
|
if ( isset( $_FILES['NewFile'] ) && !is_null($_FILES['NewFile']['tmp_name'])
|
||||||
# This is for the QuickUpload tab box
|
// This is for the QuickUpload tab box
|
||||||
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
|
or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name'])))
|
||||||
{
|
{
|
||||||
global $Config ;
|
global $Config ;
|
||||||
@ -181,21 +181,21 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];
|
$oFile = isset($_FILES['NewFile']) ? $_FILES['NewFile'] : $_FILES['upload'];
|
||||||
|
|
||||||
// Map the virtual path to the local server path.
|
// Map the virtual path to the local server path.
|
||||||
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand );
|
$sServerDir = ServerMapFolder($resourceType, $currentFolder, $sCommand);
|
||||||
|
|
||||||
// Get the uploaded file name.
|
// Get the uploaded file name.
|
||||||
$sFileName = $oFile['name'] ;
|
$sFileName = $oFile['name'] ;
|
||||||
$sFileName = SanitizeFileName( $sFileName );
|
$sFileName = SanitizeFileName($sFileName);
|
||||||
|
|
||||||
$sOriginalFileName = $sFileName ;
|
$sOriginalFileName = $sFileName ;
|
||||||
|
|
||||||
// Get the extension.
|
// Get the extension.
|
||||||
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) );
|
$sExtension = substr($sFileName, (strrpos($sFileName, '.') + 1));
|
||||||
$sExtension = strtolower( $sExtension );
|
$sExtension = strtolower($sExtension);
|
||||||
|
|
||||||
if ( isset( $Config['SecureImageUploads'] ) )
|
if ( isset( $Config['SecureImageUploads'] ) )
|
||||||
{
|
{
|
||||||
if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false )
|
if ( ( $isImageValid = IsImageValid($oFile['tmp_name'], $sExtension) ) === false )
|
||||||
{
|
{
|
||||||
$sErrorNumber = '202' ;
|
$sErrorNumber = '202' ;
|
||||||
}
|
}
|
||||||
@ -203,15 +203,15 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
|
|
||||||
if ( isset( $Config['HtmlExtensions'] ) )
|
if ( isset( $Config['HtmlExtensions'] ) )
|
||||||
{
|
{
|
||||||
if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) &&
|
if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) &&
|
||||||
( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true )
|
($detectHtml = DetectHtml($oFile['tmp_name'])) === true)
|
||||||
{
|
{
|
||||||
$sErrorNumber = '202' ;
|
$sErrorNumber = '202' ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it is an allowed extension.
|
// Check if it is an allowed extension.
|
||||||
if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) )
|
if ( !$sErrorNumber && IsAllowedExt($sExtension, $resourceType) )
|
||||||
{
|
{
|
||||||
$iCounter = 0 ;
|
$iCounter = 0 ;
|
||||||
|
|
||||||
@ -219,17 +219,17 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
{
|
{
|
||||||
$sFilePath = $sServerDir . $sFileName ;
|
$sFilePath = $sServerDir . $sFileName ;
|
||||||
|
|
||||||
if ( is_file( $sFilePath ) )
|
if ( is_file($sFilePath) )
|
||||||
{
|
{
|
||||||
$iCounter++ ;
|
$iCounter++ ;
|
||||||
$sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
|
$sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension ;
|
||||||
$sErrorNumber = '201' ;
|
$sErrorNumber = '201' ;
|
||||||
}
|
}
|
||||||
else
|
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'] )
|
if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] )
|
||||||
{
|
{
|
||||||
@ -244,25 +244,25 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oldumask = umask(0);
|
$oldumask = umask(0);
|
||||||
chmod( $sFilePath, $permissions );
|
chmod($sFilePath, $permissions);
|
||||||
umask( $oldumask );
|
umask($oldumask);
|
||||||
}
|
}
|
||||||
|
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( file_exists( $sFilePath ) )
|
if ( file_exists($sFilePath) )
|
||||||
{
|
{
|
||||||
//previous checks failed, try once again
|
//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' ;
|
$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' ;
|
$sErrorNumber = '202' ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,8 +274,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
$sErrorNumber = '202' ;
|
$sErrorNumber = '202' ;
|
||||||
|
|
||||||
|
|
||||||
$sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder );
|
$sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder);
|
||||||
$sFileUrl = CombinePaths( $sFileUrl, $sFileName );
|
$sFileUrl = CombinePaths($sFileUrl, $sFileName);
|
||||||
|
|
||||||
|
|
||||||
// DOL_CHANGE
|
// DOL_CHANGE
|
||||||
@ -283,18 +283,18 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
|||||||
if($CKEcallback == '')
|
if($CKEcallback == '')
|
||||||
{
|
{
|
||||||
// this line already exists so wrap the if block around it
|
// this line already exists so wrap the if block around it
|
||||||
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
|
SendUploadResults($sErrorNumber, $sFileUrl, $sFileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//issue the CKEditor Callback
|
//issue the CKEditor Callback
|
||||||
SendCKEditorResults (
|
SendCKEditorResults(
|
||||||
$CKEcallback,
|
$CKEcallback,
|
||||||
$sFileUrl,
|
$sFileUrl,
|
||||||
($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful')
|
($sErrorNumber != 0 ? 'Error '. $sErrorNumber. ' upload failed.' : 'Upload Successful')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit ;
|
exit;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -22,13 +22,27 @@
|
|||||||
* Utility functions for the File Manager Connector for PHP.
|
* 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 . '+|' ;
|
$sPattern = '|^' . $charToRemove . '+|' ;
|
||||||
return preg_replace($sPattern, '', $sourceString);
|
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 . '+$|' ;
|
$sPattern = '|' . $charToRemove . '+$|' ;
|
||||||
return preg_replace($sPattern, '', $sourceString);
|
return preg_replace($sPattern, '', $sourceString);
|
||||||
@ -38,11 +52,11 @@ function RemoveFromEnd( $sourceString, $charToRemove)
|
|||||||
* FindBadUtf8
|
* FindBadUtf8
|
||||||
*
|
*
|
||||||
* @param unknown_type $string String
|
* @param unknown_type $string String
|
||||||
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function FindBadUtf8( $string )
|
function FindBadUtf8($string)
|
||||||
{
|
{
|
||||||
$regex =
|
$regex = '([\x00-\x7F]'.
|
||||||
'([\x00-\x7F]'.
|
|
||||||
'|[\xC2-\xDF][\x80-\xBF]'.
|
'|[\xC2-\xDF][\x80-\xBF]'.
|
||||||
'|\xE0[\xA0-\xBF][\x80-\xBF]'.
|
'|\xE0[\xA0-\xBF][\x80-\xBF]'.
|
||||||
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
|
'|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'.
|
||||||
@ -65,11 +79,12 @@ function FindBadUtf8( $string )
|
|||||||
/**
|
/**
|
||||||
* ConvertToXmlAttribute
|
* ConvertToXmlAttribute
|
||||||
*
|
*
|
||||||
* @param unknown_type $value
|
* @param string $value Value
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
function ConvertToXmlAttribute( $value )
|
function ConvertToXmlAttribute( $value )
|
||||||
{
|
{
|
||||||
if ( defined( 'PHP_OS' ) )
|
if ( defined('PHP_OS') )
|
||||||
{
|
{
|
||||||
$os = PHP_OS ;
|
$os = PHP_OS ;
|
||||||
}
|
}
|
||||||
@ -78,35 +93,35 @@ function ConvertToXmlAttribute( $value )
|
|||||||
$os = php_uname();
|
$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
|
else
|
||||||
{
|
{
|
||||||
return ( htmlspecialchars( $value ) );
|
return (htmlspecialchars($value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether given extension is in html etensions list
|
* Check whether given extension is in html etensions list
|
||||||
*
|
*
|
||||||
* @param string $ext
|
* @param string $ext Extension
|
||||||
* @param array $formExtensions
|
* @param array $formExtensions Array of extensions
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function IsHtmlExtension( $ext, $formExtensions )
|
function IsHtmlExtension( $ext, $formExtensions )
|
||||||
{
|
{
|
||||||
if ( !$formExtensions || !is_array( $formExtensions ) )
|
if (!$formExtensions || !is_array($formExtensions) )
|
||||||
{
|
{
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
$lcaseHtmlExtensions = array();
|
$lcaseHtmlExtensions = array();
|
||||||
foreach ( $formExtensions as $key => $val )
|
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 )
|
function DetectHtml( $filePath )
|
||||||
{
|
{
|
||||||
$fp = @fopen( $filePath, 'rb' );
|
$fp = @fopen($filePath, 'rb');
|
||||||
|
|
||||||
//open_basedir restriction, see #1906
|
//open_basedir restriction, see #1906
|
||||||
if ( $fp === false || !flock( $fp, LOCK_SH ) )
|
if ( $fp === false || !flock($fp, LOCK_SH) )
|
||||||
{
|
{
|
||||||
return -1 ;
|
return -1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$chunk = fread( $fp, 1024 );
|
$chunk = fread($fp, 1024);
|
||||||
flock( $fp, LOCK_UN );
|
flock($fp, LOCK_UN);
|
||||||
fclose( $fp );
|
fclose($fp);
|
||||||
|
|
||||||
$chunk = strtolower( $chunk );
|
$chunk = strtolower($chunk);
|
||||||
|
|
||||||
if (!$chunk)
|
if (!$chunk)
|
||||||
{
|
{
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
$chunk = trim( $chunk );
|
$chunk = trim($chunk);
|
||||||
|
|
||||||
if ( preg_match( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) )
|
if ( preg_match("/<!DOCTYPE\W*X?HTML/sim", $chunk) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -149,14 +164,14 @@ function DetectHtml( $filePath )
|
|||||||
|
|
||||||
foreach( $tags as $tag )
|
foreach( $tags as $tag )
|
||||||
{
|
{
|
||||||
if( false !== strpos( $chunk, $tag ) )
|
if( false !== strpos($chunk, $tag) )
|
||||||
{
|
{
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//type = javascript
|
//type = javascript
|
||||||
if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) )
|
if ( preg_match('!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk) )
|
||||||
{
|
{
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@ -164,13 +179,13 @@ function DetectHtml( $filePath )
|
|||||||
//href = javascript
|
//href = javascript
|
||||||
//src = javascript
|
//src = javascript
|
||||||
//data = javascript
|
//data = javascript
|
||||||
if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
|
if ( preg_match('!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
|
||||||
{
|
{
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//url(javascript
|
//url(javascript
|
||||||
if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) )
|
if ( preg_match('!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk) )
|
||||||
{
|
{
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@ -196,16 +211,16 @@ function IsImageValid( $filePath, $extension )
|
|||||||
$imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff');
|
$imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff');
|
||||||
|
|
||||||
// version_compare is available since PHP4 >= 4.0.7
|
// version_compare is available since PHP4 >= 4.0.7
|
||||||
if ( function_exists( 'version_compare' ) ) {
|
if ( function_exists('version_compare') ) {
|
||||||
$sCurrentVersion = phpversion();
|
$sCurrentVersion = phpversion();
|
||||||
if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
|
if ( version_compare($sCurrentVersion, "4.2.0") >= 0 ) {
|
||||||
$imageCheckExtensions[] = "tiff";
|
$imageCheckExtensions[] = "tiff";
|
||||||
$imageCheckExtensions[] = "tif";
|
$imageCheckExtensions[] = "tif";
|
||||||
}
|
}
|
||||||
if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
|
if ( version_compare($sCurrentVersion, "4.3.0") >= 0 ) {
|
||||||
$imageCheckExtensions[] = "swc";
|
$imageCheckExtensions[] = "swc";
|
||||||
}
|
}
|
||||||
if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
|
if ( version_compare($sCurrentVersion, "4.3.2") >= 0 ) {
|
||||||
$imageCheckExtensions[] = "jpc";
|
$imageCheckExtensions[] = "jpc";
|
||||||
$imageCheckExtensions[] = "jp2";
|
$imageCheckExtensions[] = "jp2";
|
||||||
$imageCheckExtensions[] = "jpx";
|
$imageCheckExtensions[] = "jpx";
|
||||||
|
|||||||
@ -129,6 +129,13 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
*/
|
*/
|
||||||
class FPDI_DolExtended extends FPDI
|
class FPDI_DolExtended extends FPDI
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* __call
|
||||||
|
*
|
||||||
|
* @param string $method Method
|
||||||
|
* @param mixed $args Arguments
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function __call($method, $args)
|
public function __call($method, $args)
|
||||||
{
|
{
|
||||||
if (isset($this->$method)) {
|
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)
|
public function writeHTMLCell($w, $h, $x, $y, $html = '', $border = 0, $ln = 0, $fill = false, $reseth = true, $align = '', $autopadding = true)
|
||||||
{
|
{
|
||||||
$this->SetXY($x,$y);
|
$this->SetXY($x,$y);
|
||||||
|
|||||||
@ -107,7 +107,6 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
|
|||||||
* Export the message
|
* Export the message
|
||||||
*
|
*
|
||||||
* @param array $content Array containing the info about 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
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function export($content)
|
public function export($content)
|
||||||
|
|||||||
@ -828,7 +828,7 @@ else
|
|||||||
if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator)
|
if ($action == 'refuse' && $cp->statut == 2 && $userID == $cp->fk_validator)
|
||||||
{
|
{
|
||||||
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
$array_input = array(array('type'=>"text",'label'=>"Entrez ci-dessous un motif de refus :",'name'=>"detail_refuse",'size'=>"50",'value'=>""));
|
||||||
$ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse",$langs->trans("TitleRefuseCP"),"","confirm_refuse", $array_input, 1 ,0);
|
$ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), "", "confirm_refuse", $array_input, 1, 0);
|
||||||
if ($ret == 'html') print '<br />';
|
if ($ret == 'html') print '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -305,7 +305,7 @@ if (! empty($holiday->holiday))
|
|||||||
print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>';
|
print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>';
|
||||||
print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>';
|
print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'] ,0, 1, $infos_CP['halfday']);
|
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'], 0, 1, $infos_CP['halfday']);
|
||||||
print $nbopenedday;
|
print $nbopenedday;
|
||||||
print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
print '<td align="right">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|||||||
@ -228,8 +228,6 @@ $server->register(
|
|||||||
*
|
*
|
||||||
* @param array $authentication Array of authentication information
|
* @param array $authentication Array of authentication information
|
||||||
* @param int $id Id of object
|
* @param int $id Id of object
|
||||||
* @param string $ref Ref of object
|
|
||||||
* @param ref_ext $ref_ext Ref external of object
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getActionComm($authentication,$id)
|
function getActionComm($authentication,$id)
|
||||||
|
|||||||
@ -444,6 +444,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='')
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get list of orders for third party
|
* Get list of orders for third party
|
||||||
|
*
|
||||||
* @param array $authentication Array of authentication information
|
* @param array $authentication Array of authentication information
|
||||||
* @param int $idthirdparty Id of thirdparty
|
* @param int $idthirdparty Id of thirdparty
|
||||||
* @return array Array result
|
* @return array Array result
|
||||||
@ -604,6 +605,7 @@ function getOrdersForThirdParty($authentication,$idthirdparty)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create order
|
* Create order
|
||||||
|
*
|
||||||
* @param array $authentication Array of authentication information
|
* @param array $authentication Array of authentication information
|
||||||
* @param array $order Order info
|
* @param array $order Order info
|
||||||
* @return int Id of new order
|
* @return int Id of new order
|
||||||
@ -701,6 +703,7 @@ function createOrder($authentication,$order)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Valid an order
|
* Valid an order
|
||||||
|
*
|
||||||
* @param array $authentication Array of authentication information
|
* @param array $authentication Array of authentication information
|
||||||
* @param int $id Id of order to validate
|
* @param int $id Id of order to validate
|
||||||
* @return array Array result
|
* @return array Array result
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user