2
0
forked from Wavyzz/dolibarr

Fix: Space after closing parenthesis of function call prohibited

This commit is contained in:
Regis Houssin
2011-09-20 13:32:16 +00:00
parent 3af539e70a
commit 551e1f81bf
63 changed files with 324 additions and 324 deletions

View File

@@ -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; $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 ) if ( $resql )
{ {
$result = $this->db->fetch_array($resql); $result = $this->db->fetch_array($resql);

View File

@@ -63,7 +63,7 @@ class BoutiqueCommande
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders"; $sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
$sql.= " WHERE orders_id = ".$id; $sql.= " WHERE orders_id = ".$id;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$array = $this->db->fetch_array($result); $array = $this->db->fetch_array($result);

View File

@@ -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 p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID;
$sql .= " AND r.reviews_id=$id"; $sql .= " AND r.reviews_id=$id";
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {

View File

@@ -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 .= " 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 .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".$conf->global->OSC_LANGUAGE_ID;
$sql .= " AND c.categories_id = ".$id; $sql .= " AND c.categories_id = ".$id;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) { if ( $result ) {
$result = $this->db->fetch_array($result); $result = $this->db->fetch_array($result);

View File

@@ -803,8 +803,8 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$productid = $_POST['productid'] ; $productid = $_POST['productid'] ;
if ($productid) if ($productid)
{ {
$product = new Product($db) ; $product = new Product($db);
$res=$product->fetch($productid) ; $res=$product->fetch($productid);
$price_min = $product->price_min; $price_min = $product->price_min;
if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level]; if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level) $price_min = $product->multiprices_min[$object->client->price_level];
} }

View File

@@ -1220,7 +1220,7 @@ class Commande extends CommonObject
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'"; if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG); dol_syslog("Commande::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);

View File

@@ -59,7 +59,7 @@ class ComptaCompte
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux "; $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux ";
$sql .= " WHERE numero = '" .trim($this->numero)."'"; $sql .= " WHERE numero = '" .trim($this->numero)."'";
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql);
if ( $resql ) if ( $resql )
{ {

View File

@@ -205,7 +205,7 @@ class Deplacement extends CommonObject
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$id;
dol_syslog("Deplacement::fetch sql=".$sql, LOG_DEBUG); dol_syslog("Deplacement::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@@ -341,7 +341,7 @@ class Deplacement extends CommonObject
$sql.= " WHERE active = ".$active; $sql.= " WHERE active = ".$active;
dol_syslog("Deplacement::listOfTypes sql=".$sql, LOG_DEBUG); dol_syslog("Deplacement::listOfTypes sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);

View File

@@ -237,7 +237,7 @@ class Don extends CommonObject
$this->amount = trim($this->amount); $this->amount = trim($this->amount);
$map = range(0,9); $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)] )) if (!isset($map[substr($this->amount, $i, 1)] ))
{ {

View File

@@ -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))) 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 ; $result = -1 ;
} }
else else

View File

