1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | global $conf, $template; |
---|
6 | |
---|
7 | $conf_smiliessupport = explode("," , $conf['smiliessupport']); |
---|
8 | // Enregistrement de la configuration |
---|
9 | if (isset($_POST['submit'])) |
---|
10 | { |
---|
11 | if (!isset($_POST['text1'])) $_POST['text1'] = 'plugins/SmiliesSupport/smilies'; |
---|
12 | if (!isset($_POST['text2'])) $_POST['text2'] = '5'; |
---|
13 | if (!isset($_POST['text3'])) $_POST['text3'] = 'sourire.gif'; |
---|
14 | |
---|
15 | $conf_smiliessupport=array( |
---|
16 | $_POST['text1'], |
---|
17 | $_POST['text2'], |
---|
18 | $_POST['text3']); |
---|
19 | |
---|
20 | $new_value_smiliessupport = implode ("," , $conf_smiliessupport); |
---|
21 | $query = ' |
---|
22 | UPDATE ' . CONFIG_TABLE . ' |
---|
23 | SET value="' . $new_value_smiliessupport . '" |
---|
24 | WHERE param="smiliessupport" |
---|
25 | LIMIT 1'; |
---|
26 | pwg_query($query); |
---|
27 | |
---|
28 | $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; |
---|
29 | |
---|
30 | if (file_exists($smilies_file)) |
---|
31 | { |
---|
32 | if (@copy($smilies_file , get_filename_wo_extension($smilies_file).'.bak')) |
---|
33 | { |
---|
34 | $file = @fopen($smilies_file , "w"); |
---|
35 | fwrite($file , stripslashes($content_file = $_POST['text'])); |
---|
36 | fclose($file); |
---|
37 | array_push($page['infos'], l10n('Configuration saved.')); |
---|
38 | } |
---|
39 | else |
---|
40 | { |
---|
41 | array_push($page['errors'], l10n('Configuration not saved. (copy : '.$smilies_file.' to '.get_filename_wo_extension($smilies_file).'.bak').')' ); |
---|
42 | } |
---|
43 | } |
---|
44 | else |
---|
45 | { |
---|
46 | array_push($page['errors'], l10n('Configuration not saved. (file exists : '.$smilies_file.')' )); |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | $template->assign(array('TEXT1_VALUE' => $conf_smiliessupport[0])); |
---|
51 | $template->assign(array('TEXT2_VALUE' => $conf_smiliessupport[1])); |
---|
52 | $template->assign(array('TEXT3_VALUE' => $conf_smiliessupport[2])); |
---|
53 | |
---|
54 | include_once(dirname(__FILE__) . '/smiliessupport.inc.php'); |
---|
55 | $template->assign('SMILIESSUPPORT_PAGE', SmiliesTable()); |
---|
56 | |
---|
57 | $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; |
---|
58 | $content_file = ''; |
---|
59 | if (file_exists($smilies_file)) |
---|
60 | { |
---|
61 | $content_file = file_get_contents($smilies_file); |
---|
62 | $template->assign(array('CONTENT_FILE' =>$content_file )); |
---|
63 | } |
---|
64 | |
---|
65 | $template->set_filename('smiliessupport_conf', dirname(__FILE__).'/smiliessupport_admin.tpl'); |
---|
66 | $template->assign_var_from_handle('ADMIN_CONTENT', 'smiliessupport_conf'); |
---|
67 | |
---|
68 | ?> |
---|