Changeset 9764 for extensions/SmiliesSupport/smiliessupport.inc.php
- Timestamp:
- Mar 19, 2011, 10:27:48 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/smiliessupport.inc.php
r9683 r9764 6 6 global $template, $lang, $pwg_loaded_plugins; 7 7 8 if (!isset($pwg_loaded_plugins['bbcode_bar'])) 9 { 8 if (!isset($pwg_loaded_plugins['bbcode_bar'])) { 10 9 $lang['Comment'] .= SmiliesTable(); 11 10 } … … 14 13 function SmiliesTable($new_conf=null) 15 14 { 16 global $conf, $template ;15 global $conf, $template, $page; 17 16 18 17 // this is for live update on admin page 19 if (empty($new_conf)) 18 if (empty($new_conf)) { 20 19 $conf_smiliessupport = explode("," , $conf['smiliessupport']); 21 else20 } else { 22 21 $conf_smiliessupport = $new_conf; 22 } 23 23 24 24 // edit field has a different id 25 if (isset($_GET['action']) AND $_GET['action'] == 'edit_comment') 25 if ( 26 (isset($_GET['action']) AND $_GET['action'] == 'edit_comment') 27 OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 28 ) { 26 29 $template->assign('form_name', 'editComment'); 27 else30 } else { 28 31 $template->assign('form_name', 'addComment'); 32 } 29 33 30 34 $cnt = 1; … … 40 44 if ($file != "." && $file != ".." && ( get_extension($file) == "gif" || get_extension($file) == "png")) 41 45 { 42 if (( $cnt > 0 ) && ( $cnt % $conf_smiliessupport[1] == 0 )) 43 { 46 if (( $cnt > 0 ) && ( $cnt % $conf_smiliessupport[1] == 0 )) { 44 47 $trvalue = '</tr><tr>'; 45 48 } … … 51 54 } 52 55 } 53 } 54 else 55 { 56 57 } else { 56 58 array_push($page['errors'], l10n('opendir failed : '.PHPWG_ROOT_PATH.$conf_smiliessupport[0].')' )); 57 59 } … … 66 68 $conf_smiliessupport = explode("," , $conf['smiliessupport']); 67 69 $def_path = $conf_smiliessupport[0].'/smilies.txt'; 70 $accepted_ext = array('gif', 'jpg', 'png'); 68 71 69 72 if ($handle = opendir(PHPWG_ROOT_PATH.$conf_smiliessupport[0])) … … 71 74 while (false !== ($file = readdir($handle))) 72 75 { 73 if ($file != "." && $file != ".." && ( get_extension($file) == "gif" || get_extension($file) == "png")) {76 if ($file != "." && $file != ".." && in_array(get_extension($file), $accepted_ext)) { 74 77 $v = ':'.get_filename_wo_extension($file).':'; 75 78 $s = '<img src="'.$conf_smiliessupport[0].'/'.$file.'" alt=":'.get_filename_wo_extension($file).':" title=":'.get_filename_wo_extension($file).':"/>'; … … 79 82 } 80 83 81 if ( file_exists($def_path))84 if (file_exists($def_path)) 82 85 { 83 86 $def = file($def_path); … … 85 88 { 86 89 $v = trim($v); 87 if (preg_match('|^([^\t]*)[\t]+(.*)$|',$v,$matches)) 88 { 90 if (preg_match('|^([^\t]*)[\t]+(.*)$|',$v,$matches)) { 89 91 $r = '#'.preg_quote($matches[1],'/').'#'; 90 92 $t = '<img src="'.$conf_smiliessupport[0].'/'.$matches[2].'" alt=":'.get_filename_wo_extension($matches[2]).':" title=":'.get_filename_wo_extension($matches[2]).':"/>';
Note: See TracChangeset
for help on using the changeset viewer.