bbcode.inc.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Copyright (C) 2011-2015 Visman (mio.visman@yandex.ru)
  4. * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
  5. */
  6. // Make sure no one attempts to run this script "directly"
  7. if (!defined('PUN'))
  8. exit;
  9. if (file_exists(PUN_ROOT.'style/'.$pun_user['style'].'/img/bbcode/b.png'))
  10. $btndir = 'style/'.$pun_user['style'].'/img/bbcode/';
  11. else
  12. $btndir = 'style/Air/img/bbcode/';
  13. if (!isset($smilies))
  14. {
  15. if (file_exists($container->getParameter('DIR_CACHE') . 'cache_smilies.php'))
  16. include $container->getParameter('DIR_CACHE') . 'cache_smilies.php';
  17. else
  18. {
  19. if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
  20. require PUN_ROOT.'include/cache.php';
  21. generate_smiley_cache();
  22. require $container->getParameter('DIR_CACHE') . 'cache_smilies.php';
  23. }
  24. }
  25. $smil_g = $smil_i = $smil_t = array();
  26. foreach ($smilies as $smileyt => $smileyi)
  27. {
  28. if (isset($smil_g[$smileyi])) continue;
  29. $smil_g[$smileyi] = true;
  30. $smil_i[] = "'".$smileyi."'";
  31. $smil_t[] = "'".addslashes($smileyt)."'";
  32. }
  33. $bbres = '<style type="text/css">div.grippie {background:#EEEEEE url(img/grippie.png) no-repeat scroll center 2px;border-color:#DDDDDD;border-style:solid;border-width:0pt 1px 1px;cursor:s-resize;height:9px;overflow:hidden;} .resizable-textarea textarea {display:block;margin-bottom:0pt;width:95%;height: 20%;}</style>';
  34. $tpl_main = str_replace('</head>', $bbres."\n".'</head>', $tpl_main);
  35. // mod upload
  36. $bbflagup = 0;
  37. if (!$pun_user['is_guest'] && !empty($pun_user['g_up_ext']))
  38. {
  39. if ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_up_limit'] > 0 && $pun_user['g_up_max'] > 0))
  40. $bbflagup = 1;
  41. }
  42. $page_js['j'] = 1; // for resize textarea :(
  43. $page_js['f']['bbcode'] = 'js/post.js';
  44. $page_js['c'][] = 'if (typeof FluxBB === \'undefined\' || !FluxBB) {var FluxBB = {};}
  45. FluxBB.vars = {
  46. bbDir: "'.$btndir.'",
  47. bbGuest: '.($pun_user['is_guest'] ? 1 : 0).',
  48. bbCIndex: '.$cur_index.',
  49. bbFlagUp: '.$bbflagup.',
  50. bbSmImg: ['.implode(',',$smil_i).'],
  51. bbSmTxt: ['.implode(',',$smil_t).']
  52. };
  53. FluxBB.post.init();';
  54. $cur_index += 19;
  55. unset($smil_g, $smil_i, $smil_t);