@@ -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); $factures = dol_dir_list($conf->facture->dir_output,'all',1,implode('|',$arrayofexclusion),'\.meta$|\.png','date',SORT_DESC);
// liste les fichiers // liste les fichiers
$files = array() ; $files = array();
$factures_bak = $factures ; $factures_bak = $factures ;
foreach($_POST['toGenerate'] as $basename){ foreach($_POST['toGenerate'] as $basename){
foreach($factures as $facture){ foreach($factures as $facture){

View File

@@ -746,7 +746,7 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman
print '<td align="center" width="16">&nbsp;</td>'; print '<td align="center" width="16">&nbsp;</td>';
print '</tr>'; print '</tr>';
$tot_ht=$tot_ttc=$tot_tobill=0; $tot_ht=$tot_ttc=$tot_tobill=0;
$societestatic = new Societe($db) ; $societestatic = new Societe($db);
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@@ -845,7 +845,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
print '</tr>'; print '</tr>';
if ($num) if ($num)
{ {
$societestatic = new Societe($db) ; $societestatic = new Societe($db);
$total_ttc = $totalam = $total = 0; $total_ttc = $totalam = $total = 0;
while ($i < $num && $i < $conf->liste_limit) while ($i < $num && $i < $conf->liste_limit)
{ {
@@ -877,7 +877,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
$societestatic->nom=$obj->nom; $societestatic->nom=$obj->nom;
$societestatic->client=1; $societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44) ; print $societestatic->getNomUrl(1,'customer',44);
print '</a></td>'; print '</a></td>';
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total).'</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>'; 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 align="right">'.$langs->trans("Paid").'</td>';
print '<td width="16">&nbsp;</td>'; print '<td width="16">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$societestatic = new Societe($db) ; $societestatic = new Societe($db);
if ($num) if ($num)
{ {
$i = 0; $i = 0;

View File

@@ -112,8 +112,8 @@ if ($result)
$compta_prod = $obj->accountancy_code_buy; $compta_prod = $obj->accountancy_code_buy;
if (empty($compta_prod)) 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") ; 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") ; 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; $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;

View File

@@ -112,8 +112,8 @@ if ($result)
$compta_prod = $obj->accountancy_code_sell; $compta_prod = $obj->accountancy_code_sell;
if (empty($compta_prod)) 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") ; 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") ; 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"); $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; $compta_tva = (! empty($obj->accountancy_code))?$obj->accountancy_code:$cpttva;

View File

@@ -654,7 +654,7 @@ class RemiseCheque extends CommonObject
$sql.= " WHERE rowid < ".$this->id; $sql.= " WHERE rowid < ".$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if (! $result) if (! $result)
{ {
$this->errno = -1035; $this->errno = -1035;
@@ -667,7 +667,7 @@ class RemiseCheque extends CommonObject
$sql.= " WHERE rowid > ".$this->id; $sql.= " WHERE rowid > ".$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if (! $result) if (! $result)
{ {
$this->errno = -1035; $this->errno = -1035;

View File

@@ -335,7 +335,7 @@ class Tva extends CommonObject
$payee = $this->tva_sum_payee($year); $payee = $this->tva_sum_payee($year);
$collectee = $this->tva_sum_collectee($year); $collectee = $this->tva_sum_collectee($year);
$solde = $reglee - ($collectee - $payee) ; $solde = $reglee - ($collectee - $payee);
return $solde; return $solde;
} }

View File

@@ -203,7 +203,7 @@ class Contrat extends CommonObject
$sql.= " commentaire = '".$this->db->escape($comment)."'"; $sql.= " commentaire = '".$this->db->escape($comment)."'";
$sql.= " WHERE rowid = ".$line_id . " AND statut = 4"; $sql.= " WHERE rowid = ".$line_id . " AND statut = 4";
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
// Appel des triggers // Appel des triggers
@@ -287,7 +287,7 @@ class Contrat extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1"; $sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1";
$sql .= " WHERE rowid = ".$this->id . " AND statut = 0"; $sql .= " WHERE rowid = ".$this->id . " AND statut = 0";
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->use_webcal=($conf->global->PHPWEBCALENDAR_CONTRACTSTATUS=='always'?1:0); $this->use_webcal=($conf->global->PHPWEBCALENDAR_CONTRACTSTATUS=='always'?1:0);
@@ -327,7 +327,7 @@ class Contrat extends CommonObject
else $sql.= " WHERE rowid=".$id; else $sql.= " WHERE rowid=".$id;
dol_syslog("Contrat::fetch sql=".$sql, LOG_DEBUG); dol_syslog("Contrat::fetch sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$result = $this->db->fetch_array($resql); $result = $this->db->fetch_array($resql);

View File

@@ -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))) 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 ; $result = -1 ;
} }
else else

View File

@@ -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).')'; if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN (0,'.(! empty($conf->entities[$this->element]) ? $conf->entities[$this->element] : $conf->entity).')';
//print $sql."<br>"; //print $sql."<br>";
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if (! $result) if (! $result)
{ {
$this->error=$this->db->error(); $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 // 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>"; //print $sql."<br>";
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if (! $result) if (! $result)
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();

View File

@@ -88,7 +88,7 @@ class DolCookie
$this->myValue .= strval(chr($this->cookiearray[$f]/$this->myKey)); $this->myValue .= strval(chr($this->cookiearray[$f]/$this->myKey));
} }
return(base64_decode($this->myValue)) ; return(base64_decode($this->myValue));
} }
else else
{ {

View File

@@ -46,7 +46,7 @@ require('../../../../main.inc.php');
{} {}
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
d = d.replace( /.*?(?:\.|$)/, '' ) ; d = d.replace( /.*?(?:\.|$)/, '' );
if ( d.length == 0 ) if ( d.length == 0 )
break ; // It was not able to detect the domain. break ; // It was not able to detect the domain.
@@ -60,36 +60,36 @@ require('../../../../main.inc.php');
break ; break ;
} }
} }
})() ; })();
function GetUrlParam( paramName ) function GetUrlParam( paramName )
{ {
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ; var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
var oMatch = oRegex.exec( window.top.location.search ) ; var oMatch = oRegex.exec( window.top.location.search );
if ( oMatch && oMatch.length > 1 ) if ( oMatch && oMatch.length > 1 )
return decodeURIComponent( oMatch[1] ) ; return decodeURIComponent( oMatch[1] );
else else
return '' ; return '' ;
} }
var oConnector = new Object() ; var oConnector = new Object();
oConnector.CurrentFolder = '/' ; oConnector.CurrentFolder = '/' ;
var sConnUrl = GetUrlParam( 'Connector' ) ; var sConnUrl = GetUrlParam( 'Connector' );
// Gecko has some problems when using relative URLs (not starting with slash). // Gecko has some problems when using relative URLs (not starting with slash).
if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 ) if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 )
sConnUrl = window.location.href.replace( /browser.php.*$/, '' ) + sConnUrl ; 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 ) if ( sServerPath.length > 0 )
oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ; oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ;
oConnector.ResourceType = GetUrlParam( 'Type' ) ; oConnector.ResourceType = GetUrlParam( 'Type' );
oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ) ; oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 );
if ( oConnector.ShowAllTypes ) if ( oConnector.ShowAllTypes )
oConnector.ResourceType = 'File' ; oConnector.ResourceType = 'File' ;
@@ -98,19 +98,19 @@ oConnector.SendCommand = function( command, params, callBackFunction )
{ {
var sUrl = this.ConnectorUrl + 'Command=' + command ; var sUrl = this.ConnectorUrl + 'Command=' + command ;
sUrl += '&Type=' + this.ResourceType ; sUrl += '&Type=' + this.ResourceType ;
sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ; sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder );
if ( params ) sUrl += '&' + params ; if ( params ) sUrl += '&' + params ;
// Add a random salt to avoid getting a cached version of the command execution // 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 ) if ( callBackFunction )
oXML.LoadUrl( sUrl, callBackFunction ) ; // Asynchronous load. oXML.LoadUrl( sUrl, callBackFunction ); // Asynchronous load.
else else
return oXML.LoadUrl( sUrl ) ; return oXML.LoadUrl( sUrl );
return null ; return null ;
} }
@@ -118,53 +118,53 @@ oConnector.SendCommand = function( command, params, callBackFunction )
oConnector.CheckError = function( responseXml ) oConnector.CheckError = function( responseXml )
{ {
var iErrorNumber = 0 ; var iErrorNumber = 0 ;
var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ; var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' );
if ( oErrorNode ) if ( oErrorNode )
{ {
iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ; iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 );
switch ( iErrorNumber ) switch ( iErrorNumber )
{ {
case 0 : case 0 :
break ; break ;
case 1 : // Custom error. Message placed in the "text" attribute. case 1 : // Custom error. Message placed in the "text" attribute.
alert( oErrorNode.attributes.getNamedItem('text').value ) ; alert( oErrorNode.attributes.getNamedItem('text').value );
break ; break ;
case 101 : case 101 :
alert( 'Folder already exists' ) ; alert( 'Folder already exists' );
break ; break ;
case 102 : case 102 :
alert( 'Invalid folder name' ) ; alert( 'Invalid folder name' );
break ; break ;
case 103 : case 103 :
alert( 'You have no permissions to create the folder' ) ; alert( 'You have no permissions to create the folder' );
break ; break ;
case 110 : case 110 :
alert( 'Unknown error creating folder' ) ; alert( 'Unknown error creating folder' );
break ; break ;
default : default :
alert( 'Error on your request. Error number: ' + iErrorNumber ) ; alert( 'Error on your request. Error number: ' + iErrorNumber );
break ; break ;
} }
} }
return iErrorNumber ; return iErrorNumber ;
} }
var oIcons = new Object() ; var oIcons = new Object();
oIcons.AvailableIconsArray = [ oIcons.AvailableIconsArray = [
'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js', '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' ] ; '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++ ) for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ )
oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ; oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ;
oIcons.GetIcon = function( fileName ) 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 ) if ( this.AvailableIcons[ sExtension ] == true )
return sExtension ; return sExtension ;
@@ -175,9 +175,9 @@ oIcons.GetIcon = function( fileName )
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
{ {
if (errorNumber == "1") if (errorNumber == "1")
window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ; window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg );
else else
window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ; window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName );
} }
</script> </script>

View File

