addBreadCrumb(['link' => ADMIN.'bbcodes.php'.fusion_get_aidlink(), 'title' => $locale['BBCA_400']]); $allowed_section = ['bbcode_form', 'bbcode_list']; $_GET['section'] = isset($_GET['section']) && in_array($_GET['section'], $allowed_section) ? $_GET['section'] : 'bbcode_form'; $tab_title['title'][] = $locale['BBCA_400a']; $tab_title['id'][] = 'bbcode_form'; $tab_title['icon'][] = ''; $tab_title['title'][] = $locale['BBCA_401']; $tab_title['id'][] = 'bbcode_list'; $tab_title['icon'][] = ''; opentable($locale['BBCA_400']); echo opentab($tab_title, $_GET['section'], 'bbcode_list', TRUE, 'nav-tabs m-b-15'); switch ($_GET['section']) { case "bbcode_form": bbcode_form(); break; default: bbcode_list(); break; } echo closetab(); closetable(); function bbcode_list() { $locale = fusion_get_locale('', LOCALE.LOCALESET.'comments.php'); $test_message = ''; $smileys_checked = 0; if (isset($_POST['post_test'])) { $test_message = form_sanitizer($_POST['test_message'], '', 'test_message'); $smileys_checked = isset($_POST['test_smileys']) || preg_match("#(\[code\](.*?)\[/code\]|\[geshi=(.*?)\](.*?)\[/geshi\]|\[php\](.*?)\[/php\])#si", $test_message) ? 1 : 0; if (\defender::safe()) { opentable($locale['BBCA_417']); echo "
\n"; if (!$smileys_checked) { echo parseubb(parsesmileys($test_message)); } else { echo parseubb($test_message); } echo "
\n"; closetable(); } } opentable($locale['BBCA_401']); echo openform('input_form', 'post', FUSION_SELF.fusion_get_aidlink()."&section=bbcode_list"); echo form_textarea('test_message', $locale['BBCA_418a'], $test_message, [ 'required' => TRUE, 'error_text' => $locale['BBCA_418b'], 'type' => 'bbcode' ]); echo '
'; echo "
\n"; echo form_checkbox('test_smileys', $locale['BBCA_418'], $smileys_checked, [ 'type' => 'checkbox', 'reverse_label' => TRUE ]); echo "
\n"; echo "
\n"; echo form_button('post_test', $locale['BBCA_401'], $locale['BBCA_401'], ['class' => 'btn-primary']); echo "
\n"; echo "
\n"; closeform(); closetable(); } function bbcode_form() { $locale = fusion_get_locale('', LOCALE.LOCALESET."comments.php"); $aidlink = fusion_get_aidlink(); $available_bbcodes = []; $enabled_bbcodes = []; $textarea_name = ""; $inputform_name = ""; $__BBCODE__ = []; if ((isset($_GET['action']) && $_GET['action'] == "mup") && (isset($_GET['bbcode_id']) && isnum($_GET['bbcode_id']))) { $data = dbarray(dbquery("SELECT bbcode_id FROM ".DB_BBCODES." WHERE bbcode_order=:bbcodeorder", [':bbcodeorder' => intval($_GET['order'])])); dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order+1 WHERE bbcode_id=:bbcodeid", [':bbcodeid' => $data['bbcode_id']]); dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order-1 WHERE bbcode_id=:bbcode", [':bbcode' => $_GET['bbcode_id']]); addNotice('info', $locale['BBCA_430']); redirect(clean_request('', ['section', 'action', 'bbcode_id', 'order'], FALSE)); } else if ((isset($_GET['action']) && $_GET['action'] == "mdown") && (isset($_GET['bbcode_id']) && isnum($_GET['bbcode_id']))) { $data = dbarray(dbquery("SELECT bbcode_id FROM ".DB_BBCODES." WHERE bbcode_order=:bbcodeorder", [':bbcodeorder' => intval($_GET['order'])])); dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order-1 WHERE bbcode_id=:bbcodeid", [':bbcodeid' => $data['bbcode_id']]); dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order+1 WHERE bbcode_id=:bbcode", [':bbcode' => $_GET['bbcode_id']]); addNotice('info', $locale['BBCA_431']); redirect(clean_request('', ['section', 'action', 'bbcode_id', 'order'], FALSE)); } else if (isset($_GET['enable']) && preg_match("/^!?([a-z0-9_-]){1,50}$/i", $_GET['enable']) && file_exists(INCLUDES."bbcodes/".$_GET['enable']."_bbcode_include_var.php") && file_exists(INCLUDES."bbcodes/".$_GET['enable']."_bbcode_include.php") ) { if (substr($_GET['enable'], 0, 1) != '!') { $data2 = dbarray(dbquery("SELECT MAX(bbcode_order) AS xorder FROM ".DB_BBCODES)); $order = ($data2['xorder'] == 0 ? 1 : ($data2['xorder'] + 1)); dbquery("INSERT INTO ".DB_BBCODES." (bbcode_name, bbcode_order) VALUES ('".$_GET['enable']."', '".$order."')"); } else { $result2 = dbcount("(bbcode_id)", DB_BBCODES); if (!empty($result2)) { dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=bbcode_order+1"); } dbquery("INSERT INTO ".DB_BBCODES." (bbcode_name, bbcode_order) VALUES ('".$_GET['enable']."', '1')"); } addNotice('info', $locale['BBCA_432']); redirect(clean_request('', ['section', 'enable'], FALSE)); } else if (isset($_GET['disable']) && isnum($_GET['disable'])) { dbquery("DELETE FROM ".DB_BBCODES." WHERE bbcode_id=:bbcodeid", [':bbcodeid' => $_GET['disable']]); $result = dbquery("SELECT bbcode_order FROM ".DB_BBCODES." ORDER BY bbcode_order"); $order = 1; while ($data = dbarray($result)) { dbquery("UPDATE ".DB_BBCODES." SET bbcode_order=:norder WHERE bbcode_order=:bbcodeorder", [':norder' => $order, ':bbcodeorder' => $data['bbcode_order']]); $order++; } addNotice('warning', $locale['BBCA_433']); redirect(clean_request('', ['section', 'disable'], FALSE)); } $bbcode_folder = makefilelist(INCLUDES."bbcodes/", '.|..|index.php|.js', TRUE, 'files'); if (!empty($bbcode_folder)) { foreach ($bbcode_folder as $bbcode_folders) { if (preg_match("/_include.php/i", $bbcode_folders)) { $bbcode_name = explode("_", $bbcode_folders); $available_bbcodes[] = $bbcode_name[0]; } } } $result = dbquery("SELECT * FROM ".DB_BBCODES." ORDER BY bbcode_order"); sort($available_bbcodes); if (dbrows($result)) { opentable($locale['BBCA_402']); echo "
\n\n\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n\n\n"; $i = 1; $numrows = dbcount("(bbcode_id)", DB_BBCODES); while ($data = dbarray($result)) { if ($numrows != 1) { $up = $data['bbcode_order'] - 1; $down = $data['bbcode_order'] + 1; if ($i == 1) { $up_down = " ".$locale[\n"; } else { if ($i < $numrows) { $up_down = " ".$locale[\n"; $up_down .= " ".$locale[\n"; } else { $up_down = " ".$locale[\n"; } } } else { $up_down = ""; } $i++; $enabled_bbcodes[] = $data['bbcode_name']; $check_path = __DIR__.'/../includes/bbcodes/images/'; $img_path = FUSION_ROOT.fusion_get_settings('site_path').'includes/bbcodes/images/'; $bbcode_attr = ['.svg', '.png', '.gif', '.jpg']; $bbcode_image = '-'; foreach ($bbcode_attr as $attr) { if (file_exists($check_path.$data['bbcode_name'].$attr)) { $bbcode_image = "".$data[\n"; break; } } if (file_exists(LOCALE.LOCALESET."bbcodes/".$data['bbcode_name'].".php")) { $locale = fusion_get_locale('', LOCALE.LOCALESET."bbcodes/".$data['bbcode_name'].".php"); } else if (file_exists(LOCALE."English/bbcodes/".$data['bbcode_name'].".php")) { $locale = fusion_get_locale('', LOCALE."English/bbcodes/".$data['bbcode_name'].".php"); } if (file_exists(INCLUDES."bbcodes/".$data['bbcode_name']."_bbcode_include_var.php")) { include INCLUDES."bbcodes/".$data['bbcode_name']."_bbcode_include_var.php"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; unset ($__BBCODE__); echo "\n"; echo "\n"; echo "\n"; echo "\n"; } } echo "\n
".$locale['BBCA_403']."".$locale['BBCA_404']."".$locale['BBCA_405']."".$locale['BBCA_406']."".$locale['BBCA_407']."
".ucwords($data['bbcode_name'])."".$bbcode_image."".$__BBCODE__[0]['description']."".$__BBCODE__[0]['usage']."".$data['bbcode_order']."".$up_down."".$locale['BBCA_410']."
\n"; echo "
\n"; } else { echo "
".$locale['BBCA_411']."
\n"; } closetable(); $enabled = dbcount("(bbcode_id)", DB_BBCODES); opentable($locale['BBCA_413']); if (count($available_bbcodes) != $enabled) { echo "
\n\n\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n\n\n"; foreach ($available_bbcodes as $available_bbcode) { $__BBCODE__ = []; $check_path = __DIR__.'/../includes/bbcodes/images/'; $img_path = FUSION_ROOT.fusion_get_settings('site_path').'includes/bbcodes/images/'; $bbcode_attr = ['.svg', '.png', '.gif', '.jpg']; $bbcode_image = '-'; if (!in_array($available_bbcode, $enabled_bbcodes)) { foreach ($bbcode_attr as $attr) { if (file_exists($check_path.$available_bbcode.$attr)) { $bbcode_image = "".$available_bbcode."\n"; break; } } if (file_exists(LOCALE.LOCALESET."bbcodes/".$available_bbcode.".php")) { $locale = fusion_get_locale('', LOCALE.LOCALESET."bbcodes/".$available_bbcode.".php"); } else if (file_exists(LOCALE."English/bbcodes/".$available_bbcode.".php")) { $locale = fusion_get_locale('', LOCALE."English/bbcodes/".$available_bbcode.".php"); } include INCLUDES."bbcodes/".$available_bbcode."_bbcode_include_var.php"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; unset ($__BBCODE__); } } echo "\n
".$locale['BBCA_403']."".$locale['BBCA_404']."".$locale['BBCA_405']."".$locale['BBCA_406']."
".ucwords($available_bbcode)."".$bbcode_image."".$__BBCODE__[0]['description']."".$__BBCODE__[0]['usage']."".$locale['BBCA_414']."
\n"; echo "
\n"; } else { echo "
".$locale['BBCA_416']."
\n"; } closetable(); } require_once THEMES.'templates/footer.php';