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