PageRenderTime 39ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/AP_EZBBC_Toolbar.php

https://github.com/Dratone/EveBB
PHP | 416 lines | 313 code | 31 blank | 72 comment | 94 complexity | 4f26ca13062f9ce8bb9f95cc6299885c MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /**
  3. * Copyright (C) 2008-2010 Jojaba
  4. * see CREDITS file to learn more about this page
  5. * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  6. */
  7. // Make sure no one attempts to run this script "directly"
  8. if (!defined('PUN'))
  9. exit;
  10. // Tell admin_loader.php that this is indeed a plugin and that it is loaded
  11. define('PUN_PLUGIN_LOADED', 1);
  12. /* ******************************** */
  13. /* Core of the EZBBC Toolbar Plugin */
  14. /* ******************************** */
  15. // Language file load
  16. $ezbbc_language_folder = file_exists(PUN_ROOT.'plugins/ezbbc/lang/'.$admin_language.'/ezbbc_plugin.php') ? $admin_language : 'English';
  17. require PUN_ROOT.'plugins/ezbbc/lang/'.$ezbbc_language_folder.'/ezbbc_plugin.php';
  18. // Getting the config data
  19. $plugin_version = "1.3.1";
  20. $config_content = trim(file_get_contents(PUN_ROOT.'plugins/ezbbc/config.php'));
  21. $config_item = explode(";", $config_content);
  22. $ezbbc_install = $config_item[0];
  23. $ezbbc_status = $config_item[1];
  24. $ezbbc_style_folder = $config_item[2];
  25. $ezbbc_smilies_set = $config_item[3];
  26. if ($ezbbc_install != 0) {
  27. $first_install = false;
  28. $ezbbc_install_date = date($lang_ezbbc['Date format'], $config_item[0]);
  29. }
  30. else {
  31. $first_install = true;
  32. }
  33. if ($ezbbc_status == 0) {
  34. $ezbbc_plugin_status = '<span style="color: red; font-weight: bold;">'.$lang_ezbbc['Plugin disabled'].'</span>';
  35. } else {
  36. // Looking first if all is really installed and updated
  37. $header_file_content = file_get_contents(PUN_ROOT.'header.php');
  38. $parser_file_content = file_get_contents(PUN_ROOT.'include/parser.php');
  39. // looking if the right code is in all modified files
  40. if (strpos($header_file_content, "<?php require PUN_ROOT.'plugins/ezbbc/ezbbc_head.php'; ?>") === false || strpos($parser_file_content, "require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies1.php';") === false || strpos($parser_file_content, "require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies2.php';") === false) {
  41. $ezbbc_plugin_status = '<span style="color: orange; font-weight: bold;">'.$lang_ezbbc['Plugin wrong installation'].'</span>';
  42. }
  43. else {
  44. $ezbbc_plugin_status = '<span style="color: green; font-weight: bold;">'.$lang_ezbbc['Plugin in action'].'</span>';
  45. }
  46. }
  47. /* If the change style button was clicked */
  48. /* ************************************** */
  49. if (isset($_POST['style_change'])) {
  50. $new_style = $_POST['ezbbc_style'];
  51. $new_smilies_set = $_POST['ezbbc_smilies_set'];
  52. $ezbbc_style_folder = $new_style;
  53. $ezbbc_smilies_set = $new_smilies_set;
  54. // Changing config data
  55. $config_content = trim(file_get_contents(PUN_ROOT.'plugins/ezbbc/config.php'));
  56. $config_item = explode(";", $config_content);
  57. $ezbbc_install = $config_item[0];
  58. $ezbbc_status = $config_item[1];
  59. $config_new_content = $ezbbc_install.';'.$ezbbc_status.';'.$new_style.';'.$new_smilies_set;
  60. $fp = fopen(PUN_ROOT.'plugins/ezbbc/config.php', 'wb');
  61. fwrite($fp, $config_new_content);
  62. fclose($fp);
  63. // Message to display
  64. $ezbbc_style_changed = '<span style="color: green;">'.$lang_ezbbc['Style changed'].'</span>';
  65. }
  66. /* If the install button was clicked or the plugin was newly installed */
  67. /* ******************************************************************* */
  68. if (isset($_POST['enable']) || $first_install){
  69. /* Trying to set right permissions for files to be writeable */
  70. /* This doesn't consider what settings are on the server. Bad idea.
  71. @chmod (PUN_ROOT.'header.php', 0640);
  72. @chmod (PUN_ROOT.'include/parser.php', 0640);
  73. @chmod (PUN_ROOT.'plugins/ezbbc/config.php', 0640);*/
  74. /* Looking if the files are writable */
  75. if (is_writable(PUN_ROOT.'header.php') && is_writable(PUN_ROOT.'include/parser.php') && is_writable(PUN_ROOT.'plugins/ezbbc/config.php')):
  76. /* Getting the content of the header.php file */
  77. $file_content = file_get_contents(PUN_ROOT.'header.php');
  78. if (strpos($file_content, "<?php require PUN_ROOT.'plugins/ezbbc/ezbbc_head.php'; ?>") === false) {
  79. //Inserting the EZBBC code by replacing an existing line
  80. $search = '</title>';
  81. $insert = "<?php require PUN_ROOT.'plugins/ezbbc/ezbbc_head.php'; ?>";
  82. $replacement = $search."\n".$insert;
  83. $file_content = str_replace ($search, $replacement, $file_content);
  84. $fp = fopen (PUN_ROOT.'header.php', 'wb');
  85. fwrite ($fp, $file_content);
  86. fclose ($fp);
  87. }
  88. /* Getting the content of the include/parser.php file and processing replacment */
  89. $file_content = file_get_contents(PUN_ROOT.'include/parser.php');
  90. if (strpos($file_content, "require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies1.php';") === false) {
  91. //Inserting the EZBBC code by replacing several existing lines
  92. $search = '~\$smilies\s*=\s*array\(.*?\);~si';
  93. $replacement = "require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies1.php';";
  94. $file_content = preg_replace ($search, $replacement, $file_content);
  95. $fp = fopen (PUN_ROOT.'include/parser.php', 'wb');
  96. fwrite ($fp, $file_content);
  97. fclose ($fp);
  98. }
  99. if (strpos($file_content, "require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies2.php';") === false) {
  100. //Inserting the EZBBC code by replacing several existing lines
  101. $search = '~\$text.*/img/smilies/.*\$text\);~';
  102. $replacement = "require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies2.php';";
  103. $file_content = preg_replace ($search, $replacement, $file_content);
  104. $fp = fopen (PUN_ROOT.'include/parser.php', 'wb');
  105. fwrite ($fp, $file_content);
  106. fclose ($fp);
  107. }
  108. /* Updating config and display datas */
  109. if ($first_install) {
  110. $ezbbc_install = time();
  111. $ezbbc_install_date = date($lang_ezbbc['Date format'], $ezbbc_install);
  112. }
  113. // Adding new data to config file
  114. $config_new_content = $ezbbc_install.';1;'.$ezbbc_style_folder.';'.$ezbbc_smilies_set;
  115. $fp = fopen(PUN_ROOT.'plugins/ezbbc/config.php', 'wb');
  116. fwrite($fp, $config_new_content);
  117. fclose($fp);
  118. // New status message
  119. $ezbbc_plugin_status = '<span style="color: green; font-weight: bold;">'.$lang_ezbbc['Plugin in action'].'</span>';
  120. else:
  121. $ezbbc_plugin_status = '<span style="color: red; font-weight: bold;">'.$lang_ezbbc['Not writable'].'</span>';
  122. endif;
  123. }
  124. /* If the remove button was clicked */
  125. /* ******************************** */
  126. if (isset($_POST['disable'])){
  127. /* Trying to set right permissions for files to be writeable
  128. @chmod (PUN_ROOT.'header.php', 0640);
  129. @chmod (PUN_ROOT.'include/parser.php', 0640);
  130. @chmod (PUN_ROOT.'plugins/ezbbc/config.php', 0640);*/
  131. /* First looking if the files are writable */
  132. if (is_writable(PUN_ROOT.'header.php') && is_writable(PUN_ROOT.'include/parser.php') && is_writable(PUN_ROOT.'plugins/ezbbc/config.php')):
  133. /* Getting the content of the header.php file */
  134. $file_content = file_get_contents(PUN_ROOT.'header.php');
  135. //Searching for ezbbc code and replacing it with nothing
  136. $search = "\n<?php require PUN_ROOT.'plugins/ezbbc/ezbbc_head.php'; ?>";
  137. $replacement = '';
  138. $file_content = str_replace ($search, $replacement, $file_content);
  139. $fp = fopen (PUN_ROOT.'header.php', 'wb');
  140. fwrite ($fp, $file_content);
  141. fclose ($fp);
  142. /* Getting the content of the include/parser.php file */
  143. $file_content = file_get_contents(PUN_ROOT.'include/parser.php');
  144. //Searching for ezbbc code and replacing it with nothing
  145. $search = array("require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies1.php';","require PUN_ROOT.'plugins/ezbbc/ezbbc_smilies2.php';");
  146. $replacement = array("\$smilies = array(
  147. ':)' => 'smile.png',
  148. '=)' => 'smile.png',
  149. ':|' => 'neutral.png',
  150. '=|' => 'neutral.png',
  151. ':(' => 'sad.png',
  152. '=(' => 'sad.png',
  153. ':D' => 'big_smile.png',
  154. '=D' => 'big_smile.png',
  155. ':o' => 'yikes.png',
  156. ':O' => 'yikes.png',
  157. ';)' => 'wink.png',
  158. ':/' => 'hmm.png',
  159. ':P' => 'tongue.png',
  160. ':p' => 'tongue.png',
  161. ':lol:' => 'lol.png',
  162. ':mad:' => 'mad.png',
  163. ':rolleyes:' => 'roll.png',
  164. ':cool:' => 'cool.png');",
  165. '$text = preg_replace("#(?<=[>\s])".preg_quote($smiley_text, \'#\')."(?=\W)#m", \'<img src="\'.pun_htmlspecialchars((function_exists(\'get_base_url\') ? get_base_url(true) : $pun_config[\'o_base_url\']).\'/img/smilies/\'.$smiley_img).\'" width="15" height="15" alt="\'.substr($smiley_img, 0, strrpos($smiley_img, \'.\')).\'" />\', $text);');
  166. $file_content = str_replace ($search, $replacement, $file_content);
  167. $fp = fopen (PUN_ROOT.'include/parser.php', 'wb');
  168. fwrite ($fp, $file_content);
  169. fclose ($fp);
  170. // Adding new data to config file
  171. $config_new_content = $ezbbc_install.';0;'.$ezbbc_style_folder.';'.$ezbbc_smilies_set;
  172. $fp = fopen(PUN_ROOT.'plugins/ezbbc/config.php', 'wb');
  173. fwrite($fp, $config_new_content);
  174. fclose($fp);
  175. // New status message
  176. $ezbbc_plugin_status = '<span style="color: red; font-weight: bold;">'.$lang_ezbbc['Plugin disabled'].'</span>';
  177. else:
  178. $ezbbc_plugin_status = '<span style="color: red; font-weight: bold;">'.$lang_ezbbc['Not writable'].'</span>';
  179. endif;
  180. }
  181. /* If the Rename button was clicked */
  182. /* ******************************** */
  183. if (isset($_POST['folder_count'])){
  184. $folder_count = $_POST['folder_count'];
  185. for ($i=0; $i<$folder_count; $i++) {
  186. if (isset($_POST['vrename'.$i])){
  187. $folder_name = $_POST['folder_name'.$i];
  188. $new_name = $_POST['rename'.$i];
  189. if ($new_name != '') {
  190. // Converting special characters
  191. $new_name = htmlentities($new_name, ENT_QUOTES, 'utf-8');
  192. $search = array('&Agrave;', '&agrave;', '&Aacute;', '&aacute;', '&Acirc;', '&acirc;', '&Atilde;', '&atilde;', '&Auml;', '&auml;', '&Aring;', '&aring;', '&AElig;', '&aelig;', '&Ccedil;', '&ccedil;', '&ETH;', '&eth;', '&Egrave;', '&egrave;', '&Eacute;', '&eacute;', '&Ecirc;', '&ecirc;', '&Euml;', '&euml;', '&Igrave;', '&igrave;', '&Iacute;', '&iacute;', '&Icirc;', '&icirc;', '&Iuml;', '&iuml;', '&Ntilde;', '&ntilde;', '&Ograve;', '&ograve;', '&Oacute;', '&oacute;', '&Ocirc;', '&ocirc;', '&Otilde;', '&otilde;', '&Ouml;', '&ouml;', '&Oslash;', '&oslash;', '&OElig;', '&oelig;', '&szlig;', '&THORN;', '&thorn;', '&Ugrave;', '&ugrave;', '&Uacute;', '&uacute;', '&Ucirc;', '&ucirc;', '&Uuml;', '&uuml;', '&Yacute;', '&yacute;', '&Yuml;', '&yuml;', ' ');
  193. $replace = array('a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'ae', 'c', 'c', 'd', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'n', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'o', 'oe', 'oe', 'ss', 'p', 'p', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'y', 'y', 'y', 'y', '_');
  194. $new_name = str_replace($search, $replace, $new_name);
  195. @rename (PUN_ROOT.'plugins/ezbbc/style/'.$folder_name, PUN_ROOT.'plugins/ezbbc/style/'.$new_name);
  196. }
  197. }
  198. }
  199. }
  200. /* If the Copy button was clicked */
  201. /* ******************************** */
  202. if (isset($_GET['copy'])) {
  203. $style_folder = $_GET['style_folder'];
  204. // Creating the new folders
  205. mkdir(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'-copy');
  206. mkdir(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'-copy/images');
  207. // Copying the files in the images folder
  208. $images = opendir(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/');
  209. while(false !== ($image = readdir($images))) {
  210. if ($image != '.' && $image != '..') {
  211. copy (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/'.$image, PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'-copy/images/'.$image);
  212. }
  213. }
  214. closedir($images);
  215. // Copying the css and the html file in the new style folder
  216. copy (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css', PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'-copy/ezbbc.css');
  217. copy (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/index.html', PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'-copy/index.html');
  218. header('Location: admin_loader.php?plugin=AP_EZBBC_Toolbar.php');
  219. }
  220. /* If the Remove button was clicked */
  221. /* ******************************** */
  222. if (isset($_GET['remove'])) {
  223. $style_folder = $_GET['style_folder'];
  224. // Retrieving and removing the files in images folder
  225. $images = opendir(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/');
  226. while(false !== ($image = readdir($images))) {
  227. if ($image != '.' && $image != '..') {
  228. @chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/'.$image, 0777);
  229. @unlink (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/'.$image);
  230. }
  231. }
  232. closedir($images);
  233. // Removing images folder
  234. @rmdir(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/');
  235. // Removing css file and html file
  236. @unlink (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css');
  237. @unlink (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/index.html');
  238. // Removing the style folder
  239. @rmdir(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder);
  240. header('Location: admin_loader.php?plugin=AP_EZBBC_Toolbar.php');
  241. }
  242. /* Display the admin navigation menu */
  243. /* ********************************* */
  244. generate_admin_menu($plugin);
  245. /* Display the EZBBC Tolbar admin page */
  246. /* ************************************** */
  247. ?>
  248. <div id="ezbbc" class="plugin blockform">
  249. <h2><span><?php echo $lang_ezbbc['Plugin title'] ?></span></h2>
  250. <h3><span><?php echo $lang_ezbbc['Description title'] ?></span></h3>
  251. <div class="box">
  252. <?php //Retrieving language file folder
  253. $ezbbc_lang_folder = file_exists (PUN_ROOT.'plugins/ezbbc/lang/'.$ezbbc_language_folder.'/help.php') ? $ezbbc_language_folder : 'English';
  254. $help_file_path = 'plugins/ezbbc/lang/'.$ezbbc_lang_folder.'/help.php';
  255. ?>
  256. <p>
  257. <?php echo ($lang_ezbbc['Explanation']) ?><br />
  258. <img src="plugins/ezbbc/style/<?php echo $ezbbc_style_folder ?>/images/help.png" alt="<?php echo $lang_ezbbc['Toolbar help'] ?>" /> <a class="toolbar_help" href="<?php echo $help_file_path ?>" title="<?php echo $lang_ezbbc['Toolbar help'] ?>" onclick="window.open(this.href, 'Toolbar_help', 'height=400, width=750, top=50, left=50, toolbar=yes, menubar=yes, location=no, resizable=yes, scrollbars=yes, status=no'); return false;"><?php echo $lang_ezbbc['Toolbar help'] ?></a>
  259. </p>
  260. </div>
  261. <h3><span><?php echo $lang_ezbbc['Form title'] ?></span></h3>
  262. <div class="box">
  263. <form id="ezbbcform" method="post" action="<?php echo pun_htmlspecialchars($_SERVER['REQUEST_URI']) ?>">
  264. <div class="inform">
  265. <fieldset>
  266. <legend><?php echo $lang_ezbbc['Legend status'] ?></legend>
  267. <div class="infldset">
  268. <ul>
  269. <li><?php echo $lang_ezbbc['Plugin version'].' '.$plugin_version ?></li>
  270. <li><?php echo $lang_ezbbc['Installation date'] ?> <?php echo $ezbbc_install_date ?></li>
  271. <li><?php echo $lang_ezbbc['Available languages'] ?>
  272. <?php //retrieving the language folder name and flags
  273. $lang_folders = opendir(PUN_ROOT.'plugins/ezbbc/lang');
  274. while(false !== ($lang_folder = readdir($lang_folders))) {
  275. if ($lang_folder != '.' && $lang_folder != '..' && is_dir('plugins/ezbbc/lang/'.$lang_folder)) {
  276. $lang_flag_path = file_exists(PUN_ROOT.'plugins/ezbbc/style/admin/flags/'.strtolower($lang_folder).'.png') ? 'plugins/ezbbc/style/admin/flags/'.strtolower($lang_folder).'.png' : 'plugins/ezbbc/style/admin/flags/no_flag.png';
  277. $lang_folder = ($lang_folder == $ezbbc_lang_folder) ? '<strong>'.$lang_folder.'</strong>' : $lang_folder;
  278. echo '<img src="'.$lang_flag_path.'" alt="'.$lang_folder.' flag" /> '.$lang_folder.' ';
  279. }
  280. }
  281. closedir($lang_folders);
  282. ?>
  283. </li>
  284. <li><?php echo $lang_ezbbc['Plugin status'] ?> <?php echo $ezbbc_plugin_status ?></li>
  285. </ul>
  286. <p><input type="submit" name="enable" value="<?php echo $lang_ezbbc['Enable'] ?>" /><input type="submit" name="disable" value="<?php echo $lang_ezbbc['Disable'] ?>" /></p>
  287. </div>
  288. </fieldset>
  289. <fieldset>
  290. <legend><?php echo $lang_ezbbc['Legend style'] ?></legend>
  291. <div class="infldset">
  292. <p>
  293. <input type="submit" name="style_change" value="<?php echo $lang_ezbbc['Change style'] ?>" />
  294. </p>
  295. <?php //Displaying the current style
  296. $smilies_style = ($ezbbc_smilies_set == "ezbbc_smilies") ? $lang_ezbbc['EZBBC smilies'] : $lang_ezbbc['Default smilies'];
  297. echo '<p style="text-align: center; border: #DDD 1px solid; background: #FFF;">'.$lang_ezbbc['Current style'].' <span style="color: green; font-weight: bold;">'.$ezbbc_style_folder.'</span> ['.$lang_ezbbc['Buttons'].'] - <span style="color: green;font-weight: bold;">'.$smilies_style.'</span></p>';
  298. ?>
  299. <h4 style="padding-bottom: 0; border-bottom: #DDD 2px solid;"><?php echo $lang_ezbbc['Buttons'] ?></h4>
  300. <script type="text/javascript" src="plugins/ezbbc/ezbbctoolbar.js"></script>
  301. <?php
  302. $style_folders = opendir(PUN_ROOT.'plugins/ezbbc/style');
  303. while(false !== ($style_folder = readdir($style_folders))) {
  304. if ($style_folder != '.' && $style_folder != '..' && file_exists(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css')) {
  305. $unsorted_style_folders[] = $style_folder;
  306. }
  307. }
  308. closedir($style_folders);
  309. // Sorting sttyle folder names
  310. natcasesort($unsorted_style_folders);
  311. $sorted_style_folders = $unsorted_style_folders;
  312. $folder_count = count($sorted_style_folders);
  313. $i = 0;
  314. foreach ($sorted_style_folders as $style_folder) {
  315. @chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css', 0664);
  316. // Selection of several data to display the style folder
  317. $radio_value = ($style_folder == $ezbbc_style_folder)?'<input type="radio" value="'.$style_folder.'" name="ezbbc_style" checked="checked" /><strong>'.$style_folder.'</strong>':'<input type="radio" value="'.$style_folder.'" name="ezbbc_style" /><span style="color: grey;">'.$style_folder.'</span>';
  318. $edit_css = (is_writable(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css'))?' <a href="plugins/ezbbc/ezbbc_edit.php?style_folder='.$style_folder.'" onclick="window.open(this.href, \'CSS Edition\', \'height=520, width=660, top=80, left=80, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=no, status=no\'); return false;" title="'.$lang_ezbbc['Edit css'].'"><img src="plugins/ezbbc/style/admin/buttons/edit.png" alt="'.$lang_ezbbc['Edit css'].'" /></a>':'';
  319. $rename_folder = ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/')),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/', 0777)) && ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder)),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder, 0777))) && ($style_folder != $ezbbc_style_folder))?'<span id="rfield_'.$style_folder.'" style="display: none;"> <input type="text" name="rename'.$i.'" value="'.$style_folder.'" /> <input type="hidden" name="folder_name'.$i.'" value="'.$style_folder.'" /><input type="submit" name="vrename'.$i.'" value="'.$lang_ezbbc['OK'].'" /></span> <a href="#rfield_'.$style_folder.'" onclick="visibility(\'rfield_'.$style_folder.'\'); return false;" title="'.$lang_ezbbc['Rename'].'"><img src="plugins/ezbbc/style/admin/buttons/rename.png" alt="'.$lang_ezbbc['Rename'].'" /></a>':'';
  320. $copy_folder = ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/')),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/', 0777)))?' <a href="admin_loader.php?plugin=AP_EZBBC_Toolbar.php&amp;style_folder='.$style_folder.'&amp;copy=yes" title="'.$lang_ezbbc['Copy'].'"><img src="plugins/ezbbc/style/admin/buttons/copy.png" alt="'.$lang_ezbbc['Copy'].'" /></a>':'';
  321. $remove_folder = (((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/')),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/', 0777))) && ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder)),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder, 0777))) && ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/')),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/', 0777))) && ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/index.html')),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/index.html', 0777))) && ((substr(decoct(@fileperms(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css')),2) == 777) || (@chmod (PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/ezbbc.css', 0777))) && ($style_folder != $ezbbc_style_folder))?' <a href="admin_loader.php?plugin=AP_EZBBC_Toolbar.php&amp;style_folder='.$style_folder.'&amp;remove=yes" onclick="return window.confirm(\''.$lang_ezbbc['Remove confirm'].'\')" title="'.$lang_ezbbc['Remove'].'"><img src="plugins/ezbbc/style/admin/buttons/remove.png" alt="'.$lang_ezbbc['Remove'].'" /></a>':'';
  322. $preview_screenshot = (file_exists(PUN_ROOT.'plugins/ezbbc/style/'.$style_folder.'/images/preview.png'))?'<img src="plugins/ezbbc/style/'.$style_folder.'/images/preview.png" alt="'.$lang_ezbbc['Toolbar preview'].'" style="border: #DDD 1px groove;"/>':$lang_ezbbc['No preview'];
  323. echo '<dl>'."\n";
  324. echo '<dt>'.$radio_value.$rename_folder.$edit_css.$copy_folder.$remove_folder.'</dt>'."\n";
  325. echo '<dd>'.$preview_screenshot.'</dd>'."\n";
  326. echo '</dl>'."\n";
  327. $i++;
  328. }
  329. echo '<input type="hidden" name="folder_count" value="'.$folder_count.'" />'
  330. ?>
  331. <h4 style="padding-bottom: 0; border-bottom: #DDD 2px solid;"><?php echo $lang_ezbbc['Smilies'] ?></h4>
  332. <?php
  333. // Retrieving the smilies icons and defining the image list for each set
  334. //Default FluxBB smilies
  335. $default_smilies_images = '';
  336. $icons = opendir(PUN_ROOT.'img/smilies');
  337. while(false !== ($icon = readdir($icons))) {
  338. if ($icon != '.' && $icon != '..' && substr($icon, -3) == 'png') {
  339. $icon_path = 'img/smilies/'.$icon;
  340. $default_smilies_images .= '<img src="'.$icon_path.'" alt="'.$lang_ezbbc['Smiley'].'" /> ';
  341. }
  342. }
  343. closedir($icons);
  344. //EZBBC smilies
  345. $ezbbc_smilies_images = '';
  346. $icons = opendir(PUN_ROOT.'plugins/ezbbc/style/smilies');
  347. while(false !== ($icon = readdir($icons))) {
  348. if ($icon != '.' && $icon != '..' && substr($icon, -3) == 'png') {
  349. $icon_path = 'plugins/ezbbc/style/smilies/'.$icon;
  350. $ezbbc_smilies_images .= '<img src="'.$icon_path.'" alt="'.$lang_ezbbc['Smiley'].'" /> ';
  351. }
  352. }
  353. closedir($icons);
  354. //Displaying the two sets
  355. if ($ezbbc_smilies_set == "fluxbb_default_smilies") {
  356. echo '<dl>'."\n";
  357. echo '<dt><input type="radio" value="fluxbb_default_smilies" name="ezbbc_smilies_set" checked="checked" /><strong>'.$lang_ezbbc['Default smilies'].'</strong></dt>'."\n";
  358. echo '<dd>'.$default_smilies_images.'</dd>'."\n";
  359. echo '<dt><input type="radio" value="ezbbc_smilies" name="ezbbc_smilies_set" /><strong>'.$lang_ezbbc['EZBBC smilies'].'</strong></dt>'."\n";
  360. echo '<dd>'.$ezbbc_smilies_images.'</dd>'."\n";
  361. echo '</dl>'."\n";
  362. } else {
  363. echo '<dl>'."\n";
  364. echo '<dt><input type="radio" value="fluxbb_default_smilies" name="ezbbc_smilies_set" /><strong>'.$lang_ezbbc['Default smilies'].'</strong></dt>'."\n";
  365. echo '<dd>'.$default_smilies_images.'</dd>'."\n";
  366. echo '<dt><input type="radio" value="ezbbc_smilies" name="ezbbc_smilies_set" checked="checked" /><strong>'.$lang_ezbbc['EZBBC smilies'].'</strong></dt>'."\n";
  367. echo '<dd>'.$ezbbc_smilies_images.'</dd>'."\n";
  368. echo '</dl>'."\n";
  369. }
  370. ?>
  371. <?php //Displaying the current style
  372. $smilies_style = ($ezbbc_smilies_set == "ezbbc_smilies") ? $lang_ezbbc['EZBBC smilies'] : $lang_ezbbc['Default smilies'];
  373. echo '<p style="text-align: center; border: #DDD 1px solid; background: #FFF;">'.$lang_ezbbc['Current style'].' <span style="color: green; font-weight: bold;">'.$ezbbc_style_folder.'</span> ['.$lang_ezbbc['Buttons'].'] - <span style="color: green;font-weight: bold;">'.$smilies_style.'</span></p>';
  374. ?>
  375. <p>
  376. <input type="submit" name="style_change" value="<?php echo $lang_ezbbc['Change style'] ?>" />
  377. </p>
  378. </div>
  379. </fieldset>
  380. </div>
  381. </form>
  382. </div>
  383. </div>
  384. <?php
  385. // Note that the script just ends here. The footer will be included by admin_loader.php