@@ -66,7 +66,7 @@ require('../../../../main.inc.php'); ?>
{} {}
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
d = d.replace( /.*?(?:\.|$)/, '' ) ; d = d.replace( /.*?(?:\.|$)/, '' );
if ( d.length == 0 ) if ( d.length == 0 )
break ; // It was not able to detect the domain. break ; // It was not able to detect the domain.
@@ -80,7 +80,7 @@ require('../../../../main.inc.php'); ?>
break ; break ;
} }
} }
})() ; })();
function SetCurrentFolder( resourceType, folderPath ) function SetCurrentFolder( resourceType, folderPath )
{ {

View File

@@ -63,48 +63,48 @@ function CreateFolder()
while ( true ) while ( true )
{ {
sFolderName = prompt( 'Type the name of the new folder:', '' ) ; sFolderName = prompt( 'Type the name of the new folder:', '' );
if ( sFolderName == null ) if ( sFolderName == null )
return ; return ;
else if ( sFolderName.length == 0 ) else if ( sFolderName.length == 0 )
alert( 'Please type the folder name' ) ; alert( 'Please type the folder name' );
else else
break ; break ;
} }
oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack ) ; oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack );
} }
function CreateFolderCallBack( fckXml ) function CreateFolderCallBack( fckXml )
{ {
if ( oConnector.CheckError( fckXml ) == 0 ) if ( oConnector.CheckError( fckXml ) == 0 )
window.parent.frames['frmResourcesList'].Refresh() ; window.parent.frames['frmResourcesList'].Refresh();
/* /*
// Get the current folder path. // Get the current folder path.
var oNode = fckXml.SelectSingleNode( 'Connector/Error' ) ; var oNode = fckXml.SelectSingleNode( 'Connector/Error' );
var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value ) ; var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value );
switch ( iErrorNumber ) switch ( iErrorNumber )
{ {
case 0 : case 0 :
window.parent.frames['frmResourcesList'].Refresh() ; window.parent.frames['frmResourcesList'].Refresh();
break ; break ;
case 101 : case 101 :
alert( 'Folder already exists' ) ; alert( 'Folder already exists' );
break ; break ;
case 102 : case 102 :
alert( 'Invalid folder name' ) ; alert( 'Invalid folder name' );
break ; break ;
case 103 : case 103 :
alert( 'You have no permissions to create the folder' ) ; alert( 'You have no permissions to create the folder' );
break ; break ;
case 110 : case 110 :
alert( 'Unknown error creating folder' ) ; alert( 'Unknown error creating folder' );
break ; break ;
default : default :
alert( 'Error creating folder. Error number: ' + iErrorNumber ) ; alert( 'Error creating folder. Error number: ' + iErrorNumber );
break ; break ;
} }
*/ */

View File

@@ -61,42 +61,42 @@ var sActiveFolder ;
var bIsLoaded = false ; var bIsLoaded = false ;
var iIntervalId ; var iIntervalId ;
var oListManager = new Object() ; var oListManager = new Object();
oListManager.Init = function() oListManager.Init = function()
{ {
this.Table = document.getElementById('tableFiles') ; this.Table = document.getElementById('tableFiles');
this.UpRow = document.getElementById('trUp') ; this.UpRow = document.getElementById('trUp');
this.TableRows = new Object() ; this.TableRows = new Object();
} }
oListManager.Clear = function() oListManager.Clear = function()
{ {
// Remove all other rows available. // Remove all other rows available.
while ( this.Table.rows.length > 1 ) while ( this.Table.rows.length > 1 )
this.Table.deleteRow(1) ; this.Table.deleteRow(1);
// Reset the TableRows collection. // Reset the TableRows collection.
this.TableRows = new Object() ; this.TableRows = new Object();
} }
oListManager.AddItem = function( folderName, folderPath ) oListManager.AddItem = function( folderName, folderPath )
{ {
// Create the new row. // Create the new row.
var oRow = this.Table.insertRow(-1) ; var oRow = this.Table.insertRow(-1);
oRow.className = 'FolderListFolder' ; oRow.className = 'FolderListFolder' ;
// Build the link to view the folder. // Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ; var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ;
// Add the folder icon cell. // Add the folder icon cell.
var oCell = oRow.insertCell(-1) ; var oCell = oRow.insertCell(-1);
oCell.width = 16 ; oCell.width = 16 ;
oCell.innerHTML = sLink + '<img alt="" src="spacer.gif" width="16" height="16" border="0"><\/a>' ; oCell.innerHTML = sLink + '<img alt="" src="spacer.gif" width="16" height="16" border="0"><\/a>' ;
// Add the folder name cell. // Add the folder name cell.
oCell = oRow.insertCell(-1) ; oCell = oRow.insertCell(-1);
oCell.noWrap = true ; oCell.noWrap = true ;
oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ; oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ;
@@ -105,13 +105,13 @@ oListManager.AddItem = function( folderName, folderPath )
oListManager.ShowUpFolder = function( upFolderPath ) oListManager.ShowUpFolder = function( upFolderPath )
{ {
this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ; this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' );
if ( upFolderPath != null ) if ( upFolderPath != null )
{ {
document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function() document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function()
{ {
LoadFolders( upFolderPath ) ; LoadFolders( upFolderPath );
return false ; return false ;
} }
} }
@@ -124,9 +124,9 @@ function CheckLoaded()
&& window.top.IsLoadedUpload && window.top.IsLoadedUpload
&& window.top.IsLoadedResourcesList ) && window.top.IsLoadedResourcesList )
{ {
window.clearInterval( iIntervalId ) ; window.clearInterval( iIntervalId );
bIsLoaded = true ; bIsLoaded = true ;
OpenFolder( sActiveFolder ) ; OpenFolder( sActiveFolder );
} }
} }
@@ -137,7 +137,7 @@ function OpenFolder( folderPath )
if ( ! bIsLoaded ) if ( ! bIsLoaded )
{ {
if ( ! iIntervalId ) if ( ! iIntervalId )
iIntervalId = window.setInterval( CheckLoaded, 100 ) ; iIntervalId = window.setInterval( CheckLoaded, 100 );
return ; return ;
} }
@@ -145,39 +145,39 @@ function OpenFolder( folderPath )
for ( var sFolderPath in oListManager.TableRows ) for ( var sFolderPath in oListManager.TableRows )
{ {
oListManager.TableRows[ sFolderPath ].className = oListManager.TableRows[ sFolderPath ].className =
( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ; ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' );
} }
// Set the current folder in all frames. // Set the current folder in all frames.
window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath );
window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath );
// Load the resources list for this folder. // 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 ) function LoadFolders( folderPath )
{ {
// Clear the folders list. // Clear the folders list.
oListManager.Clear() ; oListManager.Clear();
// Get the parent folder path. // Get the parent folder path.
var sParentFolderPath ; var sParentFolderPath ;
if ( folderPath != '/' ) 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. // Show/Hide the Up Folder.
oListManager.ShowUpFolder( sParentFolderPath ) ; oListManager.ShowUpFolder( sParentFolderPath );
if ( folderPath != '/' ) if ( folderPath != '/' )
{ {
sActiveFolder = folderPath ; sActiveFolder = folderPath ;
oConnector.CurrentFolder = sParentFolderPath ; oConnector.CurrentFolder = sParentFolderPath ;
oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ; oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack );
} }
else else
OpenFolder( '/' ) ; OpenFolder( '/' );
} }
function GetFoldersCallBack( fckXml ) function GetFoldersCallBack( fckXml )
@@ -186,30 +186,30 @@ function GetFoldersCallBack( fckXml )
return ; return ;
// Get the current folder path. // 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 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++ ) for ( var i = 0 ; i < oNodes.length ; i++ )
{ {
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ; 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 ) function SetResourceType( type )
{ {
oConnector.ResourceType = type ; oConnector.ResourceType = type ;
LoadFolders( '/' ) ; LoadFolders( '/' );
} }
window.onload = function() window.onload = function()
{ {
oListManager.Init() ; oListManager.Init();
LoadFolders( '/' ) ; LoadFolders( '/' );
} }
</script> </script>
</head> </head>

View File

@@ -51,7 +51,7 @@ require('../../../../main.inc.php'); ?>
<script type="text/javascript" src="js/common.js"></script> <script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var oListManager = new Object() ; var oListManager = new Object();
oListManager.Clear = function() oListManager.Clear = function()
{ {
@@ -60,8 +60,8 @@ oListManager.Clear = function()
function ProtectPath(path) function ProtectPath(path)
{ {
path = path.replace( /\\/g, '\\\\') ; path = path.replace( /\\/g, '\\\\');
path = path.replace( /'/g, '\\\'') ; path = path.replace( /'/g, '\\\'');
return path ; return path ;
} }
@@ -87,7 +87,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath(fileUrl ) + '\');return false;">' ; var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath(fileUrl ) + '\');return false;">' ;
// Get the file icon. // Get the file icon.
var sIcon = oIcons.GetIcon( fileName ) ; var sIcon = oIcons.GetIcon( fileName );
return '<tr>' + return '<tr>' +
'<td width="16">' + '<td width="16">' +
@@ -106,41 +106,41 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
function OpenFolder( folderPath ) function OpenFolder( folderPath )
{ {
// Load the resources list for this folder. // Load the resources list for this folder.
window.parent.frames['frmFolders'].LoadFolders( folderPath ) ; window.parent.frames['frmFolders'].LoadFolders( folderPath );
} }
function GetUrlParam( paramName ) function GetUrlParam( paramName )
{ {
var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ; var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' );
var oMatch = oRegex.exec( window.top.location.search ) ; var oMatch = oRegex.exec( window.top.location.search );
if ( oMatch && oMatch.length > 1 ) if ( oMatch && oMatch.length > 1 )
return decodeURIComponent( oMatch[1] ) ; return decodeURIComponent( oMatch[1] );
else else
return '' ; return '' ;
} }
function OpenFile( fileUrl ) function OpenFile( fileUrl )
{ {
funcNum = GetUrlParam('CKEditorFuncNum') ; funcNum = GetUrlParam('CKEditorFuncNum');
window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' )); window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' ));
/////////////////////////////////// ///////////////////////////////////
window.top.close() ; window.top.close();
window.top.opener.focus() ; window.top.opener.focus();
} }
function LoadResources( resourceType, folderPath ) function LoadResources( resourceType, folderPath )
{ {
oListManager.Clear() ; oListManager.Clear();
oConnector.ResourceType = resourceType ; oConnector.ResourceType = resourceType ;
oConnector.CurrentFolder = folderPath ; oConnector.CurrentFolder = folderPath ;
oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ; oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack );
} }
function Refresh() function Refresh()
{ {
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ; LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
} }
function GetFoldersAndFilesCallBack( fckXml ) function GetFoldersAndFilesCallBack( fckXml )
@@ -149,30 +149,30 @@ function GetFoldersAndFilesCallBack( fckXml )
return ; return ;
// Get the current folder path. // Get the current folder path.
var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ; var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' );
if ( oFolderNode == null ) 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 ; return ;
} }
var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ; var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ;
var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').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. // Add the Folders.
var oNodes ; var oNodes ;
oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ; oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' );
for ( var i = 0 ; i < oNodes.length ; i++ ) for ( var i = 0 ; i < oNodes.length ; i++ )
{ {
var sFolderName = oNodes[i].attributes.getNamedItem('name').value ; 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. // Add the Files.
oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ; oNodes = fckXml.SelectNodes( 'Connector/Files/File' );
for ( var j = 0 ; j < oNodes.length ; j++ ) for ( var j = 0 ; j < oNodes.length ; j++ )
{ {
var oNode = oNodes[j] ; var oNode = oNodes[j] ;
@@ -180,15 +180,15 @@ function GetFoldersAndFilesCallBack( fckXml )
var sFileSize = oNode.attributes.getNamedItem('size').value ; var sFileSize = oNode.attributes.getNamedItem('size').value ;
// Get the optional "url" attribute. If not available, build the url. // Get the optional "url" attribute. If not available, build the url.
var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ; var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url');
var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : encodeURI( sCurrentFolderUrl + sFileName ).replace( /#/g, '%23' ) ; 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' ; // window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ;

View File

@@ -55,7 +55,7 @@ function SetCurrentFolder( resourceType, folderPath )
{ {
var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ; var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ;
sUrl += '&Type=' + resourceType ; sUrl += '&Type=' + resourceType ;
sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ; sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath );
document.getElementById('frmUpload').action = sUrl ; document.getElementById('frmUpload').action = sUrl ;
} }
@@ -64,7 +64,7 @@ function OnSubmit()
{ {
if ( document.getElementById('NewFile').value.length == 0 ) 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 ; return false ;
} }
@@ -84,7 +84,7 @@ function OnUploadCompleted( errorNumber, data )
if ( document.all ) if ( document.all )
document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ; document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
else else
document.getElementById('frmUpload').reset() ; document.getElementById('frmUpload').reset();
// Reset the interface elements. // Reset the interface elements.
document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ; document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
@@ -93,20 +93,20 @@ function OnUploadCompleted( errorNumber, data )
switch ( errorNumber ) switch ( errorNumber )
{ {
case 0 : case 0 :
window.parent.frames['frmResourcesList'].Refresh() ; window.parent.frames['frmResourcesList'].Refresh();
break ; break ;
case 1 : // Custom error. case 1 : // Custom error.
alert( data ) ; alert( data );
break ; break ;
case 201 : case 201 :
window.parent.frames['frmResourcesList'].Refresh() ; window.parent.frames['frmResourcesList'].Refresh();
alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ) ; alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' );
break ; break ;
case 202 : case 202 :
alert( 'Invalid file' ) ; alert( 'Invalid file' );
break ; break ;
default : default :
alert( 'Error on file upload. Error number: ' + errorNumber ) ; alert( 'Error on file upload. Error number: ' + errorNumber );
break ; break ;
} }
} }

View File

@@ -25,26 +25,26 @@
function SetXmlHeaders() function SetXmlHeaders()
{ {
ob_end_clean() ; ob_end_clean();
// Prevent the browser from caching the result. // Prevent the browser from caching the result.
// Date in the past // 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 // 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 // HTTP/1.1
header('Cache-Control: no-store, no-cache, must-revalidate') ; header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false) ; header('Cache-Control: post-check=0, pre-check=0', false);
// HTTP/1.0 // HTTP/1.0
header('Pragma: no-cache') ; header('Pragma: no-cache');
// Set the response format. // Set the response format.
header( 'Content-Type: text/xml; charset=utf-8' ) ; header( 'Content-Type: text/xml; charset=utf-8' );
} }
function CreateXmlHeader( $command, $resourceType, $currentFolder ) function CreateXmlHeader( $command, $resourceType, $currentFolder )
{ {
SetXmlHeaders() ; SetXmlHeaders();
// Create the XML document header. // Create the XML document header.
echo '<?xml version="1.0" encoding="utf-8" ?>' ; echo '<?xml version="1.0" encoding="utf-8" ?>' ;
@@ -66,23 +66,23 @@ function CreateXmlFooter()
function SendError( $number, $text ) function SendError( $number, $text )
{ {
if ( $_GET['Command'] == 'FileUpload' ) if ( $_GET['Command'] == 'FileUpload' )
SendUploadResults( $number, "", "", $text ) ; SendUploadResults( $number, "", "", $text );
if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] )
{ {
SendErrorNode( $number, $text ) ; SendErrorNode( $number, $text );
CreateXmlFooter() ; CreateXmlFooter();
} }
else else
{ {
SetXmlHeaders() ; SetXmlHeaders();
// Create the XML document header // Create the XML document header
echo '<?xml version="1.0" encoding="utf-8" ?>' ; echo '<?xml version="1.0" encoding="utf-8" ?>' ;
echo '<Connector>' ; echo '<Connector>' ;
SendErrorNode( $number, $text ) ; SendErrorNode( $number, $text );
echo '</Connector>' ; echo '</Connector>' ;
} }

View File

@@ -25,12 +25,12 @@
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)
{ {
@@ -39,13 +39,13 @@ function GetFolders( $resourceType, $currentFolder )
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,13 +56,13 @@ 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)
{ {
@@ -74,13 +74,13 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
$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 ;
} }
@@ -89,11 +89,11 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
} }
} }
} }
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 )
{ {
@@ -181,17 +181,17 @@ 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'] ) )
{ {
@@ -227,7 +227,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
} }
else else
{ {
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; move_uploaded_file( $oFile['tmp_name'], $sFilePath );
if ( is_file( $sFilePath ) ) if ( is_file( $sFilePath ) )
{ {
@@ -243,9 +243,9 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
$permissions = $Config['ChmodOnUpload'] ; $permissions = $Config['ChmodOnUpload'] ;
} }
$oldumask = umask(0) ; $oldumask = umask(0);
chmod( $sFilePath, $permissions ) ; chmod( $sFilePath, $permissions );
umask( $oldumask ) ; umask( $oldumask );
} }
break ; break ;
@@ -257,12 +257,12 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '')
//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,16 +274,16 @@ 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
//SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ; //SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName );
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
{ {

View File

@@ -67,14 +67,14 @@ $Config['ForceSingleExtension'] = true ;
$Config['SecureImageUploads'] = true; $Config['SecureImageUploads'] = true;
// What the user can do with this connector. // 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. // 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 // For security, HTML is allowed in the first Kb of data for files having the
// following extensions only. // 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 // After file is uploaded, sometimes it is required to change its permissions
// so that it was possible to access it at the later time. // 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['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['DeniedExtensions']['File'] = array();
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ; $Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ;
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ; $Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png') ; $Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png');
$Config['DeniedExtensions']['Image'] = array() ; $Config['DeniedExtensions']['Image'] = array();
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ; $Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ; $Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ; $Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Flash'] = array('swf','flv') ; $Config['AllowedExtensions']['Flash'] = array('swf','flv');
$Config['DeniedExtensions']['Flash'] = array() ; $Config['DeniedExtensions']['Flash'] = array();
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ; $Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ;
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ; $Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ; $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['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['DeniedExtensions']['Media'] = array();
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ; $Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ;
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ; $Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ; $Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ;

View File

@@ -22,19 +22,19 @@
* This is the File Manager Connector for PHP. * This is the File Manager Connector for PHP.
*/ */
ob_start() ; ob_start();
require('./config.php') ; require('./config.php');
require('./util.php') ; require('./util.php');
require('./io.php') ; require('./io.php');
require('./basexml.php') ; require('./basexml.php');
require('./commands.php') ; require('./commands.php');
require('./phpcompat.php') ; require('./phpcompat.php');
if ( !$Config['Enabled'] ) if ( !$Config['Enabled'] )
SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ; SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' );
DoResponse() ; DoResponse();
function DoResponse() function DoResponse()
{ {
@@ -47,40 +47,40 @@ function DoResponse()
// Get the main request informaiton. // Get the main request informaiton.
$sCommand = $_GET['Command'] ; $sCommand = $_GET['Command'] ;
$sResourceType = $_GET['Type'] ; $sResourceType = $_GET['Type'] ;
$sCurrentFolder = GetCurrentFolder() ; $sCurrentFolder = GetCurrentFolder();
// Check if it is an allowed command // Check if it is an allowed command
if ( ! IsAllowedCommand( $sCommand ) ) if ( ! IsAllowedCommand( $sCommand ) )
SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ; SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' );
// Check if it is an allowed type. // Check if it is an allowed type.
if ( !IsAllowedType( $sResourceType ) ) if ( !IsAllowedType( $sResourceType ) )
SendError( 1, 'Invalid type specified' ) ; SendError( 1, 'Invalid type specified' );
// File Upload doesn't have to Return XML, so it must be intercepted before anything. // File Upload doesn't have to Return XML, so it must be intercepted before anything.
if ( $sCommand == 'FileUpload' ) if ( $sCommand == 'FileUpload' )
{ {
FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ; FileUpload( $sResourceType, $sCurrentFolder, $sCommand );
return ; return ;
} }
CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder );
// Execute the required command. // Execute the required command.
switch ( $sCommand ) switch ( $sCommand )
{ {
case 'GetFolders' : case 'GetFolders' :
GetFolders( $sResourceType, $sCurrentFolder ) ; GetFolders( $sResourceType, $sCurrentFolder );
break ; break ;
case 'GetFoldersAndFiles' : case 'GetFoldersAndFiles' :
GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; GetFoldersAndFiles( $sResourceType, $sCurrentFolder );
break ; break ;
case 'CreateFolder' : case 'CreateFolder' :
CreateFolder( $sResourceType, $sCurrentFolder ) ; CreateFolder( $sResourceType, $sCurrentFolder );
break ; break ;
} }
CreateXmlFooter() ; CreateXmlFooter();
exit ; exit ;
} }

View File

@@ -23,7 +23,7 @@
*/ */
function CombinePaths( $sBasePath, $sFolder ) function CombinePaths( $sBasePath, $sFolder )
{ {
return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' ) ; return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' );
} }
function GetResourceTypePath( $resourceType, $sCommand ) function GetResourceTypePath( $resourceType, $sCommand )
{ {
@@ -44,7 +44,7 @@ function GetResourceTypeDirectory( $resourceType, $sCommand )
return $Config['QuickUploadAbsolutePath'][$resourceType] ; return $Config['QuickUploadAbsolutePath'][$resourceType] ;
// Map the "UserFiles" path to a local directory. // Map the "UserFiles" path to a local directory.
return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ; return Server_MapPath( $Config['QuickUploadPath'][$resourceType] );
} }
else else
{ {
@@ -52,49 +52,49 @@ function GetResourceTypeDirectory( $resourceType, $sCommand )
return $Config['FileTypesAbsolutePath'][$resourceType] ; return $Config['FileTypesAbsolutePath'][$resourceType] ;
// Map the "UserFiles" path to a local directory. // 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 ) function GetUrlFromPath( $resourceType, $folderPath, $sCommand )
{ {
return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ) ; return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath );
} }
function RemoveExtension( $fileName ) function RemoveExtension( $fileName )
{ {
return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ; return substr( $fileName, 0, strrpos( $fileName, '.' ) );
} }
function ServerMapFolder( $resourceType, $folderPath, $sCommand ) function ServerMapFolder( $resourceType, $folderPath, $sCommand )
{ {
// Get the resource type directory. // Get the resource type directory.
$sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ) ; $sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand );
// Ensure that the directory exists. // Ensure that the directory exists.
$sErrorMsg = CreateServerFolder( $sResourceTypePath ) ; $sErrorMsg = CreateServerFolder( $sResourceTypePath );
if ( $sErrorMsg != '' ) 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 the resource type directory combined with the required path.
return CombinePaths( $sResourceTypePath , $folderPath ) ; return CombinePaths( $sResourceTypePath , $folderPath );
} }
function GetParentFolder( $folderPath ) function GetParentFolder( $folderPath )
{ {
$sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ;
return preg_replace( $sPattern, '', $folderPath ) ; return preg_replace( $sPattern, '', $folderPath );
} }
function CreateServerFolder( $folderPath, $lastFolder = null ) function CreateServerFolder( $folderPath, $lastFolder = null )
{ {
global $Config ; global $Config ;
$sParent = GetParentFolder( $folderPath ) ; $sParent = GetParentFolder( $folderPath );
// Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms
while ( strpos($folderPath, '//') !== false ) while ( strpos($folderPath, '//') !== false )
{ {
$folderPath = str_replace( '//', '/', $folderPath ) ; $folderPath = str_replace( '//', '/', $folderPath );
} }
// Check if the parent exists, or create it. // Check if the parent exists, or create it.
@@ -105,7 +105,7 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
return "Can't create $folderPath directory" ; return "Can't create $folderPath directory" ;
} }
$sErrorMsg = CreateServerFolder( $sParent, $folderPath ) ; $sErrorMsg = CreateServerFolder( $sParent, $folderPath );
if ( $sErrorMsg != '' ) if ( $sErrorMsg != '' )
return $sErrorMsg ; return $sErrorMsg ;
} }
@@ -113,15 +113,15 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
if ( !file_exists( $folderPath ) ) if ( !file_exists( $folderPath ) )
{ {
// Turn off all error reporting. // Turn off all error reporting.
error_reporting( 0 ) ; error_reporting( 0 );
$php_errormsg = '' ; $php_errormsg = '' ;
// Enable error tracking to catch the error. // Enable error tracking to catch the error.
ini_set( 'track_errors', '1' ) ; ini_set( 'track_errors', '1' );
if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] ) if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] )
{ {
mkdir( $folderPath ) ; mkdir( $folderPath );
} }
else else
{ {
@@ -131,16 +131,16 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
$permissions = $Config['ChmodOnFolderCreate'] ; $permissions = $Config['ChmodOnFolderCreate'] ;
} }
// To create the folder with 0777 permissions, we need to set umask to zero. // To create the folder with 0777 permissions, we need to set umask to zero.
$oldumask = umask(0) ; $oldumask = umask(0);
mkdir( $folderPath, $permissions ) ; mkdir( $folderPath, $permissions );
umask( $oldumask ) ; umask( $oldumask );
} }
$sErrorMsg = $php_errormsg ; $sErrorMsg = $php_errormsg ;
// Restore the configurations. // Restore the configurations.
ini_restore( 'track_errors' ) ; ini_restore( 'track_errors' );
ini_restore( 'error_reporting' ) ; ini_restore( 'error_reporting' );
return $sErrorMsg ; return $sErrorMsg ;
} }
@@ -153,23 +153,23 @@ function GetRootPath()
if (!isset($_SERVER)) { if (!isset($_SERVER)) {
global $_SERVER; global $_SERVER;
} }
$sRealPath = realpath( './' ) ; $sRealPath = realpath( './' );
// #2124 ensure that no slash is at the end // #2124 ensure that no slash is at the end
$sRealPath = rtrim($sRealPath,"\\/"); $sRealPath = rtrim($sRealPath,"\\/");
$sSelfPath = $_SERVER['PHP_SELF'] ; $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 // 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 // But it avoids the problems that arise if it isn't checked
if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) 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. // Emulate the asp Server.mapPath function.
@@ -179,7 +179,7 @@ function Server_MapPath( $path )
// This function is available only for Apache // This function is available only for Apache
if ( function_exists( 'apache_lookup_uri' ) ) if ( function_exists( 'apache_lookup_uri' ) )
{ {
$info = apache_lookup_uri( $path ) ; $info = apache_lookup_uri( $path );
return $info->filename . $info->path_info ; return $info->filename . $info->path_info ;
} }
@@ -238,15 +238,15 @@ function GetCurrentFolder()
// Ensure the folder path has no double-slashes // Ensure the folder path has no double-slashes
while ( strpos ($sCurrentFolder, '//') !== false ) { while ( strpos ($sCurrentFolder, '//') !== false ) {
$sCurrentFolder = str_replace ('//', '/', $sCurrentFolder) ; $sCurrentFolder = str_replace ('//', '/', $sCurrentFolder);
} }
// Check for invalid folder paths (..) // Check for invalid folder paths (..)
if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" )) if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" ))
SendError( 102, '' ) ; SendError( 102, '' );
if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder)) if ( preg_match(",(/\.)|[[:cntrl:]]|(//)|(\\\\)|([\:\*\?\"\<\>\|]),", $sCurrentFolder))
SendError( 102, '' ) ; SendError( 102, '' );
return $sCurrentFolder ; return $sCurrentFolder ;
} }
@@ -254,10 +254,10 @@ function GetCurrentFolder()
// Do a cleanup of the folder name to avoid possible problems // Do a cleanup of the folder name to avoid possible problems
function SanitizeFolderName( $sNewFolderName ) function SanitizeFolderName( $sNewFolderName )
{ {
$sNewFolderName = stripslashes( $sNewFolderName ) ; $sNewFolderName = stripslashes( $sNewFolderName );
// Remove . \ / | : ? * " < > // Remove . \ / | : ? * " < >
$sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ) ; $sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName );
return $sNewFolderName ; return $sNewFolderName ;
} }
@@ -267,14 +267,14 @@ function SanitizeFileName( $sNewFileName )
{ {
global $Config ; global $Config ;
$sNewFileName = stripslashes( $sNewFileName ) ; $sNewFileName = stripslashes( $sNewFileName );
// Replace dots in the name with underscores (only one dot can be there... security issue). // Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] ) if ( $Config['ForceSingleExtension'] )
$sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ) ; $sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName );
// Remove \ / | : ? * " < > // Remove \ / | : ? * " < >
$sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ; $sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName );
return $sNewFileName ; return $sNewFileName ;
} }
@@ -294,8 +294,8 @@ EOF;
$fileName = ""; $fileName = "";
} }
$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ; $rpl = array( '\\' => '\\\\', '"' => '\\"' );
echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '") ;' ; echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '");' ;
echo '</script>' ; echo '</script>' ;
exit ; exit ;
} }
@@ -308,7 +308,7 @@ function SendCKEditorResults ($callback, $sFileUrl, $customMsg = '')
{ {
echo '<script type="text/javascript">'; echo '<script type="text/javascript">';
$rpl = array( '\\' => '\\\\', '"' => '\\"' ) ; $rpl = array( '\\' => '\\\\', '"' => '\\"' );
echo 'window.parent.CKEDITOR.tools.callFunction("'. $callback. '","'. echo 'window.parent.CKEDITOR.tools.callFunction("'. $callback. '","'.
strtr($sFileUrl, $rpl). '", "'. strtr($customMsg, $rpl). '");' ; strtr($sFileUrl, $rpl). '", "'. strtr($customMsg, $rpl). '");' ;

View File

@@ -13,5 +13,5 @@ if ( !isset( $_FILES ) ) {
if ( !defined( 'DIRECTORY_SEPARATOR' ) ) { if ( !defined( 'DIRECTORY_SEPARATOR' ) ) {
define( 'DIRECTORY_SEPARATOR', define( 'DIRECTORY_SEPARATOR',
strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/' strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/'
) ; );
} }

View File

@@ -22,21 +22,21 @@
* This is the "File Uploader" for PHP. * This is the "File Uploader" for PHP.
*/ */
require('./config.php') ; require('./config.php');
require('./util.php') ; require('./util.php');
require('./io.php') ; require('./io.php');
require('./commands.php') ; require('./commands.php');
require('./phpcompat.php') ; require('./phpcompat.php');
function SendError( $number, $text ) function SendError( $number, $text )
{ {
SendUploadResults( $number, '', '', $text ) ; SendUploadResults( $number, '', '', $text );
} }
// Check if this uploader has been enabled. // Check if this uploader has been enabled.
if ( !$Config['Enabled'] ) if ( !$Config['Enabled'] )
SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ; SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' );
$sCommand = 'QuickUpload' ; $sCommand = 'QuickUpload' ;
@@ -47,11 +47,11 @@ $sCurrentFolder = "/" ;
// Is enabled the upload? // Is enabled the upload?
if ( ! IsAllowedCommand( $sCommand ) ) if ( ! IsAllowedCommand( $sCommand ) )
SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' ) ; SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' );
// Check if it is an allowed type. // Check if it is an allowed type.
if ( !IsAllowedType( $sType ) ) if ( !IsAllowedType( $sType ) )
SendUploadResults( 1, '', '', 'Invalid type specified' ) ; SendUploadResults( 1, '', '', 'Invalid type specified' );
// DOL_CHANGE // DOL_CHANGE

View File

@@ -25,13 +25,13 @@
function RemoveFromStart( $sourceString, $charToRemove ) function RemoveFromStart( $sourceString, $charToRemove )
{ {
$sPattern = '|^' . $charToRemove . '+|' ; $sPattern = '|^' . $charToRemove . '+|' ;
return preg_replace( $sPattern, '', $sourceString ) ; return preg_replace( $sPattern, '', $sourceString );
} }
function RemoveFromEnd( $sourceString, $charToRemove ) function RemoveFromEnd( $sourceString, $charToRemove )
{ {
$sPattern = '|' . $charToRemove . '+$|' ; $sPattern = '|' . $charToRemove . '+$|' ;
return preg_replace( $sPattern, '', $sourceString ) ; return preg_replace( $sPattern, '', $sourceString );
} }
function FindBadUtf8( $string ) function FindBadUtf8( $string )
@@ -65,16 +65,16 @@ function ConvertToXmlAttribute( $value )
} }
else else
{ {
$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 ) );
} }
} }
@@ -91,12 +91,12 @@ function IsHtmlExtension( $ext, $htmlExtensions )
{ {
return false ; return false ;
} }
$lcaseHtmlExtensions = array() ; $lcaseHtmlExtensions = array();
foreach ( $htmlExtensions as $key => $val ) 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 ) 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 ) )
@@ -117,25 +117,25 @@ function DetectHtml( $filePath )
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;
} }
$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' ) ; $tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' );
foreach( $tags as $tag ) foreach( $tags as $tag )
{ {

View File

@@ -330,7 +330,7 @@ class Expedition extends CommonObject
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'"; if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
dol_syslog("Expedition::fetch sql=".$sql); dol_syslog("Expedition::fetch sql=".$sql);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))

