Changeset 10986 for extensions/SmiliesSupport/admin.php
- Timestamp:
- May 22, 2011, 12:48:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/admin.php
r9966 r10986 9 9 if (isset($_POST['submit'])) 10 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 { 14 $not_save_file = true; 15 } 16 17 // new configuration 18 $conf_smiliessupport = array( 19 isset($_POST['text1']) ? $_POST['text1'] : 'plugins/SmiliesSupport/smilies_1', 20 isset($_POST['text2']) ? $_POST['text2'] : '6', 21 isset($_POST['text3']) ? $_POST['text3'] : 'smile.png', 22 ); 23 if (empty($_POST['text'])) $_POST['text'] = ':) smile.png'; 24 25 $new_value_smiliessupport = implode(",", $conf_smiliessupport); 26 $query = "UPDATE " . CONFIG_TABLE . " 27 SET value='" . $new_value_smiliessupport . "' 28 WHERE param='smiliessupport'"; 29 pwg_query($query); 30 31 // new definitions file 32 if (!isset($not_save_file)) 33 { 34 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 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 { 14 $not_save_file = true; 15 } 16 17 // new configuration 18 $conf_smiliessupport = array( 19 isset($_POST['text1']) ? $_POST['text1'] : 'plugins/SmiliesSupport/smilies_1', 20 isset($_POST['text2']) ? $_POST['text2'] : '6', 21 isset($_POST['text3']) ? $_POST['text3'] : 'smile.png', 22 ); 23 if (empty($_POST['text'])) $_POST['text'] = ':) smile.png'; 24 25 conf_update_param('smiliessupport', implode(",", $conf_smiliessupport)); 26 array_push($page['infos'], l10n('Information data registered in database')); 27 28 // new definitions file 29 if (!isset($not_save_file)) 30 { 31 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 35 32 36 if (file_exists($smilies_file)) { 37 @copy($smilies_file, get_filename_wo_extension($smilies_file).'.bak'); 38 } 39 40 if (@file_put_contents($smilies_file, stripslashes($_POST['text']))) { 41 $page['infos'][] = l10n('Information data registered in database'); 42 } else { 43 $page['errors'][] = l10n('File/directory read error').' : '.$smilies_file; 44 } 45 } 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 array_push($page['errors'], l10n('File/directory read error').' : '.$smilies_file); 39 } 40 } 46 41 } 47 42 48 43 // check if the representant exists 49 44 if (!file_exists(PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2])) { 50 $page['errors'][] = l10n('File/directory read error').' : '.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2];45 array_push($page['errors'], l10n('File/directory read error').' : '.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2]); 51 46 } 52 47 53 48 $template->assign(array( 54 55 56 49 'TEXT1_VALUE' => $conf_smiliessupport[0], 50 'TEXT2_VALUE' => $conf_smiliessupport[1], 51 'TEXT3_VALUE' => $conf_smiliessupport[2], 57 52 )); 58 53 … … 64 59 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 65 60 if (file_exists($smilies_file)) { 66 67 61 $content_file = file_get_contents($smilies_file); 62 $template->assign(array('CONTENT_FILE' => $content_file)); 68 63 } 69 64 70 65 $template->assign('SMILIES_PATH', SMILIES_PATH); 71 66 $template->set_filename('smiliessupport_conf', dirname(__FILE__).'/template/smiliessupport_admin.tpl');
Note: See TracChangeset
for help on using the changeset viewer.