Changeset 23236 for extensions/SmiliesSupport/include
- Timestamp:
- Jun 16, 2013, 1:09:12 AM (11 years ago)
- Location:
- extensions/SmiliesSupport/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/include/functions.inc.php
r23234 r23236 20 20 } 21 21 22 function smiliessupport_ get_list()22 function smiliessupport_action() 23 23 { 24 if (!isset($_GET['action']) || $_GET['action']!='ss_preview') return; 24 if (!isset($_GET['action'])) return; 25 if (strpos($_GET['action'], 'ss_') !== 0) return; 25 26 26 27 global $conf; … … 28 29 $folder = SMILIES_DIR . ltrim($_GET['folder'], '/') . '/'; 29 30 30 $short = array(); 31 if (file_exists($folder.'smilies.txt')) 31 if ($_GET['action'] == 'ss_reset') 32 32 { 33 foreach (file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES) as $v) 33 @unlink($folder.'smilies-custom.txt'); 34 $_GET['action'] = 'ss_list'; 35 } 36 37 if ($_GET['action'] == 'ss_list') 38 { 39 $short = array(); 40 if (file_exists($folder.'smilies-custom.txt')) 34 41 { 35 if (preg_match('#^([^\s]+)[\s]+(.+)$#', trim($v), $matches)) 42 $file = file($folder.'smilies-custom.txt', FILE_IGNORE_NEW_LINES); 43 } 44 else if (file_exists($folder.'smilies.txt')) 45 { 46 $file = file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES); 47 } 48 if (!empty($file)) 49 { 50 foreach ($file as $v) 36 51 { 37 $short[ $matches[2] ][] = $matches[1]; 52 if (preg_match('#^([^\s]+)[\s]+(.+)$#', trim($v), $matches)) 53 { 54 $short[ $matches[2] ][] = $matches[1]; 55 } 38 56 } 39 57 } 58 59 $smilies = array(); 60 $handle = opendir($folder); 61 while (false !== ($file = readdir($handle))) 62 { 63 if ( $file != '.' && $file != '..' && in_array(get_extension($file), $conf['smiliessupport']['ext']) ) 64 { 65 $smilies[$file] = array('title'=>':'.get_filename_wo_extension($file).':', 'file'=>$file, 'short'=>@$short[$file]); 66 } 67 } 68 closedir($handle); 69 70 echo json_encode(array('path'=>$folder, 'smilies'=>$smilies)); 40 71 } 41 42 $smilies = array();43 $handle = opendir($folder);44 while (false !== ($file = readdir($handle)))45 {46 if ( $file != '.' && $file != '..' && in_array(get_extension($file), $conf['smiliessupport']['ext']) )47 {48 $smilies[$file] = array('title'=>':'.get_filename_wo_extension($file).':', 'file'=>$file, 'short'=>@$short[$file]);49 }50 }51 closedir($handle);52 72 53 echo json_encode(array('path'=>$folder, 'smilies'=>$smilies));54 73 exit; 55 74 } -
extensions/SmiliesSupport/include/smiliessupport.inc.php
r23234 r23236 79 79 } 80 80 81 if (file_exists($folder.'smilies .txt'))81 if (file_exists($folder.'smilies-custom.txt')) 82 82 { 83 foreach (file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES) as $v) 83 $file = file($folder.'smilies-custom.txt', FILE_IGNORE_NEW_LINES); 84 } 85 else if (file_exists($folder.'smilies.txt')) 86 { 87 $file = file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES); 88 } 89 if (!empty($file)) 90 { 91 foreach ($file as $v) 84 92 { 85 93 $v = trim($v);
Note: See TracChangeset
for help on using the changeset viewer.