1<?php 2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18/** 19 * \file htdocs/admin/website.php 20 * \ingroup setup 21 * \brief Page to administer web sites 22 */ 23 24require '../main.inc.php'; 25require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; 26require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; 27require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; 28require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; 29require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php'; 30require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; 31require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 32require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; 33 34// Load translation files required by the page 35$langs->loadLangs(array('errors', 'admin', 'companies', 'website')); 36 37$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; 38$confirm = GETPOST('confirm', 'alpha'); 39$backtopage = GETPOST('backtopage', 'alpha'); 40 41$rowid = GETPOST('rowid', 'alpha'); 42 43if (!$user->admin) accessforbidden(); 44 45$status = 1; 46 47// Load variable for pagination 48$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; 49$sortfield = GETPOST('sortfield', 'aZ09comma'); 50$sortorder = GETPOST('sortorder', 'aZ09comma'); 51$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); 52if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 53$offset = $limit * $page; 54$pageprev = $page - 1; 55$pagenext = $page + 1; 56 57// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context 58$hookmanager->initHooks(array('admin')); 59 60$arrayofparameters = array('WEBSITE_USE_WEBSITE_ACCOUNTS'=>array('css'=>'minwidth200')); 61 62 63/* 64 * Actions 65 */ 66 67include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; 68 69 70/* 71 * View 72 */ 73 74$form = new Form($db); 75$formadmin = new FormAdmin($db); 76 77llxHeader('', $langs->trans("WebsiteSetup")); 78 79$titre = $langs->trans("WebsiteSetup"); 80$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>'; 81print load_fiche_titre($titre, $linkback, 'title_setup'); 82 83// Onglets 84$head = array(); 85$h = 0; 86 87$head[$h][0] = DOL_URL_ROOT."/admin/website.php"; 88$head[$h][1] = $langs->trans("WebSites"); 89$head[$h][2] = 'website'; 90$h++; 91 92$head[$h][0] = DOL_URL_ROOT."/admin/website_options.php"; 93$head[$h][1] = $langs->trans("Options"); 94$head[$h][2] = 'options'; 95$h++; 96 97print dol_get_fiche_head($head, 'options', '', -1); 98 99 100if ($action == 'edit') 101{ 102 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; 103 print '<input type="hidden" name="token" value="'.newToken().'">'; 104 print '<input type="hidden" name="action" value="update">'; 105 106 print '<table class="noborder centpercent">'; 107 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; 108 109 foreach ($arrayofparameters as $key => $val) 110 { 111 print '<tr class="oddeven"><td>'; 112 print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); 113 print '</td><td><input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'"></td></tr>'; 114 } 115 116 print '</table>'; 117 118 print '<br><div class="center">'; 119 print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">'; 120 print '</div>'; 121 122 print '</form>'; 123 print '<br>'; 124} else { 125 print '<table class="noborder centpercent">'; 126 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; 127 128 foreach ($arrayofparameters as $key => $val) 129 { 130 print '<tr class="oddeven"><td>'; 131 print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); 132 print '</td><td>'.$conf->global->$key.'</td></tr>'; 133 } 134 135 print '</table>'; 136 137 print '<div class="tabsAction">'; 138 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; 139 print '</div>'; 140} 141 142 143print dol_get_fiche_end(); 144 145// End of page 146llxFooter(); 147$db->close(); 148