Fix: rename dol_file_exists to dol_buildpath

This commit is contained in:
Regis Houssin 2010-12-19 18:43:44 +00:00
parent b3c373bae8
commit e1ab6c053f
19 changed files with 26 additions and 27 deletions

View File

@ -63,7 +63,7 @@ function print_auguria_menu($db,$atarget,$type_user)
}
else
{
$url=dol_file_exists($tabMenu[$i]['url'],1);
$url=dol_buildpath($tabMenu[$i]['url'],1);
if (! preg_match('/\?/',$url)) $url.='?';
else $url.='&';
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
@ -275,7 +275,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after)
}
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
$url=dol_file_exists($menu_array[$i]['url'],1);
$url=dol_buildpath($menu_array[$i]['url'],1);
if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
{

View File

@ -453,7 +453,7 @@ function print_eldy_menu($db,$atarget,$type_user)
}
else
{
$url=dol_file_exists($tabMenu[$i]['url'],1);
$url=dol_buildpath($tabMenu[$i]['url'],1);
if (! preg_match('/\?/',$url)) $url.='?';
else $url.='&';
if (! preg_match('/mainmenu/i',$url) || ! preg_match('/leftmenu/i',$url))
@ -1385,7 +1385,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
}
// For external modules
$url = dol_file_exists($menu_array[$i]['url'], 1);
$url = dol_buildpath($menu_array[$i]['url'], 1);
// Menu niveau 0
if ($menu_array[$i]['level'] == 0)

View File

@ -122,7 +122,7 @@ function societe_prepare_head($objsoc)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -79,7 +79,7 @@ function contact_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -65,7 +65,7 @@ function contract_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -78,7 +78,7 @@ function fichinter_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -69,7 +69,7 @@ function facturefourn_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
@ -134,7 +134,7 @@ function ordersupplier_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -87,19 +87,18 @@ function dol_require_once($relpath)
// Forced to use file_exists otherwise there is a blank page
//$res=@require_once(DOL_DOCUMENT_ROOT.$relpath);
//if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@require_once(DOL_DOCUMENT_ROOT_ALT.$relpath);
$res=require_once(dol_file_exists($relpath));
$res=require_once(dol_buildpath($relpath));
return $res;
}
/**
* Return path of url or filesystem. Return default_root or alternate root if file_exist fails.
* TODO Rename function into dol_buildpath
* @param path Relative or absolute path to file (Ie: mydir/myfile, ../myfile, ...)
* @param mode 0=Used for a Filesystem path, 1=Used for an URL path
* @return string Full filsystem path (if mode=0), Relative url path (if mode=1)
*/
function dol_file_exists($path,$mode=0)
function dol_buildpath($path,$mode=0)
{
if (empty($mode)) // For a filesystem path
{

View File

@ -88,7 +88,7 @@ function facture_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -89,7 +89,7 @@ function member_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -106,7 +106,7 @@ function commande_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -83,7 +83,7 @@ function prelevement_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -131,7 +131,7 @@ function product_prepare_head($object, $user)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -76,7 +76,7 @@ function project_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
@ -156,7 +156,7 @@ function task_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -101,7 +101,7 @@ function propal_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -59,7 +59,7 @@ function shipping_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
@ -102,7 +102,7 @@ function delivery_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -80,7 +80,7 @@ function stock_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -97,7 +97,7 @@ function user_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
@ -153,7 +153,7 @@ function group_prepare_head($object)
{
$values=explode(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_file_exists(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;

View File

@ -843,7 +843,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
{
foreach($conf->css_modules as $cssfile)
{ // cssfile is an absolute path
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_file_exists($cssfile,1).'?lang='.$langs->defaultlang.'&theme='.$conf->theme.(! empty($_GET["optioncss"])?'&optioncss='.$_GET["optioncss"]:'').'">'."\n";
print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1).'?lang='.$langs->defaultlang.'&theme='.$conf->theme.(! empty($_GET["optioncss"])?'&optioncss='.$_GET["optioncss"]:'').'">'."\n";
}
}
// CSS forced by page in top_htmlhead call (relative url starting with /)