function display_forum_postform($info) { $locale = fusion_get_locale(); add_to_head("<link rel='stylesheet' type='text/css' href='" . INFUSIONS . "forum/templates/css/forum.css'>"); echo render_breadcrumbs(); opentable($info['title']); // New template echo "<!--pre_form-->\n"; echo "<h4 class='m-b-20'>" . $info['description'] . "</h4>\n"; echo $info['openform']; echo $info['forum_field']; echo $info['subject_field']; echo $info['tags_field']; echo $info['message_field']; echo $info['edit_reason_field']; echo $info['forum_id_field']; echo $info['thread_id_field']; echo $info['poll_form']; $tab_title['title'][0] = $locale['forum_0602']; $tab_title['id'][0] = 'postopts'; $tab_title['icon'][0] = ''; $tab_active = tab_active($tab_title, 0); $tab_content = opentabbody($tab_title['title'][0], 'postopts', $tab_active); // first one is guaranteed to be available $tab_content .= "<div class='well m-t-20'>\n"; $tab_content .= $info['delete_field']; $tab_content .= $info['sticky_field']; $tab_content .= $info['notify_field']; $tab_content .= $info['lock_field']; $tab_content .= $info['hide_edit_field']; $tab_content .= $info['smileys_field']; $tab_content .= $info['signature_field']; $tab_content .= "</div>\n"; $tab_content .= closetabbody(); if (!empty($info['attachment_field'])) { $tab_title['title'][1] = $locale['forum_0557']; $tab_title['id'][1] = 'attach_tab'; $tab_title['icon'][1] = ''; $tab_content .= opentabbody($tab_title['title'][1], 'attach_tab', $tab_active); $tab_content .= "<div class='well m-t-20'>\n" . $info['attachment_field'] . "</div>\n"; $tab_content .= closetabbody(); } echo opentab($tab_title, $tab_active, 'newthreadopts'); echo $tab_content; echo closetab(); echo $info['post_buttons']; echo $info['closeform']; echo "<!--end_form-->\n"; closetable(); if (!empty($info['last_posts_reply'])) { echo "<div class='well m-t-20'>\n"; echo $info['last_posts_reply']; echo "</div>\n"; } }
function form_textarea($input_name, $label = '', $input_value = '', array $options = array()) { global $locale, $defender, $userdata; // for editor $title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name))); $input_name = isset($input_name) && !empty($input_name) ? stripinput($input_name) : ""; require_once INCLUDES . "bbcode_include.php"; require_once INCLUDES . "html_buttons_include.php"; include_once LOCALE . LOCALESET . "admin/html_buttons.php"; include_once LOCALE . LOCALESET . "error.php"; if (!empty($options['bbcode'])) { $options['type'] = "bbcode"; } elseif (!empty($options['html'])) { $options['type'] = "html"; } $options = array('input_id' => !empty($options['input_id']) ? $options['input_id'] : $input_name, "type" => !empty($options['type']) && in_array($options['type'], array("html", "bbcode", "tinymce")) ? $options['type'] : "", 'required' => !empty($options['required']) && $options['required'] == 1 ? '1' : '0', 'placeholder' => !empty($options['placeholder']) ? $options['placeholder'] : '', 'deactivate' => !empty($options['deactivate']) && $options['deactivate'] == 1 ? '1' : '', 'width' => !empty($options['width']) ? $options['width'] : '100%', 'height' => !empty($options['height']) ? $options['height'] : '80px', 'class' => !empty($options['class']) ? $options['class'] : '', 'inline' => !empty($options['inline']) && $options['inline'] == 1 ? '1' : '0', 'length' => !empty($options['length']) ? $options['length'] : '200', 'error_text' => !empty($options['error_text']) ? $options['error_text'] : $locale['error_input_default'], 'safemode' => !empty($options['safemode']) && $options['safemode'] == 1 ? '1' : '0', 'form_name' => !empty($options['form_name']) ? $options['form_name'] : 'input_form', 'tinymce' => !empty($options['tinymce']) && in_array($options['tinymce'], array(TRUE, 'simple', 'advanced')) ? $options['tinymce'] : "simple", 'no_resize' => !empty($options['no_resize']) && $options['no_resize'] == '1' ? '1' : '0', 'autosize' => !empty($options['autosize']) && $options['autosize'] == 1 ? '1' : '0', 'preview' => !empty($options['preview']) && $options['preview'] == TRUE ? TRUE : FALSE, 'path' => !empty($options['path']) && $options['path'] ? $options['path'] : IMAGES, 'maxlength' => !empty($options['maxlength']) && isnum($options['maxlength']) ? $options['maxlength'] : '', 'tip' => !empty($options['tip']) ? $options['tip'] : ''); if ($options['type'] == "tinymce") { $tinymce_list = array(); $image_list = makefilelist(IMAGES, ".|..|"); $image_filter = array('png', 'PNG', 'bmp', 'BMP', 'jpg', 'JPG', 'jpeg', 'gif', 'GIF', 'tiff', 'TIFF'); foreach ($image_list as $image_name) { $image_1 = explode('.', $image_name); $last_str = count($image_1) - 1; if (in_array($image_1[$last_str], $image_filter)) { $tinymce_list[] = array('title' => $image_name, 'value' => IMAGES . $image_name); } } $tinymce_list = json_encode($tinymce_list); $tinymce_smiley_vars = ""; if (!defined('tinymce')) { add_to_head("<style type='text/css'>.mceIframeContainer iframe{width:100%!important; height:30px;}</style>"); add_to_footer("<script type='text/javascript' src='" . INCLUDES . "jscripts/tinymce/tinymce.min.js'></script>"); define('tinymce', TRUE); // PHP-Fusion Parse Cache Smileys $smileys = cache_smileys(); $tinymce_smiley_vars = ""; if (!empty($smileys)) { $tinymce_smiley_vars = "var shortcuts = {\n"; foreach ($smileys as $params) { $tinymce_smiley_vars .= "'" . strtolower($params['smiley_code']) . "' : '<img alt=\"" . $params['smiley_text'] . "\" src=\"" . IMAGES . "smiley/" . $params['smiley_image'] . "\"/>',\n"; } $tinymce_smiley_vars .= "};\n"; $tinymce_smiley_vars .= "\n\t\t\t\ted.on('keyup load', function(e){\n\t\t\t\t\tvar marker = tinymce.activeEditor.selection.getBookmark();\n\t\t\t\t\t// Store editor contents\n\t\t\t\t\tvar content = tinymce.activeEditor.getContent({'format':'raw'});\n\t\t\t\t\t// Loop through all shortcuts\n\t\t\t\t\tfor(var key in shortcuts){\n\t\t\t\t\t\t// Check if the editor html contains the looped shortcut\n\t\t\t\t\t\tif(content.toLowerCase().indexOf(key) != -1) {\n\t\t\t\t\t\t\t// Escaping special characters to be able to use the shortcuts in regular expression\n\t\t\t\t\t\t\tvar k = key.replace(/[<>*()?']/ig, \"\\\$&\");\n\t\t\t\t\t\t\ttinymce.activeEditor.setContent(content.replace(k, shortcuts[key]));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// Now put cursor back where it was\n\t\t\t\t\ttinymce.activeEditor.selection.moveToBookmark(marker);\n\t\t\t\t});\n\t\t\t\t"; } } // Mode switching for TinyMCE switch ($options['tinymce']) { case 'advanced': add_to_jquery("\n tinymce.init({\n selector: '#" . $options['input_id'] . "',\n theme: 'modern',\n entity_encoding : 'raw',\n width: '100%',\n height: 300,\n plugins: [\n 'advlist autolink autoresize link image lists charmap print preview hr anchor pagebreak spellchecker',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'save table contextmenu directionality template paste textcolor'\n ],\n image_list: {$tinymce_list},\n content_css: '" . THEMES . "admin_templates/" . fusion_get_settings("admin_theme") . "/acp_styles.css',\n toolbar1: 'insertfile undo redo | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | newdocument fullscreen preview cut copy paste pastetext spellchecker searchreplace code',\n toolbar2: 'styleselect formatselect removeformat | fontselect fontsizeselect bold italic underline strikethrough subscript superscript blockquote | forecolor backcolor',\n toolbar3: 'hr pagebreak insertdatetime | link unlink anchor | image media | table charmap visualchars visualblocks emoticons',\n image_advtab: true,\n style_formats: [\n {title: 'Bold text', inline: 'b'},\n {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},\n {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},\n {title: 'Example 1', inline: 'span', classes: 'example1'},\n {title: 'Example 2', inline: 'span', classes: 'example2'},\n {title: 'Table styles'},\n {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}\n ],\n setup: function(ed) {\n \t\t\t\t\t// add tabkey listener\n \t\t\t\t\ted.on('keydown', function(event) {\n \t\t\t\t\tif (event.keyCode == 9) { // tab pressed\n \t\t\t\t\t\tif (event.shiftKey) { ed.execCommand('Outdent'); } else { ed.execCommand('Indent'); }\n \t\t\t\t\t\tevent.preventDefault();\n \t\t\t\t\t\treturn false;\n \t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// auto smileys parsing\n\t\t\t\t\t\t" . $tinymce_smiley_vars . "\n\t\t\t\t}\n });\n "); break; case 'simple': add_to_jquery("\n tinymce.init({\n selector: '#" . $options['input_id'] . "',\n theme: 'modern',\n menubar: false,\n statusbar: false,\n content_css: '" . THEMES . "/templates/tinymce.css',\n image_list: {$tinymce_list},\n plugins: [\n 'advlist autolink autoresize link lists charmap print preview hr anchor pagebreak spellchecker',\n 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',\n 'contextmenu directionality template paste bbcode autoresize'\n ],\n height: 30,\n image_advtab: true,\n toolbar1: 'undo redo | bold italic underline | bullist numlist blockquote | hr media | fullscreen',\n entity_encoding : 'raw',\n language: '" . $locale['tinymce'] . "',\n object_resizing: false,\n resize: false,\n relative_urls: false,\n setup: function(ed) {\n \t\t\t\t\t// add tabkey listener\n \t\t\t\t\ted.on('keydown', function(event) {\n \t\t\t\t\tif (event.keyCode == 9) { // tab pressed\n \t\t\t\t\t\tif (event.shiftKey) { ed.execCommand('Outdent'); } else { ed.execCommand('Indent'); }\n \t\t\t\t\t\tevent.preventDefault();\n \t\t\t\t\t\treturn false;\n \t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// auto smileys parsing\n\t\t\t\t\t\t" . $tinymce_smiley_vars . "\n\t\t\t\t}\n });\n "); add_to_jquery("\n\t\t\t\t\$('#inject').bind('click', function() {\n\t\t\t\t\ttinyMCE.activeEditor.execCommand(\"mceInsertContent\", true, '[b]I am injecting in stuff..[/b]');\n\t\t\t\t\t});\n\t\t\t\t"); break; case 'default': add_to_jquery("\n tinymce.init({\n selector: '#" . $options['input_id'] . "',\n theme: 'modern',\n entity_encoding : 'raw',\n language:'" . $locale['tinymce'] . "',\n setup: function(ed) {\n \t\t\t\t\t// add tabkey listener\n \t\t\t\t\ted.on('keydown', function(event) {\n \t\t\t\t\tif (event.keyCode == 9) { // tab pressed\n \t\t\t\t\t\tif (event.shiftKey) { ed.execCommand('Outdent'); } else { ed.execCommand('Indent'); }\n \t\t\t\t\t\tevent.preventDefault();\n \t\t\t\t\t\treturn false;\n \t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// auto smileys parsing\n\t\t\t\t\t\t" . $tinymce_smiley_vars . "\n\t\t\t\t}\n });\n "); break; } } else { if (!defined('autogrow') && $options['autosize']) { define('autogrow', TRUE); add_to_footer("<script src='" . DYNAMICS . "assets/autosize/jquery.autosize.min.js'></script>"); } if ($options['autosize']) { add_to_jquery("\n\t\t \$('#" . $options['input_id'] . "').autosize();\n\t\t "); } } if ($input_value !== '') { $input_value = html_entity_decode(stripslashes($input_value), ENT_QUOTES, $locale['charset']); $input_value = str_replace("<br />", "", $input_value); } $error_class = ""; if ($defender->inputHasError($input_name)) { $error_class = "has-error "; if (!empty($options['error_text'])) { $new_error_text = $defender->getErrorText($input_name); if (!empty($new_error_text)) { $options['error_text'] = $new_error_text; } addNotice("danger", "<strong>{$title}</strong> - " . $options['error_text']); } } $html = "<div id='" . $options['input_id'] . "-field' class='form-group " . $error_class . $options['class'] . "' " . ($options['inline'] && $options['width'] && !$label ? "style='width: " . $options['width'] . " !important;'" : '') . ">\n"; $html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 col-md-3 col-lg-3 p-l-0" : '') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] == 1 ? "<span class='required'>*</span>" : '') . " " . ($options['tip'] ? "<i class='pointer fa fa-question-circle' title='" . $options['tip'] . "'></i>" : '') . "</label>\n" : ''; $html .= $options['inline'] ? "<div class='col-xs-12 " . ($label ? "col-sm-9 col-md-9 col-lg-9 p-r-0" : "col-sm-12 p-l-0") . "'>\n" : ""; $tab_active = 0; $tab_title = array(); if ($options['preview'] && ($options['type'] == "html" || $options['type'] == "bbcode")) { $tab_title['title'][] = $locale['preview']; $tab_title['id'][] = "prw-" . $options['input_id']; $tab_title['icon'][] = ''; $tab_title['title'][] = $locale['texts']; $tab_title['id'][] = "txt-" . $options['input_id']; $tab_title['icon'][] = ''; $tab_active = tab_active($tab_title, 1); $html .= opentab($tab_title, $tab_active, $options['input_id'] . "-link", "", "editor-wrapper"); $html .= opentabbody($tab_title['title'][1], "txt-" . $options['input_id'], $tab_active); } $html .= $options['type'] == "html" || $options['type'] == "bbcode" ? "<div class='panel panel-default panel-txtarea m-b-0' " . ($options['preview'] ? "style='border-top:0 !important; border-radius:0 !important;'" : '') . ">\n<div class='panel-heading clearfix' style='padding-bottom:0 !important;'>\n" : ''; if ($options['type'] == "bbcode" && $options['form_name']) { $html .= display_bbcodes('90%', $input_name, $options['form_name']); } elseif ($options['type'] == "html" && $options['form_name']) { $html .= display_html($options['form_name'], $input_name, TRUE, TRUE, TRUE, $options['path']); } $html .= $options['type'] == "html" || $options['type'] == "bbcode" ? "</div>\n<div class='panel-body p-0'>\n" : ''; $html .= "<textarea name='{$input_name}' style='width:100%; height:" . $options['height'] . "; " . ($options['no_resize'] ? 'resize: none;' : '') . "' class='form-control p-15 m-0 " . $options['class'] . " " . ($options['autosize'] ? 'animated-height' : '') . " " . ($options['type'] == "html" || $options['type'] == "bbcode" ? "no-shadow no-border" : '') . " textbox ' placeholder='" . $options['placeholder'] . "' id='" . $options['input_id'] . "' " . ($options['deactivate'] ? 'readonly' : '') . ($options['maxlength'] ? "maxlength='" . $options['maxlength'] . "'" : '') . ">" . $input_value . "</textarea>\n"; if ($options['type'] == "html" || $options['type'] == "bbcode") { $html .= "</div>\n<div class='panel-footer clearfix'>\n"; $html .= "<div class='overflow-hide'><small>" . $locale['word_count'] . ": <span id='" . $options['input_id'] . "-wordcount'></span></small></div>"; add_to_jquery("\n\t\tvar init_str = \$('#" . $options['input_id'] . "').val().replace(/<[^>]+>/ig, '').replace(/\\n/g,'').replace(/ /g, '').length;\n\t\t\$('#" . $options['input_id'] . "-wordcount').text(init_str);\n\t\t\$('#" . $options['input_id'] . "').on('input propertychange paste', function() {\n\t\tvar str = \$(this).val().replace(/<[^>]+>/ig, '').replace(/\\n/g,'').replace(/ /g, '').length;\n\t\t\$('#" . $options['input_id'] . "-wordcount').text(str);\n\t\t});\n\t\t"); $html .= "</div>\n</div>\n"; } if ($options['preview'] && ($options['type'] == "bbcode" || $options['type'] == "html")) { $html .= closetabbody(); $html .= opentabbody($tab_title['title'][0], "prw-" . $options['input_id'] . "", $tab_active); $html .= "No Result"; $html .= closetabbody(); $html .= closetab(); add_to_jquery("\n\t\t// preview syntax\n\t\tvar form = \$('#" . $options['form_name'] . "');\n\t\t\$('#tab-prw-" . $options['input_id'] . "').bind('click',function(){\n\t\tvar text = \$('#" . $options['input_id'] . "').val();\n\t\tvar format = '" . ($options['type'] == "bbcode" ? 'bbcode' : 'html') . "';\n\t\tvar data = {\n\t\t\t" . (defined('ADMIN_PANEL') ? "'mode': 'admin', " : "") . "\n\t\t\t'text' : text,\n\t\t\t'editor' : format,\n\t\t\t'url' : '" . $_SERVER['REQUEST_URI'] . "',\n\t\t};\n\t\tvar sendData = form.serialize() + '&' + \$.param(data);\n\t\t\$.ajax({\n\t\t\turl: '" . INCLUDES . "dynamics/assets/preview/preview.ajax.php',\n\t\t\ttype: 'POST',\n\t\t\tdataType: 'html',\n\t\t\tdata : sendData,\n\t\t\tsuccess: function(result){\n\t\t\t//console.log(result);\n\t\t\t\$('#prw-" . $options['input_id'] . "').html(result);\n\t\t\t},\n\t\t\terror: function(result) {\n\t\t\t\tnew PNotify({\n\t\t\t\t\ttitle: '" . $locale['error_preview'] . "',\n\t\t\t\t\ttext: '" . $locale['error_preview_text'] . "',\n\t\t\t\t\ticon: 'notify_icon n-attention',\n\t\t\t\t\tanimation: 'fade',\n\t\t\t\t\twidth: 'auto',\n\t\t\t\t\tdelay: '3000'\n\t\t\t\t});\n\t\t\t}\n\t\t\t});\n\t\t});\n\t\t"); } $html .= $options['required'] == 1 && $defender->inputHasError($input_name) || $defender->inputHasError($input_name) ? "<div id='" . $options['input_id'] . "-help' class='label label-danger p-5 display-inline-block'>" . $options['error_text'] . "</div>" : ""; $html .= $options['inline'] ? "</div>\n" : ''; $html .= "</div>\n"; $defender->add_field_session(array('input_name' => $input_name, 'type' => 'textarea', 'title' => $label, 'id' => $options['input_id'], 'required' => $options['required'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text'])); return $html; }
/** * Display Forum Form */ public function display_forum_form() { require_once INCLUDES . 'photo_functions_include.php'; require_once INCLUDES . 'infusions_include.php'; $forum_settings = $this->get_forum_settings(); $language_opts = fusion_get_enabled_languages(); add_breadcrumb(array('link' => '', 'title' => self::$locale['forum_001'])); if (!isset($_GET['action']) && $_GET['parent_id']) { $data['forum_cat'] = $_GET['parent_id']; } $type_opts = array('1' => self::$locale['forum_opts_001'], '2' => self::$locale['forum_opts_002'], '3' => self::$locale['forum_opts_003'], '4' => self::$locale['forum_opts_004']); $forum_image_path = FORUM . "images/"; if (isset($_POST['remove_image']) && isset($_POST['forum_id'])) { $data['forum_id'] = form_sanitizer($_POST['forum_id'], '', 'forum_id'); if ($data['forum_id']) { $data = self::get_forum($data['forum_id']); if (!empty($data)) { $forum_image = $forum_image_path . $data['forum_image']; if (!empty($data['forum_image']) && file_exists($forum_image) && !is_dir($forum_image)) { @unlink($forum_image); $data['forum_image'] = ''; } dbquery_insert(DB_FORUMS, $data, 'update'); addNotice('success', self::$locale['forum_notice_8']); redirect(FUSION_REQUEST); } } } opentable(self::$locale['forum_001']); echo openform('inputform', 'post', FUSION_REQUEST, array('enctype' => 1)); echo "<div class='row'>\n<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n"; echo form_text('forum_name', self::$locale['forum_006'], $this->data['forum_name'], array('required' => 1, 'error_text' => self::$locale['forum_error_1'])) . form_textarea('forum_description', self::$locale['forum_007'], $this->data['forum_description'], array('autosize' => 1, 'type' => 'bbcode', 'form_name' => 'inputform', 'preview' => TRUE)) . form_text('forum_alias', self::$locale['forum_011'], $this->data['forum_alias']); echo "</div><div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n"; openside(''); $self_id = $this->data['forum_id'] ? $this->data['forum_id'] : ''; echo form_select_tree('forum_cat', self::$locale['forum_008'], $this->data['forum_cat'], array('add_parent_opts' => 1, 'disable_opts' => $self_id, 'hide_disabled' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $self_id) . form_select('forum_type', self::$locale['forum_009'], $this->data['forum_type'], array("options" => $type_opts)) . form_select('forum_language', self::$locale['forum_010'], $this->data['forum_language'], array("options" => $language_opts)) . form_text('forum_order', self::$locale['forum_043'], $this->data['forum_order'], array('number' => 1)) . form_button('save_forum', $this->data['forum_id'] ? self::$locale['forum_000a'] : self::$locale['forum_000'], self::$locale['forum_000'], array('class' => 'btn btn-sm btn-success')); closeside(); echo "</div>\n</div>\n"; echo "<div class='row'>\n<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n"; echo form_select('forum_meta', self::$locale['forum_012'], $this->data['forum_meta'], array('tags' => 1, 'multiple' => 1, 'width' => '100%')); if ($this->data['forum_image'] && file_exists(FORUM . "images/" . $this->data['forum_image'])) { openside(); echo "<div class='pull-left m-r-10'>\n"; echo thumbnail(FORUM . "images/" . $this->data['forum_image'], '80px', '80px'); echo "</div>\n<div class='overflow-hide'>\n"; echo "<span class='strong'>" . self::$locale['forum_013'] . "</span><br/>\n"; $image_size = @getimagesize(FORUM . "images/" . $this->data['forum_image']); echo "<span class='text-smaller'>" . sprintf(self::$locale['forum_027'], $image_size[0], $image_size[1]) . "</span><br/>"; echo form_hidden('forum_image', '', $this->data['forum_image']); echo form_button('remove_image', self::$locale['forum_028'], self::$locale['forum_028'], array('class' => 'btn-danger btn-sm m-t-10', 'icon' => 'fa fa-trash')); echo "</div>\n"; closeside(); } else { $tab_title['title'][] = self::$locale['forum_013']; $tab_title['id'][] = 'fir'; $tab_title['icon'][] = ''; $tab_title['title'][] = self::$locale['forum_014']; $tab_title['id'][] = 'ful'; $tab_title['icon'][] = ''; $tab_active = tab_active($tab_title, 0); echo opentab($tab_title, $tab_active, 'forum-image-tab', FALSE, "m-t-20 m-b-20"); // Upload Image echo opentabbody($tab_title['title'][0], 'fir', $tab_active); echo "<span class='display-inline-block m-t-10 m-b-10'>" . sprintf(self::$locale['forum_015'], parsebytesize($forum_settings['forum_attachmax'])) . "</span>\n"; $fileOptions = array("upload_path" => $forum_image_path, "thumbnail" => TRUE, "thumbnail_folder" => $forum_image_path, "type" => "image", "delete_original" => TRUE, "max_count" => $forum_settings['forum_attachmax']); echo form_fileinput('forum_image', "", '', $fileOptions); echo closetabbody(); // Upload image via Web Address echo opentabbody($tab_title['title'][1], 'ful', $tab_active); echo "<span class='display-inline-block m-t-10 m-b-10'>" . self::$locale['forum_016'] . "</strong></span>\n"; $header_opts = array('0' => 'Local Server', '1' => 'URL'); echo form_select('forum_image_header', self::$locale['forum_056'], '', array('inline' => TRUE, 'options' => $header_opts)); echo form_text('forum_image_url', self::$locale['forum_014'], '', array('placeholder' => 'images/forum/', 'inline' => TRUE)); echo closetabbody(); echo closetab(); } echo form_textarea('forum_rules', self::$locale['forum_017'], $this->data['forum_rules'], array('autosize' => 1, 'bbcode' => 1)); echo "</div><div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n"; openside(''); // need to get parent category echo form_select_tree('forum_permissions', self::$locale['forum_025'], $this->data['forum_branch'], array('no_root' => 1, 'deactivate' => $this->data['forum_id'] ? TRUE : FALSE), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat'); if ($this->data['forum_id']) { echo form_button('jp_forum', self::$locale['forum_029'], self::$locale['forum_029'], array('class' => 'btn-sm btn-default m-r-10')); } closeside(); openside(''); echo form_checkbox('forum_lock', self::$locale['forum_026'], $this->data['forum_lock'], array("reverse_label" => TRUE)) . form_checkbox('forum_users', self::$locale['forum_024'], $this->data['forum_users'], array("reverse_label" => TRUE)) . form_checkbox('forum_quick_edit', self::$locale['forum_021'], $this->data['forum_quick_edit'], array("reverse_label" => TRUE)) . form_checkbox('forum_merge', self::$locale['forum_019'], $this->data['forum_merge'], array("reverse_label" => TRUE)) . form_checkbox('forum_allow_attach', self::$locale['forum_020'], $this->data['forum_allow_attach'], array("reverse_label" => TRUE)) . form_checkbox('forum_allow_poll', self::$locale['forum_022'], $this->data['forum_allow_poll'], array("reverse_label" => TRUE)) . form_hidden('forum_id', '', $this->data['forum_id']) . form_hidden('forum_branch', '', $this->data['forum_branch']); closeside(); echo "</div>\n</div>\n"; echo form_button('save_forum', $this->data['forum_id'] ? self::$locale['forum_000a'] : self::$locale['forum_000'], self::$locale['forum_000'], array('class' => 'btn-sm btn-success')); echo closeform(); closetable(); }
* There must be two tabs. * First tab is to control widget * Second tab is to control theme settings */ include "locale/" . LOCALESET . "locale.php"; // this works too (same as above) $tab['title'] = array($locale['debonair_0200'], $locale['debonair_0201']); $tab['id'] = array("banner", "tsettings"); $tab_active = tab_active($tab, 0); echo opentab($tab, $tab_active, "debonair_widget"); echo opentabbody($tab['title'][0], $tab['id'][0], $tab_active); debonair_banner_widget(); echo closetabbody(); echo opentabbody($tab['title'][1], $tab['id'][1], $tab_active); debonair_theme_widget(); echo closetabbody(); echo closetab(); function debonair_banner_widget() { global $locale; $acceptedMode = array("edit", "new", "del"); echo "<a class='btn btn-default m-t-10 m-b-20' href='" . clean_request("slides=new", array(), false) . "'>" . $locale['debonair_0203'] . "</a>\n"; echo "<div class='alert alert-info'>" . $locale['debonair_0700'] . "</div>\n"; if (isset($_GET['slides']) && in_array($_GET['slides'], $acceptedMode)) { $_GET['id'] = isset($_GET['id']) && isnum($_GET['id']) ? $_GET['id'] : 0; $data = array(); $db_keys = fieldgenerator(DB_DEBONAIR); foreach ($db_keys as $keys) { $value = ""; if ($keys == "banner_id") { $value = 0;
/** * Theme Styler Page * Edit done, save done. Now load. */ public function theme_editor() { global $aidlink, $locale; if (isset($_GET['e_action']) && $_GET['e_action'] == "edit" && isset($_GET['preset']) && isnum($_GET['preset'])) { $result = dbquery("SELECT * FROM " . DB_THEME . " WHERE theme_name='" . $this->theme_name . "' AND theme_id='" . intval($_GET['preset']) . "'"); if (dbrows($result) > 0) { $this->data = dbarray($result); if ($this->data['theme_config']) { $this->data += unserialize(stripslashes($this->data['theme_config'])); } } } self::save_theme(); $this->font_decoration_options = array($locale['theme_5000'], $locale['theme_5001'], $locale['theme_5002'], $locale['theme_5003'], $locale['theme_5004'], $locale['theme_5005'], $locale['theme_5006'], $locale['theme_5007']); $this->fills = array($locale['theme_5008'], $locale['theme_5009'], $locale['theme_5010'], $locale['theme_5011'], $locale['theme_5012']); $tab_title['title'][] = $locale['theme_2001']; $tab_title['id'][] = 'font'; $tab_title['icon'][] = 'fa fa-text-width m-r-10'; $tab_title['title'][] = $locale['theme_2002']; $tab_title['id'][] = 'grid'; $tab_title['icon'][] = 'fa fa-magic m-r-10'; $tab_title['title'][] = $locale['theme_2003']; $tab_title['id'][] = 'nav'; $tab_title['icon'][] = 'fa fa-navicon m-r-10'; $tab_active = tab_active($tab_title, 0); if ($this->debug) { print_p($_POST); } // Use a modal to block user to avoid double clicking the save button. echo openmodal('dbi', sprintf($locale['theme_2005'], ucwords($this->theme_name)), array('class' => 'zindex-boost modal-center', 'button_id' => 'save_theme', 'static' => 1)); echo "<div class='pull-left m-r-20'><i class='icon_notify n-magic'></i></div>\n"; echo "<div class='overflow-hide text-smaller'>" . $locale['theme_2006'] . "</div>\n"; echo closemodal(); // how come my multiple preset missing now? echo openform('theme_edit', 'post', FUSION_REQUEST, array("class" => "m-t-20")); echo "<div class='list-group-item m-b-20 clearfix'>\n"; echo "<div class='pull-right m-l-10'>\n"; echo form_button('save_theme', $locale['theme_5013'], 'save_theme', array('class' => 'btn-primary m-r-10')); echo form_button('close_theme', $locale['close'], 'close_theme', array('class' => 'btn-default')); echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo form_hidden('theme_id', '', $this->data['theme_id']); echo form_hidden("theme_datestamp", '', time()); echo form_text('theme_title', $locale['theme_2007'], $this->data['theme_title'], array('inline' => 1, 'required' => TRUE)); echo form_hidden('theme_name', $locale['theme_2008'], $this->theme_name, array('inline' => 1, 'deactivate' => 1)); echo "</div>\n"; echo "</div>\n"; echo opentab($tab_title, $tab_active, 'atom'); echo opentabbody($tab_title['title'][0], $tab_title['id'][0], $tab_active); echo "<div class='m-t-20'>\n"; $this->font_admin(); echo "</div>\n"; echo closetabbody(); echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active); echo "<div class='m-t-20'>\n"; $this->layout_admin(); echo "</div>\n"; echo closetabbody(); echo opentabbody($tab_title['title'][2], $tab_title['id'][2], $tab_active); echo "<div class='m-t-20'>\n"; $this->nav_admin(); echo "</div>\n"; echo closetabbody(); echo closetab(); echo closeform(); }
/** * Administration Console */ public function display_administration() { global $aidlink; $locale = self::$locale; define("NO_DEBUGGER", TRUE); $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) ? $_GET['rowstart'] : 0; $tab_title['title'][0] = 'Errors'; $tab_title['id'][0] = 'errors-list'; $tab_title['icon'][0] = 'fa fa-bug m-r-10'; if ($this->error_id) { $tab_title['title'][1] = 'Error File'; $tab_title['id'][1] = 'error-file'; $tab_title['icon'][1] = 'fa fa-medkit m-r-10'; $tab_title['title'][2] = 'Source File'; $tab_title['id'][2] = 'src-file'; $tab_title['icon'][2] = 'fa fa-stethoscope m-r-10'; } $tab_active = tab_active($tab_title, $this->error_id ? 1 : 0); add_breadcrumb(array('link' => ADMIN . "errors.php" . $aidlink, 'title' => $locale['400'])); opentable($locale['400']); echo opentab($tab_title, $tab_active, 'error_tab'); echo opentabbody($tab_title['title'][0], $tab_title['id'][0], $tab_active); ?> <div class='m-t-20'><?php echo $this->getErrorLogs(); ?> </div> <?php echo closetabbody(); if ($this->error_id) { // dump 1 and 2 add_to_head("<link rel='stylesheet' href='" . THEMES . "templates/errors.css' type='text/css' media='all' />"); define('no_debugger', 1); $data = dbarray(dbquery("SELECT * FROM " . DB_ERRORS . " WHERE error_id='" . $this->error_id . "' LIMIT 1")); if (!$data) { redirect(FUSION_SELF . $aidlink); } $thisFileContent = is_file($data['error_file']) ? file($data['error_file']) : array(); $line_start = max($data['error_line'] - 10, 1); $line_end = min($data['error_line'] + 10, count($thisFileContent)); $output = implode("", array_slice($thisFileContent, $line_start - 1, $line_end - $line_start + 1)); $pageFilePath = BASEDIR . $data['error_page']; $pageContent = is_file($pageFilePath) ? file_get_contents($pageFilePath) : ''; add_to_jquery("\n\t\t\t\$('#error_status_sel').bind('change', function(e) { this.form.submit();\t});\n\t\t\t"); echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active); ?> <div class='m-t-20'> <h2><?php echo $data['error_message']; ?> </h2> <h3 style='border-bottom:0;' class='display-inline'><label class='label label-success'><?php echo $locale['415'] . " " . number_format($data['error_line']); ?> </label> </h3> <div class='display-inline text-lighter'><strong><?php echo $locale['419']; ?> </strong> -- <?php echo self::getMaxFolders(stripslashes($data['error_file']), 3); ?> </div> <div class='m-t-10'> <div class='display-inline-block m-r-20'><i class='fa fa-file-code-o m-r-10'></i><strong class='m-r-10'><?php echo $locale['411']; ?> </strong> -- <a href='<?php echo FUSION_SELF . $aidlink . "&rowstart=" . $_GET['rowstart'] . "&error_id=" . $data['error_id']; ?> #page' title='<?php echo $data['error_page']; ?> '> <?php echo self::getMaxFolders($data['error_page'], 3); ?> </a> </div> <span class='text-lighter'>generated by</span> <div class='alert alert-info display-inline-block p-t-0 p-b-0 text-smaller'> <strong><?php echo $locale['412'] . "-" . $locale['416']; ?> <?php echo $data['error_user_level']; ?> -- <?php echo $locale['417'] . " " . $data['error_user_ip']; ?> </strong> </div> <span class='text-lighter'><?php echo lcfirst($locale['on']); ?> </span> <div class='alert alert-info display-inline-block p-t-0 p-b-0 text-smaller'><strong class='m-r-10'><?php echo showdate("longdate", $data['error_timestamp']); ?> </strong></div> </div> <div class='m-t-10 display-inline-block' style='width:300px'> <?php echo openform('logform', 'post', FUSION_SELF . $aidlink . "&rowstart=" . $_GET['rowstart'] . "&error_id=" . $data['error_id'] . "#file", array('max_tokens' => 1)); echo form_hidden('error_id', '', $data['error_id']); echo form_select('error_status', $locale['mark_as'], $data['error_status'], array("inline" => TRUE, "options" => self::get_logTypes())); echo closeform(); ?> </div> </div> <div class='m-t-10'> <?php openside(''); ?> <table class='table table-responsive'> <tr> <td colspan='4' class='tbl2'><strong><?php echo $locale['421']; ?> </strong> (<?php echo $locale['415'] . " " . $line_start . " - " . $line_end; ?> ) </td> </tr> <tr> <td colspan='4'><?php echo self::printCode($output, $line_start, $data['error_line'], array('time' => $data['error_timestamp'], 'text' => $data['error_message'])); ?> </td> </tr> </table> <?php closeside(); ?> </div> <?php echo closetabbody(); echo opentabbody($tab_title['title'][2], $tab_title['id'][2], $tab_active); ?> <div class='m-t-10'> <?php openside(''); ?> <table class='table table-responsive'> <tr> <td class='tbl2'><a name='page'></a> <strong><?php echo $locale['411']; ?> : <?php echo self::getMaxFolders($data['error_page'], 3); ?> </strong> </td> </tr> <tr> <td><?php echo self::printCode($pageContent, "1"); ?> </td> </tr> </table> <?php closeside(); ?> </div> <?php echo closetabbody(); } echo closetab(); closetable(); }
public function quantum_admin_buttons() { global $aidlink; $tab_title['title'][] = $this->locale['fields_0300']; $tab_title['id'][] = 'dyn'; $tab_title['icon'][] = ''; if (!empty($this->cat_list)) { $tab_title['title'][] = $this->locale['fields_0301']; $tab_title['id'][] = 'mod'; $tab_title['icon'][] = ''; } // Extended Tabs // add category if (isset($_POST['add_cat'])) { $tab_title['title'][] = $this->locale['fields_0305']; $tab_title['id'][] = 'add'; $tab_title['icon'][] = ''; $tab_active = !empty($this->cat_list) ? tab_active($tab_title, 2) : tab_active($tab_title, 1); } elseif (isset($_POST['add_field']) && in_array($_POST['add_field'], array_flip($this->get_dynamics_type()))) { $tab_title['title'][] = $this->locale['fields_0306']; $tab_title['id'][] = 'add'; $tab_title['icon'][] = ''; $tab_active = tab_active($tab_title, 2); } elseif (isset($_POST['add_module']) && in_array($_POST['add_module'], array_flip($this->get_available_modules))) { $tab_title['title'][] = $this->locale['fields_0307']; $tab_title['id'][] = 'add'; $tab_title['icon'][] = ''; $tab_active = tab_active($tab_title, 2); } elseif (isset($_GET['action']) && $_GET['action'] == 'cat_edit' && isset($_GET['cat_id']) && isnum($_GET['cat_id'])) { $tab_title['title'][] = $this->locale['fields_0308']; $tab_title['id'][] = 'edit'; $tab_title['icon'][] = ''; $tab_active = !empty($this->cat_list) ? tab_active($tab_title, 2) : tab_active($tab_title, 1); } elseif (isset($_GET['action']) && $_GET['action'] == 'field_edit' && isset($_GET['field_id']) && isnum($_GET['field_id'])) { $tab_title['title'][] = $this->locale['fields_0309']; $tab_title['id'][] = 'edit'; $tab_title['icon'][] = ''; $tab_active = tab_active($tab_title, 2); } elseif (isset($_GET['action']) && $_GET['action'] == 'module_edit' && isset($_GET['module_id']) && isnum($_GET['module_id'])) { $tab_title['title'][] = $this->locale['fields_0310']; $tab_title['id'][] = 'edit'; $tab_title['icon'][] = ''; $tab_active = tab_active($tab_title, 2); } else { $tab_active = tab_active($tab_title, 0); } echo opentab($tab_title, $tab_active, 'amd'); echo opentabbody($tab_title['title'][0], $tab_title['id'][0], $tab_active); echo openform('addfield', 'post', FUSION_SELF . $aidlink); echo form_button('add_cat', $this->locale['fields_0311'], 'add_cat', array('class' => 'm-t-20 m-b-20 btn-sm btn-primary btn-block', 'icon' => 'entypo plus-circled')); if (!empty($this->cat_list)) { echo "<div class='row m-t-20'>\n"; $field_type = $this->get_dynamics_type(); unset($field_type['file']); foreach ($field_type as $type => $name) { echo "<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6 p-b-20'>" . form_button('add_field', $name, $type, array('class' => 'btn-block btn-sm btn-default')) . "</div>\n"; } echo "</div>\n"; } echo closeform(); echo closetabbody(); if (!empty($this->cat_list)) { echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active); // list down modules. echo openform('addfield', 'post', FUSION_SELF . $aidlink, array('notice' => 0, 'max_tokens' => 1)); echo "<div class='m-t-20'>\n"; if (!empty($this->available_field_info)) { foreach ($this->available_field_info as $title => $module_data) { echo "<div class='list-group-item'>"; echo form_button('add_module', $this->locale['fields_0312'], $title, array('class' => 'btn-sm btn-default pull-right m-l-10')); echo "<div class='overflow-hide'>\n"; echo "<span class='text-dark strong'>" . $module_data['title'] . "</span><br/>\n"; echo "<span>" . $module_data['description'] . "</span>\n<br/>"; echo "</div>\n"; echo "</div>\n"; } } else { echo "<div class='alert alert-info text-center m-b-20'>No modules found</div>\n"; } echo "</div>\n"; echo closeform(); echo closetabbody(); } if (isset($_POST['add_cat']) or isset($_GET['action']) && $_GET['action'] == 'cat_edit' && isset($_GET['cat_id']) && isnum($_GET['cat_id'])) { if (!empty($this->cat_list)) { echo opentabbody($tab_title['title'][2], $tab_title['id'][2], $tab_active); } else { echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active); } echo "<div class='m-t-20'>\n"; echo $this->quantum_category_form(); echo "</div>\n"; echo closetabbody(); } elseif (isset($_POST['add_field']) && in_array($_POST['add_field'], array_flip($this->get_dynamics_type())) or isset($_GET['action']) && $_GET['action'] == 'field_edit' && isset($_GET['field_id']) && isnum($_GET['field_id'])) { echo opentabbody($tab_title['title'][2], $tab_title['id'][2], $tab_active); $this->quantum_dynamics_form(); echo closetabbody(); } elseif (isset($_POST['add_module']) && in_array($_POST['add_module'], array_flip($this->get_available_modules)) or isset($_GET['action']) && $_GET['action'] == 'module_edit' && isset($_GET['module_id']) && isnum($_GET['module_id'])) { echo opentabbody($tab_title['title'][2], $tab_title['id'][2], $tab_active); $this->display_module_form(); echo closetabbody(); } echo closetab(); }
public function display_admin() { global $aidlink; // do the table opentable(self::$locale['600']); $edit = isset($_GET['action']) && $_GET['action'] == 'edit' ? $this->verify_panel($_GET['panel_id']) : 0; // build a new interface $tab_title['title'][] = self::$locale['407']; $tab_title['id'][] = 'listpanel'; $tab_title['icon'][] = ''; $tab_title['title'][] = $edit ? self::$locale['409'] : self::$locale['408']; $tab_title['id'][] = 'panelform'; $tab_title['icon'][] = $edit ? "fa fa-pencil m-r-10" : 'fa fa-plus-square m-r-10'; $tab_active = tab_active($tab_title, $edit ? 1 : 0, 'section'); echo opentab($tab_title, $tab_active, 'id', FUSION_SELF . $aidlink); echo opentabbody($tab_title['title'][0], 'listpanel', $tab_active, 1); $this->panel_listing(); echo closetabbody(); if (isset($_GET['section']) && $_GET['section'] == 'panelform') { echo opentabbody($tab_title['title'][1], 'panelform', $tab_active, 1); $this->add_panel_form(); echo closetabbody(); } echo closetab(); closetable(); }