Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
cbbafb6432
@ -189,7 +189,19 @@ else
|
||||
show_skin(null,1);
|
||||
print '<br>'."\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("TestSubmitForm"),'(mode='.$mode.')','');
|
||||
$listofmodes=array('dolibarr_mailings','dolibarr_notes','dolibarr_details','Full');
|
||||
$linkstomode='';
|
||||
foreach($listofmodes as $newmode)
|
||||
{
|
||||
if ($linkstomode) $linkstomode.=' - ';
|
||||
$linkstomode.='<a href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
||||
if ($mode == $newmode) $linkstomode.='<strong>';
|
||||
$linkstomode.=$newmode;
|
||||
if ($mode == $newmode) $linkstomode.='</strong>';
|
||||
$linkstomode.='</a>';
|
||||
}
|
||||
$linkstomode.='';
|
||||
print load_fiche_titre($langs->trans("TestSubmitForm"),$linkstomode,'');
|
||||
print '<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
||||
$uselocalbrowser=true;
|
||||
$readonly=($mode=='dolibarr_readonly'?1:0);
|
||||
|
||||
@ -52,7 +52,7 @@ class DolEditor
|
||||
* @param string $content Content of WYSIWIG field
|
||||
* @param int $width Width in pixel of edit area (auto by default)
|
||||
* @param int $height Height in pixel of edit area (200px by default)
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', ')
|
||||
* @param string $toolbarname Name of bar set to use ('Full', 'dolibarr_notes[_encoded]', 'dolibarr_details[_encoded]'=the less featured, 'dolibarr_mailings[_encoded]', 'dolibarr_readonly')
|
||||
* @param string $toolbarlocation Where bar is stored :
|
||||
* 'In' each window has its own toolbar
|
||||
* 'Out:name' share toolbar into the div called 'name'
|
||||
@ -148,7 +148,10 @@ class DolEditor
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$found=0;
|
||||
$fullpage=False;
|
||||
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed
|
||||
|
||||
$found=0;
|
||||
$out='';
|
||||
|
||||
if ($this->tool == 'fckeditor')
|
||||
@ -186,7 +189,8 @@ class DolEditor
|
||||
customConfig : ckeditorConfig,
|
||||
readOnly : '.($this->readonly?'true':'false').',
|
||||
htmlEncodeOutput :'.$htmlencode_force.',
|
||||
allowedContent :'.(empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)?'false':'true').',
|
||||
allowedContent :'.($disallowAnyContent?'false':'true').',
|
||||
fullPage : '.($fullpage?'true':'false').',
|
||||
toolbar: \''.$this->toolbarname.'\',
|
||||
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
|
||||
width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').',
|
||||
|
||||
@ -19,15 +19,20 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
//require '../../../../main.inc.php';
|
||||
require '../../connectors/php/config.php'; // This include the define('NOTOKENRENEWAL',1) and the require main.in.php
|
||||
|
||||
global $Config;
|
||||
|
||||
|
||||
|
||||
require '../../../../main.inc.php';
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
|
||||
"http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>FCKeditor - Resources Browser</title>
|
||||
<title><?php echo $langs->trans("MediaBrowser").' - '.$Config['UserFilesAbsolutePathRelative']; ?></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script type="text/javascript" src="js/fckxml.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
*/
|
||||
|
||||
global $Config ;
|
||||
global $website;
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
|
||||
@ -44,13 +45,15 @@ $Config['Enabled'] = true ;
|
||||
|
||||
|
||||
// Path to user files relative to the document root.
|
||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ;
|
||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website)?'':'_'.$website).'&file=' ;
|
||||
|
||||
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/' . $entity : '') . '/medias/') : ('/websites/'.$website));
|
||||
|
||||
// Fill the following value it you prefer to specify the absolute path for the
|
||||
// user files directory. Useful if you are using a virtual directory, symbolic
|
||||
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
|
||||
// Attention: The above 'UserFilesPath' must point to the same directory.
|
||||
$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root . (!empty($entity) ? '/' . $entity : '') . '/fckeditor/';
|
||||
$Config['UserFilesAbsolutePath'] = $dolibarr_main_data_root . $Config['UserFilesAbsolutePathRelative'];
|
||||
|
||||
// Due to security issues with Apache modules, it is recommended to leave the
|
||||
// following setting enabled.
|
||||
@ -64,7 +67,7 @@ $Config['SecureImageUploads'] = true;
|
||||
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
|
||||
|
||||
// Allowed Resource Types.
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Flash', 'Media');
|
||||
$Config['ConfigAllowedTypes'] = array('File', 'Image', 'Media');
|
||||
|
||||
// For security, HTML is allowed in the first Kb of data for files having the
|
||||
// following extensions only.
|
||||
@ -75,11 +78,19 @@ $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
|
||||
// If possible, it is recommended to set more restrictive permissions, like 0755.
|
||||
// Set to 0 to disable this feature.
|
||||
// Note: not needed on Windows-based servers.
|
||||
$Config['ChmodOnUpload'] = 0775 ;
|
||||
$newmask = '0644';
|
||||
if (! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
$Config['ChmodOnUpload'] = $newmask;
|
||||
|
||||
// See comments above.
|
||||
// Used when creating folders that does not exist.
|
||||
$Config['ChmodOnFolderCreate'] = 0775 ;
|
||||
$newmask = '0755';
|
||||
$dirmaskdec=octdec($newmask);
|
||||
if (! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
|
||||
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
|
||||
$newmask = decoct($dirmaskdec);
|
||||
|
||||
$Config['ChmodOnFolderCreate'] = $newmask;
|
||||
|
||||
/*
|
||||
Configuration settings for each Resource Type
|
||||
|
||||
@ -42,7 +42,7 @@ function SendError($number, $text)
|
||||
|
||||
// Check if this uploader has been 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 "filemanagerdol/connectors/php/config.php" file');
|
||||
|
||||
$sCommand = 'QuickUpload' ;
|
||||
|
||||
|
||||
@ -2213,8 +2213,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// Wrapping for import module
|
||||
else if ($modulepart == 'import')
|
||||
{
|
||||
// Aucun test necessaire car on force le rep de download sur
|
||||
// le rep export qui est propre a l'utilisateur
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->import->dir_temp.'/'.$original_file;
|
||||
}
|
||||
@ -2222,13 +2220,19 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// Wrapping pour l'editeur wysiwyg
|
||||
else if ($modulepart == 'editor')
|
||||
{
|
||||
// Aucun test necessaire car on force le rep de download sur
|
||||
// le rep export qui est propre a l'utilisateur
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les backups
|
||||
|
||||
// Wrapping for miscellaneous medias files
|
||||
elseif ($modulepart == 'medias')
|
||||
{
|
||||
$accessallowed=1;
|
||||
global $dolibarr_main_data_root;
|
||||
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for backups
|
||||
else if ($modulepart == 'systemtools')
|
||||
{
|
||||
if ($fuser->admin)
|
||||
|
||||
@ -71,7 +71,8 @@ function jsUnEscape($source)
|
||||
|
||||
|
||||
/**
|
||||
* Return list of modules directories
|
||||
* Return list of modules directories. We detect directories that contains a subdirectory /core/modules
|
||||
* We discard directory modules that contains 'disabled' into their name.
|
||||
*
|
||||
* @param string $subdir Sub directory (Example: '/mailings')
|
||||
* @return array Array of directories that can contains module descriptors
|
||||
@ -95,6 +96,8 @@ function dolGetModulesDirs($subdir='')
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (preg_match('/disabled/',$file)) continue; // We discard module if it contains disabled into name.
|
||||
|
||||
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
|
||||
{
|
||||
if (is_dir($dirroot . '/' . $file . '/core/modules'.$subdir.'/'))
|
||||
|
||||
@ -57,7 +57,7 @@ class modFckeditor extends DolibarrModules
|
||||
$this->picto='list';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array("/fckeditor/temp","/fckeditor/image");
|
||||
$this->dirs = array("/medias/temp","/medias/image");
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("fckeditor.php");
|
||||
@ -65,7 +65,7 @@ class modFckeditor extends DolibarrModules
|
||||
// Dependencies
|
||||
$this->disabled = (in_array(constant('JS_CKEDITOR'),array('disabled','disabled/'))?1:0); // A condition to disable module (used for native debian packages)
|
||||
$this->depends = array();
|
||||
$this->requiredby = array();
|
||||
$this->requiredby = array('modWebsites');
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
@ -58,8 +58,8 @@ class modWebsites extends DolibarrModules
|
||||
// Name of image file used for this module.
|
||||
$this->picto='globe';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array("/websites/temp");
|
||||
|
||||
// Config pages
|
||||
//-------------
|
||||
@ -68,7 +68,7 @@ class modWebsites extends DolibarrModules
|
||||
// Dependancies
|
||||
//-------------
|
||||
$this->hidden = ! empty($conf->global->WEBSITE_MODULE_DISABLED); // A condition to disable module
|
||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||
$this->depends = array('modFckeditor'); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of modules id this module is in conflict with
|
||||
$this->langfiles = array("websites");
|
||||
|
||||
@ -65,6 +65,7 @@ $entity=GETPOST('entity')?GETPOST('entity','int'):$conf->entity;
|
||||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility
|
||||
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
@ -97,7 +98,7 @@ if (preg_match('/\.(html|htm)$/i',$original_file)) $attachment = false;
|
||||
if (isset($_GET["attachment"])) $attachment = GETPOST("attachment")?true:false;
|
||||
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
|
||||
|
||||
// Suppression de la chaine de caractere ../ dans $original_file
|
||||
// Security: Delete string ../ into $original_file
|
||||
$original_file = str_replace("../","/", $original_file);
|
||||
|
||||
// Find the subdirectory name as the reference
|
||||
@ -169,7 +170,6 @@ if (! file_exists($original_file_osencoded))
|
||||
}
|
||||
|
||||
// Permissions are ok and file found, so we return it
|
||||
|
||||
header('Content-Description: File Transfer');
|
||||
if ($encoding) header('Content-Encoding: '.$encoding);
|
||||
if ($type) header('Content-Type: '.$type.(preg_match('/text/',$type)?'; charset="'.$conf->file->character_set_client:''));
|
||||
@ -183,7 +183,7 @@ header('Pragma: public');
|
||||
|
||||
//ob_clean();
|
||||
//flush();
|
||||
|
||||
|
||||
readfile($original_file_osencoded);
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
|
||||
@ -115,11 +115,12 @@ CREATE TABLE llx_website
|
||||
ref varchar(24) NOT NULL,
|
||||
description varchar(255),
|
||||
status integer,
|
||||
fk_default_home integer,
|
||||
date_creation datetime,
|
||||
date_modification datetime,
|
||||
tms timestamp
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_website ADD COLUMN fk_default_home integer;
|
||||
ALTER TABLE llx_website ADD UNIQUE INDEX uk_website_ref (ref, entity);
|
||||
|
||||
CREATE TABLE llx_website_page
|
||||
|
||||
@ -24,6 +24,7 @@ CREATE TABLE llx_website
|
||||
ref varchar(24) NOT NULL,
|
||||
description varchar(255),
|
||||
status integer,
|
||||
fk_default_home integer,
|
||||
date_creation datetime,
|
||||
date_modification datetime,
|
||||
tms timestamp
|
||||
|
||||
@ -401,6 +401,8 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
$beforeversionarray=explode('.','4.0.9');
|
||||
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
|
||||
{
|
||||
migrate_directories($db,$langs,$conf,'/fckeditor','/medias');
|
||||
|
||||
// Reload modules (this must be always and only into last targeted version)
|
||||
$listofmodule=array(
|
||||
'MAIN_MODULE_BARCODE'=>'newboxdefonly',
|
||||
|
||||
@ -521,7 +521,7 @@ Module1520Desc=Mass mail document generation
|
||||
Module1780Name=Tags/Categories
|
||||
Module1780Desc=Create tags/category (products, customers, suppliers, contacts or members)
|
||||
Module2000Name=WYSIWYG editor
|
||||
Module2000Desc=Allow to edit some text area using an advanced editor
|
||||
Module2000Desc=Allow to edit some text area using an advanced editor (Based on CKEditor)
|
||||
Module2200Name=Dynamic Prices
|
||||
Module2200Desc=Enable the usage of math expressions for prices
|
||||
Module2300Name=Cron
|
||||
|
||||
@ -120,6 +120,7 @@ Home=Home
|
||||
Help=Help
|
||||
OnlineHelp=Online help
|
||||
PageWiki=Wiki page
|
||||
MediaBrowser=Media browser
|
||||
Always=Always
|
||||
Never=Never
|
||||
Under=under
|
||||
|
||||
@ -4,11 +4,19 @@ WebsiteSetupDesc=Create here as much entry as number of different websites you n
|
||||
DeleteWebsite=Delete website
|
||||
ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed.
|
||||
WEBSITE_PAGENAME=Page name/alias
|
||||
WEBSITE_URL=Page real URL
|
||||
WEBSITE_URL=Web site URL
|
||||
WEBSITE_CSS_URL=URL of external CSS file
|
||||
WEBSITE_CSS_INLINE=CSS content
|
||||
MediaFiles=Media library
|
||||
EditCss=Edit Style/CSS
|
||||
EditMenu=Edit menu
|
||||
EditPageMeta=Edit Meta
|
||||
EditPageContent=Edit Content
|
||||
Website=Web site
|
||||
AddPage=Add page
|
||||
Page=Page
|
||||
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
|
||||
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first add a page.
|
||||
PageDeleted=Page %s of website %s deleted
|
||||
ViewSiteInNewTab=View site in new tab
|
||||
ViewPageInNewTab=View page in new tab
|
||||
SetAsHomePage=Set as Home page
|
||||
@ -866,7 +866,7 @@ else
|
||||
define('ROWS_9',8);
|
||||
}
|
||||
|
||||
$heightforframes=52;
|
||||
$heightforframes=48;
|
||||
|
||||
// Init menu manager
|
||||
if (! defined('NOREQUIREMENU'))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2016 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
|
||||
@ -16,16 +16,122 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/public/paypal/index.php
|
||||
* \file htdocs/public/websites/index.php
|
||||
* \ingroup core
|
||||
* \brief A redirect page to an error
|
||||
* \author Laurent Destailleur
|
||||
*/
|
||||
|
||||
define('NOTOKENRENEWAL',1); // Disables token renewal
|
||||
define("NOLOGIN",1);
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
|
||||
/**
|
||||
* Header empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function llxHeader() { }
|
||||
/**
|
||||
* Footer empty
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function llxFooter() { }
|
||||
|
||||
require '../../master.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$error=0;
|
||||
$website=GETPOST('website', 'alpha');
|
||||
$page=GETPOST('page', 'alpha');
|
||||
$pageid=GETPOST('pageid', 'alpha');
|
||||
|
||||
$accessallowed = 1;
|
||||
$type='';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$appli=constant('DOL_APPLICATION_TITLE');
|
||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
print 'Directory with '.$appli.' websites.<br>';
|
||||
//print 'Directory with '.$appli.' websites.<br>';
|
||||
|
||||
if (empty($pageid))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
||||
|
||||
$object=new Website($db);
|
||||
$object->fetch(0, $website);
|
||||
|
||||
$objectpage=new WebsitePage($db);
|
||||
$array=$objectpage->fetchAll($object->id);
|
||||
|
||||
if (count($array) > 0)
|
||||
{
|
||||
$firstrep=reset($array);
|
||||
$pageid=$firstrep->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Security: Delete string ../ into $original_file
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
if ($pageid == 'css')
|
||||
{
|
||||
$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/styles.css';
|
||||
}
|
||||
else
|
||||
{
|
||||
$original_file=$dolibarr_main_data_root.'/websites/'.$website.'/page'.$pageid.'.tpl.php';
|
||||
}
|
||||
|
||||
// Find the subdirectory name as the reference
|
||||
$refname=basename(dirname($original_file)."/");
|
||||
|
||||
// Security:
|
||||
// Limite acces si droits non corrects
|
||||
if (! $accessallowed)
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Security:
|
||||
// On interdit les remontees de repertoire ainsi que les pipe dans
|
||||
// les noms de fichiers.
|
||||
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
|
||||
{
|
||||
dol_syslog("Refused to deliver file ".$original_file);
|
||||
$file=basename($original_file); // Do no show plain path of original_file in shown error message
|
||||
dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$file));
|
||||
exit;
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$filename = basename($original_file);
|
||||
|
||||
// Output file on browser
|
||||
dol_syslog("index.php include $original_file $filename content-type=$type");
|
||||
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
|
||||
|
||||
// This test if file exists should be useless. We keep it to find bug more easily
|
||||
if (! file_exists($original_file_osencoded))
|
||||
{
|
||||
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once $original_file_osencoded;
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
|
||||
|
||||
@ -32,14 +32,12 @@ CKEDITOR.editorConfig = function( config )
|
||||
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
|
||||
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
|
||||
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
|
||||
'/',
|
||||
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
|
||||
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
|
||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||
['BidiLtr', 'BidiRtl'],
|
||||
['Link','Unlink','Anchor'],
|
||||
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
|
||||
'/',
|
||||
['Styles','Format','Font','FontSize'],
|
||||
['TextColor','BGColor'],
|
||||
['Maximize', 'ShowBlocks','-','About']
|
||||
|
||||
@ -350,7 +350,7 @@ legend { margin-bottom: 8px; }
|
||||
fieldset { border: 1px solid #AAAAAA !important; }
|
||||
|
||||
|
||||
.button, input[name="sbmtConnexion"] {
|
||||
.button, .buttonDelete, input[name="sbmtConnexion"] {
|
||||
font-family: <?php print $fontlist ?>;
|
||||
border-color: #c5c5c5;
|
||||
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
|
||||
@ -383,17 +383,17 @@ fieldset { border: 1px solid #AAAAAA !important; }
|
||||
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.button:focus {
|
||||
.button:focus, .buttonDelete:focus {
|
||||
-moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
}
|
||||
.button:hover {
|
||||
.button:hover, .buttonDelete:hover {
|
||||
-moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
}
|
||||
.button:disabled {
|
||||
.button:disabled, .buttonDelete:disabled {
|
||||
opacity: 0.4;
|
||||
filter: alpha(opacity=40); /* For IE8 and earlier */
|
||||
box-shadow: none;
|
||||
@ -1907,31 +1907,16 @@ span.butAction, span.butActionDelete {
|
||||
}
|
||||
|
||||
.butAction:hover {
|
||||
/* for bootstrap look
|
||||
color: #fff;
|
||||
background-color: #286090;
|
||||
border-color: #204d74;
|
||||
*/
|
||||
-moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
}
|
||||
|
||||
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active {
|
||||
/* for bootstrap look
|
||||
color: #fff;
|
||||
background-color: #d9534f;
|
||||
border-color: #d43f3a;
|
||||
*/
|
||||
color: #800;
|
||||
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
|
||||
color: #800 !important;
|
||||
}
|
||||
|
||||
.butActionDelete:hover {
|
||||
/* for bootstrap look
|
||||
color: #fff;
|
||||
background-color: #c9302c;
|
||||
border-color: #ac2925;
|
||||
*/
|
||||
-moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
-webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1);
|
||||
@ -3126,19 +3111,27 @@ td.hidden {
|
||||
|
||||
.websitebar {
|
||||
border-bottom: 1px solid #888;
|
||||
height: 30px;
|
||||
background: #eee;
|
||||
}
|
||||
.websitebar .button, .websitebar .buttonDelete
|
||||
{
|
||||
padding: 2px 5px 3px 5px !important;
|
||||
margin: 2px 4px 2px 4px !important;
|
||||
line-height: normal;
|
||||
}
|
||||
.websiteselection {
|
||||
display: inline-block;
|
||||
padding-left: 10px;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 5px;
|
||||
line-height: 29px;
|
||||
}
|
||||
.websitetools {
|
||||
float: right;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.websiteiframenoborder {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
|
||||
@ -32,14 +32,12 @@ CKEDITOR.editorConfig = function( config )
|
||||
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
|
||||
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
|
||||
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
|
||||
'/',
|
||||
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
|
||||
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
|
||||
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
|
||||
['BidiLtr', 'BidiRtl'],
|
||||
['Link','Unlink','Anchor'],
|
||||
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
|
||||
'/',
|
||||
['Styles','Format','Font','FontSize'],
|
||||
['TextColor','BGColor'],
|
||||
['Maximize', 'ShowBlocks','-','About']
|
||||
|
||||
@ -1913,7 +1913,7 @@ span.butAction, span.butActionDelete {
|
||||
background-repeat: repeat-x
|
||||
}
|
||||
|
||||
.butActionDelete {
|
||||
.butActionDelete, .buttonDelete {
|
||||
color: #ffffff !important;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
background-color: #cc6d00;
|
||||
@ -2988,19 +2988,27 @@ td.hidden {
|
||||
|
||||
.websitebar {
|
||||
border-bottom: 1px solid #888;
|
||||
height: 30px;
|
||||
background: #eee;
|
||||
}
|
||||
.websitebar .button, .websitebar .buttonDelete
|
||||
{
|
||||
padding: 2px 4px 2px 4px !important;
|
||||
margin: 2px 4px 2px 4px !important;
|
||||
line-height: normal;
|
||||
}
|
||||
.websiteselection {
|
||||
display: inline-block;
|
||||
padding-left: 10px;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 5px;
|
||||
line-height: 29px;
|
||||
}
|
||||
.websitetools {
|
||||
float: right;
|
||||
padding-top: 2px;
|
||||
}
|
||||
.websiteiframenoborder {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
|
||||
@ -62,7 +62,7 @@ $entity=GETPOST('entity')?GETPOST('entity','int'):$conf->entity;
|
||||
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
|
||||
if ($modulepart == 'fckeditor') $modulepart='medias'; // For backward compatibility
|
||||
|
||||
|
||||
/*
|
||||
@ -95,7 +95,7 @@ $type = 'application/octet-stream';
|
||||
if (! empty($_GET["type"])) $type=$_GET["type"];
|
||||
else $type=dol_mimetype($original_file);
|
||||
|
||||
// Suppression de la chaine de caractere ../ dans $original_file
|
||||
// Security: Delete string ../ into $original_file
|
||||
$original_file = str_replace("../","/", $original_file);
|
||||
|
||||
// Find the subdirectory name as the reference
|
||||
|
||||
@ -63,7 +63,7 @@ class Website extends CommonObject
|
||||
public $date_creation = '';
|
||||
public $date_modification = '';
|
||||
public $tms = '';
|
||||
|
||||
public $fk_default_home;
|
||||
public $records;
|
||||
|
||||
/**
|
||||
@ -122,9 +122,9 @@ class Website extends CommonObject
|
||||
$sql.= 'ref,';
|
||||
$sql.= 'description,';
|
||||
$sql.= 'status,';
|
||||
$sql.= 'fk_default_home,';
|
||||
$sql.= 'date_creation,';
|
||||
$sql.= 'date_modification';
|
||||
|
||||
|
||||
$sql .= ') VALUES (';
|
||||
|
||||
@ -132,6 +132,7 @@ class Website extends CommonObject
|
||||
$sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").',';
|
||||
$sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").',';
|
||||
$sql .= ' '.(! isset($this->status)?'NULL':$this->status).',';
|
||||
$sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).',';
|
||||
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").',';
|
||||
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
|
||||
|
||||
@ -191,6 +192,7 @@ class Website extends CommonObject
|
||||
$sql .= " t.ref,";
|
||||
$sql .= " t.description,";
|
||||
$sql .= " t.status,";
|
||||
$sql .= " t.fk_default_home,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_modification,";
|
||||
$sql .= " t.tms";
|
||||
@ -213,6 +215,7 @@ class Website extends CommonObject
|
||||
$this->ref = $obj->ref;
|
||||
$this->description = $obj->description;
|
||||
$this->status = $obj->status;
|
||||
$this->fk_default_home = $obj->fk_default_home;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
@ -257,6 +260,7 @@ class Website extends CommonObject
|
||||
$sql .= " t.ref,";
|
||||
$sql .= " t.description,";
|
||||
$sql .= " t.status,";
|
||||
$sql .= " t.fk_default_home,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_modification,";
|
||||
$sql .= " t.tms";
|
||||
@ -295,6 +299,7 @@ class Website extends CommonObject
|
||||
$line->ref = $obj->ref;
|
||||
$line->description = $obj->description;
|
||||
$line->status = $obj->status;
|
||||
$line->fk_default_home = $obj->fk_default_home;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->tms = $this->db->jdate($obj->tms);
|
||||
@ -353,6 +358,7 @@ class Website extends CommonObject
|
||||
$sql .= ' ref = '.(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").',';
|
||||
$sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").',';
|
||||
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
|
||||
$sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").',';
|
||||
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
||||
$sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').',';
|
||||
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'");
|
||||
@ -595,13 +601,14 @@ class Website extends CommonObject
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
$this->entity = '';
|
||||
$this->ref = '';
|
||||
$this->description = '';
|
||||
$this->entity = 1;
|
||||
$this->ref = 'myspecimenwebsite';
|
||||
$this->description = 'A specimen website';
|
||||
$this->status = '';
|
||||
$this->date_creation = '';
|
||||
$this->date_modification = '';
|
||||
$this->tms = '';
|
||||
$this->fk_default_home = null;
|
||||
$this->date_creation = dol_now();
|
||||
$this->date_modification = dol_now();
|
||||
$this->tms = dol_now();
|
||||
|
||||
|
||||
}
|
||||
@ -625,6 +632,7 @@ class WebsiteLine
|
||||
public $ref;
|
||||
public $description;
|
||||
public $status;
|
||||
public $fk_default_home;
|
||||
public $date_creation = '';
|
||||
public $date_modification = '';
|
||||
public $tms = '';
|
||||
|
||||
@ -307,7 +307,7 @@ class WebsitePage extends CommonObject
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$record = new Websitepage($this->db);
|
||||
$record = new WebsitePage($this->db);
|
||||
|
||||
$record->id = $obj->rowid;
|
||||
$record->fk_website = $obj->fk_website;
|
||||
@ -320,7 +320,7 @@ class WebsitePage extends CommonObject
|
||||
$record->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$record->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$record->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
//var_dump($record->id);
|
||||
$records[$record->id] = $record;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2016 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
|
||||
@ -16,11 +16,14 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/website.php
|
||||
* \file htdocs/website/index.php
|
||||
* \ingroup website
|
||||
* \brief Page to setup the module Website
|
||||
* \brief Page to website view/edit
|
||||
*/
|
||||
|
||||
define('NOSCANPOSTFORINJECTION',1);
|
||||
define('NOSTYLECHECK',1);
|
||||
|
||||
|
||||
/**
|
||||
* Show HTML header HTML + BODY + Top menu + left menu + DIV
|
||||
@ -63,6 +66,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/websitepage.class.php';
|
||||
|
||||
@ -77,12 +81,16 @@ $conf->dol_hide_leftmenu = 1;
|
||||
$error=0;
|
||||
$website=GETPOST('website', 'alpha');
|
||||
$page=GETPOST('page', 'alpha');
|
||||
$pageid=GETPOST('pageid', 'alpha');
|
||||
$pageid=GETPOST('pageid', 'int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
if (GETPOST('delete')) { $action='delete'; }
|
||||
if (GETPOST('preview')) $action='preview';
|
||||
if (GETPOST('create')) { $action='create'; }
|
||||
if (GETPOST('editmedia')) { $action='editmedia'; }
|
||||
if (GETPOST('editcss')) { $action='editcss'; }
|
||||
if (GETPOST('editmenu')) { $action='editmenu'; }
|
||||
if (GETPOST('setashome')) { $action='setashome'; }
|
||||
if (GETPOST('editmeta')) { $action='editmeta'; }
|
||||
if (GETPOST('editcontent')) { $action='editcontent'; }
|
||||
|
||||
@ -102,16 +110,23 @@ if (empty($website))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($website)
|
||||
{
|
||||
$res = $object->fetch(0, $website);
|
||||
}
|
||||
if ($pageid)
|
||||
|
||||
if ($pageid < 0) $pageid = 0;
|
||||
if ($pageid > 0 && $action != 'add')
|
||||
{
|
||||
$res = $objectpage->fetch($pageid);
|
||||
}
|
||||
|
||||
global $dolibarr_main_data_root;
|
||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$website;
|
||||
$filecss=$pathofwebsite.'/styles.css';
|
||||
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -127,7 +142,7 @@ if ($action == 'add')
|
||||
$objectpage->title = GETPOST('WEBSITE_TITLE');
|
||||
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME');
|
||||
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION');
|
||||
$objectpage->keyword = GETPOST('WEBSITE_KEYWORD');
|
||||
$objectpage->keywords = GETPOST('WEBSITE_KEYWORD');
|
||||
|
||||
if (empty($objectpage->title))
|
||||
{
|
||||
@ -198,22 +213,155 @@ if ($action == 'update')
|
||||
}
|
||||
}
|
||||
|
||||
// Update page
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res = $object->fetch(0, $website);
|
||||
|
||||
$res = $objectpage->fetch($pageid, $object->fk_website);
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
$res = $objectpage->delete($user);
|
||||
if (! $res > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $website), null, 'mesgs');
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Update css
|
||||
if ($action == 'updatecss')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res = $object->fetch(0, $website);
|
||||
/*
|
||||
$res = $object->update($user);
|
||||
if ($res > 0)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
$action='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}*/
|
||||
|
||||
$csscontent = GETPOST('WEBSITE_CSS_INLINE');
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
file_put_contents($filecss, $csscontent);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$action='preview';
|
||||
}
|
||||
|
||||
// Update page
|
||||
if ($action == 'setashome')
|
||||
{
|
||||
$db->begin();
|
||||
$object->fetch(0, $website);
|
||||
|
||||
$object->fk_default_home = $pageid;
|
||||
$res = $object->update($user);
|
||||
if (! $res > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||
$action='preview';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
// Update page
|
||||
if ($action == 'updatemeta')
|
||||
{
|
||||
$db->begin();
|
||||
$object->fetch(0, $website);
|
||||
|
||||
$objectpage->fk_website = $object->id;
|
||||
|
||||
$res = $objectpage->fetch($pageid, $object->fk_website);
|
||||
if ($res > 0)
|
||||
{
|
||||
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME');
|
||||
$objectpage->title = GETPOST('WEBSITE_TITLE');
|
||||
$objectpage->description = GETPOST('WEBSITE_DESCRIPTION');
|
||||
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS');
|
||||
|
||||
$res = $objectpage->update($user);
|
||||
if (! $res > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($objectpage->error, $objectpage->errors, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||
$action='preview';
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db, 'Page not found');
|
||||
}
|
||||
}
|
||||
|
||||
// Update page
|
||||
if ($action == 'updatecontent')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$object->fetch(0, $website);
|
||||
|
||||
|
||||
$objectpage->fk_website = $object->id;
|
||||
$objectpage->pageurl = GETPOST('WEBSITE_PAGENAME');
|
||||
|
||||
$res = $objectpage->fetch(0, $object->fk_website, $objectpage->pageurl);
|
||||
|
||||
$res = $objectpage->fetch($pageid, $object->fk_website);
|
||||
if ($res > 0)
|
||||
{
|
||||
$objectpage->content = GETPOST('PAGE_CONTENT');
|
||||
|
||||
// Clean data. We remove all the head section.
|
||||
$objectpage->content = preg_replace('/<head.*<\/head>/s', '', $objectpage->content);
|
||||
/* $objectpage->content = preg_replace('/<base\s+href=[\'"][^\'"]+[\'"]\s/?>/s', '', $objectpage->content); */
|
||||
|
||||
$res = $objectpage->update($user);
|
||||
if (! $res > 0)
|
||||
{
|
||||
@ -225,7 +373,15 @@ if ($action == 'updatecontent')
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("Saved"), null, 'mesgs');
|
||||
$action='';
|
||||
|
||||
dol_mkdir($pathofwebsite);
|
||||
dol_delete_file($filetpl);
|
||||
file_put_contents($filetpl, $objectpage->content);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -234,7 +390,7 @@ if ($action == 'updatecontent')
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db, 'Page not found');
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,6 +412,22 @@ if ($action == 'create')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
}
|
||||
if ($action == 'editcss')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updatecss">';
|
||||
}
|
||||
if ($action == 'editmenu')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updatemenu">';
|
||||
}
|
||||
if ($action == 'setashome')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updateashome">';
|
||||
}
|
||||
if ($action == 'editmeta')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updatemeta">';
|
||||
}
|
||||
if ($action == 'editcontent')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="updatecontent">';
|
||||
@ -264,7 +436,6 @@ if ($action == 'edit')
|
||||
{
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
}
|
||||
if ($website) print '<input type="hidden" name="website" value="'.dol_escape_htmltag($website).'">';
|
||||
|
||||
|
||||
// Add a margin under toolbar ?
|
||||
@ -280,25 +451,35 @@ if (count($object->records) > 0)
|
||||
print $langs->trans("Website").': ';
|
||||
print '</div>';
|
||||
|
||||
// List of websites
|
||||
print '<div class="websiteselection">';
|
||||
$out='';
|
||||
$out.='<select name="website">';
|
||||
if (empty($object->records)) $out.='<option value="-1"> </option>';
|
||||
// Loop on each sites
|
||||
$i=0;
|
||||
foreach($object->records as $key => $valwebsite)
|
||||
{
|
||||
if (empty($website)) $website=$valwebsite->ref;
|
||||
|
||||
if ($i) print ' - ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.urlencode($valwebsite->ref).'">';
|
||||
if ($valwebsite->ref == $website) print '<strong>';
|
||||
print $valwebsite->ref;
|
||||
if ($valwebsite->ref == $website) print '</strong>';
|
||||
print '</a>';
|
||||
|
||||
$out.='<option value="'.$valwebsite->ref.'"';
|
||||
if ($website == $valwebsite->ref) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.=$valwebsite->ref;
|
||||
$out.='</option>';
|
||||
$i++;
|
||||
}
|
||||
$out.='</select>';
|
||||
print $out;
|
||||
print '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
|
||||
|
||||
if ($website)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'">'.$langs->trans("ViewSiteInNewTab").'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
// Button for websites
|
||||
print '<div class="websitetools">';
|
||||
|
||||
if ($action == 'preview')
|
||||
@ -306,10 +487,18 @@ if (count($object->records) > 0)
|
||||
$disabled='';
|
||||
if (empty($user->rights->websites->create)) $disabled=' disabled="disabled"';
|
||||
|
||||
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
|
||||
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
|
||||
}
|
||||
//else print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
|
||||
if (in_array($action, array('editcss','editmenu','create')))
|
||||
{
|
||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -338,6 +527,7 @@ if (count($object->records) > 0)
|
||||
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.=$valpage->title;
|
||||
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
|
||||
$out.='</option>';
|
||||
}
|
||||
}
|
||||
@ -345,7 +535,14 @@ if (count($object->records) > 0)
|
||||
$out.='</select>';
|
||||
print $out;
|
||||
print '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
|
||||
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'">';
|
||||
//print $form->selectarray('page', $array);
|
||||
|
||||
if ($website && $pageid > 0)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'&page='.$pageid.'" target="tab'.$website.'">'.$langs->trans("ViewPageInNewTab").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
print '</div>';
|
||||
@ -359,13 +556,21 @@ if (count($object->records) > 0)
|
||||
|
||||
if ($pageid > 0)
|
||||
{
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
|
||||
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editmeta&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</a>';
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcontent&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageContent")).'</a>';
|
||||
}
|
||||
}
|
||||
else print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
|
||||
if (! in_array($action, array('editcss','editmenu','create')))
|
||||
{
|
||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/',$action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -390,45 +595,96 @@ $head = array();
|
||||
* Edit mode
|
||||
*/
|
||||
|
||||
if ($action == 'editcss')
|
||||
{
|
||||
print '<div class="fiche">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
$csscontent = @file_get_contents($filecss);
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WebSite');
|
||||
print '</td><td>';
|
||||
print $website;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">';
|
||||
print $langs->trans('WEBSITE_CSS_INLINE');
|
||||
print '</td><td>';
|
||||
print '<textarea class="flat centpercent" rows="32" name="WEBSITE_CSS_INLINE">';
|
||||
print $csscontent;
|
||||
print '</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
/*print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_CSS_URL');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_CSS_URL" value="'.dol_escape_htmltag($obj->WEBSITE_CSS_URL).'">';
|
||||
print '</td></tr>';*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if ($action == 'editmeta' || $action == 'create')
|
||||
{
|
||||
print '<div class="fiche">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_PAGENAME');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_PAGENAME" value="'.dol_escape_htmltag($page).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
if ($action != 'create')
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_URL');
|
||||
print $langs->trans('WEBSITE_PAGEURL');
|
||||
print '</td><td>';
|
||||
print '/public/websites/'.$website.'/index.php?pageid='.urlencode($pageid);
|
||||
print '/public/websites/index.php?website='.urlencode($website).'&pageid='.urlencode($pageid);
|
||||
print '</td></tr>';
|
||||
$pageurl=dol_escape_htmltag($objectpage->pageurl);
|
||||
$pagetitle=dol_escape_htmltag($objectpage->title);
|
||||
$pagedescription=dol_escape_htmltag($objectpage->description);
|
||||
$pagekeywords=dol_escape_htmltag($objectpage->keywords);
|
||||
}
|
||||
if (GETPOST('WEBSITE_PAGENAME')) $pageurl=GETPOST('WEBSITE_PAGENAME');
|
||||
if (GETPOST('WEBSITE_TITLE')) $pagetitle=GETPOST('WEBSITE_TITLE');
|
||||
if (GETPOST('WEBSITE_DESCRIPTION')) $pagedescription=GETPOST('WEBSITE_DESCRIPTION');
|
||||
if (GETPOST('WEBSITE_KEYWORDS')) $pagekeywords=GETPOST('WEBSITE_KEYWORDS');
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_PAGENAME');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_PAGENAME" value="'.$pageurl.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_TITLE');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_TITLE" value="'.dol_escape_htmltag($obj->WEBSITE_TITLE).'">';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_TITLE" value="'.$pagetitle.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_DESCRIPTION');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($obj->WEBSITE_DESCRIPTION).'">';
|
||||
print '<input type="text" class="flat" size="96" name="WEBSITE_DESCRIPTION" value="'.$pagedescription.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('WEBSITE_KEYWORDS');
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="128" name="WEBSITE_KEYWORDS" value="'.dol_escape_htmltag($obj->WEBSITE_KEYWORDS).'">';
|
||||
print '<input type="text" class="flat" size="128" name="WEBSITE_KEYWORDS" value="'.$pagekeywords.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -440,6 +696,11 @@ if ($action == 'editmeta' || $action == 'create')
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
if ($action == 'editmedia')
|
||||
{
|
||||
print '<div class="center">'.$langs->trans("FeatureNotYetAvailable").'</center>';
|
||||
}
|
||||
|
||||
if ($action == 'editmenu')
|
||||
{
|
||||
print '<div class="center">'.$langs->trans("FeatureNotYetAvailable").'</center>';
|
||||
@ -451,7 +712,7 @@ if ($action == 'editcontent')
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('PAGE_CONTENT',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
|
||||
$doleditor=new DolEditor('PAGE_CONTENT',$objectpage->content,'',500,'Full','',true,true,true,5,60);
|
||||
$doleditor->Create();
|
||||
}
|
||||
|
||||
@ -465,10 +726,45 @@ if ($action == 'preview')
|
||||
{
|
||||
$objectpage->fetch($pageid);
|
||||
|
||||
print '<!-- Page content -->'."\n";
|
||||
print '<div class="websitecontent">';
|
||||
print $objectpage->content;
|
||||
print '</div>';
|
||||
print "\n".'<!-- Page content '.$filetpl.' c-->'."\n";
|
||||
|
||||
|
||||
$csscontent = @file_get_contents($filecss);
|
||||
|
||||
$out='';
|
||||
|
||||
$out.='<div id="websitecontent" class="websitecontent">'."\n";
|
||||
|
||||
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
||||
$out.=$csscontent;
|
||||
$out.='</style>'."\n";
|
||||
|
||||
$out.=$objectpage->content."\n";
|
||||
|
||||
$out.='</div>';
|
||||
|
||||
print $out;
|
||||
|
||||
/*file_put_contents($filetpl, $out);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
// Output file on browser
|
||||
dol_syslog("index.php include $filetpl $filename content-type=$type");
|
||||
$original_file_osencoded=dol_osencode($filetpl); // New file name encoded in OS encoding charset
|
||||
|
||||
// This test if file exists should be useless. We keep it to find bug more easily
|
||||
if (! file_exists($original_file_osencoded))
|
||||
{
|
||||
dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
|
||||
exit;
|
||||
}
|
||||
|
||||
//include_once $original_file_osencoded;
|
||||
*/
|
||||
|
||||
/*print '<iframe class="websiteiframenoborder centpercent" src="'.DOL_URL_ROOT.'/public/websites/index.php?website='.$website.'&pageid='.$pageid.'"/>';
|
||||
print '</iframe>';*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user