View File

@@ -85,7 +85,7 @@ class Fournisseur extends Societe
$sql.= " ".MAIN_DB_PREFIX."product_fournisseur_price as ppf"; $sql.= " ".MAIN_DB_PREFIX."product_fournisseur_price as ppf";
$sql .= " WHERE fk_soc = ".$this->id." AND ppf.fk_product_fournisseur = pf.rowid"; $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 ) if ( $resql )
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);

View File

@@ -125,7 +125,7 @@ class CommandeFournisseur extends Commande
else $sql.= " AND c.rowid=".$id; else $sql.= " AND c.rowid=".$id;
dol_syslog("CommandeFournisseur::fetch sql=".$sql,LOG_DEBUG); dol_syslog("CommandeFournisseur::fetch sql=".$sql,LOG_DEBUG);
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $this->db->fetch_object($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 .= " 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]->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 .= ", '".$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) ) if ( $this->db->query( $sql) )
{ {
$this->update_price(); $this->update_price();

View File

@@ -393,7 +393,7 @@ class ProductFournisseur extends Product
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this)."::fetch_fourn_data sql=".$sql); dol_syslog(get_class($this)."::fetch_fourn_data sql=".$sql);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$result = $this->db->fetch_array($result); $result = $this->db->fetch_array($result);
@@ -425,7 +425,7 @@ class ProductFournisseur extends Product
$sql.= " AND pf.rowid = pfp.fk_product_fournisseur"; $sql.= " AND pf.rowid = pfp.fk_product_fournisseur";
dol_syslog(get_class($this)."::fetch_product_fournisseur_price sql=".$sql, LOG_DEBUG); 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) if ($resql)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);

