From 5f5cbec1cf74b450a5833bad6c687bbc7fee601f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Oct 2017 13:09:11 +0200 Subject: [PATCH] Debug module website --- htdocs/core/lib/website.lib.php | 20 ++++++++++++++++++- htdocs/index.php | 8 ++++---- htdocs/install/mysql/tables/llx_website.sql | 2 +- htdocs/public/{websites => website}/index.php | 0 .../{websites => website}/styles.css.php | 0 htdocs/website/class/website.class.php | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) rename htdocs/public/{websites => website}/index.php (100%) rename htdocs/public/{websites => website}/styles.css.php (100%) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index ffe67bcf913..b420733f185 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -188,7 +188,7 @@ function dolIncludeHtmlContent($contentfile) * Generate a zip with all data of web site. * * @param Website $website Object website - * @return void + * @return string Path to file with zip */ function exportWebSite($website) { @@ -278,6 +278,24 @@ function exportWebSite($website) } +/** + * Open a zip with all data of web site and load it into database. + * + * @param string $filename Path of zip file + * @return int <0 if KO, >0 if OK + */ +function importWebSite($website) +{ + $result = 0; + + + //$sql = array("INSERT INTO ".MAIN_DB_PREFIX."website(ref, entity, description, status) values('sellyoursaas', '.$conf->entity.', Portal to sell your SaaS', 1)"); + + + return $result; +} + + /** * Download all images found into page content $tmp. * If $modifylinks is set, links to images will be replace with a link to viewimage wrapper. diff --git a/htdocs/index.php b/htdocs/index.php index 0bbdbb0fbad..0cba7291e9b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2015 Marcos GarcĂ­a @@ -375,7 +375,7 @@ if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) { include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $board=new ActionComm($db); - + $dashboardlines[] = $board->load_board($user); } @@ -688,13 +688,13 @@ $db->close(); function showWeather($totallate,$text,$options) { global $conf; - + $out=''; $offset=0; $factor=10; // By default $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'; - + $level0=$offset; if (! empty($conf->global->{$used_conf.'0'})) $level0=$conf->global->{$used_conf.'0'}; $level1=$offset+1*$factor; if (! empty($conf->global->{$used_conf.'1'})) $level1=$conf->global->{$used_conf.'1'}; $level2=$offset+2*$factor; if (! empty($conf->global->{$used_conf.'2'})) $level2=$conf->global->{$used_conf.'2'}; diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 64f72142add..14afe19d0aa 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_website entity integer DEFAULT 1, ref varchar(128) NOT NULL, description varchar(255), - status integer, + status integer DEFAULT 1, fk_default_home integer, virtualhost varchar(255), fk_user_create integer, diff --git a/htdocs/public/websites/index.php b/htdocs/public/website/index.php similarity index 100% rename from htdocs/public/websites/index.php rename to htdocs/public/website/index.php diff --git a/htdocs/public/websites/styles.css.php b/htdocs/public/website/styles.css.php similarity index 100% rename from htdocs/public/websites/styles.css.php rename to htdocs/public/website/styles.css.php diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 8fb23d2b8a2..e99fc3fe31e 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -139,7 +139,7 @@ class Website extends CommonObject $sql.= 'date_creation,'; $sql.= 'tms'; $sql .= ') VALUES ('; - $sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).','; + $sql .= ' '.((empty($this->entity) && $this->entity != '0')?'NULL':$this->entity).','; $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).',';