Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/langs/en_US/website.lang htdocs/theme/eldy/style.css.php htdocs/websites/class/website.class.php htdocs/websites/index.php
This commit is contained in:
commit
7760594643
@ -64,3 +64,38 @@ function dolWebsiteOutput($content)
|
||||
print $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clean an HTML page to report only content, so we can include it into another page
|
||||
* It outputs content of file sanitized from html and body part.
|
||||
*
|
||||
* @param string $contentfile Path to file to include (must include website root. Example: 'mywebsite/mypage.php')
|
||||
* @return void
|
||||
*/
|
||||
function dolIncludeHtmlContent($contentfile)
|
||||
{
|
||||
global $conf, $db, $langs, $mysoc, $user, $website;
|
||||
global $includehtmlcontentopened;
|
||||
|
||||
$MAXLEVEL=20;
|
||||
|
||||
$fullpathfile=DOL_DATA_ROOT.'/websites/'.$contentfile;
|
||||
//$content = file_get_contents($fullpathfile);
|
||||
//print preg_replace(array('/^.*<body[^>]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/
|
||||
|
||||
if (empty($includehtmlcontentopened)) $includehtmlcontentopened=0;
|
||||
$includehtmlcontentopened++;
|
||||
if ($includehtmlcontentopened > $MAXLEVEL)
|
||||
{
|
||||
print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.$MAXLEVEL.".\n";
|
||||
return;
|
||||
}
|
||||
$res = include $fullpathfile; // Include because we want to execute code content
|
||||
if (! $res)
|
||||
{
|
||||
print 'ERROR: FAILED TO INCLUDE PAGE '.$contentfile.".\n";
|
||||
}
|
||||
|
||||
$includehtmlcontentopened--;
|
||||
}
|
||||
|
||||
|
||||
28
htdocs/core/website.inc.php
Normal file
28
htdocs/core/website.inc.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/website.inc.php
|
||||
* \brief Common file loaded used by all website pages (after master.inc.php)
|
||||
* The global variable $website must be defined.
|
||||
*/
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||
$website=new Website($db);
|
||||
$website->fetch(0,$websitekey);
|
||||
@ -573,3 +573,7 @@ UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement c
|
||||
UPDATE llx_bank SET label= '(payment_salary)' WHERE label LIKE 'Règlement salaire';
|
||||
|
||||
ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255);
|
||||
|
||||
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
|
||||
|
||||
@ -163,6 +163,8 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_product_price_by_qty FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
|
||||
|
||||
-- Add triggers for timestamp fields named date_m
|
||||
|
||||
@ -19,8 +19,9 @@ AddPage=Add page
|
||||
HomePage=Home Page
|
||||
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
|
||||
RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this.
|
||||
PageDeleted=Page '%s' of website %s deleted
|
||||
PageAdded=Page '%s' added
|
||||
PageContent=Page/Content
|
||||
PageDeleted=Page/Content '%s' of website %s deleted
|
||||
PageAdded=Page/Content '%s' added
|
||||
ViewSiteInNewTab=View site in new tab
|
||||
ViewPageInNewTab=View page in new tab
|
||||
SetAsHomePage=Set as Home page
|
||||
@ -30,4 +31,6 @@ SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a
|
||||
PreviewSiteServedByWebServer=Preview %s in a new tab.<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=Preview %s in a new tab.<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
|
||||
NoPageYet=No pages yet
|
||||
NoPageYet=No pages yet
|
||||
SyntaxHelp=Help on code syntax
|
||||
YouCanEditHtmlSource=You can edit HTML source code using the "Source" button in editor. You can also include PHP code into this source using tags <strong><?php ?></strong>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.<br>You can also include content of another Page/Content with the following syntax: <strong><?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?></strong>
|
||||
|
||||
@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$error=0;
|
||||
$website=GETPOST('website', 'alpha');
|
||||
$websitekey=GETPOST('website', 'alpha');
|
||||
$pageid=GETPOST('page', 'alpha')?GETPOST('page', 'alpha'):GETPOST('pageid', 'alpha');
|
||||
|
||||
$accessallowed = 1;
|
||||
@ -69,7 +69,7 @@ if (empty($pageid))
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
||||
|
||||
$object=new Website($db);
|
||||
$object->fetch(0, $website);
|
||||
$object->fetch(0, $websitekey);
|
||||
if (empty($object->id))
|
||||
{
|
||||
if (empty($pageid))
|
||||
@ -125,11 +125,11 @@ if ($pageid == 'css') // No more used ?
|
||||
//if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||
//else
|
||||
header('Cache-Control: no-cache');
|
||||
$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css.php';
|
||||
$original_file=$dolibarr_main_data_root.'/websites/'.$websitekey.'/styles.css.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/page'.$pageid.'.tpl.php';
|
||||
$original_file=$dolibarr_main_data_root.'/websites/'.$websitekey.'/page'.$pageid.'.tpl.php';
|
||||
}
|
||||
|
||||
// Find the subdirectory name as the reference
|
||||
|
||||
@ -3353,6 +3353,11 @@ a.websitebuttonsitepreview img {
|
||||
a.websitebuttonsitepreviewdisabled img {
|
||||
opacity: 0.2;
|
||||
}
|
||||
.websitehelp {
|
||||
vertical-align: middle;
|
||||
float: right;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
|
||||
@ -3428,10 +3428,17 @@ a.websitebuttonsitepreview img {
|
||||
width: 26px;
|
||||
display: inline-block;
|
||||
}
|
||||
a.websitebuttonsitepreviewdisabled img {
|
||||
opacity: 0.2;
|
||||
}
|
||||
.websiteiframenoborder {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.websitehelp {
|
||||
vertical-align: middle;
|
||||
float: right;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Module agenda */
|
||||
|
||||
@ -48,11 +48,6 @@ class Website extends CommonObject
|
||||
*/
|
||||
public $table_element = 'website';
|
||||
|
||||
/**
|
||||
* @var WebsitePage[] Lines of all pages
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
@ -87,12 +82,6 @@ class Website extends CommonObject
|
||||
public $virtualhost;
|
||||
|
||||
|
||||
public $records;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -146,8 +135,8 @@ class Website extends CommonObject
|
||||
$sql.= 'status,';
|
||||
$sql.= 'fk_default_home,';
|
||||
$sql.= 'virtualhost,';
|
||||
$sql.= 'fk_user_create';
|
||||
$sql.= 'date_creation';
|
||||
$sql.= 'fk_user_create,';
|
||||
$sql.= 'date_creation,';
|
||||
$sql.= 'tmps';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).',';
|
||||
@ -222,7 +211,7 @@ class Website extends CommonObject
|
||||
$sql .= " t.tms";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if (null !== $ref) {
|
||||
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
|
||||
$sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'";
|
||||
} else {
|
||||
$sql .= ' WHERE t.rowid = ' . $id;
|
||||
}
|
||||
|
||||
@ -379,12 +379,13 @@ if ($action == 'updatemeta')
|
||||
|
||||
|
||||
// Now generate the master.inc.php page
|
||||
dol_syslog("We regenerate the master file");
|
||||
dol_syslog("We regenerate the master file (because we update meta)");
|
||||
dol_delete_file($filemaster);
|
||||
|
||||
$mastercontent = '<?php'."\n";
|
||||
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
|
||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||
$mastercontent.= '$website = new WebSite($db)'."\n";
|
||||
$mastercontent.= '?>'."\n";
|
||||
$result = file_put_contents($filemaster, $mastercontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@ -572,8 +573,10 @@ if ($action == 'updatecontent' || ($action == 'preview' && (GETPOST('refreshsite
|
||||
|
||||
$tplcontent ='';
|
||||
$tplcontent.= "<?php // BEGIN PHP\n";
|
||||
$tplcontent.= '$websitekey=basename(dirname(__FILE__));'."\n";
|
||||
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require './master.inc.php'; } // Not already loaded"."\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
|
||||
$tplcontent.= "ob_start();\n";
|
||||
$tplcontent.= "// END PHP ?>\n";
|
||||
$tplcontent.= '<html>'."\n";
|
||||
@ -759,8 +762,8 @@ if (count($object->records) > 0)
|
||||
|
||||
$urlext=$virtualurl;
|
||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
||||
print '<a class="websitebuttonsitepreview'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||
print '<a class="websitebuttonsitepreview'.($urlext?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'ext" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
|
||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||
@ -832,7 +835,6 @@ if (count($object->records) > 0)
|
||||
}
|
||||
|
||||
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
//print $form->selectarray('page', $array);
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
@ -853,8 +855,6 @@ if (count($object->records) > 0)
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="websitetools">';
|
||||
@ -869,15 +869,14 @@ if (count($object->records) > 0)
|
||||
|
||||
print '<div class="websiteinputurl" id="websiteinputpage">';
|
||||
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
|
||||
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
|
||||
$htmltext=$langs->trans("PageNameAliasHelp", $langs->transnoentitiesnoconv("EditPageMeta"));
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helppagealias');
|
||||
print '</div>';
|
||||
|
||||
$urlext=$virtualurl.'/'.$pagealias.'.php';
|
||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
||||
print '<a class="websitebuttonsitepreview'.($virtualurl?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $virtualurl?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||
print '<a class="websitebuttonsitepreview'.($virtualurl?'':' websitebuttonsitepreviewdisabled cursornotallowed').'" id="previewpageext" href="'.$urlext.'ext" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $virtualurl?$urlext:'<span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span>'), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
|
||||
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
|
||||
@ -896,6 +895,16 @@ if (count($object->records) > 0)
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="websitehelp">';
|
||||
if (GETPOST('editcontent', 'alpha'))
|
||||
{
|
||||
$htmltext=$langs->transnoentitiesnoconv("YouCanEditHtmlSource");
|
||||
print $form->textwithpicto($langs->trans("SyntaxHelp"), $htmltext, 1, 'help', 'inline-block', 0, 2, 'tooltipsubstitution');
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
// Adding jquery code to change on the fly url of preview ext
|
||||
|
||||
Loading…
Reference in New Issue
Block a user