Changeset 9764 for extensions/SmiliesSupport
- Timestamp:
- Mar 19, 2011, 10:27:48 AM (13 years ago)
- Location:
- extensions/SmiliesSupport
- Files:
-
- 46 added
- 1 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/admin.php
r9683 r9764 9 9 if (isset($_POST['submit'])) 10 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'; 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 } 14 15 15 16 $conf_smiliessupport = array( 16 $_POST['text1'],17 $_POST['text2'],18 $_POST['text3']17 isset($_POST['text1']) ? $_POST['text1'] : 'plugins/SmiliesSupport/smilies', 18 isset($_POST['text2']) ? $_POST['text2'] : '5', 19 isset($_POST['text3']) ? $_POST['text3'] : 'sourire.gif', 19 20 ); 21 22 if (empty($_POST['text'])) $_POST['text'] = ':) sourire.gif'; 20 23 21 $new_value_smiliessupport = implode ("," 24 $new_value_smiliessupport = implode (",", $conf_smiliessupport); 22 25 $query = 'UPDATE ' . CONFIG_TABLE . ' 23 SET value="' . $new_value_smiliessupport . '"24 WHERE param="smiliessupport"';26 SET value="' . $new_value_smiliessupport . '" 27 WHERE param="smiliessupport"'; 25 28 pwg_query($query); 26 29 27 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 30 if (!isset($not_save_file)) { 31 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 28 32 29 if (file_exists($smilies_file)) 30 { 31 if (@copy($smilies_file , get_filename_wo_extension($smilies_file).'.bak')) 32 { 33 $file = @fopen($smilies_file , "w"); 34 fwrite($file , stripslashes($content_file = $_POST['text'])); 35 fclose($file); 36 array_push($page['infos'], l10n('Configuration saved.')); 33 if (file_exists($smilies_file)) { 34 @copy($smilies_file, get_filename_wo_extension($smilies_file).'.bak'); 37 35 } 38 else 39 { 40 array_push($page['errors'], l10n('Configuration not saved. (copy : '.$smilies_file.' to '.get_filename_wo_extension($smilies_file).'.bak').')' ); 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 41 } 42 }43 else44 {45 array_push($page['errors'], l10n('Configuration not saved. (file exists : '.$smilies_file.')' ));46 42 } 47 43 } … … 55 51 56 52 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 57 $content_file = '';53 $content_file = null; 58 54 59 if (file_exists($smilies_file)) 60 { 55 if (file_exists($smilies_file)) { 61 56 $content_file = file_get_contents($smilies_file); 62 $template->assign(array('CONTENT_FILE' => $content_file));57 $template->assign(array('CONTENT_FILE' => $content_file)); 63 58 } 64 59 -
extensions/SmiliesSupport/language/cs_CZ/plugin.lang.php
r9700 r9764 5 5 $lang['representant'] = "Representative"; 6 6 $lang['All Smilies'] = "All Smilies"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/de_DE/plugin.lang.php
r9703 r9764 5 5 $lang['representant'] = "Repräsentative"; 6 6 $lang['All Smilies'] = "Alle Smilies"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/en_UK/plugin.lang.php
r9700 r9764 5 5 $lang['representant'] = "Representative"; 6 6 $lang['All Smilies'] = "All Smilies"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/fr_FR/plugin.lang.php
r9700 r9764 5 5 $lang['representant'] = "Représentant"; 6 6 $lang['All Smilies'] = "Tous les smileys"; 7 $lang['smilies_file_help'] = "Par défaut quand l'utilisateur clique sur un smiley, Smilies Support ajoute un mot clef correspondant au nom du fichier (smile.png -> :smile:).<br> 8 Mais vous pouvez configurer ici d'autres chaînes de caractères qui seront remplacées. Chaque dossier de smileys a son propre fichier <i>smilies.txt</i>."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/hu_HU/plugin.lang.php
r9701 r9764 5 5 $lang['representant'] = "Képviselő"; 6 6 $lang['All Smilies'] = "Összes hangulatjel"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/it_IT/plugin.lang.php
r9703 r9764 5 5 $lang['representant'] = "Rappresentante"; 6 6 $lang['All Smilies'] = "Tutti gli smiley"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/lv_LV/plugin.lang.php
r9724 r9764 5 5 $lang['representant'] = "Parstavošs"; 6 6 $lang['All Smilies'] = "Visi Smailini"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/no_NO/plugin.lang.php
r9700 r9764 5 5 $lang['representant'] = "Representative"; 6 6 $lang['All Smilies'] = "All Smilies"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/ru_RU/plugin.lang.php
r9700 r9764 5 5 $lang['representant'] = "Representative"; 6 6 $lang['All Smilies'] = "All Smilies"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/sk_SK/plugin.lang.php
r9726 r9764 5 5 $lang['representant'] = "Zástupca"; 6 6 $lang['All Smilies'] = "Všetky smajlíky"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/language/tr_TR/plugin.lang.php
r9728 r9764 5 5 $lang['representant'] = "Temsilcisi"; 6 6 $lang['All Smilies'] = "Tüm İfadeler"; 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 7 9 8 10 ?> -
extensions/SmiliesSupport/main.inc.php
r9683 r9764 2 2 /* 3 3 Plugin Name: Smilies Support 4 Version: 2.2. 04 Version: 2.2.a 5 5 Description: Allow add Smilies for comments and descriptions. 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=159 … … 16 16 17 17 add_event_handler('render_comment_content', 'SmiliesParse', 60); 18 add_event_handler('loc_begin_picture', 'set_smiliessupport_page'); 18 add_event_handler('loc_after_page_header', 'add_smiliessupport'); 19 20 function add_smiliessupport() { 21 global $page; 22 if ($page['body_id'] == 'theCommentsPage' OR $page['body_id'] == 'thePicturePage') { 23 set_smiliessupport_page(); 24 } 25 } 19 26 20 27 if (script_basename() == 'admin') -
extensions/SmiliesSupport/maintain.inc.php
r9683 r9764 6 6 global $conf; 7 7 8 if (!isset($conf['smiliessupport'])) 9 { 8 if (!isset($conf['smiliessupport'])) { 10 9 $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 11 VALUES ("smiliessupport","plugins/SmiliesSupport/smilies ,5,sourire.gif","Parametres SmiliesSupport");';10 VALUES ("smiliessupport","plugins/SmiliesSupport/smilies_1,6,smile.png","Parametres SmiliesSupport");'; 12 11 pwg_query($q); 13 12 } … … 18 17 global $conf; 19 18 20 if (isset($conf['smiliessupport'])) 21 { 19 if (isset($conf['smiliessupport'])) { 22 20 pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="smiliessupport" LIMIT 1;'); 23 21 } -
extensions/SmiliesSupport/smilies/smilies.txt
r3304 r9764 15 15 oO perplexe.gif 16 16 Oo perplexe.gif 17 OO perplexe.gif 17 18 :o surpris.gif 18 19 :O surpris.gif 19 20 :-o surpris.gif 20 21 :-O surpris.gif 22 <3 wub.gif -
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]).':"/>'; -
extensions/SmiliesSupport/smiliessupport_admin.tpl
r9683 r9764 1 1 {combine_script id='jquery'} 2 {combine_script id='jquery.cluetip' require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'} 2 3 {include file='include/autosize.inc.tpl'} 4 5 {footer_script} 6 {literal} 7 jQuery().ready(function(){ 8 // Cluetip 9 jQuery('.cluetip').cluetip({ 10 width: 550, 11 splitTitle: '|' 12 }); 13 }); 14 {/literal} 15 {/footer_script} 16 17 {html_head} 18 <style type="text/css"> 19 legend .cluetip {ldelim} 20 text-align:center; 21 margin:20px 0 -10px 0; 22 font-size:1.2em; 23 } 24 .cluetip:after {ldelim} 25 margin-left:5px; 26 vertical-align:top; 27 content:url('{$themeconf.admin_icon_dir}/help.png'); 28 } 29 </style> 30 {/html_head} 3 31 4 32 <div class="titrePage"> … … 29 57 30 58 <fieldset> 31 <legend> smilies.txt</legend>59 <legend><span class="cluetip" title="smilies.txt|{'smilies_file_help'|@translate}">smilies.txt</legend> 32 60 <textarea rows="5" name="text">{$CONTENT_FILE}</textarea> 33 61 </fieldset>
Note: See TracChangeset
for help on using the changeset viewer.