forked from Wavyzz/dolibarr
Fix: Space after closing parenthesis of function call prohibited
This commit is contained in:
@@ -49,7 +49,7 @@ class BoutiqueClient
|
||||
|
||||
$sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers WHERE customers_id = ".$id;
|
||||
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$result = $this->db->fetch_array($resql);
|
||||
|
||||
@@ -63,7 +63,7 @@ class BoutiqueCommande
|
||||
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
|
||||
$sql.= " WHERE orders_id = ".$id;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$array = $this->db->fetch_array($result);
|
||||
|
||||
@@ -53,7 +53,7 @@ class Critique {
|
||||
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " AND r.reviews_id=$id";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
|
||||
@@ -139,7 +139,7 @@ class Promotion {
|
||||
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories as c,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories_description as cd";
|
||||
$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".$conf->global->OSC_LANGUAGE_ID;
|
||||
$sql .= " AND c.categories_id = ".$id;
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ( $result ) {
|
||||
$result = $this->db->fetch_array($result);
|
||||
|
||||
@@ -803,8 +803,8 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
||||
$productid = $_POST['productid'] ;
|
||||
if ($productid)
|
||||
{
|
||||
$product = new Product($db) ;
|
||||
$res=$product->fetch($productid) ;
|
||||
$product = new Product($db);
|
||||
$res=$product->fetch($productid);
|
||||
$price_min = $product->price_min;
|
||||
if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level];
|
||||
}
|
||||
|
||||
@@ -1220,7 +1220,7 @@ class Commande extends CommonObject
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
@@ -59,7 +59,7 @@ class ComptaCompte
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux ";
|
||||
$sql .= " WHERE numero = '" .trim($this->numero)."'";
|
||||
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ( $resql )
|
||||
{
|
||||
|
||||
@@ -205,7 +205,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
dol_syslog("Deplacement::fetch sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@@ -341,7 +341,7 @@ class Deplacement extends CommonObject
|
||||
$sql.= " WHERE active = ".$active;
|
||||
|
||||
dol_syslog("Deplacement::listOfTypes sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
@@ -237,7 +237,7 @@ class Don extends CommonObject
|
||||
$this->amount = trim($this->amount);
|
||||
|
||||
$map = range(0,9);
|
||||
for ($i = 0; $i < dol_strlen($this->amount) ; $i++)
|
||||
for ($i = 0; $i < dol_strlen($this->amount); $i++)
|
||||
{
|
||||
if (!isset($map[substr($this->amount, $i, 1)] ))
|
||||
{
|
||||
|
||||
@@ -972,7 +972,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
|
||||
{
|
||||
if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
|
||||
{
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ;
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie));
|
||||
$result = -1 ;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -57,7 +57,7 @@ if ($_POST["action"] == "builddoc" && $user->rights->facture->lire)
|
||||
$factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofexclusion),'\.meta$|\.png','date',SORT_DESC);
|
||||
|
||||
// liste les fichiers
|
||||
$files = array() ;
|
||||
$files = array();
|
||||
$factures_bak = $factures ;
|
||||
foreach($_POST['toGenerate'] as $basename){
|
||||
foreach($factures as $facture){
|
||||
|
||||
@@ -746,7 +746,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
|
||||
print '<td align="center" width="16"> </td>';
|
||||
print '</tr>';
|
||||
$tot_ht=$tot_ttc=$tot_tobill=0;
|
||||
$societestatic = new Societe($db) ;
|
||||
$societestatic = new Societe($db);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@@ -845,7 +845,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
$societestatic = new Societe($db) ;
|
||||
$societestatic = new Societe($db);
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
@@ -877,7 +877,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->nom=$obj->nom;
|
||||
$societestatic->client=1;
|
||||
print $societestatic->getNomUrl(1,'customer',44) ;
|
||||
print $societestatic->getNomUrl(1,'customer',44);
|
||||
print '</a></td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
@@ -948,7 +948,7 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
|
||||
print '<td align="right">'.$langs->trans("Paid").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
print "</tr>\n";
|
||||
$societestatic = new Societe($db) ;
|
||||
$societestatic = new Societe($db);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
@@ -112,8 +112,8 @@ if ($result)
|
||||
$compta_prod = $obj->accountancy_code_buy;
|
||||
if (empty($compta_prod))
|
||||
{
|
||||
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef") ;
|
||||
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_BUY_ACCOUNT))?$conf->global->COMPTA_PRODUCT_BUY_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT))?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
}
|
||||
$compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ if ($result)
|
||||
$compta_prod = $obj->accountancy_code_sell;
|
||||
if (empty($compta_prod))
|
||||
{
|
||||
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT))?$conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT:$langs->trans("CodeNotDef") ;
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT))?$conf->global->COMPTA_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef") ;
|
||||
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT))?$conf->global->COMPTA_PRODUCT_SOLD_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT))?$conf->global->COMPTA_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
}
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT))?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef");
|
||||
$compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;
|
||||
|
||||
@@ -654,7 +654,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " WHERE rowid < ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->errno = -1035;
|
||||
@@ -667,7 +667,7 @@ class RemiseCheque extends CommonObject
|
||||
$sql.= " WHERE rowid > ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->errno = -1035;
|
||||
|
||||
@@ -335,7 +335,7 @@ class Tva extends CommonObject
|
||||
$payee = $this->tva_sum_payee($year);
|
||||
$collectee = $this->tva_sum_collectee($year);
|
||||
|
||||
$solde = $reglee - ($collectee - $payee) ;
|
||||
$solde = $reglee - ($collectee - $payee);
|
||||
|
||||
return $solde;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ class Contrat extends CommonObject
|
||||
$sql.= " commentaire = '".$this->db->escape($comment)."'";
|
||||
$sql.= " WHERE rowid = ".$line_id . " AND statut = 4";
|
||||
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Appel des triggers
|
||||
@@ -287,7 +287,7 @@ class Contrat extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1";
|
||||
$sql .= " WHERE rowid = ".$this->id . " AND statut = 0";
|
||||
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->use_webcal=($conf->global->PHPWEBCALENDAR_CONTRACTSTATUS=='always'?1:0);
|
||||
@@ -327,7 +327,7 @@ class Contrat extends CommonObject
|
||||
else $sql.= " WHERE rowid=".$id;
|
||||
|
||||
dol_syslog("Contrat::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result = $this->db->fetch_array($resql);
|
||||
|
||||
@@ -290,7 +290,7 @@ if ($action == 'addline' && $user->rights->contrat->creer)
|
||||
|
||||
if($price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
|
||||
{
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie)) ;
|
||||
$object->error = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->monnaie));
|
||||
$result = -1 ;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -653,7 +653,7 @@ abstract class CommonObject
|
||||
if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN (0,'.(! empty($conf->entities[$this->element]) ? $conf->entities[$this->element] : $conf->entity).')';
|
||||
|
||||
//print $sql."<br>";
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
@@ -675,7 +675,7 @@ abstract class CommonObject
|
||||
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
|
||||
|
||||
//print $sql."<br>";
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
|
||||
@@ -88,7 +88,7 @@ class DolCookie
|
||||
$this->myValue .= strval(chr($this->cookiearray[$f]/$this->myKey));
|
||||
}
|
||||
|
||||
return(base64_decode($this->myValue)) ;
|
||||
return(base64_decode($this->myValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ require('../../../../main.inc.php');
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
d = d.replace( /.*?(?:\.|$)/, '' );
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
@@ -60,36 +60,36 @@ require('../../../../main.inc.php');
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
})();
|
||||
|
||||
function GetUrlParam( paramName )
|
||||
{
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
|
||||
var oMatch = oRegex.exec( window.top.location.search ) ;
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
|
||||
var oMatch = oRegex.exec( window.top.location.search );
|
||||
|
||||
if ( oMatch && oMatch.length > 1 )
|
||||
return decodeURIComponent( oMatch[1] ) ;
|
||||
return decodeURIComponent( oMatch[1] );
|
||||
else
|
||||
return '' ;
|
||||
}
|
||||
|
||||
var oConnector = new Object() ;
|
||||
var oConnector = new Object();
|
||||
oConnector.CurrentFolder = '/' ;
|
||||
|
||||
var sConnUrl = GetUrlParam( 'Connector' ) ;
|
||||
var sConnUrl = GetUrlParam( 'Connector' );
|
||||
|
||||
// Gecko has some problems when using relative URLs (not starting with slash).
|
||||
if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
|
||||
sConnUrl = window.location.href.replace( /browser.php.*$/, '' ) + sConnUrl ;
|
||||
|
||||
oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ) ;
|
||||
oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' );
|
||||
|
||||
var sServerPath = GetUrlParam( 'ServerPath' ) ;
|
||||
var sServerPath = GetUrlParam( 'ServerPath' );
|
||||
if ( sServerPath.length > 0 )
|
||||
oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ;
|
||||
|
||||
oConnector.ResourceType = GetUrlParam( 'Type' ) ;
|
||||
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ) ;
|
||||
oConnector.ResourceType = GetUrlParam( 'Type' );
|
||||
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 );
|
||||
|
||||
if ( oConnector.ShowAllTypes )
|
||||
oConnector.ResourceType = 'File' ;
|
||||
@@ -98,19 +98,19 @@ oConnector.SendCommand = function( command, params, callBackFunction )
|
||||
{
|
||||
var sUrl = this.ConnectorUrl + 'Command=' + command ;
|
||||
sUrl += '&Type=' + this.ResourceType ;
|
||||
sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;
|
||||
sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder );
|
||||
|
||||
if ( params ) sUrl += '&' + params ;
|
||||
|
||||
// Add a random salt to avoid getting a cached version of the command execution
|
||||
sUrl += '&uuid=' + new Date().getTime() ;
|
||||
sUrl += '&uuid=' + new Date().getTime();
|
||||
|
||||
var oXML = new FCKXml() ;
|
||||
var oXML = new FCKXml();
|
||||
|
||||
if ( callBackFunction )
|
||||
oXML.LoadUrl( sUrl, callBackFunction ) ; // Asynchronous load.
|
||||
oXML.LoadUrl( sUrl, callBackFunction ); // Asynchronous load.
|
||||
else
|
||||
return oXML.LoadUrl( sUrl ) ;
|
||||
return oXML.LoadUrl( sUrl );
|
||||
|
||||
return null ;
|
||||
}
|
||||
@@ -118,53 +118,53 @@ oConnector.SendCommand = function( command, params, callBackFunction )
|
||||
oConnector.CheckError = function( responseXml )
|
||||
{
|
||||
var iErrorNumber = 0 ;
|
||||
var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ;
|
||||
var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' );
|
||||
|
||||
if ( oErrorNode )
|
||||
{
|
||||
iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ;
|
||||
iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 );
|
||||
|
||||
switch ( iErrorNumber )
|
||||
{
|
||||
case 0 :
|
||||
break ;
|
||||
case 1 : // Custom error. Message placed in the "text" attribute.
|
||||
alert( oErrorNode.attributes.getNamedItem('text').value ) ;
|
||||
alert( oErrorNode.attributes.getNamedItem('text').value );
|
||||
break ;
|
||||
case 101 :
|
||||
alert( 'Folder already exists' ) ;
|
||||
alert( 'Folder already exists' );
|
||||
break ;
|
||||
case 102 :
|
||||
alert( 'Invalid folder name' ) ;
|
||||
alert( 'Invalid folder name' );
|
||||
break ;
|
||||
case 103 :
|
||||
alert( 'You have no permissions to create the folder' ) ;
|
||||
alert( 'You have no permissions to create the folder' );
|
||||
break ;
|
||||
case 110 :
|
||||
alert( 'Unknown error creating folder' ) ;
|
||||
alert( 'Unknown error creating folder' );
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on your request. Error number: ' + iErrorNumber ) ;
|
||||
alert( 'Error on your request. Error number: ' + iErrorNumber );
|
||||
break ;
|
||||
}
|
||||
}
|
||||
return iErrorNumber ;
|
||||
}
|
||||
|
||||
var oIcons = new Object() ;
|
||||
var oIcons = new Object();
|
||||
|
||||
oIcons.AvailableIconsArray = [
|
||||
'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js',
|
||||
'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ;
|
||||
|
||||
oIcons.AvailableIcons = new Object() ;
|
||||
oIcons.AvailableIcons = new Object();
|
||||
|
||||
for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
|
||||
oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
|
||||
|
||||
oIcons.GetIcon = function( fileName )
|
||||
{
|
||||
var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ;
|
||||
var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase();
|
||||
|
||||
if ( this.AvailableIcons[ sExtension ] == true )
|
||||
return sExtension ;
|
||||
@@ -175,9 +175,9 @@ oIcons.GetIcon = function( fileName )
|
||||
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
|
||||
{
|
||||
if (errorNumber == "1")
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ;
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg );
|
||||
else
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ;
|
||||
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName );
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -66,7 +66,7 @@ require('../../../../main.inc.php'); ?>
|
||||
{}
|
||||
|
||||
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
|
||||
d = d.replace( /.*?(?:\.|$)/, '' ) ;
|
||||
d = d.replace( /.*?(?:\.|$)/, '' );
|
||||
|
||||
if ( d.length == 0 )
|
||||
break ; // It was not able to detect the domain.
|
||||
@@ -80,7 +80,7 @@ require('../../../../main.inc.php'); ?>
|
||||
break ;
|
||||
}
|
||||
}
|
||||
})() ;
|
||||
})();
|
||||
|
||||
function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
|
||||
@@ -63,48 +63,48 @@ function CreateFolder()
|
||||
|
||||
while ( true )
|
||||
{
|
||||
sFolderName = prompt( 'Type the name of the new folder:', '' ) ;
|
||||
sFolderName = prompt( 'Type the name of the new folder:', '' );
|
||||
|
||||
if ( sFolderName == null )
|
||||
return ;
|
||||
else if ( sFolderName.length == 0 )
|
||||
alert( 'Please type the folder name' ) ;
|
||||
alert( 'Please type the folder name' );
|
||||
else
|
||||
break ;
|
||||
}
|
||||
|
||||
oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack ) ;
|
||||
oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack );
|
||||
}
|
||||
|
||||
function CreateFolderCallBack( fckXml )
|
||||
{
|
||||
if ( oConnector.CheckError( fckXml ) == 0 )
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
window.parent.frames['frmResourcesList'].Refresh();
|
||||
|
||||
/*
|
||||
// Get the current folder path.
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/Error' ) ;
|
||||
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value ) ;
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/Error' );
|
||||
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value );
|
||||
|
||||
switch ( iErrorNumber )
|
||||
{
|
||||
case 0 :
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
window.parent.frames['frmResourcesList'].Refresh();
|
||||
break ;
|
||||
case 101 :
|
||||
alert( 'Folder already exists' ) ;
|
||||
alert( 'Folder already exists' );
|
||||
break ;
|
||||
case 102 :
|
||||
alert( 'Invalid folder name' ) ;
|
||||
alert( 'Invalid folder name' );
|
||||
break ;
|
||||
case 103 :
|
||||
alert( 'You have no permissions to create the folder' ) ;
|
||||
alert( 'You have no permissions to create the folder' );
|
||||
break ;
|
||||
case 110 :
|
||||
alert( 'Unknown error creating folder' ) ;
|
||||
alert( 'Unknown error creating folder' );
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error creating folder. Error number: ' + iErrorNumber ) ;
|
||||
alert( 'Error creating folder. Error number: ' + iErrorNumber );
|
||||
break ;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -61,42 +61,42 @@ var sActiveFolder ;
|
||||
var bIsLoaded = false ;
|
||||
var iIntervalId ;
|
||||
|
||||
var oListManager = new Object() ;
|
||||
var oListManager = new Object();
|
||||
|
||||
oListManager.Init = function()
|
||||
{
|
||||
this.Table = document.getElementById('tableFiles') ;
|
||||
this.UpRow = document.getElementById('trUp') ;
|
||||
this.Table = document.getElementById('tableFiles');
|
||||
this.UpRow = document.getElementById('trUp');
|
||||
|
||||
this.TableRows = new Object() ;
|
||||
this.TableRows = new Object();
|
||||
}
|
||||
|
||||
oListManager.Clear = function()
|
||||
{
|
||||
// Remove all other rows available.
|
||||
while ( this.Table.rows.length > 1 )
|
||||
this.Table.deleteRow(1) ;
|
||||
this.Table.deleteRow(1);
|
||||
|
||||
// Reset the TableRows collection.
|
||||
this.TableRows = new Object() ;
|
||||
this.TableRows = new Object();
|
||||
}
|
||||
|
||||
oListManager.AddItem = function( folderName, folderPath )
|
||||
{
|
||||
// Create the new row.
|
||||
var oRow = this.Table.insertRow(-1) ;
|
||||
var oRow = this.Table.insertRow(-1);
|
||||
oRow.className = 'FolderListFolder' ;
|
||||
|
||||
// Build the link to view the folder.
|
||||
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
|
||||
|
||||
// Add the folder icon cell.
|
||||
var oCell = oRow.insertCell(-1) ;
|
||||
var oCell = oRow.insertCell(-1);
|
||||
oCell.width = 16 ;
|
||||
oCell.innerHTML = sLink + '<img alt="" src="spacer.gif" width="16" height="16" border="0"><\/a>' ;
|
||||
|
||||
// Add the folder name cell.
|
||||
oCell = oRow.insertCell(-1) ;
|
||||
oCell = oRow.insertCell(-1);
|
||||
oCell.noWrap = true ;
|
||||
oCell.innerHTML = ' ' + sLink + folderName + '<\/a>' ;
|
||||
|
||||
@@ -105,13 +105,13 @@ oListManager.AddItem = function( folderName, folderPath )
|
||||
|
||||
oListManager.ShowUpFolder = function( upFolderPath )
|
||||
{
|
||||
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ;
|
||||
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
|
||||
|
||||
if ( upFolderPath != null )
|
||||
{
|
||||
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
|
||||
{
|
||||
LoadFolders( upFolderPath ) ;
|
||||
LoadFolders( upFolderPath );
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
@@ -124,9 +124,9 @@ function CheckLoaded()
|
||||
&& window.top.IsLoadedUpload
|
||||
&& window.top.IsLoadedResourcesList )
|
||||
{
|
||||
window.clearInterval( iIntervalId ) ;
|
||||
window.clearInterval( iIntervalId );
|
||||
bIsLoaded = true ;
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
OpenFolder( sActiveFolder );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ function OpenFolder( folderPath )
|
||||
if ( ! bIsLoaded )
|
||||
{
|
||||
if ( ! iIntervalId )
|
||||
iIntervalId = window.setInterval( CheckLoaded, 100 ) ;
|
||||
iIntervalId = window.setInterval( CheckLoaded, 100 );
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -145,39 +145,39 @@ function OpenFolder( folderPath )
|
||||
for ( var sFolderPath in oListManager.TableRows )
|
||||
{
|
||||
oListManager.TableRows[ sFolderPath ].className =
|
||||
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ;
|
||||
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
|
||||
}
|
||||
|
||||
// Set the current folder in all frames.
|
||||
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
|
||||
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
|
||||
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
|
||||
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ;
|
||||
window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath );
|
||||
}
|
||||
|
||||
function LoadFolders( folderPath )
|
||||
{
|
||||
// Clear the folders list.
|
||||
oListManager.Clear() ;
|
||||
oListManager.Clear();
|
||||
|
||||
// Get the parent folder path.
|
||||
var sParentFolderPath ;
|
||||
if ( folderPath != '/' )
|
||||
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ;
|
||||
sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 );
|
||||
|
||||
// Show/Hide the Up Folder.
|
||||
oListManager.ShowUpFolder( sParentFolderPath ) ;
|
||||
oListManager.ShowUpFolder( sParentFolderPath );
|
||||
|
||||
if ( folderPath != '/' )
|
||||
{
|
||||
sActiveFolder = folderPath ;
|
||||
oConnector.CurrentFolder = sParentFolderPath ;
|
||||
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ;
|
||||
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
|
||||
}
|
||||
else
|
||||
OpenFolder( '/' ) ;
|
||||
OpenFolder( '/' );
|
||||
}
|
||||
|
||||
function GetFoldersCallBack( fckXml )
|
||||
@@ -186,30 +186,30 @@ function GetFoldersCallBack( fckXml )
|
||||
return ;
|
||||
|
||||
// Get the current folder path.
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
||||
var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
|
||||
var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ;
|
||||
|
||||
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
||||
var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
|
||||
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
||||
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ;
|
||||
oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' );
|
||||
}
|
||||
|
||||
OpenFolder( sActiveFolder ) ;
|
||||
OpenFolder( sActiveFolder );
|
||||
}
|
||||
|
||||
function SetResourceType( type )
|
||||
{
|
||||
oConnector.ResourceType = type ;
|
||||
LoadFolders( '/' ) ;
|
||||
LoadFolders( '/' );
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
oListManager.Init() ;
|
||||
LoadFolders( '/' ) ;
|
||||
oListManager.Init();
|
||||
LoadFolders( '/' );
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -51,7 +51,7 @@ require('../../../../main.inc.php'); ?>
|
||||
<script type="text/javascript" src="js/common.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var oListManager = new Object() ;
|
||||
var oListManager = new Object();
|
||||
|
||||
oListManager.Clear = function()
|
||||
{
|
||||
@@ -60,8 +60,8 @@ oListManager.Clear = function()
|
||||
|
||||
function ProtectPath(path)
|
||||
{
|
||||
path = path.replace( /\\/g, '\\\\') ;
|
||||
path = path.replace( /'/g, '\\\'') ;
|
||||
path = path.replace( /\\/g, '\\\\');
|
||||
path = path.replace( /'/g, '\\\'');
|
||||
return path ;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
|
||||
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath(fileUrl ) + '\');return false;">' ;
|
||||
|
||||
// Get the file icon.
|
||||
var sIcon = oIcons.GetIcon( fileName ) ;
|
||||
var sIcon = oIcons.GetIcon( fileName );
|
||||
|
||||
return '<tr>' +
|
||||
'<td width="16">' +
|
||||
@@ -106,41 +106,41 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
|
||||
function OpenFolder( folderPath )
|
||||
{
|
||||
// Load the resources list for this folder.
|
||||
window.parent.frames['frmFolders'].LoadFolders( folderPath ) ;
|
||||
window.parent.frames['frmFolders'].LoadFolders( folderPath );
|
||||
}
|
||||
|
||||
function GetUrlParam( paramName )
|
||||
{
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
|
||||
var oMatch = oRegex.exec( window.top.location.search ) ;
|
||||
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
|
||||
var oMatch = oRegex.exec( window.top.location.search );
|
||||
|
||||
if ( oMatch && oMatch.length > 1 )
|
||||
return decodeURIComponent( oMatch[1] ) ;
|
||||
return decodeURIComponent( oMatch[1] );
|
||||
else
|
||||
return '' ;
|
||||
}
|
||||
|
||||
function OpenFile( fileUrl )
|
||||
{
|
||||
funcNum = GetUrlParam('CKEditorFuncNum') ;
|
||||
funcNum = GetUrlParam('CKEditorFuncNum');
|
||||
window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
|
||||
|
||||
///////////////////////////////////
|
||||
window.top.close() ;
|
||||
window.top.opener.focus() ;
|
||||
window.top.close();
|
||||
window.top.opener.focus();
|
||||
}
|
||||
|
||||
function LoadResources( resourceType, folderPath )
|
||||
{
|
||||
oListManager.Clear() ;
|
||||
oListManager.Clear();
|
||||
oConnector.ResourceType = resourceType ;
|
||||
oConnector.CurrentFolder = folderPath ;
|
||||
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ;
|
||||
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
|
||||
}
|
||||
|
||||
function Refresh()
|
||||
{
|
||||
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;
|
||||
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
|
||||
}
|
||||
|
||||
function GetFoldersAndFilesCallBack( fckXml )
|
||||
@@ -149,30 +149,30 @@ function GetFoldersAndFilesCallBack( fckXml )
|
||||
return ;
|
||||
|
||||
// Get the current folder path.
|
||||
var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ;
|
||||
var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
|
||||
if ( oFolderNode == null )
|
||||
{
|
||||
alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ;
|
||||
alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' );
|
||||
return ;
|
||||
}
|
||||
var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
|
||||
var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ;
|
||||
|
||||
// var dTimer = new Date() ;
|
||||
// var dTimer = new Date();
|
||||
|
||||
var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ;
|
||||
var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' );
|
||||
|
||||
// Add the Folders.
|
||||
var oNodes ;
|
||||
oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ;
|
||||
oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
|
||||
for ( var i = 0 ; i < oNodes.length ; i++ )
|
||||
{
|
||||
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ;
|
||||
oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ;
|
||||
oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) );
|
||||
}
|
||||
|
||||
// Add the Files.
|
||||
oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ;
|
||||
oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
|
||||
for ( var j = 0 ; j < oNodes.length ; j++ )
|
||||
{
|
||||
var oNode = oNodes[j] ;
|
||||
@@ -180,15 +180,15 @@ function GetFoldersAndFilesCallBack( fckXml )
|
||||
var sFileSize = oNode.attributes.getNamedItem('size').value ;
|
||||
|
||||
// Get the optional "url" attribute. If not available, build the url.
|
||||
var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ;
|
||||
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ) ;
|
||||
var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
|
||||
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' );
|
||||
|
||||
oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ;
|
||||
oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) );
|
||||
}
|
||||
|
||||
oHtml.Append( '<\/table>' ) ;
|
||||
oHtml.Append( '<\/table>' );
|
||||
|
||||
document.body.innerHTML = oHtml.ToString() ;
|
||||
document.body.innerHTML = oHtml.ToString();
|
||||
|
||||
// window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ function SetCurrentFolder( resourceType, folderPath )
|
||||
{
|
||||
var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
|
||||
sUrl += '&Type=' + resourceType ;
|
||||
sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ;
|
||||
sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath );
|
||||
|
||||
document.getElementById('frmUpload').action = sUrl ;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ function OnSubmit()
|
||||
{
|
||||
if ( document.getElementById('NewFile').value.length == 0 )
|
||||
{
|
||||
alert( 'Please select a file from your computer' ) ;
|
||||
alert( 'Please select a file from your computer' );
|
||||
return false ;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ function OnUploadCompleted( errorNumber, data )
|
||||
if ( document.all )
|
||||
document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
|
||||
else
|
||||
document.getElementById('frmUpload').reset() ;
|
||||
document.getElementById('frmUpload').reset();
|
||||
|
||||
// Reset the interface elements.
|
||||
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
|
||||
@@ -93,20 +93,20 @@ function OnUploadCompleted( errorNumber, data )
|
||||
switch ( errorNumber )
|
||||
{
|
||||
case 0 :
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
window.parent.frames['frmResourcesList'].Refresh();
|
||||
break ;
|
||||
case 1 : // Custom error.
|
||||
alert( data ) ;
|
||||
alert( data );
|
||||
break ;
|
||||
case 201 :
|
||||
window.parent.frames['frmResourcesList'].Refresh() ;
|
||||
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ) ;
|
||||
window.parent.frames['frmResourcesList'].Refresh();
|
||||
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' );
|
||||
break ;
|
||||
case 202 :
|
||||
alert( 'Invalid file' ) ;
|
||||
alert( 'Invalid file' );
|
||||
break ;
|
||||
default :
|
||||
alert( 'Error on file upload. Error number: ' + errorNumber ) ;
|
||||
alert( 'Error on file upload. Error number: ' + errorNumber );
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,26 +25,26 @@
|
||||
|
||||
function SetXmlHeaders()
|
||||
{
|
||||
ob_end_clean() ;
|
||||
ob_end_clean();
|
||||
|
||||
// Prevent the browser from caching the result.
|
||||
// Date in the past
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ;
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
// always modified
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ;
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
// HTTP/1.1
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate') ;
|
||||
header('Cache-Control: post-check=0, pre-check=0', false) ;
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
// HTTP/1.0
|
||||
header('Pragma: no-cache') ;
|
||||
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 )
|
||||
{
|
||||
SetXmlHeaders() ;
|
||||
SetXmlHeaders();
|
||||
|
||||
// Create the XML document header.
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
@@ -66,23 +66,23 @@ function CreateXmlFooter()
|
||||
function SendError( $number, $text )
|
||||
{
|
||||
if ( $_GET['Command'] == 'FileUpload' )
|
||||
SendUploadResults( $number, "", "", $text ) ;
|
||||
SendUploadResults( $number, "", "", $text );
|
||||
|
||||
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
|
||||
{
|
||||
SendErrorNode( $number, $text ) ;
|
||||
CreateXmlFooter() ;
|
||||
SendErrorNode( $number, $text );
|
||||
CreateXmlFooter();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetXmlHeaders() ;
|
||||
SetXmlHeaders();
|
||||
|
||||
// Create the XML document header
|
||||
echo '<?xml version="1.0" encoding="utf-8" ?>' ;
|
||||
|
||||
echo '<Connector>' ;
|
||||
|
||||
SendErrorNode( $number, $text ) ;
|
||||
SendErrorNode( $number, $text );
|
||||
|
||||
echo '</Connector>' ;
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
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() ;
|
||||
$aFolders = array();
|
||||
|
||||
$oCurrentFolder = @opendir( $sServerDir ) ;
|
||||
$oCurrentFolder = @opendir( $sServerDir );
|
||||
|
||||
if ($oCurrentFolder !== false)
|
||||
{
|
||||
@@ -39,13 +39,13 @@ function GetFolders( $resourceType, $currentFolder )
|
||||
if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) )
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
||||
}
|
||||
closedir( $oCurrentFolder ) ;
|
||||
closedir( $oCurrentFolder );
|
||||
}
|
||||
|
||||
// Open the "Folders" node.
|
||||
echo "<Folders>" ;
|
||||
|
||||
natcasesort( $aFolders ) ;
|
||||
natcasesort( $aFolders );
|
||||
foreach ( $aFolders as $sFolder )
|
||||
echo $sFolder ;
|
||||
|
||||
@@ -56,13 +56,13 @@ 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() ;
|
||||
$aFolders = array();
|
||||
$aFiles = array();
|
||||
|
||||
$oCurrentFolder = @opendir( $sServerDir ) ;
|
||||
$oCurrentFolder = @opendir( $sServerDir );
|
||||
|
||||
if ($oCurrentFolder !== false)
|
||||
{
|
||||
@@ -74,13 +74,13 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
|
||||
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 ;
|
||||
}
|
||||
@@ -89,11 +89,11 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir( $oCurrentFolder ) ;
|
||||
closedir( $oCurrentFolder );
|
||||
}
|
||||
|
||||
// Send the folders
|
||||
natcasesort( $aFolders ) ;
|
||||
natcasesort( $aFolders );
|
||||
echo '<Folders>' ;
|
||||
|
||||
foreach ( $aFolders as $sFolder )
|
||||
@@ -102,7 +102,7 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
|
||||
echo '</Folders>' ;
|
||||
|
||||
// Send the files
|
||||
natcasesort( $aFiles ) ;
|
||||
natcasesort( $aFiles );
|
||||
echo '<Files>' ;
|
||||
|
||||
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 )
|
||||
$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 ) )
|
||||
{
|
||||
$sServerDir .= $sNewFolderName ;
|
||||
|
||||
$sErrorMsg = CreateServerFolder( $sServerDir ) ;
|
||||
$sErrorMsg = CreateServerFolder( $sServerDir );
|
||||
|
||||
switch ( $sErrorMsg )
|
||||
{
|
||||
@@ -181,17 +181,17 @@ 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'] ) )
|
||||
{
|
||||
@@ -227,7 +227,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
}
|
||||
else
|
||||
{
|
||||
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
|
||||
move_uploaded_file( $oFile['tmp_name'], $sFilePath );
|
||||
|
||||
if ( is_file( $sFilePath ) )
|
||||
{
|
||||
@@ -243,9 +243,9 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
$permissions = $Config['ChmodOnUpload'] ;
|
||||
}
|
||||
|
||||
$oldumask = umask(0) ;
|
||||
chmod( $sFilePath, $permissions ) ;
|
||||
umask( $oldumask ) ;
|
||||
$oldumask = umask(0);
|
||||
chmod( $sFilePath, $permissions );
|
||||
umask( $oldumask );
|
||||
}
|
||||
|
||||
break ;
|
||||
@@ -257,12 +257,12 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
|
||||
//previous checks failed, try once again
|
||||
if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false )
|
||||
{
|
||||
@unlink( $sFilePath ) ;
|
||||
@unlink( $sFilePath );
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true )
|
||||
{
|
||||
@unlink( $sFilePath ) ;
|
||||
@unlink( $sFilePath );
|
||||
$sErrorNumber = '202' ;
|
||||
}
|
||||
}
|
||||
@@ -274,16 +274,16 @@ 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
|
||||
//SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ;
|
||||
//SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
|
||||
if($CKEcallback == '')
|
||||
{
|
||||
// this line already exists so wrap the if block around it
|
||||
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ;
|
||||
SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -67,14 +67,14 @@ $Config['ForceSingleExtension'] = true ;
|
||||
$Config['SecureImageUploads'] = true;
|
||||
|
||||
// What the user can do with this connector.
|
||||
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder') ;
|
||||
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
|
||||
|
||||
// Allowed Resource Types.
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media') ;
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media');
|
||||
|
||||
// For security, HTML is allowed in the first Kb of data for files having the
|
||||
// following extensions only.
|
||||
$Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js") ;
|
||||
$Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
|
||||
|
||||
// After file is uploaded, sometimes it is required to change its permissions
|
||||
// so that it was possible to access it at the later time.
|
||||
@@ -139,29 +139,29 @@ $Config['ChmodOnFolderCreate'] = 0775 ;
|
||||
|
||||
*/
|
||||
|
||||
$Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip') ;
|
||||
$Config['DeniedExtensions']['File'] = array() ;
|
||||
$Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip');
|
||||
$Config['DeniedExtensions']['File'] = array();
|
||||
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ;
|
||||
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
|
||||
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png') ;
|
||||
$Config['DeniedExtensions']['Image'] = array() ;
|
||||
$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png');
|
||||
$Config['DeniedExtensions']['Image'] = array();
|
||||
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;
|
||||
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
|
||||
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
$Config['AllowedExtensions']['Flash'] = array('swf','flv') ;
|
||||
$Config['DeniedExtensions']['Flash'] = array() ;
|
||||
$Config['AllowedExtensions']['Flash'] = array('swf','flv');
|
||||
$Config['DeniedExtensions']['Flash'] = array();
|
||||
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ;
|
||||
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
|
||||
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ;
|
||||
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
|
||||
|
||||
$Config['AllowedExtensions']['Media'] = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv') ;
|
||||
$Config['DeniedExtensions']['Media'] = array() ;
|
||||
$Config['AllowedExtensions']['Media'] = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv');
|
||||
$Config['DeniedExtensions']['Media'] = array();
|
||||
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ;
|
||||
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
|
||||
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ;
|
||||
|
||||
@@ -22,19 +22,19 @@
|
||||
* This is the File Manager Connector for PHP.
|
||||
*/
|
||||
|
||||
ob_start() ;
|
||||
ob_start();
|
||||
|
||||
require('./config.php') ;
|
||||
require('./util.php') ;
|
||||
require('./io.php') ;
|
||||
require('./basexml.php') ;
|
||||
require('./commands.php') ;
|
||||
require('./phpcompat.php') ;
|
||||
require('./config.php');
|
||||
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() ;
|
||||
DoResponse();
|
||||
|
||||
function DoResponse()
|
||||
{
|
||||
@@ -47,40 +47,40 @@ function DoResponse()
|
||||
// Get the main request informaiton.
|
||||
$sCommand = $_GET['Command'] ;
|
||||
$sResourceType = $_GET['Type'] ;
|
||||
$sCurrentFolder = GetCurrentFolder() ;
|
||||
$sCurrentFolder = GetCurrentFolder();
|
||||
|
||||
// Check if it is an allowed command
|
||||
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.
|
||||
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.
|
||||
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 ;
|
||||
}
|
||||
|
||||
CreateXmlFooter() ;
|
||||
CreateXmlFooter();
|
||||
|
||||
exit ;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
function CombinePaths( $sBasePath, $sFolder )
|
||||
{
|
||||
return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' ) ;
|
||||
return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' );
|
||||
}
|
||||
function GetResourceTypePath( $resourceType, $sCommand )
|
||||
{
|
||||
@@ -44,7 +44,7 @@ function GetResourceTypeDirectory( $resourceType, $sCommand )
|
||||
return $Config['QuickUploadAbsolutePath'][$resourceType] ;
|
||||
|
||||
// Map the "UserFiles" path to a local directory.
|
||||
return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ;
|
||||
return Server_MapPath( $Config['QuickUploadPath'][$resourceType] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,49 +52,49 @@ function GetResourceTypeDirectory( $resourceType, $sCommand )
|
||||
return $Config['FileTypesAbsolutePath'][$resourceType] ;
|
||||
|
||||
// Map the "UserFiles" path to a local directory.
|
||||
return Server_MapPath( $Config['FileTypesPath'][$resourceType] ) ;
|
||||
return Server_MapPath( $Config['FileTypesPath'][$resourceType] );
|
||||
}
|
||||
}
|
||||
|
||||
function GetUrlFromPath( $resourceType, $folderPath, $sCommand )
|
||||
{
|
||||
return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ) ;
|
||||
return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath );
|
||||
}
|
||||
|
||||
function RemoveExtension( $fileName )
|
||||
{
|
||||
return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ;
|
||||
return substr( $fileName, 0, strrpos( $fileName, '.' ) );
|
||||
}
|
||||
|
||||
function ServerMapFolder( $resourceType, $folderPath, $sCommand )
|
||||
{
|
||||
// Get the resource type directory.
|
||||
$sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ) ;
|
||||
$sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand );
|
||||
|
||||
// Ensure that the directory exists.
|
||||
$sErrorMsg = CreateServerFolder( $sResourceTypePath ) ;
|
||||
$sErrorMsg = CreateServerFolder( $sResourceTypePath );
|
||||
if ( $sErrorMsg != '' )
|
||||
SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ;
|
||||
SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" );
|
||||
|
||||
// Return the resource type directory combined with the required path.
|
||||
return CombinePaths( $sResourceTypePath , $folderPath ) ;
|
||||
return CombinePaths( $sResourceTypePath , $folderPath );
|
||||
}
|
||||
|
||||
function GetParentFolder( $folderPath )
|
||||
{
|
||||
$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
|
||||
return preg_replace( $sPattern, '', $folderPath ) ;
|
||||
return preg_replace( $sPattern, '', $folderPath );
|
||||
}
|
||||
|
||||
function CreateServerFolder( $folderPath, $lastFolder = null )
|
||||
{
|
||||
global $Config ;
|
||||
$sParent = GetParentFolder( $folderPath ) ;
|
||||
$sParent = GetParentFolder( $folderPath );
|
||||
|
||||
// Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms
|
||||
while ( strpos($folderPath, '//') !== false )
|
||||
{
|
||||
$folderPath = str_replace( '//', '/', $folderPath ) ;
|
||||
$folderPath = str_replace( '//', '/', $folderPath );
|
||||
}
|
||||
|
||||
// Check if the parent exists, or create it.
|
||||
@@ -105,7 +105,7 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
|
||||
return "Can't create $folderPath directory" ;
|
||||
}
|
||||
|
||||
$sErrorMsg = CreateServerFolder( $sParent, $folderPath ) ;
|
||||
$sErrorMsg = CreateServerFolder( $sParent, $folderPath );
|
||||
if ( $sErrorMsg != '' )
|
||||
return $sErrorMsg ;
|
||||
}
|
||||
@@ -113,15 +113,15 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
|
||||
if ( !file_exists( $folderPath ) )
|
||||
{
|
||||
// Turn off all error reporting.
|
||||
error_reporting( 0 ) ;
|
||||
error_reporting( 0 );
|
||||
|
||||
$php_errormsg = '' ;
|
||||
// Enable error tracking to catch the error.
|
||||
ini_set( 'track_errors', '1' ) ;
|
||||
ini_set( 'track_errors', '1' );
|
||||
|
||||
if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
|
||||
{
|
||||
mkdir( $folderPath ) ;
|
||||
mkdir( $folderPath );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,16 +131,16 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
|
||||
$permissions = $Config['ChmodOnFolderCreate'] ;
|
||||
}
|
||||
// To create the folder with 0777 permissions, we need to set umask to zero.
|
||||
$oldumask = umask(0) ;
|
||||
mkdir( $folderPath, $permissions ) ;
|
||||
umask( $oldumask ) ;
|
||||
$oldumask = umask(0);
|
||||
mkdir( $folderPath, $permissions );
|
||||
umask( $oldumask );
|
||||
}
|
||||
|
||||
$sErrorMsg = $php_errormsg ;
|
||||
|
||||
// Restore the configurations.
|
||||
ini_restore( 'track_errors' ) ;
|
||||
ini_restore( 'error_reporting' ) ;
|
||||
ini_restore( 'track_errors' );
|
||||
ini_restore( 'error_reporting' );
|
||||
|
||||
return $sErrorMsg ;
|
||||
}
|
||||
@@ -153,23 +153,23 @@ function GetRootPath()
|
||||
if (!isset($_SERVER)) {
|
||||
global $_SERVER;
|
||||
}
|
||||
$sRealPath = realpath( './' ) ;
|
||||
$sRealPath = realpath( './' );
|
||||
// #2124 ensure that no slash is at the end
|
||||
$sRealPath = rtrim($sRealPath,"\\/");
|
||||
|
||||
$sSelfPath = $_SERVER['PHP_SELF'] ;
|
||||
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;
|
||||
$sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) );
|
||||
|
||||
$sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ) ;
|
||||
$sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath );
|
||||
|
||||
$position = strpos( $sRealPath, $sSelfPath ) ;
|
||||
$position = strpos( $sRealPath, $sSelfPath );
|
||||
|
||||
// This can check only that this script isn't run from a virtual dir
|
||||
// But it avoids the problems that arise if it isn't checked
|
||||
if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) )
|
||||
SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ;
|
||||
SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' );
|
||||
|
||||
return substr( $sRealPath, 0, $position ) ;
|
||||
return substr( $sRealPath, 0, $position );
|
||||
}
|
||||
|
||||
// Emulate the asp Server.mapPath function.
|
||||
@@ -179,7 +179,7 @@ function Server_MapPath( $path )
|
||||
// This function is available only for Apache
|
||||
if ( function_exists( 'apache_lookup_uri' ) )
|
||||
{
|
||||
$info = apache_lookup_uri( $path ) ;
|
||||
$info = apache_lookup_uri( $path );
|
||||
return $info->filename . $info->path_info ;
|
||||
}
|
||||
|
||||
@@ -238,15 +238,15 @@ function GetCurrentFolder()
|
||||
|
||||
// Ensure the folder path has no double-slashes
|
||||
while ( strpos ($sCurrentFolder, '//') !== false ) {
|
||||
$sCurrentFolder = str_replace ('//', '/', $sCurrentFolder) ;
|
||||
$sCurrentFolder = str_replace ('//', '/', $sCurrentFolder);
|
||||
}
|
||||
|
||||
// Check for invalid folder paths (..)
|
||||
if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" ))
|
||||
SendError( 102, '' ) ;
|
||||
SendError( 102, '' );
|
||||
|
||||
if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder))
|
||||
SendError( 102, '' ) ;
|
||||
SendError( 102, '' );
|
||||
|
||||
return $sCurrentFolder ;
|
||||
}
|
||||
@@ -254,10 +254,10 @@ function GetCurrentFolder()
|
||||
// Do a cleanup of the folder name to avoid possible problems
|
||||
function SanitizeFolderName( $sNewFolderName )
|
||||
{
|
||||
$sNewFolderName = stripslashes( $sNewFolderName ) ;
|
||||
$sNewFolderName = stripslashes( $sNewFolderName );
|
||||
|
||||
// Remove . \ / | : ? * " < >
|
||||
$sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ) ;
|
||||
$sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName );
|
||||
|
||||
return $sNewFolderName ;
|
||||
}
|
||||
@@ -267,14 +267,14 @@ function SanitizeFileName( $sNewFileName )
|
||||
{
|
||||
global $Config ;
|
||||
|
||||
$sNewFileName = stripslashes( $sNewFileName ) ;
|
||||
$sNewFileName = stripslashes( $sNewFileName );
|
||||
|
||||
// Replace dots in the name with underscores (only one dot can be there... security issue).
|
||||
if ( $Config['ForceSingleExtension'] )
|
||||
$sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ) ;
|
||||
$sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName );
|
||||
|
||||
// Remove \ / | : ? * " < >
|
||||
$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ;
|
||||
$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName );
|
||||
|
||||
return $sNewFileName ;
|
||||
}
|
||||
@@ -294,8 +294,8 @@ EOF;
|
||||
$fileName = "";
|
||||
}
|
||||
|
||||
$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ;
|
||||
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '") ;' ;
|
||||
$rpl = array( '\\' => '\\\\', '"' => '\\"' );
|
||||
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '");' ;
|
||||
echo '</script>' ;
|
||||
exit ;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '')
|
||||
{
|
||||
echo '<script type="text/javascript">';
|
||||
|
||||
$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ;
|
||||
$rpl = array( '\\' => '\\\\', '"' => '\\"' );
|
||||
|
||||
echo 'window.parent.CKEDITOR.tools.callFunction("'. $callback. '","'.
|
||||
strtr($sFileUrl, $rpl). '", "'. strtr($customMsg, $rpl). '");' ;
|
||||
|
||||
@@ -13,5 +13,5 @@ if ( !isset( $_FILES ) ) {
|
||||
if ( !defined( 'DIRECTORY_SEPARATOR' ) ) {
|
||||
define( 'DIRECTORY_SEPARATOR',
|
||||
strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/'
|
||||
) ;
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,21 +22,21 @@
|
||||
* This is the "File Uploader" for PHP.
|
||||
*/
|
||||
|
||||
require('./config.php') ;
|
||||
require('./util.php') ;
|
||||
require('./io.php') ;
|
||||
require('./commands.php') ;
|
||||
require('./phpcompat.php') ;
|
||||
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' ;
|
||||
|
||||
@@ -47,11 +47,11 @@ $sCurrentFolder = "/" ;
|
||||
|
||||
// Is enabled the upload?
|
||||
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.
|
||||
if ( !IsAllowedType( $sType ) )
|
||||
SendUploadResults( 1, '', '', 'Invalid type specified' ) ;
|
||||
SendUploadResults( 1, '', '', 'Invalid type specified' );
|
||||
|
||||
|
||||
// DOL_CHANGE
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
function RemoveFromStart( $sourceString, $charToRemove )
|
||||
{
|
||||
$sPattern = '|^' . $charToRemove . '+|' ;
|
||||
return preg_replace( $sPattern, '', $sourceString ) ;
|
||||
return preg_replace( $sPattern, '', $sourceString );
|
||||
}
|
||||
|
||||
function RemoveFromEnd( $sourceString, $charToRemove )
|
||||
{
|
||||
$sPattern = '|' . $charToRemove . '+$|' ;
|
||||
return preg_replace( $sPattern, '', $sourceString ) ;
|
||||
return preg_replace( $sPattern, '', $sourceString );
|
||||
}
|
||||
|
||||
function FindBadUtf8( $string )
|
||||
@@ -65,16 +65,16 @@ function ConvertToXmlAttribute( $value )
|
||||
}
|
||||
else
|
||||
{
|
||||
$os = php_uname() ;
|
||||
$os = php_uname();
|
||||
}
|
||||
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,12 +91,12 @@ function IsHtmlExtension( $ext, $htmlExtensions )
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
$lcaseHtmlExtensions = array() ;
|
||||
$lcaseHtmlExtensions = array();
|
||||
foreach ( $htmlExtensions as $key => $val )
|
||||
{
|
||||
$lcaseHtmlExtensions[$key] = strtolower( $val ) ;
|
||||
$lcaseHtmlExtensions[$key] = strtolower( $val );
|
||||
}
|
||||
return in_array( $ext, $lcaseHtmlExtensions ) ;
|
||||
return in_array( $ext, $lcaseHtmlExtensions );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ function IsHtmlExtension( $ext, $htmlExtensions )
|
||||
*/
|
||||
function DetectHtml( $filePath )
|
||||
{
|
||||
$fp = @fopen( $filePath, 'rb' ) ;
|
||||
$fp = @fopen( $filePath, 'rb' );
|
||||
|
||||
//open_basedir restriction, see #1906
|
||||
if ( $fp === false || !flock( $fp, LOCK_SH ) )
|
||||
@@ -117,25 +117,25 @@ function DetectHtml( $filePath )
|
||||
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( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' ) ;
|
||||
$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' );
|
||||
|
||||
foreach( $tags as $tag )
|
||||
{
|
||||
|
||||
@@ -330,7 +330,7 @@ class Expedition extends CommonObject
|
||||
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
dol_syslog("Expedition::fetch sql=".$sql);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
|
||||
@@ -85,7 +85,7 @@ class Fournisseur extends Societe
|
||||
$sql.= " ".MAIN_DB_PREFIX."product_fournisseur_price as ppf";
|
||||
$sql .= " WHERE fk_soc = ".$this->id." AND ppf.fk_product_fournisseur = pf.rowid";
|
||||
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
|
||||
@@ -125,7 +125,7 @@ class CommandeFournisseur extends Commande
|
||||
else $sql.= " AND c.rowid=".$id;
|
||||
|
||||
dol_syslog("CommandeFournisseur::fetch sql=".$sql,LOG_DEBUG);
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@@ -1421,7 +1421,7 @@ class CommandeFournisseur extends Commande
|
||||
$sql .= " VALUES (".$idc.", '" . $this->db->escape($libelle) . "','" . $this->db->escape($comclient->lines[$i]->desc) . "'";
|
||||
$sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'";
|
||||
$sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->localtax1_tx.", ".$comclient->lines[$i]->localtax2_tx.", ".$comclient->lines[$i]->remise_percent;
|
||||
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."') ;";
|
||||
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."');";
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
$this->update_price();
|
||||
|
||||
@@ -393,7 +393,7 @@ class ProductFournisseur extends Product
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_fourn_data sql=".$sql);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$result = $this->db->fetch_array($result);
|
||||
@@ -425,7 +425,7 @@ class ProductFournisseur extends Product
|
||||
$sql.= " AND pf.rowid = pfp.fk_product_fournisseur";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_product_fournisseur_price sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
@@ -101,7 +101,7 @@ $sql .= " WHERE p.fk_product_type <> 1";
|
||||
$sql .= " ORDER BY p.datec DESC ";
|
||||
$sql .= $db->plimit(15 ,0);
|
||||
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ $sql .= $db->plimit($limit + 1 ,$offset);
|
||||
|
||||
dol_syslog("fourn/product/liste: sql=".$sql);
|
||||
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -654,7 +654,7 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect
|
||||
if ($conn_id)
|
||||
{
|
||||
// turn on passive mode transfers
|
||||
//ftp_pasv ($conn_id, true) ;
|
||||
//ftp_pasv ($conn_id, true);
|
||||
|
||||
if ($ftp_user)
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ function checkBanForAccount($account)
|
||||
|
||||
if ($country_code == 'FR') // France rules
|
||||
{
|
||||
$coef = array(62, 34, 3) ;
|
||||
$coef = array(62, 34, 3);
|
||||
// Concatenation des differents codes.
|
||||
$rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle));
|
||||
// On remplace les eventuelles lettres par des chiffres.
|
||||
@@ -105,11 +105,11 @@ function checkBanForAccount($account)
|
||||
// Multiplication de chaque groupe par les coef du tableau
|
||||
for ($i=0, $s=0; $i<3; $i++)
|
||||
{
|
||||
$code = substr($rib, 7 * $i, 7) ;
|
||||
$code = substr($rib, 7 * $i, 7);
|
||||
$s += (0 + $code) * $coef[$i] ;
|
||||
}
|
||||
// Soustraction du modulo 97 de $s a 97 pour obtenir la cle
|
||||
$cle_rib = 97 - ($s % 97) ;
|
||||
$cle_rib = 97 - ($s % 97);
|
||||
if ($cle_rib == $account->cle)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -345,7 +345,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
||||
if($tableMarkup) $text = '<table '.$tableoptions.'>' ;
|
||||
foreach($data as $key => $item){
|
||||
if(is_array($item)){
|
||||
$text.=array2tr($item,$troptions,$tdoptions) ;
|
||||
$text.=array2tr($item,$troptions,$tdoptions);
|
||||
} else {
|
||||
$text.= '<tr '.$troptions.'>' ;
|
||||
$text.= '<td '.$tdoptions.'>'.$key.'</td>' ;
|
||||
|
||||
@@ -251,7 +251,7 @@ class Livraison extends CommonObject
|
||||
$sql.= " WHERE l.rowid = ".$id;
|
||||
|
||||
dol_syslog("Livraison::fetch sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
|
||||
@@ -636,7 +636,7 @@ function hash_call($methodName,$nvpStr)
|
||||
if (curl_errno($ch))
|
||||
{
|
||||
// moving to display page to display curl errors
|
||||
$_SESSION['curl_error_no']=curl_errno($ch) ;
|
||||
$_SESSION['curl_error_no']=curl_errno($ch);
|
||||
$_SESSION['curl_error_msg']=curl_error($ch);
|
||||
|
||||
//Execute the Error handling module to display errors.
|
||||
|
||||
@@ -1135,7 +1135,7 @@ class Product extends CommonObject
|
||||
$sql.= " fk_product = '".$this->id."'";
|
||||
$sql.= " ORDER BY date_price DESC";
|
||||
$sql.= " LIMIT 1";
|
||||
$resql = $this->db->query($sql) ;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$result = $this->db->fetch_array($resql);
|
||||
@@ -1197,7 +1197,7 @@ class Product extends CommonObject
|
||||
//$sql.= " AND pr.fk_statut != 0";
|
||||
if ($socid > 0) $sql.= " AND p.fk_soc = ".$socid;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1240,7 +1240,7 @@ class Product extends CommonObject
|
||||
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if ($filtrestatut <> '') $sql.= " AND c.fk_statut in (".$filtrestatut.")";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1282,7 +1282,7 @@ class Product extends CommonObject
|
||||
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if ($filtrestatut != '') $sql.= " AND c.fk_statut in (".$filtrestatut.")"; // Peut valoir 0
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1326,7 +1326,7 @@ class Product extends CommonObject
|
||||
if ($socid > 0) $sql.= " AND e.fk_soc = ".$socid;
|
||||
if ($filtrestatut <> '') $sql.= " AND e.fk_statut in (".$filtrestatut.")";
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1368,7 +1368,7 @@ class Product extends CommonObject
|
||||
//$sql.= " AND c.statut != 0";
|
||||
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1410,7 +1410,7 @@ class Product extends CommonObject
|
||||
//$sql.= " AND f.fk_statut != 0";
|
||||
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1452,7 +1452,7 @@ class Product extends CommonObject
|
||||
//$sql.= " AND f.fk_statut != 0";
|
||||
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ( $result )
|
||||
{
|
||||
$obj=$this->db->fetch_object($result);
|
||||
@@ -1665,7 +1665,7 @@ class Product extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
@@ -2387,7 +2387,7 @@ class Product extends CommonObject
|
||||
$sql.= " WHERE fk_product = '".$this->id."'";
|
||||
|
||||
dol_syslog("Product::load_stock sql=".$sql);
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
@@ -152,7 +152,7 @@ if($action == 'search' )
|
||||
}
|
||||
$sql.= " ORDER BY p.ref ASC";
|
||||
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ $sql.= $db->order("p.tms","DESC");
|
||||
$sql.= $db->plimit($max,0);
|
||||
|
||||
//print $sql;
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@@ -165,7 +165,7 @@ else
|
||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||
|
||||
dol_syslog("sql=".$sql);
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -106,7 +106,7 @@ $sql.= " GROUP BY (p.rowid)";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit ,$offset);
|
||||
|
||||
$result=$db->query($sql) ;
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@@ -345,7 +345,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
|
||||
|
||||
// Price minimum
|
||||
print '<tr><td>' ;
|
||||
$text=$langs->trans('MinPrice') ;
|
||||
$text=$langs->trans('MinPrice');
|
||||
print $html->textwithpicto($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
||||
if ($product->price_base_type == 'TTC')
|
||||
{
|
||||
@@ -436,20 +436,20 @@ if ($socid && $conf->global->PRODUIT_MULTIPRICES) $sql.= " AND p.price_level = "
|
||||
$sql.= " ORDER BY p.date_price DESC, p.price_level ASC";
|
||||
//$sql .= $db->plimit();
|
||||
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if (! $num)
|
||||
{
|
||||
$db->free($result) ;
|
||||
$db->free($result);
|
||||
|
||||
// Il doit au moins y avoir la ligne de prix initial.
|
||||
// On l'ajoute donc pour remettre a niveau (pb vieilles versions)
|
||||
$product->update_price($product->id, $product->price, 'HT', $user, $newprice_min);
|
||||
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ $sql.= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte";
|
||||
if ($toolowstock) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -330,7 +330,7 @@ class Entrepot extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot";
|
||||
$sql.= " WHERE statut = ".$status;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows($result);
|
||||
if ( $result )
|
||||
@@ -361,7 +361,7 @@ class Entrepot extends CommonObject
|
||||
$sql .= " WHERE ps.fk_entrepot = ".$this->id." AND ps.fk_product=p.rowid";
|
||||
|
||||
//print $sql;
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
@@ -355,7 +355,7 @@ else
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
dol_syslog('List products sql='.$sql);
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -65,7 +65,7 @@ $sql.= " AND e.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY e.statut DESC ";
|
||||
$sql.= $db->plimit(15 ,0);
|
||||
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ $sql.= $db->order("datem","DESC");
|
||||
$sql.= $db->plimit($max,0);
|
||||
|
||||
dol_syslog("Index:list stock movements sql=".$sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -59,7 +59,7 @@ if ($sall)
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@@ -125,7 +125,7 @@ $sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit + 1 ,$offset);
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -141,7 +141,7 @@ if ($_GET["id"])
|
||||
$sql .= " WHERE ue.fk_user = u.rowid ";
|
||||
$sql .= " AND ue.fk_entrepot = ".$entrepot->id;
|
||||
|
||||
$resql = $db->query($sql) ;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@@ -74,7 +74,7 @@ $sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@@ -816,7 +816,7 @@ class Societe extends CommonObject
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON l.fk_pays = p.rowid";
|
||||
$sql .= " WHERE l.rowid = ".$id;
|
||||
|
||||
$result = $this->db->query($sql) ;
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ( $result )
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
$upload_dir = $conf->societe->dir_output . "/" . $socid ;
|
||||
$courrier_dir = $conf->societe->dir_output . "/courrier/" . get_exdir($socid) ;
|
||||
$courrier_dir = $conf->societe->dir_output . "/courrier/" . get_exdir($socid);
|
||||
|
||||
$object = new Societe($db);
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ $sql.= $db->order("s.tms","DESC");
|
||||
$sql.= $db->plimit($max,0);
|
||||
|
||||
//print $sql;
|
||||
$result = $db->query($sql) ;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@@ -320,7 +320,7 @@ div.tmenu {
|
||||
padding: 0px;
|
||||
margin: 10px 0px 10px 0px;
|
||||
font-size: 13px;
|
||||
background-image : url(<?php echo DOL_URL_ROOT.'/theme/bureau2crea/img/bg_mainNav.jpg' ?>) ;
|
||||
background-image : url(<?php echo DOL_URL_ROOT.'/theme/bureau2crea/img/bg_mainNav.jpg' ?>);
|
||||
height: 22px;
|
||||
border-bottom: 2px solid #842F00;
|
||||
<?php } ?>
|
||||
|
||||
Reference in New Issue
Block a user