Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JeromeDevome
committed
Feb 15, 2018
1 parent
d3c99fb
commit c202e29
Showing
15 changed files
with
265 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
/** | ||
* admin_config1.php | ||
* Interface permettant à l'administrateur la configuration de certains paramètres généraux | ||
* Ce script fait partie de l'application GRR. | ||
* Dernière modification : $Date: 2017-12-16 14:00$ | ||
* @author JeromeB | ||
* @copyright Copyright 2003-2018 Team DEVOME - JeromeB | ||
* @link http://www.gnu.org/licenses/licenses.html | ||
* | ||
* This file is part of GRR. | ||
* | ||
* GRR is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
include "../include/admin.inc.php"; | ||
require_once("../include/pages.class.php"); | ||
$grr_script_name = "admin_cgu.php"; | ||
$back = ''; | ||
if (isset($_SERVER['HTTP_REFERER'])) | ||
$back = htmlspecialchars($_SERVER['HTTP_REFERER']); | ||
$_SESSION['chemin_retour'] = "admin_cgu.php"; | ||
$day = date("d"); | ||
$month = date("m"); | ||
$year = date("Y"); | ||
check_access(6, $back); | ||
|
||
if (!Pages::load()) { | ||
die('Erreur chargement pages'); | ||
} | ||
|
||
/* Enregistrement de la page */ | ||
if (isset($_POST['CGU'])) { | ||
if (!Pages::set("CGU", $_POST['CGU'])) { | ||
echo "Erreur lors de l'enregistrement de CGU !<br />"; | ||
die(); | ||
} | ||
} | ||
/**/ | ||
|
||
$msg = ''; | ||
|
||
|
||
// Si pas de problème, message de confirmation | ||
if (isset($_POST['ok'])) { | ||
$_SESSION['displ_msg'] = 'yes'; | ||
if ($msg == '') { | ||
$msg = get_vocab('message_records'); | ||
} | ||
Header('Location: '.'admin_cgu.php?msg='.$msg); | ||
exit(); | ||
} | ||
if ((isset($_GET['msg'])) && isset($_SESSION['displ_msg']) && ($_SESSION['displ_msg'] == 'yes')) { | ||
$msg = $_GET['msg']; | ||
} else { | ||
$msg = ''; | ||
} | ||
|
||
print_header('', '', '', $type = 'with_session'); | ||
affiche_pop_up($msg, 'admin'); | ||
// Affichage de la colonne de gauche | ||
include 'admin_col_gauche.php'; | ||
|
||
echo '<form action="./admin_cgu.php" id="nom_formulaire" method="post" style="width: 100%;">'.PHP_EOL; | ||
?> | ||
<table class="table_adm"> | ||
<?php | ||
if (Settings::get('use_fckeditor') == 1) { | ||
echo '<script type="text/javascript" src="../js/ckeditor/ckeditor.js"></script>'.PHP_EOL; | ||
} | ||
echo '<h3>'.get_vocab('cgu_titre').'</h3>'.PHP_EOL; | ||
echo get_vocab('cgu_grr'); | ||
if (Pages::get('use_fckeditor') != 1) { | ||
echo ' '.get_vocab('description complete2'); | ||
} | ||
if (Settings::get('use_fckeditor') == 1) { | ||
echo '<textarea class="ckeditor" id="editor1" name="CGU" rows="20" cols="120">'.PHP_EOL; | ||
echo htmlspecialchars(Pages::get('CGU')); | ||
echo "</textarea>\n"; | ||
?> | ||
|
||
<?php | ||
|
||
} else { | ||
echo "\n<textarea name=\"CGU\" rows=\"8\" cols=\"120\">".htmlspecialchars(Pages::get('CGU')).'</textarea>'.PHP_EOL; | ||
} | ||
echo '</p>'.PHP_EOL; | ||
|
||
echo '<div id="fixe" style="text-align:center;">'.PHP_EOL; | ||
echo '<input class="btn btn-primary" type="submit" name="ok" value="'.get_vocab('save').'" style="font-variant: small-caps;"/>'.PHP_EOL; | ||
echo '</div>'; | ||
echo '</form>'; | ||
|
||
// fin de l'affichage de la colonne de droite | ||
echo '</td></tr></table>'; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/* pages.class.php | ||
* Permet de lire et d'écrire les paramètres dans la BDD (Table setting) | ||
* Dernière modification : $Date: 2018-02-10 18:00$ | ||
* @author JeromeB | ||
* @copyright Copyright 2003-2018 Team DEVOME - JeromeB | ||
* @link http://www.gnu.org/licenses/licenses.html | ||
* | ||
* This file is part of GRR. | ||
* | ||
* GRR is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
class Pages { | ||
|
||
static $grrPages; | ||
|
||
public function __construct() | ||
{ | ||
return self::load(); | ||
} | ||
|
||
|
||
static function load() | ||
{ | ||
$test = grr_sql_query1("SELECT nom FROM ".TABLE_PREFIX."_page WHERE nom = 'CGU'"); | ||
if ($test != -1) | ||
$sql = "SELECT `nom`, `valeur` FROM ".TABLE_PREFIX."_page"; | ||
else | ||
$sql = "SELECT `nom`, `valeur` FROM page"; | ||
$res = grr_sql_query($sql); | ||
if (!$res) | ||
return false; | ||
if (grr_sql_count($res) == 0) | ||
return false; | ||
else | ||
{ | ||
for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) | ||
self::$grrPages[$row[0]] = $row[1]; | ||
return true; | ||
} | ||
} | ||
|
||
static function get($_name) | ||
{ | ||
if (isset(self::$grrPages[$_name])) | ||
return self::$grrPages[$_name]; | ||
} | ||
|
||
static function set($_name, $_value) | ||
{ | ||
if (isset(self::$grrPages[$_name])) | ||
{ | ||
$sql = "UPDATE ".TABLE_PREFIX."_page set valeur = '" . protect_data_sql($_value) . "' where nom = '" . protect_data_sql($_name) . "'"; | ||
$res = grr_sql_query($sql); | ||
if (!$res) | ||
return false; | ||
} | ||
else | ||
{ | ||
$sql = "INSERT INTO ".TABLE_PREFIX."_page set nom = '" . protect_data_sql($_name) . "', valeur = '" . protect_data_sql($_value) . "'"; | ||
$res = grr_sql_query($sql); | ||
if (!$res) | ||
return (false); | ||
} | ||
self::$grrPages[$_name] = $_value; | ||
return true; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.