Work on website module.

This commit is contained in:
Laurent Destailleur
2016-05-01 21:19:29 +02:00
parent 46e2ed2810
commit 5823055cdf
5 changed files with 41 additions and 8 deletions

View File

@@ -67,7 +67,7 @@ $Config['SecureImageUploads'] = true;
$Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder'); $Config['ConfigAllowedCommands'] = array('QuickUpload', 'FileUpload', 'GetFolders', 'GetFoldersAndFiles', 'CreateFolder');
// Allowed Resource Types. // 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 // For security, HTML is allowed in the first Kb of data for files having the
// following extensions only. // following extensions only.
@@ -78,11 +78,19 @@ $Config['HtmlExtensions'] = array("html", "htm", "xml", "xsd", "txt", "js");
// If possible, it is recommended to set more restrictive permissions, like 0755. // If possible, it is recommended to set more restrictive permissions, like 0755.
// Set to 0 to disable this feature. // Set to 0 to disable this feature.
// Note: not needed on Windows-based servers. // 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. // See comments above.
// Used when creating folders that does not exist. // 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 Configuration settings for each Resource Type

View File

@@ -16,4 +16,5 @@ Website=Web site
AddPage=Add page AddPage=Add page
Page=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 PageDeleted=Page %s of website %s deleted
ViewInNewTab=View in new tab

View File

@@ -1,5 +1,5 @@
<?php <?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 * 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 * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
*/ */
/** /**
* \file htdocs/public/paypal/index.php * \file htdocs/public/websites/index.php
* \ingroup core * \ingroup core
* \brief A redirect page to an error * \brief A redirect page to an error
* \author Laurent Destailleur * \author Laurent Destailleur
@@ -64,6 +64,24 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_AP
//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 // Security: Delete string ../ into $original_file
global $dolibarr_main_data_root; global $dolibarr_main_data_root;

View File

@@ -307,7 +307,7 @@ class WebsitePage extends CommonObject
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$record = new Websitepage($this->db); $record = new WebsitePage($this->db);
$record->id = $obj->rowid; $record->id = $obj->rowid;
$record->fk_website = $obj->fk_website; $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_creation = $this->db->jdate($obj->date_creation);
$record->date_modification = $this->db->jdate($obj->date_modification); $record->date_modification = $this->db->jdate($obj->date_modification);
$record->tms = $this->db->jdate($obj->tms); $record->tms = $this->db->jdate($obj->tms);
//var_dump($record->id);
$records[$record->id] = $record; $records[$record->id] = $record;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@@ -420,6 +420,7 @@ if (count($object->records) > 0)
print $langs->trans("Website").': '; print $langs->trans("Website").': ';
print '</div>'; print '</div>';
// List of websites
print '<div class="websiteselection">'; print '<div class="websiteselection">';
$out=''; $out='';
$out.='<select name="website">'; $out.='<select name="website">';
@@ -441,8 +442,13 @@ if (count($object->records) > 0)
print $out; print $out;
print '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">'; 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("ViewInNewTab").'</a>';
}
print '</div>'; print '</div>';
// Button for websites
print '<div class="websitetools">'; print '<div class="websitetools">';
if ($action == 'preview') if ($action == 'preview')