/** * Loads bbcode templates from the bbcode.tpl file of the current template set. * Creates an array, keys are bbcode names like "b_open" or "url", values * are the associated template. * Probably pukes all over the place if there's something really screwed * with the bbcode.tpl file. * * Nathan Codding, Sept 26 2001. */ function load_bbcode_template() { $codes = MyBBCode_GetCodes(); for ($i = 0; $i < count($codes); $i++) { $bbcode_tpl[($codes[$i]['tag'] ? $codes[$i]['tag'] : $codes[$i]['open_tag']) . '_open'] = $codes[$i]['tag_open']; $bbcode_tpl[($codes[$i]['tag'] ? $codes[$i]['tag'] : $codes[$i]['open_tag']) . '_close'] = $codes[$i]['tag_close']; } return $bbcode_tpl; }
message_die(GENERAL_ERROR, "Couldn't obtain bbcode data", "", __LINE__, __FILE__, $sql2); } $style_name = $db->sql_fetchrow($result2); $style_name = $style_name['template_name']; $sql2 = "SELECT name FROM " . MYBBCODE_TABLE . " WHERE id=" . $row['code']; if (!($result2 = $db->sql_query($sql2))) { message_die(GENERAL_ERROR, "Couldn't obtain bbcode data", "", __LINE__, __FILE__, $sql2); } $code_name = $db->sql_fetchrow($result2); $code_name = $code_name['name']; $template->assign_block_vars('mybbcode_code', array("ID" => $row['id'], "TAG" => $row['tag'], "OPEN_TAG" => $row['open_tag'], "CLOSE_TAG" => $row['close_tag'], "STYLE" => $style_name, "CODE" => $code_name, "ROW_COLOR" => '#' . $row_color, "ROW_CLASS" => $row_class, "U_EDIT_LINK" => "<a href=\"" . append_sid("admin_mybbcode.{$phpEx}?mode=editstylecode&id=" . $row['id']) . "\">" . $lang['Edit'] . "</a>", "U_DELETE_LINK" => "<a href=\"" . append_sid("admin_mybbcode.{$phpEx}?mode=deletestylecode&id=" . $row['id']) . "\">" . $lang['Delete'] . "</a>")); } } else { $template->set_filenames(array("body" => "mybbcode_list_body.tpl")); $template->assign_vars(array("L_MOVE_UP" => $lang['Move_up'], "L_MOVE_DOWN" => $lang['Move_down'], "L_EXPLAIN" => $lang['MyBBCode_Explain_List'], "L_NAME" => $lang['MyBBCode_Name'], "L_OPEN_TAG" => $lang['MyBBCode_Open_Tag'], "L_CLOSE_TAG" => $lang['MyBBCode_Close_Tag'], "L_ATTR_CHARS" => $lang['MyBBCode_Attr_Chars'], "L_CONTENT_CHARS" => $lang['MyBBCode_Content_Chars'], "L_INCLUDE_FILE" => $lang['MyBBCode_Include_File'], "L_PARSE_FUNC_1" => $lang['MyBBCode_Parse_Func_1'], "L_PARSE_FUNC_2" => $lang['MyBBCode_Parse_Func_2'], "L_SHORTCUT_KEY" => $lang['MyBBCode_Shortcut_Key'], "L_SHOW_BUTTON" => $lang['MyBBCode_Show_Button'], "L_EDIT" => $lang['Edit'], "L_DELETE" => $lang['Delete'], "L_DISABLED" => $lang['Disabled'])); $codes = MyBBCode_GetCodes('show_order ASC'); for ($i = 0; $i < count($codes); $i++) { $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2']; $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars('mybbcode_code', array("ID" => $codes[$i]['id'], "NAME" => $codes[$i]['name'], "OPEN_TAG" => $codes[$i]['open_tag'], "CLOSE_TAG" => $codes[$i]['close_tag'], "ATTR_CHARS" => !$codes[$i]['attr_chars_pure'] ? MyBBCode_StripPregSlashes($codes[$i]['attr_chars']) : $codes[$i]['attr_chars'], "CONTENT_CHARS" => !$codes[$i]['content_chars_pure'] ? MyBBCode_StripPregSlashes($codes[$i]['content_chars']) : $codes[$i]['content_chars'], "INCLUDE_FILE" => $codes[$i]['include_file'], "PARSE_FUNC_1" => $codes[$i]['parse_func_1'], "PARSE_FUNC_2" => $codes[$i]['parse_func_2'], "SHORTCUT_KEY" => $codes[$i]['shortcut_key'], "SHOW_BUTTON" => $codes[$i]['show_button'] ? $lang['Yes'] : $lang['No'], "DISABLED" => $codes[$i]['disabled'] ? $lang['Yes'] : $lang['No'], "ROW_COLOR" => '#' . $row_color, "ROW_CLASS" => $row_class, "U_EDIT_LINK" => "<a href=\"" . append_sid("admin_mybbcode.{$phpEx}?mode=editcode&id=" . $codes[$i]['id']) . "\">" . $lang['Edit'] . "</a>", "U_DELETE_LINK" => "<a href=\"" . append_sid("admin_mybbcode.{$phpEx}?mode=deletecode&id=" . $codes[$i]['id']) . "\">" . $lang['Delete'] . "</a>", "U_MOVE_UP_LINK" => $i != 0 ? "<a href=\"" . append_sid("admin_mybbcode.{$phpEx}?mode=movecode&direction=up&id=" . $codes[$i]['id']) . "\">" . $lang['Move_up'] . "</a>" : "", "U_MOVE_DOWN_LINK" => $i != count($codes) - 1 ? "<a href=\"" . append_sid("admin_mybbcode.{$phpEx}?mode=movecode&direction=down&id=" . $codes[$i]['id']) . "\">" . $lang['Move_down'] . "</a>" : "")); } } } } } } } } } } }