mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX Edit of virtualhost
This commit is contained in:
parent
bb1e7ee0a1
commit
e33f102dc2
|
|
@ -516,7 +516,7 @@ class Form
|
|||
* @param string $text Text to show
|
||||
* @param string $htmltext Content of tooltip
|
||||
* @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
|
||||
* @param string $type Type of picto ('info', 'help', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath
|
||||
* @param string $type Type of picto ('info', 'help', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'
|
||||
* @param string $extracss Add a CSS style to td, div or span tag
|
||||
* @param int $noencodehtmltext Do not encode into html entity the htmltext
|
||||
* @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
|
||||
|
|
@ -557,12 +557,13 @@ class Form
|
|||
if ($type == 'info' || $type == 'help') return $text;
|
||||
}
|
||||
|
||||
$img='';
|
||||
if ($type == 'info') $img = img_help(0, $alt);
|
||||
elseif ($type == 'help') $img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt);
|
||||
elseif ($type == 'superadmin') $img = img_picto($alt, 'redstar');
|
||||
elseif ($type == 'admin') $img = img_picto($alt, 'star');
|
||||
elseif ($type == 'warning') $img = img_warning($alt);
|
||||
else $img = img_picto($alt, $type);
|
||||
elseif ($type != 'none') $img = img_picto($alt, $type); // $type can be an image path
|
||||
|
||||
return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && ! $img)?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,11 +39,12 @@ ViewPageInNewTab=View page in new tab
|
|||
SetAsHomePage=Set as Home page
|
||||
RealURL=Real URL
|
||||
ViewWebsiteInProduction=View web site using home URLs
|
||||
SetHereVirtualHost=<u>Use with Apache/NGinx/...</u><br>If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on<br><strong>%s</strong><br>then enter here the virtual hostname you have created, so the preview can be done also using this dedicated web server access instead of only using Dolibarr server.
|
||||
SetHereVirtualHost=<u>Use with Apache/NGinx/...</u><br>If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on<br><strong>%s</strong><br>then set the name of the virtual host you have created in the properties of web site, so the preview can be done also using this dedicated web server access instead of the internal Dolibarr server.
|
||||
YouCanAlsoTestWithPHPS=<u>Use with PHP embedded server</u><br>On develop environment, you may prefer to test the site with the PHP embedded web server (PHP 5.5 required) by running<br><strong>php -S 0.0.0.0:8080 -t %s</strong>
|
||||
CheckVirtualHostPerms=Check also that virtual host has permission <strong>%s</strong> on files into<br><strong>%s</strong>
|
||||
ReadPerm=Read
|
||||
WritePerm=Write
|
||||
TestDeployOnWeb=Test/deploy on web
|
||||
PreviewSiteServedByWebServer=<u>Preview %s in a new tab.</u><br><br>The %s will be served by an external web server (like Apache, Nginx, IIS). You must install and setup this server before to point to directory:<br><strong>%s</strong><br>URL served by external server:<br><strong>%s</strong>
|
||||
PreviewSiteServedByDolibarr=<u>Preview %s in a new tab.</u><br><br>The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL served by Dolibarr:<br><strong>%s</strong><br><br>To use your own external web server to serve this web site, create a virtual host on your web server that point on directory<br><strong>%s</strong><br>then enter the name of this virtual server and click on the other preview button.
|
||||
VirtualHostUrlNotDefined=URL of the virtual host served by external web server not defined
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ if ($action == 'addsite')
|
|||
$tmpobject=new Website($db);
|
||||
$tmpobject->ref = GETPOST('WEBSITE_REF','alpha');
|
||||
$tmpobject->description = GETPOST('WEBSITE_DESCRIPTION','alpha');
|
||||
$tmpobject->virtualhost = GETPOST('WEBSITE_VIRTUALHOST','alpha');
|
||||
$tmpobject->virtualhost = GETPOST('virtualhost','alpha');
|
||||
|
||||
$result = $tmpobject->create($user);
|
||||
if ($result <= 0)
|
||||
|
|
@ -867,180 +867,207 @@ if ($action == 'updatecss')
|
|||
$res = $object->fetch(0, $websitekey);
|
||||
$website = $object;
|
||||
|
||||
// Save master.inc.php file
|
||||
$filemaster=$pathofwebsite.'/master.inc.php';
|
||||
|
||||
dol_syslog("Save master file ".$filemaster);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
|
||||
// Now generate the master.inc.php page
|
||||
$result = dolSaveMasterFile($filemaster);
|
||||
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
||||
|
||||
|
||||
// Html header file
|
||||
$htmlheadercontent ='';
|
||||
|
||||
/* We disable php code since htmlheader is never executed as an include but only read by fgets_content.
|
||||
$htmlheadercontent.= "<?php // BEGIN PHP\n";
|
||||
$htmlheadercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$htmlheadercontent.= "ob_start();\n";
|
||||
// $htmlheadercontent.= "header('Content-type: text/html');\n"; // Not required. htmlheader.html is never call as a standalone page
|
||||
$htmlheadercontent.= "// END PHP ?>\n";*/
|
||||
|
||||
$htmlheadercontent.= preg_replace(array('/<html>\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER', 'none'));
|
||||
|
||||
/*$htmlheadercontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$htmlheadercontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$htmlheadercontent.= "// END PHP ?>"."\n";*/
|
||||
|
||||
$htmlheadercontent = trim($htmlheadercontent)."\n";
|
||||
|
||||
dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent);
|
||||
|
||||
|
||||
// Css file
|
||||
$csscontent ='';
|
||||
|
||||
$csscontent.= "<?php // BEGIN PHP\n";
|
||||
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$csscontent.= "ob_start();\n";
|
||||
$csscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "// END PHP ?>\n";
|
||||
|
||||
$csscontent.= GETPOST('WEBSITE_CSS_INLINE', 'none');
|
||||
|
||||
$csscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$csscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$csscontent.= "// END PHP ?>"."\n";
|
||||
|
||||
dol_syslog("Save css content into ".$filecss);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filecss, $csscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
if (GETPOSTISSET('virtualhost'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
||||
if (GETPOST('virtualhost','alpha') && ! preg_match('/^http/',GETPOST('virtualhost','alpha')))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Error URL must start with http:// or https://', null, 'errors');
|
||||
$action='editcss';
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->virtualhost = GETPOST('virtualhost','alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='editcss';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Js file
|
||||
$jscontent ='';
|
||||
|
||||
$jscontent.= "<?php // BEGIN PHP\n";
|
||||
$jscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$jscontent.= "ob_start();\n";
|
||||
$jscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$jscontent.= "header('Content-type: application/javascript');\n";
|
||||
$jscontent.= "// END PHP ?>\n";
|
||||
|
||||
$jscontent.= GETPOST('WEBSITE_JS_INLINE', 'none');
|
||||
|
||||
$jscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$jscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$jscontent.= "// END PHP ?>"."\n";
|
||||
|
||||
dol_syslog("Save js content into ".$filejs);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filejs, $jscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filejs, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filejs, null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Robot file
|
||||
$robotcontent ='';
|
||||
|
||||
/*$robotcontent.= "<?php // BEGIN PHP\n";
|
||||
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$robotcontent.= "ob_start();\n";
|
||||
$robotcontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$robotcontent.= "header('Content-type: text/css');\n";
|
||||
$robotcontent.= "// END PHP ?>\n";*/
|
||||
|
||||
$robotcontent.= GETPOST('WEBSITE_ROBOT', 'none');
|
||||
|
||||
/*$robotcontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$robotcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$robotcontent.= "// END PHP ?>"."\n";*/
|
||||
|
||||
dol_syslog("Save file robot into ".$filerobot);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filerobot, $robotcontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Css file
|
||||
$htaccesscontent ='';
|
||||
|
||||
/*$htaccesscontent.= "<?php // BEGIN PHP\n";
|
||||
$htaccesscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htaccesscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$htaccesscontent.= "ob_start();\n";
|
||||
$htaccesscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$htaccesscontent.= "header('Content-type: text/css');\n";
|
||||
$htaccesscontent.= "// END PHP ?>\n";*/
|
||||
|
||||
$htaccesscontent.= GETPOST('WEBSITE_HTACCESS', 'none');
|
||||
|
||||
/*$htaccesscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$htaccesscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$htaccesscontent.= "// END PHP ?>"."\n";*/
|
||||
|
||||
dol_syslog("Save file htaccess into ".$filehtaccess);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filehtaccess, $htaccesscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
|
||||
}
|
||||
|
||||
// Message if no error
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||
}
|
||||
// Save master.inc.php file
|
||||
$filemaster=$pathofwebsite.'/master.inc.php';
|
||||
|
||||
$action='preview';
|
||||
dol_syslog("Save master file ".$filemaster);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
|
||||
// Now generate the master.inc.php page
|
||||
$result = dolSaveMasterFile($filemaster);
|
||||
if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors');
|
||||
|
||||
|
||||
// Html header file
|
||||
$htmlheadercontent ='';
|
||||
|
||||
/* We disable php code since htmlheader is never executed as an include but only read by fgets_content.
|
||||
$htmlheadercontent.= "<?php // BEGIN PHP\n";
|
||||
$htmlheadercontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htmlheadercontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htmlheadercontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$htmlheadercontent.= "ob_start();\n";
|
||||
// $htmlheadercontent.= "header('Content-type: text/html');\n"; // Not required. htmlheader.html is never call as a standalone page
|
||||
$htmlheadercontent.= "// END PHP ?>\n";*/
|
||||
|
||||
$htmlheadercontent.= preg_replace(array('/<html>\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER', 'none'));
|
||||
|
||||
/*$htmlheadercontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$htmlheadercontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$htmlheadercontent.= "// END PHP ?>"."\n";*/
|
||||
|
||||
$htmlheadercontent = trim($htmlheadercontent)."\n";
|
||||
|
||||
dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent);
|
||||
|
||||
|
||||
// Css file
|
||||
$csscontent ='';
|
||||
|
||||
$csscontent.= "<?php // BEGIN PHP\n";
|
||||
$csscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$csscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$csscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$csscontent.= "ob_start();\n";
|
||||
$csscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$csscontent.= "header('Content-type: text/css');\n";
|
||||
$csscontent.= "// END PHP ?>\n";
|
||||
|
||||
$csscontent.= GETPOST('WEBSITE_CSS_INLINE', 'none');
|
||||
|
||||
$csscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$csscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$csscontent.= "// END PHP ?>"."\n";
|
||||
|
||||
dol_syslog("Save css content into ".$filecss);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filecss, $csscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filecss, null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Js file
|
||||
$jscontent ='';
|
||||
|
||||
$jscontent.= "<?php // BEGIN PHP\n";
|
||||
$jscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$jscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once dirname(__FILE__).'/master.inc.php'; } // Not already loaded"."\n"; // For the css, we need to set path of master using the dirname of css file.
|
||||
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$jscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$jscontent.= "ob_start();\n";
|
||||
$jscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$jscontent.= "header('Content-type: application/javascript');\n";
|
||||
$jscontent.= "// END PHP ?>\n";
|
||||
|
||||
$jscontent.= GETPOST('WEBSITE_JS_INLINE', 'none');
|
||||
|
||||
$jscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$jscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$jscontent.= "// END PHP ?>"."\n";
|
||||
|
||||
dol_syslog("Save js content into ".$filejs);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filejs, $jscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filejs, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filejs, null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Robot file
|
||||
$robotcontent ='';
|
||||
|
||||
/*$robotcontent.= "<?php // BEGIN PHP\n";
|
||||
$robotcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$robotcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$robotcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$robotcontent.= "ob_start();\n";
|
||||
$robotcontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$robotcontent.= "header('Content-type: text/css');\n";
|
||||
$robotcontent.= "// END PHP ?>\n";*/
|
||||
|
||||
$robotcontent.= GETPOST('WEBSITE_ROBOT', 'none');
|
||||
|
||||
/*$robotcontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$robotcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$robotcontent.= "// END PHP ?>"."\n";*/
|
||||
|
||||
dol_syslog("Save file robot into ".$filerobot);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filerobot, $robotcontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Css file
|
||||
$htaccesscontent ='';
|
||||
|
||||
/*$htaccesscontent.= "<?php // BEGIN PHP\n";
|
||||
$htaccesscontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$htaccesscontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
|
||||
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$htaccesscontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$htaccesscontent.= "ob_start();\n";
|
||||
$htaccesscontent.= "header('Cache-Control: max-age=3600, public, must-revalidate');\n";
|
||||
$htaccesscontent.= "header('Content-type: text/css');\n";
|
||||
$htaccesscontent.= "// END PHP ?>\n";*/
|
||||
|
||||
$htaccesscontent.= GETPOST('WEBSITE_HTACCESS', 'none');
|
||||
|
||||
/*$htaccesscontent.= "\n".'<?php // BEGIN PHP'."\n";
|
||||
$htaccesscontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||
$htaccesscontent.= "// END PHP ?>"."\n";*/
|
||||
|
||||
dol_syslog("Save file htaccess into ".$filehtaccess);
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
$result = file_put_contents($filehtaccess, $htaccesscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages('Failed to write file '.$filehtaccess, null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
// Message if no error
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||
}
|
||||
|
||||
$action='preview';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1791,46 +1818,40 @@ if (! GETPOST('hide_websitemenu'))
|
|||
$urlext=$virtualurl;
|
||||
$urlint=$urlwithroot.'/public/website/index.php?website='.$websitekey;
|
||||
|
||||
$htmltext = $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
|
||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/website/index.php?website='.$websitekey.'" target="tab'.$websitekey.'" alt="'.dol_escape_htmltag($htmltext).'">';
|
||||
print $form->textwithpicto('', $htmltext, 1, 'preview');
|
||||
print '</a>';
|
||||
|
||||
print '<div class="websiteinputurl" id="websiteinputurl">';
|
||||
print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" placeholder="'.$langs->trans("http://myvirtualhost").'" value="'.$virtualurl.'">';
|
||||
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$websitekey.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
|
||||
$htmltext =$langs->trans("SetHereVirtualHost", $dataroot);
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>';
|
||||
$htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost');
|
||||
print '</div>';
|
||||
|
||||
$linktotestonwebserver = '<a href="'.($virtualurl?$virtualurl:'#').'" class="valignmiddle">';
|
||||
$linktotestonwebserver.= $langs->trans("TestDeployOnWeb", $virtualurl).' '.img_picto('','object_globe');
|
||||
$linktotestonwebserver.= '</a>';
|
||||
$htmltext = '';
|
||||
if (empty($object->fk_default_home))
|
||||
{
|
||||
$htmltext = '<span class="error">'.$langs->trans("YouMustDefineTheHomePage").'</span><br>'.$langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>');
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT);
|
||||
print '<span class="websitebuttonsitepreview websitebuttonsitepreviewdisabled cursornotallowed" id="previewsiteextdisabled" href="" target="tab'.$websitekey.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $htmltext, 1, 'preview_ext');
|
||||
print '</span>';
|
||||
$htmltext.= '<span class="error">'.$langs->trans("YouMustDefineTheHomePage").'</span><br><br>';
|
||||
}
|
||||
if (empty($virtualurl))
|
||||
{
|
||||
$htmltext.= '<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span><br><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmltext = $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>');
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
|
||||
print '<a class="websitebuttonsitepreview'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$websitekey.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $htmltext, 1, 'preview_ext');
|
||||
print '</a>';
|
||||
$htmltext.= '<br><center>'.$langs->trans("GoTo").' <a href="'.$virtualurl.'" target="_website">'.$virtualurl.'</a></center><br>';
|
||||
}
|
||||
if (! empty($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER))
|
||||
{
|
||||
$htmltext.= '<br>'.$conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER;
|
||||
}
|
||||
else
|
||||
{
|
||||
$htmltext.=$langs->trans("SetHereVirtualHost", $dataroot);
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>bb'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>';
|
||||
$htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot);
|
||||
}
|
||||
print $form->textwithpicto($linktotestonwebserver, $htmltext, 1, 'none', '', 0, 2, 'helpvirtualhost');
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
if (in_array($action, array('editcss','editmenu','file_manager')))
|
||||
|
|
@ -2321,6 +2342,19 @@ if ($action == 'editcss')
|
|||
|
||||
print '</td></tr>';
|
||||
|
||||
// VirtualHost
|
||||
print '<tr><td class="tdtop">';
|
||||
|
||||
$htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>'.$websitekey.'</i>');
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
|
||||
|
||||
print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'virtualhosttooltip');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" value="'.(GETPOSTISSET('virtualhost') ? GETPOST('virtualhost','alpha') : $virtualurl).'" name="virtualhost">';
|
||||
print '</td>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
|
@ -2370,14 +2404,15 @@ if ($action == 'createsite')
|
|||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
|
||||
$htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>');
|
||||
$htmltext.='<br>';
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
|
||||
$htmltext.='<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
|
||||
|
||||
print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'virtualhosttooltip');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat minwidth300" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">';
|
||||
print '<input type="text" class="flat minwidth300" name="virtualhost" value="'.dol_escape_htmltag($sitedesc).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user