View File

@@ -101,7 +101,7 @@ $sql .= " WHERE p.fk_product_type <> 1";
$sql .= " ORDER BY p.datec DESC "; $sql .= " ORDER BY p.datec DESC ";
$sql .= $db->plimit(15 ,0); $sql .= $db->plimit(15 ,0);
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -140,7 +140,7 @@ $sql .= $db->plimit($limit + 1 ,$offset);
dol_syslog("fourn/product/liste: sql=".$sql); dol_syslog("fourn/product/liste: sql=".$sql);
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@@ -654,7 +654,7 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect
if ($conn_id) if ($conn_id)
{ {
// turn on passive mode transfers // turn on passive mode transfers
//ftp_pasv ($conn_id, true) ; //ftp_pasv ($conn_id, true);
if ($ftp_user) if ($ftp_user)
{ {

View File

@@ -95,7 +95,7 @@ function checkBanForAccount($account)
if ($country_code == 'FR') // France rules if ($country_code == 'FR') // France rules
{ {
$coef = array(62, 34, 3) ; $coef = array(62, 34, 3);
// Concatenation des differents codes. // Concatenation des differents codes.
$rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle)); $rib = strtolower(trim($account->code_banque).trim($account->code_guichet).trim($account->number).trim($account->cle));
// On remplace les eventuelles lettres par des chiffres. // On remplace les eventuelles lettres par des chiffres.
@@ -105,11 +105,11 @@ function checkBanForAccount($account)
// Multiplication de chaque groupe par les coef du tableau // Multiplication de chaque groupe par les coef du tableau
for ($i=0, $s=0; $i<3; $i++) 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] ; $s += (0 + $code) * $coef[$i] ;
} }
// Soustraction du modulo 97 de $s a 97 pour obtenir la cle // 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) if ($cle_rib == $account->cle)
{ {
return true; return true;

View File

@@ -345,7 +345,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
if($tableMarkup) $text = '<table '.$tableoptions.'>' ; if($tableMarkup) $text = '<table '.$tableoptions.'>' ;
foreach($data as $key => $item){ foreach($data as $key => $item){
if(is_array($item)){ if(is_array($item)){
$text.=array2tr($item,$troptions,$tdoptions) ; $text.=array2tr($item,$troptions,$tdoptions);
} else { } else {
$text.= '<tr '.$troptions.'>' ; $text.= '<tr '.$troptions.'>' ;
$text.= '<td '.$tdoptions.'>'.$key.'</td>' ; $text.= '<td '.$tdoptions.'>'.$key.'</td>' ;

View File

@@ -251,7 +251,7 @@ class Livraison extends CommonObject
$sql.= " WHERE l.rowid = ".$id; $sql.= " WHERE l.rowid = ".$id;
dol_syslog("Livraison::fetch sql=".$sql, LOG_DEBUG); dol_syslog("Livraison::fetch sql=".$sql, LOG_DEBUG);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))

View File

@@ -636,7 +636,7 @@ function hash_call($methodName,$nvpStr)
if (curl_errno($ch)) if (curl_errno($ch))
{ {
// moving to display page to display curl errors // 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); $_SESSION['curl_error_msg']=curl_error($ch);
//Execute the Error handling module to display errors. //Execute the Error handling module to display errors.

View File

@@ -1135,7 +1135,7 @@ class Product extends CommonObject
$sql.= " fk_product = '".$this->id."'"; $sql.= " fk_product = '".$this->id."'";
$sql.= " ORDER BY date_price DESC"; $sql.= " ORDER BY date_price DESC";
$sql.= " LIMIT 1"; $sql.= " LIMIT 1";
$resql = $this->db->query($sql) ; $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$result = $this->db->fetch_array($resql); $result = $this->db->fetch_array($resql);
@@ -1197,7 +1197,7 @@ class Product extends CommonObject
//$sql.= " AND pr.fk_statut != 0"; //$sql.= " AND pr.fk_statut != 0";
if ($socid > 0) $sql.= " AND p.fk_soc = ".$socid; if ($socid > 0) $sql.= " AND p.fk_soc = ".$socid;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($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 ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
if ($filtrestatut <> '') $sql.= " AND c.fk_statut in (".$filtrestatut.")"; if ($filtrestatut <> '') $sql.= " AND c.fk_statut in (".$filtrestatut.")";
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($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 ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
if ($filtrestatut != '') $sql.= " AND c.fk_statut in (".$filtrestatut.")"; // Peut valoir 0 if ($filtrestatut != '') $sql.= " AND c.fk_statut in (".$filtrestatut.")"; // Peut valoir 0
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($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 ($socid > 0) $sql.= " AND e.fk_soc = ".$socid;
if ($filtrestatut <> '') $sql.= " AND e.fk_statut in (".$filtrestatut.")"; if ($filtrestatut <> '') $sql.= " AND e.fk_statut in (".$filtrestatut.")";
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($result); $obj=$this->db->fetch_object($result);
@@ -1368,7 +1368,7 @@ class Product extends CommonObject
//$sql.= " AND c.statut != 0"; //$sql.= " AND c.statut != 0";
if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($result); $obj=$this->db->fetch_object($result);
@@ -1410,7 +1410,7 @@ class Product extends CommonObject
//$sql.= " AND f.fk_statut != 0"; //$sql.= " AND f.fk_statut != 0";
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($result); $obj=$this->db->fetch_object($result);
@@ -1452,7 +1452,7 @@ class Product extends CommonObject
//$sql.= " AND f.fk_statut != 0"; //$sql.= " AND f.fk_statut != 0";
if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$obj=$this->db->fetch_object($result); $obj=$this->db->fetch_object($result);
@@ -1665,7 +1665,7 @@ class Product extends CommonObject
} }
else else
{ {
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
@@ -2387,7 +2387,7 @@ class Product extends CommonObject
$sql.= " WHERE fk_product = '".$this->id."'"; $sql.= " WHERE fk_product = '".$this->id."'";
dol_syslog("Product::load_stock sql=".$sql); dol_syslog("Product::load_stock sql=".$sql);
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);

View File

@@ -152,7 +152,7 @@ if($action == 'search' )
} }
$sql.= " ORDER BY p.ref ASC"; $sql.= " ORDER BY p.ref ASC";
$resql = $db->query($sql) ; $resql = $db->query($sql);
} }
//print $sql; //print $sql;

View File

@@ -171,7 +171,7 @@ $sql.= $db->order("p.tms","DESC");
$sql.= $db->plimit($max,0); $sql.= $db->plimit($max,0);
//print $sql; //print $sql;
$result = $db->query($sql) ; $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);

View File

@@ -165,7 +165,7 @@ else
$sql.= $db->plimit($limit + 1 ,$offset); $sql.= $db->plimit($limit + 1 ,$offset);
dol_syslog("sql=".$sql); dol_syslog("sql=".$sql);
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@@ -106,7 +106,7 @@ $sql.= " GROUP BY (p.rowid)";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit ,$offset); $sql.= $db->plimit($limit ,$offset);
$result=$db->query($sql) ; $result=$db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);

View File

@@ -345,7 +345,7 @@ if ($_GET["action"] == 'edit_price' && ($user->rights->produit->creer || $user->
// Price minimum // Price minimum
print '<tr><td>' ; 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); print $html->textwithpicto($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
if ($product->price_base_type == 'TTC') 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.= " ORDER BY p.date_price DESC, p.price_level ASC";
//$sql .= $db->plimit(); //$sql .= $db->plimit();
$result = $db->query($sql) ; $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
if (! $num) if (! $num)
{ {
$db->free($result) ; $db->free($result);
// Il doit au moins y avoir la ligne de prix initial. // Il doit au moins y avoir la ligne de prix initial.
// On l'ajoute donc pour remettre a niveau (pb vieilles versions) // On l'ajoute donc pour remettre a niveau (pb vieilles versions)
$product->update_price($product->id, $product->price, 'HT', $user, $newprice_min); $product->update_price($product->id, $product->price, 'HT', $user, $newprice_min);
$result = $db->query($sql) ; $result = $db->query($sql);
$num = $db->num_rows($result); $num = $db->num_rows($result);
} }

View File

@@ -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 if ($toolowstock) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1 ,$offset); $sql.= $db->plimit($limit + 1 ,$offset);
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -330,7 +330,7 @@ class Entrepot extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot";
$sql.= " WHERE statut = ".$status; $sql.= " WHERE statut = ".$status;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
$i = 0; $i = 0;
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
if ( $result ) if ( $result )
@@ -361,7 +361,7 @@ class Entrepot extends CommonObject
$sql .= " WHERE ps.fk_entrepot = ".$this->id." AND ps.fk_product=p.rowid"; $sql .= " WHERE ps.fk_entrepot = ".$this->id." AND ps.fk_product=p.rowid";
//print $sql; //print $sql;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);

View File

@@ -355,7 +355,7 @@ else
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
dol_syslog('List products sql='.$sql); dol_syslog('List products sql='.$sql);
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@@ -65,7 +65,7 @@ $sql.= " AND e.entity = ".$conf->entity;
$sql.= " ORDER BY e.statut DESC "; $sql.= " ORDER BY e.statut DESC ";
$sql.= $db->plimit(15 ,0); $sql.= $db->plimit(15 ,0);
$result = $db->query($sql) ; $result = $db->query($sql);
if ($result) if ($result)
{ {
@@ -119,7 +119,7 @@ $sql.= $db->order("datem","DESC");
$sql.= $db->plimit($max,0); $sql.= $db->plimit($max,0);
dol_syslog("Index:list stock movements sql=".$sql, LOG_DEBUG); dol_syslog("Index:list stock movements sql=".$sql, LOG_DEBUG);
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@@ -59,7 +59,7 @@ if ($sall)
$sql.= " ORDER BY $sortfield $sortorder"; $sql.= " ORDER BY $sortfield $sortorder";
$sql.= $db->plimit($limit + 1 ,$offset); $sql.= $db->plimit($limit + 1 ,$offset);
$result = $db->query($sql) ; $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);

View File

@@ -125,7 +125,7 @@ $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit + 1 ,$offset); $sql.= $db->plimit($conf->liste_limit + 1 ,$offset);
//print $sql; //print $sql;
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@@ -141,7 +141,7 @@ if ($_GET["id"])
$sql .= " WHERE ue.fk_user = u.rowid "; $sql .= " WHERE ue.fk_user = u.rowid ";
$sql .= " AND ue.fk_entrepot = ".$entrepot->id; $sql .= " AND ue.fk_entrepot = ".$entrepot->id;
$resql = $db->query($sql) ; $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@@ -74,7 +74,7 @@ $sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset); $sql.= $db->plimit($limit + 1, $offset);
$result = $db->query($sql) ; $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);

View File

@@ -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 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON l.fk_pays = p.rowid";
$sql .= " WHERE l.rowid = ".$id; $sql .= " WHERE l.rowid = ".$id;
$result = $this->db->query($sql) ; $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {

View File

@@ -60,7 +60,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$upload_dir = $conf->societe->dir_output . "/" . $socid ; $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); $object = new Societe($db);

View File

@@ -156,7 +156,7 @@ $sql.= $db->order("s.tms","DESC");
$sql.= $db->plimit($max,0); $sql.= $db->plimit($max,0);
//print $sql; //print $sql;
$result = $db->query($sql) ; $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);

View File

@@ -320,7 +320,7 @@ div.tmenu {
padding: 0px; padding: 0px;
margin: 10px 0px 10px 0px; margin: 10px 0px 10px 0px;
font-size: 13px; 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; height: 22px;
border-bottom: 2px solid #842F00; border-bottom: 2px solid #842F00;
<?php } ?> <?php } ?>