Rename sample file so we can use color editor

This commit is contained in:
Laurent Destailleur 2020-03-21 17:58:03 +01:00
parent 79086011f8
commit 83b8497d28
3 changed files with 42 additions and 13 deletions

View File

@ -253,7 +253,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
dol_delete_file($filewrapper);
$wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.html');
$wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php');
$result2 = file_put_contents($filewrapper, $wrappercontent);
if (!empty($conf->global->MAIN_UMASK))

View File

@ -333,9 +333,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
* @param array $events_array Array of events ("uid","startdate","summary","url","desc","author","category") or Array of WebsitePage
* @param string $outputfile Output file
* @param string $filter (optional) Filter
* @param string $url Url
* @return int < 0 if ko, Nb of events in file if ok
*/
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = "")
function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = "", $url="")
{
global $user, $conf, $langs;
global $dolibarr_main_url_root;
@ -371,13 +372,14 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
"<generator>Dolibarr</generator>"."\n");
*/
// Define $urlwithroot
$urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root));
if (empty($url)) {
// Define $urlwithroot
$urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$url=$urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
$url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY);
}
fwrite($fichier, "<link><![CDATA[".$url."]]></link>"."\n");

View File

@ -1,6 +1,7 @@
<?php
// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of wrapper.html sample.
// BEGIN PHP File wrapper.php - DO NOT MODIFY - It is just a copy of file website/samples/wrapper.php
$websitekey=basename(__DIR__);
if (strpos($_SERVER["PHP_SELF"], 'website/samples/wrapper.php')) die("Sample file for website module. Can be called directly.");
if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
@ -147,9 +148,9 @@ if ($rss) {
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
// Write file
if ($format == 'vcal') $result=build_calfile($format, $title, $desc, $eventarray, $outputfiletmp);
elseif ($format == 'ical') $result=build_calfile($format, $title, $desc, $eventarray, $outputfiletmp);
elseif ($format == 'rss') $result=build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp);
//if ($format == 'vcal') $result=build_calfile($format, $title, $desc, $eventarray, $outputfiletmp);
//elseif ($format == 'ical') $result=build_calfile($format, $title, $desc, $eventarray, $outputfiletmp);
if ($format == 'rss') $result=build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp);
if ($result >= 0)
{
@ -173,7 +174,33 @@ if ($rss) {
}
}
return $result;
if ($result >= 0)
{
$attachment = false;
if (isset($_GET["attachment"])) $attachment=$_GET["attachment"];
//$attachment = false;
$contenttype='application/rss+xml';
if (isset($_GET["contenttype"])) $contenttype=$_GET["contenttype"];
//$contenttype='text/plain';
$outputencoding='UTF-8';
if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding?'; charset='.$outputencoding:''));
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate');
else header('Cache-Control: private, must-revalidate');
// Clean parameters
$outputfile=$dir_temp.'/'.$filename;
$result=readfile($outputfile);
if (! $result) print 'File '.$outputfile.' was empty.';
// header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename));
exit;
}
}
// Get logos
elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file))