diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index 0336a2533c0..3b894536d04 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2017 Laurent Destailleur * * 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 @@ -48,15 +48,15 @@ $acts[1] = "disable"; $actl[0] = img_picto($langs->trans("Disabled"),'switch_off'); $actl[1] = img_picto($langs->trans("Activated"),'switch_on'); -$listoffset=GETPOST('listoffset'); -$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000; $status = 1; -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); -if ($page == -1 || $page == null) { $page = 0 ; } -$offset = $listlimit * $page ; +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -118,7 +118,7 @@ $elementList = array(); $sourceList=array(); // Actions add or modify an entry into a dictionary -if (GETPOST('actionadd') || GETPOST('actionmodify')) +if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) { $listfield=explode(',',$tabfield[$id]); $listfieldinsert=explode(',',$tabfieldinsert[$id]); @@ -138,7 +138,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } // Si verif ok et action add, on ajoute la ligne - if ($ok && GETPOST('actionadd')) + if ($ok && GETPOST('actionadd','alpha')) { if ($tabrowid[$id]) { @@ -200,7 +200,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } // Si verif ok et action modify, on modifie la ligne - if ($ok && GETPOST('actionmodify')) + if ($ok && GETPOST('actionmodify','alpha')) { if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } else { $rowidcol="rowid"; } @@ -252,7 +252,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } -if (GETPOST('actioncancel')) +if (GETPOST('actioncancel','alpha')) { //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } @@ -412,11 +412,11 @@ if ($id) $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. - if (GETPOST('actionadd')) + if (GETPOST('actionadd','alpha')) { foreach ($fieldlist as $key=>$val) { - if (GETPOST($val)) + if (GETPOST($val,'alpha')) $obj->$val=GETPOST($val); } } diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 8e4785ab4d9..ec3a945bb09 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -495,6 +495,31 @@ ALTER TABLE llx_usergroup_rights DROP INDEX fk_usergroup; ALTER TABLE llx_usergroup_rights ADD UNIQUE INDEX uk_usergroup_rights (entity, fk_usergroup, fk_id); ALTER TABLE llx_usergroup_rights ADD CONSTRAINT fk_usergroup_rights_fk_usergroup FOREIGN KEY (fk_usergroup) REFERENCES llx_usergroup (rowid); +-- For new module website + +CREATE TABLE llx_website_pages +( + rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, + fk_website integer NOT NULL, + pageurl varchar(16) NOT NULL, + title varchar(255), + description varchar(255), + keywords varchar(255), + content mediumtext, -- text is not enough in size + status integer, + fk_user_create integer, + fk_user_modif integer, + date_creation datetime, + tms timestamp +) ENGINE=innodb; + +ALTER TABLE llx_website_pages ADD UNIQUE INDEX uk_website_pages_url (fk_website,pageurl); + +ALTER TABLE llx_website_pages ADD CONSTRAINT fk_website_pages_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid); + + +-- For new module blockedlog + CREATE TABLE llx_blockedlog ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_website_pages.key.sql b/htdocs/install/mysql/tables/llx_website_pages.key.sql index 095dffabc95..00b9439d18b 100644 --- a/htdocs/install/mysql/tables/llx_website_pages.key.sql +++ b/htdocs/install/mysql/tables/llx_website_pages.key.sql @@ -16,7 +16,7 @@ -- -- =========================================================================== -ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pageurl); +ALTER TABLE llx_website_pages ADD UNIQUE INDEX uk_website_pages_url (fk_website,pageurl); -ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid); +ALTER TABLE llx_website_pages ADD CONSTRAINT fk_website_pages_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid); diff --git a/htdocs/install/mysql/tables/llx_website_pages.sql b/htdocs/install/mysql/tables/llx_website_pages.sql index 69b6c417528..d45d8f06f56 100644 --- a/htdocs/install/mysql/tables/llx_website_pages.sql +++ b/htdocs/install/mysql/tables/llx_website_pages.sql @@ -17,7 +17,7 @@ -- ======================================================================== -CREATE TABLE llx_website_page +CREATE TABLE llx_website_pages ( rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, fk_website integer NOT NULL, diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index a5c2ae4e046..d27737dd3b2 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -458,7 +458,8 @@ if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage if (! is_link(dol_osencode($pathtomediasinwebsite))) { dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); - symlink($pathtomedias, $pathtomediasinwebsite); + dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists + $result = symlink($pathtomedias, $pathtomediasinwebsite); } /*if (GETPOST('savevirtualhost') && $object->virtualhost != GETPOST('previewsite'))