Example #1
0
 if (isset($_GET['submitted']) && $_GET['submitted'] == "d") {
     echo "<div class='well text-center'><p><strong>" . $locale['download_0042'] . "</strong></p>";
     echo "<p><a href='submit.php?stype=d'>" . $locale['download_0043'] . "</a></p>";
     echo "<p><a href='index.php'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['download_0039']) . "</a></p>\n";
     echo "</div>\n";
 } else {
     /**
      * The form
      */
     // must have category
     if (dbcount("(download_cat_id)", DB_DOWNLOAD_CATS, multilang_table("DL") ? "download_cat_language='" . LANGUAGE . "'" : "")) {
         echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
         echo "<div class='alert alert-info m-b-20 submission-guidelines'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['download_0044']) . "</div>\n";
         echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=d", array('enctype' => TRUE));
         echo form_text('download_title', $locale['download_0200'], $criteriaArray['download_title'], array('required' => TRUE, "inline" => TRUE, 'error_text' => $locale['download_0110']));
         echo form_select_tree("download_cat", $locale['download_0207'], $criteriaArray['download_cat'], array("inline" => TRUE, "no_root" => TRUE, "placeholder" => $locale['choose'], "query" => multilang_table("DL") ? "WHERE download_cat_language='" . LANGUAGE . "'" : ""), DB_DOWNLOAD_CATS, "download_cat_name", "download_cat_id", "download_cat_parent");
         echo form_select('download_keywords', $locale['download_0203'], $criteriaArray['download_keywords'], array("placeholder" => $locale['download_0203a'], 'max_length' => 320, "inline" => TRUE, 'width' => '100%', 'tags' => 1, 'multiple' => 1));
         echo form_textarea('download_description_short', $locale['download_0202'], $criteriaArray['download_description_short'], array('bbcode' => 1, 'required' => TRUE, "autosize" => TRUE, "inline" => TRUE, 'error_text' => $locale['download_0112'], 'form_name' => 'submit_form'));
         echo form_textarea('download_description', $locale['download_0202a'], $criteriaArray['download_description'], array("required" => $dl_settings['download_extended_required'] ? TRUE : FALSE, "inline" => TRUE, "bbcode" => TRUE, "autosize" => TRUE, "placeholder" => $locale['download_0201'], 'form_name' => 'submit_form'));
         echo "<div class='row m-l-0 m-r-0 m-b-20'>\n";
         echo "<div class='col-xs-12 col-sm-3 p-l-0'>\n&nbsp;";
         echo "</div>\n";
         echo "<div class='col-xs-12 col-sm-9 p-r-0'>\n";
         $tab_title['title'][] = "1 -" . $locale['download_0214'];
         $tab_title['id'][] = 'dlf';
         $tab_title['icon'][] = 'fa fa-file-zip-o fa-fw';
         $tab_title['title'][] = "2 -" . $locale['download_0215'];
         $tab_title['id'][] = 'dll';
         $tab_title['icon'][] = 'fa fa-plug fa-fw';
         $tab_active = tab_active($tab_title, 0);
         echo "<div class='list-group-item'>\n";
Example #2
0
 /**
  * Moving Posts
  */
 private function mod_move_posts()
 {
     global $locale;
     if (isset($_POST['move_posts']) && iMOD) {
         $remove_first_post = FALSE;
         $f_post_blo = FALSE;
         if (isset($_POST['delete_post']) && !empty($_POST['delete_post'])) {
             $first_post = dbarray(dbquery("SELECT post_id FROM " . DB_FORUM_POSTS . " WHERE thread_id='" . intval($this->thread_id) . "' ORDER BY post_datestamp ASC LIMIT 1"));
             /**
              * Scan for Posts
              */
             $move_posts = "";
             $array_post = array();
             $first_post_found = FALSE;
             foreach ($_POST['delete_post'] as $move_post_id) {
                 if (isnum($move_post_id)) {
                     $move_posts .= ($move_posts ? "," : "") . $move_post_id;
                     $array_post[] = $move_post_id;
                     if ($move_post_id == $first_post['post_id']) {
                         $first_post_found = TRUE;
                     }
                 }
             }
             // triggered move post
             if ($move_posts) {
                 // validate whether the selected post exists
                 $move_result = dbquery("SELECT forum_id, thread_id, COUNT(post_id) 'num_posts'\n\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . "\n\t\t\t\t\t\t\t\t\tWHERE post_id IN (" . $move_posts . ")\n\t\t\t\t\t\t\t\t\tAND thread_id='" . intval($this->thread_id) . "'\n\t\t\t\t\t\t\t\t\tGROUP BY thread_id");
                 if (dbrows($move_result) > 0) {
                     $pdata = dbarray($move_result);
                     $post_count = dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "'");
                     ob_start();
                     echo openmodal('forum0300', $locale['forum_0300'], array('class' => 'modal-md'));
                     if ($first_post_found) {
                         // there is a first post.
                         echo "<div id='close-message'><div class='admin-message alert alert-info m-t-10'>";
                         if ($pdata['num_posts'] != $post_count) {
                             $remove_first_post = TRUE;
                             echo $locale['forum_0305'] . "<br />\n";
                             // trying to remove first post with other post in the thread
                         } else {
                             echo $locale['forum_0306'] . "<br />\n";
                             // confirm ok to remove first post.
                         }
                         if ($remove_first_post && count($array_post) == 1) {
                             echo "<br /><strong>" . $locale['forum_0307'] . "</strong><br /><br />\n";
                             // no post to move.
                             echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'] . "'>" . $locale['forum_0309'] . "</a>";
                             $f_post_blo = TRUE;
                         }
                         echo "</div></div>\n";
                     }
                     if (!isset($_POST['new_forum_id']) && !$f_post_blo) {
                         $fl_result = dbquery("\n\t\t\t\t\t\t\t\t\t\tSELECT f.forum_id, f.forum_name, f.forum_type, f2.forum_name 'forum_cat_name',\n\t\t\t\t\t\t\t\t\t\t(\tSELECT COUNT(thread_id) FROM " . DB_FORUM_THREADS . " th WHERE f.forum_id=th.forum_id AND th.thread_id !='" . intval($this->thread_id) . "'\n\t\t\t\t\t\t\t\t\t\t\tGROUP BY th.forum_id\n\t\t\t\t\t\t\t\t\t\t) AS threadcount\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n\t\t\t\t\t\t\t\t\t\tWHERE " . groupaccess('f.forum_access') . "\n\t\t\t\t\t\t\t\t\t\tORDER BY f2.forum_order ASC, f.forum_order ASC\n\t\t\t\t\t\t\t\t\t\t");
                         if (dbrows($fl_result) > 0) {
                             $exclude_opts = array();
                             while ($data = dbarray($fl_result)) {
                                 if (empty($data['threadcount']) || $data['forum_type'] == '1') {
                                     $exclude_opts[] = $data['forum_id'];
                                 }
                             }
                             echo openform('modopts', 'post', $this->form_action);
                             echo form_select_tree('new_forum_id', $locale['forum_0301'], '', array('disable_opts' => $exclude_opts, 'no_root' => 1, 'inline' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat');
                             foreach ($array_post as $value) {
                                 echo form_hidden("delete_post[]", "", $value, array("input_id" => "delete_post[{$value}]"));
                             }
                             echo form_hidden('move_posts', '', 1);
                             echo "<div class='clearfix'>\n<div class='col-xs-12 col-md-offset-3 col-lg-offset-3'>\n";
                             echo form_button($locale['forum_0302'], $locale['forum_0208'], $locale['forum_0208'], array('inline' => 1, 'class' => 'btn-primary'));
                             echo "</div>\n</div>\n";
                             echo closeform();
                         } else {
                             echo "<div class='well'>\n";
                             echo "<strong>" . $locale['forum_0310'] . "</strong><br /><br />\n";
                             echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'] . "'>" . $locale['forum_0309'] . "</a><br /><br />\n";
                             echo "</div>\n";
                         }
                     } elseif (isset($_POST['new_forum_id']) && isnum($_POST['new_forum_id']) && !isset($_POST['new_thread_id']) && !$f_post_blo) {
                         // Select Threads in Selected Forum.
                         // build the list.
                         $tl_result = dbquery("\n\t\t\t\t\t\t\tSELECT thread_id, thread_subject\n\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . "\n\t\t\t\t\t\t\tWHERE forum_id='" . intval($_POST['new_forum_id']) . "' AND thread_id !='" . intval($pdata['thread_id']) . "' AND thread_hidden='0'\n\t\t\t\t\t\t\tORDER BY thread_subject ASC\n\t\t\t\t\t\t\t");
                         if (dbrows($tl_result) > 0) {
                             $forum_list = array();
                             while ($tl_data = dbarray($tl_result)) {
                                 $forum_list[$tl_data['thread_id']] = $tl_data['thread_subject'];
                             }
                             echo openform('modopts', 'post', $this->form_action . "&amp;sv", array('max_tokens' => 1, 'downtime' => 1));
                             echo form_hidden('new_forum_id', '', $_POST['new_forum_id']);
                             echo form_select('new_thread_id', $locale['forum_0303'], '', array('options' => $forum_list, 'inline' => 1));
                             foreach ($array_post as $value) {
                                 echo form_hidden("delete_post[]", "", $value, array("input_id" => "delete_post[{$value}]"));
                             }
                             echo form_hidden('move_posts', '', 1);
                             echo form_button($locale['forum_0304'], $locale['forum_0208'], $locale['forum_0208'], array('class' => 'btn-primary btn-sm'));
                         } else {
                             echo $locale['forum_0308'] . "<br /><br />\n";
                             echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "'>" . $locale['forum_0309'] . "</a>\n";
                         }
                     } elseif (isset($_GET['sv']) && isset($_POST['new_forum_id']) && isnum($_POST['new_forum_id']) && isset($_POST['new_thread_id']) && isnum($_POST['new_thread_id'])) {
                         // Execute move and redirect after
                         $move_posts_add = "";
                         if (!dbcount("(thread_id)", DB_FORUM_THREADS, "thread_id='" . intval($_POST['new_thread_id']) . "' AND forum_id='" . intval($_POST['new_forum_id']) . "'")) {
                             redirect($this->form_action . "&amp;error=1");
                         }
                         foreach ($array_post as $move_post_id) {
                             if (isnum($move_post_id)) {
                                 if ($first_post_found && $remove_first_post) {
                                     if ($move_post_id != $first_post['post_id']) {
                                         $move_posts_add .= ($move_posts_add ? "," : "") . $move_post_id;
                                     }
                                     $pdata['num_posts'] = $pdata['num_posts'] - 1;
                                 } else {
                                     $move_posts_add = $move_post_id . ($move_posts_add ? "," : "") . $move_posts_add;
                                 }
                             }
                         }
                         if ($move_posts_add) {
                             $posts_ex = dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "' AND post_id IN (" . $move_posts_add . ")");
                             if ($posts_ex) {
                                 $result = dbquery("UPDATE " . DB_FORUM_POSTS . " SET forum_id='" . intval($_POST['new_forum_id']) . "', thread_id='" . intval($_POST['new_thread_id']) . "' WHERE post_id IN (" . $move_posts_add . ")");
                                 $result = dbquery("UPDATE " . DB_FORUM_ATTACHMENTS . " SET thread_id='" . intval($_POST['new_thread_id']) . "' WHERE post_id IN(" . $move_posts_add . ")");
                                 $new_thread = dbarray(dbquery("\n\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT forum_id, thread_id, post_id, post_author, post_datestamp\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE thread_id='" . intval($_POST['new_thread_id']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY post_datestamp DESC\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t"));
                                 $result = dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . intval($new_thread['post_datestamp']) . "', thread_lastpostid='" . intval($new_thread['post_id']) . "',\n\t\t\t\t\t\t\t\t\tthread_postcount=thread_postcount+" . intval($pdata['num_posts']) . ", thread_lastuser='******'post_author']) . "' WHERE thread_id='" . intval($_POST['new_thread_id']) . "'");
                                 $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($new_thread['post_datestamp']) . "', forum_postcount=forum_postcount+" . intval($pdata['num_posts']) . ", forum_lastuser='******'post_author'] . "' WHERE forum_id='" . intval($_POST['new_forum_id']) . "'");
                                 $old_thread = dbarray(dbquery("\n\t\t\t\t\t\t\t\t\tSELECT forum_id, thread_id, post_id, post_author, post_datestamp\n\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . " WHERE thread_id='" . intval($pdata['thread_id']) . "' ORDER BY post_datestamp DESC\n\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t"));
                                 if (!dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "'")) {
                                     $new_last_post = dbarray(dbquery("SELECT post_author, post_datestamp FROM " . DB_FORUM_POSTS . " WHERE forum_id='" . intval($pdata['forum_id']) . "' ORDER BY post_datestamp DESC LIMIT 1 "));
                                     $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($new_last_post['post_datestamp']) . "', forum_postcount=forum_postcount-" . intval($pdata['num_posts']) . ", forum_threadcount=forum_threadcount-1, forum_lastuser='******'post_author']) . "' WHERE forum_id='" . intval($pdata['forum_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_THREADS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_THREAD_NOTIFY . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_POLL_VOTERS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_POLLS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                 } else {
                                     $result = dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . intval($old_thread['post_datestamp']) . "',\n\t\t\t\t\t\t\t\t\t\tthread_lastpostid='" . intval($old_thread['post_id']) . "', thread_postcount=thread_postcount-" . intval($pdata['num_posts']) . ", thread_lastuser='******'post_author']) . "' WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($old_thread['post_datestamp']) . "', forum_postcount=forum_postcount-" . intval($pdata['num_posts']) . ", forum_lastuser='******'post_author']) . "' WHERE forum_id='" . intval($pdata['forum_id']) . "'");
                                 }
                                 $pid = count($array_post) - 1;
                                 redirect(INFUSIONS . "forum/viewthread.php?thread_id=" . intval($_POST['new_thread_id']) . "&amp;pid=" . $array_post[$pid] . "#post_" . $array_post[$pid]);
                             } else {
                                 addNotice('danger', $locale['error-MP002']);
                                 redirect($this->form_action);
                             }
                         } else {
                             addNotice('danger', $locale['error-MP003']);
                             redirect($this->form_action);
                         }
                     }
                     echo closemodal();
                     add_to_footer(ob_get_contents());
                     ob_end_clean();
                 } else {
                     addNotice('danger', $locale['error-MP002']);
                     redirect($this->form_action);
                 }
             } else {
                 addNotice('danger', $locale['error-MP003']);
                 redirect($this->form_action);
             }
         } else {
             addNotice('danger', $locale['error-MP003']);
             redirect($this->form_action);
         }
     }
 }
Example #3
0
            echo $locale['news_0203'] . " " . nl2br(parseubb($news_snippet)) . "<br /><br />";
            echo $locale['news_0204'] . " " . nl2br(parseubb($news_body));
            closetable();
        }
        add_to_title($locale['global_200'] . $locale['news_0400']);
        echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
        echo "<div class='alert alert-info m-b-20 submission-guidelines'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['news_0703']) . "</div>\n";
        echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=n", array("enctype" => $news_settings['news_allow_submission_files'] ? TRUE : FALSE));
        echo form_text('news_subject', $locale['news_0200'], $criteriaArray['news_subject'], array("required" => TRUE, "inline" => TRUE));
        if (multilang_table("NS")) {
            echo form_select('news_language', $locale['global_ML100'], $criteriaArray['news_language'], array("options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose'], "width" => "250px", "inline" => TRUE));
        } else {
            echo form_hidden('news_language', '', $criteriaArray['news_language']);
        }
        echo form_select('news_keywords', $locale['news_0205'], $criteriaArray['news_keywords'], array("max_length" => 320, "inline" => TRUE, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
        echo form_select_tree("news_cat", $locale['news_0201'], $criteriaArray['news_cat'], array("width" => "250px", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
        if ($news_settings['news_allow_submission_files']) {
            $file_input_options = array('upload_path' => IMAGES_N, 'max_width' => $news_settings['news_photo_max_w'], 'max_height' => $news_settings['news_photo_max_h'], 'max_byte' => $news_settings['news_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $news_settings['news_thumb_w'], 'thumbnail_h' => $news_settings['news_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $news_settings['news_photo_w'], 'thumbnail2_h' => $news_settings['news_photo_h'], 'type' => 'image', "inline" => TRUE);
            echo form_fileinput("news_image", $locale['news_0216'], "", $file_input_options);
            echo "<div class='small col-sm-offset-3 m-b-10'><span class='p-l-15'>" . sprintf($locale['news_0217'], parsebytesize($news_settings['news_photo_max_b'])) . "</span></div>\n";
            $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
            echo form_select('news_ialign', $locale['news_0218'], $criteriaArray['news_ialign'], array("options" => $alignOptions, "inline" => TRUE));
        }
        echo form_textarea('news_news', $locale['news_0203'], $criteriaArray['news_snippet'], array("required" => TRUE, "html" => TRUE, "form_name" => "submit_form", "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE));
        echo form_textarea('news_body', $locale['news_0203b'], $criteriaArray['news_body'], array("required" => $news_settings['news_extended_required'] ? TRUE : FALSE, "html" => TRUE, "form_name" => "submit_form", "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE));
        echo fusion_get_settings("site_seo") ? "" : form_button('preview_news', $locale['news_0240'], $locale['news_0240'], array('class' => 'btn-primary m-r-10'));
        echo form_button('submit_news', $locale['news_0700'], $locale['news_0700'], array('class' => 'btn-primary'));
        echo closeform();
        echo "</div>\n</div>\n";
    }
} else {
Example #4
0
 /** Add Modules Plugin Form */
 private function quantum_module_form()
 {
     global $aidlink, $defender, $locale;
     $form_action = FUSION_SELF . $aidlink;
     if (isset($_GET['action']) && $_GET['action'] == 'module_edit' && isset($_GET['module_id']) && isnum($_GET['module_id'])) {
         $form_action .= "&amp;action=" . $_GET['action'] . "&amp;module_id=" . $_GET['module_id'];
         $result = dbquery("SELECT * FROM " . $this->field_db . " WHERE field_id='" . $_GET['module_id'] . "'");
         if (dbrows($result) > 0) {
             $this->field_data = dbarray($result);
             if ($this->debug) {
                 print_p('Old Data');
                 print_p($this->field_data);
             }
         } else {
             if (!$this->debug) {
                 addNotice('warning', $locale['field_0205']);
                 redirect(FUSION_SELF . $aidlink);
             }
         }
     }
     $this->field_data['add_module'] = isset($_POST['add_module']) ? form_sanitizer($_POST['add_module']) : $this->field_data['field_name'];
     $user_field_name = '';
     $user_field_api_version = '';
     $user_field_desc = '';
     $user_field_dbname = '';
     $user_field_dbinfo = '';
     if (file_exists($this->plugin_locale_folder . stripinput($this->field_data['add_module']) . ".php") && file_exists($this->plugin_folder . stripinput($this->field_data['add_module']) . "_include_var.php")) {
         include $this->plugin_locale_folder . stripinput($this->field_data['add_module']) . ".php";
         include $this->plugin_folder . stripinput($this->field_data['add_module']) . "_include_var.php";
         $this->user_field_dbinfo = $user_field_dbinfo;
         if (!isset($user_field_dbinfo)) {
             addNotice('warning', $locale['fields_0602']);
         }
     } else {
         $defender->stop();
         addNotice('danger', $locale['fields_0109']);
     }
     // Script Execution
     if (isset($_POST['enable'])) {
         $this->field_data = array('add_module' => isset($_POST['add_module']) ? form_sanitizer($_POST['add_module']) : $this->field_data['field_name'], 'field_type' => 'file', 'field_id' => isset($_POST['field_id']) ? form_sanitizer($_POST['field_id'], '', 'field_id') : isset($_GET['module_id']) && isnum($_GET['module_id']) ? $_GET['module_id'] : 0, 'field_title' => form_sanitizer($_POST['field_title'], '', 'field_title'), 'field_name' => form_sanitizer($_POST['field_name'], '', 'field_name'), 'field_cat' => form_sanitizer($_POST['field_cat'], '', 'field_cat'), 'field_default' => form_sanitizer($_POST['field_default'], '', 'field_default'), 'field_error' => form_sanitizer($_POST['field_error'], '', 'field_error'), 'field_required' => isset($_POST['field_required']) ? 1 : 0, 'field_registration' => isset($_POST['field_registration']) ? 1 : 0, 'field_log' => isset($_POST['field_log']) ? 1 : 0, 'field_order' => form_sanitizer($_POST['field_order'], '0', 'field_order'));
         $this->field_data['field_name'] = str_replace(' ', '_', $this->field_data['field_name']);
         // make sure no space.
         $this->create_fields($this->field_data, 'module');
     }
     echo "<div class='m-t-20'>\n";
     echo openform('fieldform', 'post', $form_action, array('max_tokens' => 1));
     echo "<p class='strong text-dark'>" . $user_field_name . "</p>\n";
     echo "<div class='well'>\n";
     echo "<p class='strong'>" . $locale['fields_0400'] . "</p>\n";
     echo "<span class='text-dark strong'>" . $locale['fields_0401'] . "</span> " . ($user_field_api_version ? $user_field_api_version : $locale['fields_0402']) . "<br/>\n";
     echo "<span class='text-dark strong'>" . $locale['fields_0403'] . "</span>" . ($user_field_dbname ? "<br/>" . $user_field_dbname : '<br/>' . $locale['fields_0404']) . "<br/>\n";
     echo "<span class='text-dark strong'>" . $locale['fields_0405'] . "</span>" . ($user_field_dbinfo ? "<br/>" . $user_field_dbinfo : '<br/>' . $locale['fields_0406']) . "<br/>\n";
     echo "<span class='text-dark strong'>" . $locale['fields_0407'] . "</span>" . ($user_field_desc ? "<br/>" . $user_field_desc : '') . "<br/>\n";
     echo "</div>\n";
     echo "<hr/>\n";
     // start form.
     $disable_opts = array();
     foreach ($this->page_list as $index => $v) {
         $disable_opts[] = $index;
     }
     echo form_select_tree('field_cat', $locale['fields_0410'], $this->field_data['field_cat'], array('no_root' => 1, 'disable_opts' => $disable_opts), $this->category_db, 'field_cat_name', 'field_cat_id', 'field_parent');
     if ($user_field_dbinfo != "") {
         if (version_compare($user_field_api_version, "1.01.00", ">=")) {
             echo form_checkbox('field_required', $locale['fields_0411'], $this->field_data['field_required']);
         } else {
             echo "<p>\n" . $locale['428'] . "</p>\n";
         }
     }
     if ($user_field_dbinfo != "") {
         if (version_compare($user_field_api_version, "1.01.00", ">=")) {
             echo form_checkbox('field_log', $locale['fields_0412'], $this->field_data['field_log']);
         } else {
             echo "<p>\n" . $locale['429a'] . "</p>\n";
         }
     }
     if ($user_field_dbinfo != "") {
         echo form_checkbox('field_registration', $locale['fields_0413'], $this->field_data['field_registration']);
     }
     echo form_text('field_order', $locale['fields_0414'], $this->field_data['field_order']);
     echo form_hidden('add_module', '', $this->field_data['add_module']);
     echo form_hidden('field_name', '', $user_field_dbname);
     echo form_hidden('field_title', '', $user_field_name);
     // new api introduced
     echo form_hidden('field_default', '', isset($user_field_default) ? $user_field_default : '');
     echo form_hidden('field_options', '', isset($user_field_options) ? $user_field_options : '');
     echo form_hidden('field_error', '', isset($user_field_error) ? $user_field_error : '');
     echo form_hidden('field_config', '', isset($user_field_config) ? $user_field_config : '');
     echo form_hidden('field_id', '', $this->field_data['field_id']);
     echo form_button('enable', $this->field_data['field_id'] ? $locale['fields_0415'] : $locale['fields_0416'], $this->field_data['field_id'] ? $locale['fields_0415'] : $locale['fields_0416'], array('class' => 'btn-primary btn-sm'));
     echo closeform();
     echo "</div>\n";
 }
 echo "</div>\n";
 echo "</div>\n";
 // end package
 openside();
 if (fusion_get_settings('comments_enabled') == "0" || fusion_get_settings('ratings_enabled') == "0") {
     $sys = "";
     if (fusion_get_settings('comments_enabled') == "0" && fusion_get_settings('ratings_enabled') == "0") {
         $sys = $locale['comments_ratings'];
     } elseif (fusion_get_settings('comments_enabled') == "0") {
         $sys = $locale['comments'];
     } else {
         $sys = $locale['ratings'];
     }
     echo "<div class='well'>" . sprintf($locale['download_0256'], $sys) . "</div>\n";
 }
 echo form_select_tree("download_cat", $locale['download_0207'], $callback_data['download_cat'], array("no_root" => 1, "placeholder" => $locale['choose'], 'width' => '100%', "query" => multilang_table("DL") ? "WHERE download_cat_language='" . LANGUAGE . "'" : ""), DB_DOWNLOAD_CATS, "download_cat_name", "download_cat_id", "download_cat_parent");
 echo form_select('download_visibility', $locale['download_0205'], $callback_data['download_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%'));
 echo form_button('publish', $locale['download_0061'], $locale['download_0061'], array('class' => 'btn-primary m-r-10'));
 closeside();
 openside('');
 echo form_checkbox('download_allow_comments', $locale['download_0223'], $callback_data['download_allow_comments'], array('class' => 'm-b-0'));
 echo form_checkbox('download_allow_ratings', $locale['download_0224'], $callback_data['download_allow_ratings'], array('class' => 'm-b-0'));
 if (isset($_GET['action']) && $_GET['action'] == "edit") {
     echo form_checkbox('update_datestamp', $locale['download_0213'], '', array('class' => 'm-b-0'));
 }
 closeside();
 openside();
 echo form_text('download_license', $locale['download_0208'], $callback_data['download_license'], array('inline' => 1));
 echo form_text('download_copyright', $locale['download_0222'], $callback_data['download_copyright'], array('inline' => 1));
 echo form_text('download_os', $locale['download_0209'], $callback_data['download_os'], array('inline' => 1));
 echo form_text('download_version', $locale['download_0210'], $callback_data['download_version'], array('inline' => 1));
Example #6
0
echo openform('inputform', 'post', $formaction, array('enctype' => 1, 'max_tokens' => 1));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
echo form_hidden("blog_id", "", $data['blog_id']);
echo form_hidden("blog_datestamp", "", $data['blog_datestamp']);
echo form_text('blog_subject', $locale['blog_0422'], $data['blog_subject'], array('required' => TRUE, 'max_length' => 200, 'error_text' => $locale['blog_0450']));
// move keywords here because it's required
echo form_select('blog_keywords', $locale['blog_0443'], $data['blog_keywords'], array("max_length" => 320, "placeholder" => $locale['blog_0444'], "width" => "100%", "error_text" => $locale['blog_0457'], "tags" => TRUE, "multiple" => TRUE));
echo "<div class='pull-left m-r-10 display-inline-block'>\n";
echo form_datepicker('blog_start', $locale['blog_0427'], $data['blog_start'], array("placeholder" => $locale['blog_0429'], "join_to_id" => "blog_end"));
echo "</div>\n<div class='pull-left m-r-10 display-inline-block'>\n";
echo form_datepicker('blog_end', $locale['blog_0428'], $data['blog_end'], array("placeholder" => $locale['blog_0429'], "join_from_id" => "blog_start"));
echo "</div>\n";
echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
openside('');
echo form_select_tree("blog_cat[]", $locale['blog_0423'], $data['blog_cat'], array("width" => "100%", "delimiter" => ".", "inline" => TRUE, "no_root" => TRUE, "tags" => TRUE, "multiple" => TRUE, "query" => multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : ""), DB_BLOG_CATS, "blog_cat_name", "blog_cat_id", "blog_cat_parent");
echo form_select('blog_visibility', $locale['blog_0430'], $data['blog_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
if (multilang_table("BL")) {
    echo form_select('blog_language', $locale['global_ML100'], $data['blog_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
} else {
    echo form_hidden('blog_language', '', $data['blog_language']);
}
echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
echo form_button('save', $locale['blog_0437'], $locale['blog_0437'], array('class' => 'btn-success', 'icon' => 'fa fa-square-check-o'));
closeside();
echo "</div>\n</div>\n";
$snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['blog_0425a'], "form_name" => "inputform");
if (fusion_get_settings("tinymce_enabled")) {
    $snippetSettings = array("required" => TRUE, "type" => "tinymce", "tinymce" => "advanced");
}
echo form_textarea('blog_blog', $locale['blog_0425'], $data['blog_blog'], $snippetSettings);
Example #7
0
 /**
  * Site Links Form
  */
 private function display_sitelinks_form()
 {
     $locale = fusion_get_locale();
     fusion_confirm_exit();
     if (isset($_POST['savelink'])) {
         $this->data = array("link_id" => form_sanitizer($_POST['link_id'], 0, 'link_id'), "link_cat" => form_sanitizer($_POST['link_cat'], 0, 'link_cat'), "link_name" => form_sanitizer($_POST['link_name'], '', 'link_name'), "link_url" => form_sanitizer($_POST['link_url'], '', 'link_url'), "link_icon" => form_sanitizer($_POST['link_icon'], '', 'link_icon'), "link_language" => form_sanitizer($_POST['link_language'], '', 'link_language'), "link_visibility" => form_sanitizer($_POST['link_visibility'], '', 'link_visibility'), "link_position" => form_sanitizer($_POST['link_position'], '', 'link_position'), "link_order" => form_sanitizer($_POST['link_order'], '', 'link_order'), "link_window" => form_sanitizer(isset($_POST['link_window']) && $_POST['link_window'] == 1 ? 1 : 0, 0, 'link_window'));
         if ($this->data['link_position'] > 3) {
             $this->data['link_position'] = form_sanitizer($_POST['link_position_id'], 3, 'link_position_id');
         }
         if (empty($this->data['link_order'])) {
             $max_order_query = "SELECT MAX(link_order) 'link_order' FROM " . DB_SITE_LINKS . "\n                " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . "\n                link_cat='" . $this->data['link_cat'] . "'";
             $this->data['link_order'] = dbresult(dbquery($max_order_query), 0) + 1;
         }
         if (\defender::safe()) {
             if (!empty($this->data['link_id'])) {
                 dbquery_order(DB_SITE_LINKS, $this->data['link_order'], "link_order", $this->data['link_id'], "link_id", $this->data['link_cat'], "link_cat", multilang_table("SL"), "link_language", "update");
                 dbquery_insert(DB_SITE_LINKS, $this->data, 'update');
                 addNotice("success", $locale['SL_0016']);
             } else {
                 dbquery_order(DB_SITE_LINKS, $this->data['link_order'], "link_order", $this->data['link_id'], "link_id", $this->data['link_cat'], "link_cat", multilang_table("SL"), "link_language", "save");
                 dbquery_insert(DB_SITE_LINKS, $this->data, 'save');
                 addNotice("success", $locale['SL_0015']);
             }
             redirect(clean_request("link_cat=" . $this->data['link_cat'], array('ref'), FALSE));
         }
     }
     echo "<div class='m-t-20'>\n";
     echo openform('link_administration_frm', 'post', FUSION_REQUEST);
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-12 col-md-8 col-lg-8'>\n";
     echo form_hidden('link_id', '', $this->data['link_id']);
     echo form_textarea('link_name', $locale['SL_0020'], $this->data['link_name'], array('max_length' => 100, 'required' => TRUE, 'error_text' => $locale['SL_0085'], 'form_name' => 'linkform', 'type' => 'bbcode', 'inline' => TRUE));
     echo form_text('link_icon', 'Link Icon', $this->data['link_icon'], array('max_length' => 100, 'inline' => TRUE));
     echo form_text('link_url', $locale['SL_0021'], $this->data['link_url'], array('required' => TRUE, 'error_text' => $locale['SL_0086'], 'inline' => TRUE));
     echo form_text('link_order', $locale['SL_0023'], $this->data['link_order'], array('class' => 'pull-left', 'inline' => TRUE, 'width' => '250px', 'type' => 'number'));
     // There will be a trick to manipulate the situation here
     if ($this->data['link_position'] > 3) {
         $this->data['link_position_id'] = $this->data['link_position'];
         $this->data['link_position'] = 4;
     }
     echo form_select('link_position', $locale['SL_0024'], $this->data['link_position'], array('options' => $this->position_opts, 'inline' => TRUE, 'stacked' => form_text('link_position_id', '', $this->data['link_position_id'], array('required' => true, 'placeholder' => 'ID', 'type' => 'number', 'type' => 'number', 'width' => '150px'))));
     add_to_jquery("\n        checkLinkPosition( " . $this->data['link_position'] . " );\n        \$('#link_position').bind('change', function(e) {\n            checkLinkPosition( \$(this).val() );\n        });\n        ");
     echo "</div>\n";
     echo "<div class='col-xs-12 col-sm-12 col-md-4 col-lg-4'>\n";
     echo form_select_tree("link_cat", $locale['SL_0029'], $this->data['link_cat'], array('input_id' => 'link_categorys', "parent_value" => $locale['parent'], 'width' => '100%', 'query' => multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "'" : '', 'disable_opts' => $this->data['link_id'], 'hide_disabled' => 1), DB_SITE_LINKS, "link_name", "link_id", "link_cat");
     echo form_select('link_language', $locale['global_ML100'], $this->data['link_language'], array('options' => $this->language_opts, 'placeholder' => $locale['choose'], 'width' => '100%'));
     echo form_select('link_visibility', $locale['SL_0022'], $this->data['link_visibility'], array('options' => self::get_LinkVisibility(), 'placeholder' => $locale['choose'], 'width' => '100%'));
     echo form_checkbox('link_window', $locale['SL_0028'], $this->data['link_window']);
     echo "</div>\n";
     echo "</div>\n";
     echo form_button('savelink', $locale['SL_0040'], $locale['SL_0040'], array('class' => 'btn-primary m-r-10', 'input_id' => 'savelink_2'));
     echo form_button("cancel", $locale['cancel'], "cancel", array('input_id' => 'cancel2'));
     echo closeform();
     echo "</div>\n";
 }
Example #8
0
 echo opentabbody($articleCatTab['title'][0], $articleCatTab['id'][0], $tab_active);
 echo "<table class='table table-responsive table-hover table-striped'>\n";
 if (dbcount("(article_cat_id)", DB_ARTICLE_CATS, multilang_table("AR") ? "article_cat_language='" . LANGUAGE . "'" : "")) {
     showcatlist();
 } else {
     echo "<tr><td align='center' class='tbl1' colspan='2'>" . $locale['articles_0342'] . "</td></tr>\n";
 }
 echo "</table>\n";
 echo closetabbody();
 echo opentabbody($articleCatTab['title'][1], $articleCatTab['id'][1], $tab_active);
 echo openform('addcat', 'post', FUSION_REQUEST, array('class' => "m-t-20"));
 echo form_hidden("cat_id", "", $cat_id);
 echo form_text('cat_name', $locale['articles_0300'], $cat_name, array("inline" => true, "required" => true, 'error_text' => $locale['articles_0351']));
 $textArea_opts = array("required" => TRUE, "type" => fusion_get_settings("tinymce_enabled") ? "tinymce" : "html", "tinymce" => fusion_get_settings("tinymce_enabled") && iADMIN ? "advanced" : "", "autosize" => TRUE, "inline" => TRUE, "preview" => TRUE, "form_name" => "addcat");
 echo form_textarea('cat_description', $locale['articles_0301'], $cat_description, $textArea_opts);
 echo form_select_tree("cat_parent", $locale['articles_0308'], $cat_parent, array("inline" => true, "disable_opts" => $cat_hidden, "hide_disabled" => TRUE), DB_ARTICLE_CATS, "article_cat_name", "article_cat_id", "article_cat_parent");
 if (multilang_table("AR")) {
     echo form_select('cat_language', $locale['global_ML100'], $cat_language, array("inline" => true, 'options' => $language_opts, 'placeholder' => $locale['choose']));
 } else {
     echo form_hidden('cat_language', '', $cat_language);
 }
 echo "<div class='row m-0'>\n";
 echo "<label class='label-control col-xs-12 col-sm-3 p-l-0'>" . $locale['articles_0302'] . "</label>\n";
 echo "<div class='col-xs-12 col-sm-3  p-l-0'>\n";
 echo form_select('cat_sort_by', "", $cat_sort_by, array("inline" => TRUE, "width" => "100%", 'options' => array('1' => $locale['articles_0303'], '2' => $locale['articles_0304'], '3' => $locale['articles_0305']), 'class' => 'pull-left m-r-10'));
 echo "</div>\n";
 echo "<div class='col-xs-12 col-sm-2'>\n";
 echo form_select('cat_sort_order', '', $cat_sort_order, array("inline" => true, "width" => "100%", 'options' => array('ASC' => $locale['articles_0306'], 'DESC' => $locale['articles_0307']), 'placeholder' => $locale['choose']));
 echo "</div>\n";
 echo "</div>\n";
 echo form_button('save_cat', $locale['articles_0309'], $locale['articles_0309'], array('class' => 'btn-primary', 'inline' => 1));
Example #9
0
    if (dbrows($result)) {
        $data = dbarray($result);
        $data['news_cat_hidden'] = array($data['news_cat_id']);
        $formTitle = $locale['news_0021'];
    } else {
        // FUSION_REQUEST without the "action" gets
        redirect(clean_request("", array("action"), FALSE));
    }
}
add_breadcrumb(array('link' => "", 'title' => $formTitle));
opentable($formTitle);
echo openform("addcat", "post", $formAction);
openside("");
echo form_hidden("news_cat_id", "", $data['news_cat_id']);
echo form_text("news_cat_name", $locale['news_0300'], $data['news_cat_name'], array("required" => TRUE, "inline" => TRUE, "error_text" => $locale['news_0351']));
echo form_select_tree("news_cat_parent", $locale['news_0305'], $data['news_cat_parent'], array("inline" => TRUE, "disable_opts" => $data['news_cat_hidden'], "hide_disabled" => TRUE, "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
if (multilang_table("NS")) {
    echo form_select("news_cat_language", $locale['global_ML100'], $data['news_cat_language'], array("inline" => TRUE, "options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose']));
} else {
    echo form_hidden("news_cat_language", "", $data['news_cat_language']);
}
echo form_select("news_cat_image", $locale['news_0301'], $data['news_cat_image'], array("inline" => TRUE, "options" => newsCatImageOpts()));
echo form_button("save_cat", $locale['news_0302'], $locale['news_0302'], array("class" => "btn-success"));
closeside();
openside($locale['news_0020']);
$result = dbquery("SELECT news_cat_id, news_cat_name FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY news_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
    $counter = 0;
    $columns = 4;
    echo "<div class='row'>\n";
Example #10
0
                        }
                        // update current forum
                        dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . time() . "', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $post_data['forum_id'] . "'");
                        // update current thread
                        dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . time() . "', thread_lastpostid='" . $post_data['post_id'] . "', thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $post_data['thread_id'] . "'");
                        // set notify
                        if ($forum_settings['thread_notify'] && isset($_POST['notify_me']) && $post_data['thread_id']) {
                            if (!dbcount("(thread_id)", DB_FORUM_THREAD_NOTIFY, "thread_id='" . $post_data['thread_id'] . "' AND notify_user='******'post_author'] . "'")) {
                                dbquery("INSERT INTO " . DB_FORUM_THREAD_NOTIFY . " (thread_id, notify_datestamp, notify_user, notify_status) VALUES('" . $post_data['thread_id'] . "', '" . time() . "', '" . $post_data['post_author'] . "', '1')");
                            }
                        }
                        if ($defender->safe()) {
                            redirect(INFUSIONS . "forum/postify.php?post=new&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;parent_id=" . intval($post_data['forum_cat']) . "&amp;thread_id=" . intval($post_data['thread_id'] . ""));
                        }
                    } else {
                        addNotice("danger", $locale['forum_0186']);
                    }
                } else {
                    addNotice("danger", $locale['forum_0187']);
                    redirect(INFUSIONS . "forum/index.php");
                }
            }
        }
        $form_action = INFUSIONS . "forum/newthread.php";
        $info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', $form_action, array('enctype' => FALSE)), 'closeform' => closeform(), 'forum_id_field' => '', 'thread_id_field' => '', 'forum_field' => form_select_tree("forum_id", $locale['forum_0395'], $thread_data['forum_id'], array("required" => true, "width" => "320px", "no_root" => TRUE, "query" => multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "'" : ""), DB_FORUMS, "forum_name", "forum_id", "forum_cat"), 'subject_field' => form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => 1, 'placeholder' => $locale['forum_2001'], 'error_text' => '', 'class' => 'm-t-20 m-b-20')), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => 1, 'error_text' => '', 'autosize' => 1, 'no_resize' => 1, 'preview' => 1, 'form_name' => 'input_form', 'bbcode' => 1)), 'attachment_field' => "", 'poll_form' => "", 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0')), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0')) : '', 'sticky_field' => iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0')) : '', 'lock_field' => iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0')) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0')) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
        postform($info);
    }
} else {
    redirect(INFUSIONS . 'forum/index.php');
}
require_once THEMES . "templates/footer.php";
Example #11
0
 echo opentabbody($tab_title['title'][0], $tab_title['id'][0], $tab_active);
 echo openform('addcat', 'post', FUSION_REQUEST, array('class' => 'm-t-20'));
 echo "<div class='row'>\n";
 echo "<div class='col-xs-12 col-sm-8'>\n";
 openside('');
 echo form_hidden("download_cat_id", "", $data['download_cat_id']);
 echo form_text('download_cat_name', $locale['download_0300'], $data['download_cat_name'], array('required' => TRUE, 'error_text' => $locale['download_0351']));
 echo form_textarea('download_cat_description', $locale['download_0301'], $data['download_cat_description'], array('resize' => 0, 'autosize' => TRUE));
 echo "<div class='clearfix'>\n";
 echo form_select('download_cat_sort_by', $locale['download_0302'], $data['download_cat_sort_by'], array('options' => array('1' => $locale['download_0303'], '2' => $locale['download_0304'], '3' => $locale['download_0305']), 'class' => 'pull-left m-r-10', 'width' => '200px'));
 echo form_select('download_cat_sort_order', '', $data['download_cat_sort_order'], array('options' => array('ASC' => $locale['download_0306'], 'DESC' => $locale['download_0307']), 'class' => 'pull-left', 'width' => '200px'));
 echo "</div>\n";
 closeside();
 echo "</div>\n<div class='col-xs-12 col-sm-4'>\n";
 openside('');
 echo form_select_tree("download_cat_parent", $locale['download_0308'], $data['download_cat_parent'], array("disable_opts" => $data['download_cat_hidden'], "hide_disabled" => TRUE, 'width' => '100%'), DB_DOWNLOAD_CATS, "download_cat_name", "download_cat_id", "download_cat_parent");
 if (multilang_table("DL")) {
     echo form_select('download_cat_language', $locale['global_ML100'], $data['download_cat_language'], array('options' => $language_opts, 'placeholder' => $locale['choose'], 'width' => '100%'));
 } else {
     echo form_hidden('download_cat_language', '', $data['download_cat_language']);
 }
 closeside();
 echo "</div>\n</div>\n";
 echo form_button('save_cat', $locale['download_0309'], $locale['download_0309'], array('class' => 'btn-success btn-sm m-t-10', 'icon' => 'fa fa-check-square-o'));
 echo closeform();
 echo closetabbody();
 echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active);
 $row_num = 0;
 showcatlist();
 if ($row_num == 0) {
     echo "<div class='well text-center'>" . $locale['download_0313'] . "</div>\n";
Example #12
0
/**
 * Select2 hierarchy
 * Returns a full hierarchy nested dropdown.
 * @param        $input_name
 * @param string $label
 * @param bool   $input_value
 * @param array  $options
 * @param        $db - your db
 * @param        $name_col - the option text to show
 * @param        $id_col - unique id
 * @param        $cat_col - parent id
 *                         ## The rest of the Params are used by the function itself -- no need to handle ##
 * @param bool   $self_id - not required
 * @param bool   $id - not required
 * @param bool   $level - not required
 * @param bool   $index - not required
 * @param bool   $data - not required
 * @return string
 */
function form_select_tree($input_name, $label = "", $input_value = FALSE, array $options = array(), $db, $name_col, $id_col, $cat_col, $self_id = FALSE, $id = FALSE, $level = FALSE, $index = FALSE, $data = FALSE)
{
    global $defender, $locale;
    if (!defined("SELECT2")) {
        define("SELECT2", TRUE);
        add_to_footer("<script src='" . DYNAMICS . "assets/select2/select2.min.js' /></script>\n");
        add_to_head("<link href='" . DYNAMICS . "assets/select2/select2.css' rel='stylesheet' />\n");
    }
    $title = $label ? stripinput($label) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
    $default_options = array('required' => FALSE, 'regex' => '', 'input_id' => $input_name, 'placeholder' => $locale['choose'], 'deactivate' => FALSE, 'safemode' => FALSE, 'allowclear' => FALSE, 'multiple' => FALSE, 'width' => '250px', 'keyflip' => FALSE, 'tags' => FALSE, 'jsonmode' => FALSE, 'chainable' => FALSE, 'maxselect' => FALSE, 'error_text' => $locale['error_input_default'], 'class' => '', 'inline' => FALSE, 'tip' => '', 'delimiter' => ',', 'callback_check' => '', 'file' => '', 'parent_value' => $locale['root'], 'add_parent_opts' => FALSE, 'disable_opts' => '', 'hide_disabled' => FALSE, 'no_root' => FALSE, 'show_current' => FALSE, 'query' => '');
    $options += $default_options;
    $options['input_id'] = trim($options['input_id'], "[]");
    if ($options['multiple']) {
        if ($input_value) {
            $input_value = construct_array($input_value, 0, $options['delimiter']);
        } else {
            $input_value = array();
        }
    }
    if (!$options['width']) {
        $options['width'] = $default_options['width'];
    }
    $allowclear = $options['placeholder'] && $options['multiple'] || $options['allowclear'] ? "allowClear:true" : '';
    $disable_opts = '';
    if ($options['disable_opts']) {
        $disable_opts = is_array($options['disable_opts']) ? $options['disable_opts'] : explode(',', $options['disable_opts']);
    }
    /* Child patern */
    $opt_pattern = str_repeat("&#8212;", $level);
    if (!$level) {
        $level = 0;
        if (!isset($index[$id])) {
            $index[$id] = array('0' => $locale['no_opts']);
        }
        $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'] . "'" : '') . ">\n";
        $html .= $label ? "<label class='control-label " . ($options['inline'] ? "col-xs-12 col-sm-3 p-l-0" : 'col-xs-12 p-l-0') . "' for='" . $options['input_id'] . "'>{$label} " . ($options['required'] == TRUE ? "<span class='required'>*</span>" : '') . " " . ($options['tip'] ? "<i class='pointer fa fa-question-circle' label=\"" . $options['tip'] . "\"></i>" : '') . "</label>\n" : '';
        $html .= $options['inline'] ? "<div class='col-xs-12 " . ($label ? "col-sm-9 col-md-9 col-lg-9" : "col-sm-12") . "'>\n" : "";
    }
    if ($level == 0) {
        $html =& $html;
        add_to_jquery("\n\t\t\$('#" . $options['input_id'] . "').select2({\n\t\tplaceholder: '" . $options['placeholder'] . "',\n\t\t{$allowclear}\n\t\t});\n\t\t");
        if (is_array($input_value) && $options['multiple']) {
            // stores as value;
            $vals = '';
            foreach ($input_value as $arr => $val) {
                $vals .= $arr == count($input_value) - 1 ? "'{$val}'" : "'{$val}',";
            }
            add_to_jquery("\$('#" . $options['input_id'] . "').select2('val', [{$vals}]);");
        }
        $html .= "<select name='{$input_name}' id='" . $options['input_id'] . "' style='width: " . ($options['width'] ? $options['width'] : $default_options['width']) . "' " . ($options['deactivate'] ? " disabled" : "") . ($options['multiple'] ? " multiple" : "") . ">";
        $html .= $options['allowclear'] ? "<option value=''></option>" : '';
        if ($options['no_root'] == FALSE) {
            // api options to remove root from selector. used in items creation.
            $this_select = '';
            if ($input_value !== NULL) {
                if ($input_value !== '') {
                    $this_select = 'selected';
                }
            }
            $html .= $options['add_parent_opts'] == TRUE ? "<option value='0' " . $this_select . ">{$opt_pattern} " . $locale['parent'] . "</option>\n" : "<option value='0' " . $this_select . " >{$opt_pattern} " . $options['parent_value'] . "</option>\n";
        }
        $index = dbquery_tree($db, $id_col, $cat_col, $options['query']);
        $data = dbquery_tree_data($db, $id_col, $cat_col, $options['query']);
    }
    if (!$id) {
        $id = 0;
    }
    if (isset($index[$id])) {
        foreach ($index[$id] as $key => $value) {
            //$hide = $disable_branch && $value == $self_id ? 1 : 0;
            $html =& $html;
            $name = $data[$value][$name_col];
            $name = PHPFusion\QuantumFields::parse_label($name);
            $select = $input_value !== "" && $input_value == $value ? 'selected' : '';
            $disabled = $disable_opts && in_array($value, $disable_opts) ? TRUE : FALSE;
            $hide = $disabled && $options['hide_disabled'] ? TRUE : FALSE;
            // do a disable for filter_opts item.
            $html .= !$hide ? "<option value='{$value}' " . $select . " " . ($disable_opts && in_array($value, $disable_opts) ? 'disabled' : '') . " >{$opt_pattern} {$name} " . ($options['show_current'] && $self_id == $value ? '(Current Item)' : '') . "</option>\n" : '';
            if (isset($index[$value]) && !$hide) {
                $html .= form_select_tree($input_name, $label, $input_value, $options, $db, $name_col, $id_col, $cat_col, $self_id, $value, $level + TRUE, $index, $data);
            }
        }
    }
    if (!$level) {
        $html =& $html;
        $html .= "</select>";
        $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";
        if ($options['required']) {
            $html .= "<input class='req' id='dummy-" . $options['input_id'] . "' type='hidden'>\n";
            // for jscheck
        }
        $input_name = $options['multiple'] ? str_replace("[]", "", $input_name) : $input_name;
        $defender->add_field_session(array('input_name' => $input_name, 'title' => trim($title, '[]'), 'id' => $options['input_id'], 'type' => 'dropdown', 'regex' => $options['regex'], 'required' => $options['required'], 'safemode' => $options['safemode'], 'error_text' => $options['error_text'], 'callback_check' => $options['callback_check'], 'delimiter' => $options['delimiter']));
    }
    return $html;
}
Example #13
0
 private function _delete_category()
 {
     global $aidlink;
     $this->locale = fusion_get_locale();
     $this->debug = FALSE;
     $data = array();
     if (isset($_POST['cancel'])) {
         redirect(FUSION_SELF . $aidlink);
     }
     if (isset($_GET['action']) && $_GET['action'] == 'cat_delete' && isset($_GET['cat_id']) && self::validate_fieldCat($_GET['cat_id'])) {
         // do action of the interior form
         if (isset($_POST['delete_cat'])) {
             // get root node
             $target_database = '';
             $field_list = array();
             if (isset($_POST['delete_subcat']) or isset($_POST['delete_field'])) {
                 if (in_array($_GET['cat_id'], $this->page_list)) {
                     // this is root.
                     $result = dbquery("\n                                  SELECT field_cat_id, field_parent, field_cat_db FROM " . $this->category_db . "\n                                  WHERE field_cat_id='" . intval($_GET['cat_id']) . "'\n                                  ");
                 } else {
                     // is is not a root.
                     $result = dbquery("\n                        SELECT uf.field_cat_id, root.field_cat_db FROM " . $this->category_db . " uf\n\t\t\t\t\t\tLEFT JOIN " . $this->category_db . " root ON uf.field_parent = root.field_cat_id\n\t\t\t\t\t\tWHERE uf.field_cat_id='" . intval($_GET['cat_id']) . "'\n\t\t\t\t\t\t");
                 }
                 if ($result == NULL) {
                     die("no result");
                 }
                 if (dbrows($result) > 0) {
                     $data += dbarray($result);
                     $target_database = $data['field_cat_db'] ? DB_PREFIX . $data['field_cat_db'] : DB_USERS;
                     $field_list = fieldgenerator($target_database);
                 }
                 if ($this->debug) {
                     print_p($field_list);
                     print_p($target_database);
                 }
             }
             if (isset($_POST['delete_subcat'])) {
                 // When deletion of a master page and involving all subcategories
                 if ($this->debug) {
                     print_p($this->page[$_GET['cat_id']]);
                 }
                 // execute removal on child fields and cats
                 foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
                     $result = dbquery("\n                                  SELECT field_id, field_name FROM " . $this->field_db . "\n                                  WHERE field_cat='" . $field_category['field_cat_id'] . "'\n                                  ");
                     // find all child > 1
                     if (dbrows($result) > 0) {
                         while ($data = dbarray($result)) {
                             // remove column from db , and fields
                             if (in_array($data['field_name'], $field_list)) {
                                 // verify table integrity
                                 if ($this->debug) {
                                     print_p("DROP " . $data['field_name'] . " FROM " . $target_database);
                                     print_p("DELETE " . $data['field_id'] . " FROM " . $this->field_db);
                                 } else {
                                     dbquery("DELETE FROM " . $this->field_db . " WHERE field_id='" . $data['field_id'] . "'");
                                     if (!empty($target_database) && !empty($data['field_name'])) {
                                         self::drop_column($target_database, $data['field_name']);
                                     }
                                 }
                             }
                             // remove category.
                             if ($this->debug) {
                                 print_p("DELETE " . $field_category['field_cat_id'] . " FROM " . $this->category_db);
                             } else {
                                 dbquery("DELETE FROM " . $this->category_db . " WHERE field_cat_id='" . $field_category['field_cat_id'] . "'");
                             }
                         }
                         // end while
                     }
                 }
             } elseif (isset($_POST['move_subcat']) && $_POST['move_subcat'] > 0) {
                 // When deletion to move subcategory
                 foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
                     $new_parent = form_sanitizer($_POST['move_subcat'], 0, 'move_subcat');
                     if ($this->debug) {
                         print_p("MOVED " . $field_category['field_cat_id'] . " TO category " . $new_parent);
                         print_p("DELETE " . $_GET['cat_id'] . " FROM " . $this->category_db);
                     } else {
                         dbquery("UPDATE " . $this->category_db . " SET field_parent='" . $new_parent . "' WHERE field_cat_id='" . $field_category['field_cat_id'] . "'");
                     }
                 }
             } elseif (isset($_POST['delete_field']) && isset($_GET['cat_id']) && isnum($_GET['cat_id'])) {
                 // Delete fields
                 $this->debug = FALSE;
                 if ($this->debug) {
                     print_p('Delete Fields');
                 }
                 // Delete Fields - Bug with Isset errors
                 $result = dbquery("SELECT field_id, field_name FROM " . $this->field_db . " WHERE field_cat='" . intval($_GET['cat_id']) . "'");
                 if (dbrows($result) > 0) {
                     while ($data = dbarray($result)) {
                         if (in_array($data['field_name'], $field_list)) {
                             // verify table integrity
                             if ($this->debug) {
                                 print_p("DROP " . $data['field_name'] . " FROM " . $target_database);
                                 print_p("DELETE " . $data['field_id'] . " FROM " . $this->field_db);
                             } else {
                                 $field_del_sql = "DELETE FROM " . $this->field_db . " WHERE field_id='" . $data['field_id'] . "'";
                                 $field_count = $this->validate_field($data['field_id']);
                                 if ($field_count) {
                                     dbquery($field_del_sql);
                                 }
                                 // drop a column
                                 if (!empty($target_database)) {
                                     self::drop_column($target_database, $data['field_name']);
                                 }
                             }
                         }
                     }
                     addNotice('success', $this->locale['field_0200']);
                     redirect(FUSION_SELF . $aidlink);
                 }
             } elseif (!isset($_POST['delete_field']) && isset($_POST['move_field']) && $_POST['move_field'] > 0) {
                 $rows = dbcount("(field_id)", $this->field_db, "field_cat='" . intval($_GET['cat_id']) . "'");
                 if ($rows) {
                     $new_parent = form_sanitizer($_POST['move_field'], 0, 'move_field');
                     dbquery("UPDATE " . $this->field_db . " SET field_cat='" . intval($new_parent) . "' WHERE field_cat='" . intval($_GET['cat_id']) . "'");
                 }
             }
             // Delete the current category
             $delete_cat_sql = "DELETE FROM " . $this->category_db . " WHERE field_cat_id='" . intval($_GET['cat_id']) . "'";
             if ($this->debug) {
                 print_p($delete_cat_sql);
             } else {
                 dbquery($delete_cat_sql);
                 addNotice('success', $this->locale['field_0200']);
                 redirect(FUSION_SELF . $aidlink);
             }
         } else {
             // show interior form
             $field_list = array();
             $form_action = FUSION_SELF . $aidlink . "&amp;action=cat_delete&amp;cat_id=" . $_GET['cat_id'];
             $result = dbquery("SELECT * FROM " . $this->category_db . " WHERE field_cat_id='" . $_GET['cat_id'] . "' OR field_cat_id='" . get_hkey($this->category_db, "field_cat_id", "field_parent", $_GET['cat_id']) . "'");
             if (dbrows($result) > 0) {
                 $data += dbarray($result);
                 // get field list - populate child fields of a category.
                 $result = dbquery("SELECT field_id, field_name, field_cat FROM " . $this->field_db . " WHERE field_cat='" . intval($_GET['cat_id']) . "'");
                 if (dbrows($result) > 0) {
                     // get field list.
                     while ($data = dbarray($result)) {
                         $field_list[$data['field_cat']][$data['field_id']] = $data['field_name'];
                     }
                 }
                 if (isset($this->page[$data['field_parent']]) or !empty($field_list) && $field_list[$_GET['cat_id']] > 0) {
                     ob_start();
                     echo openmodal("delete", $this->locale['fields_0313'], array('class' => 'modal-lg modal-center', 'static' => TRUE));
                     echo openform('delete_cat_form', 'post', $form_action);
                     if (isset($this->page[$_GET['cat_id']])) {
                         echo "<div class='row'>\n";
                         echo "<div class='col-xs-12 col-sm-6'>\n<span class='strong'>" . sprintf($this->locale['fields_0600'], count($this->page[$_GET['cat_id']])) . "</span><br/>\n";
                         echo "<div class='alert alert-info m-t-10'>\n";
                         echo "<ol style='list-style:inherit !important; margin-bottom:0;'>\n";
                         foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
                             echo "<li style='list-style-type:decimal;'>" . self::parse_label($field_category['field_cat_name']) . "</li>\n";
                         }
                         echo "</ol>\n";
                         echo "</div>\n";
                         echo "</div>\n<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n";
                         $page_list = $this->page_list;
                         unset($page_list[$_GET['cat_id']]);
                         if (count($page_list) > 0) {
                             echo form_select('move_subcat', $this->locale['fields_0314'], '', array("options" => $page_list));
                         }
                         echo form_checkbox('delete_subcat', $this->locale['fields_0315'], count($page_list) < 1 ? TRUE : FALSE);
                         echo "</div></div>";
                     }
                     if (isset($field_list[$_GET['cat_id']])) {
                         echo "<div class='row'>\n";
                         echo "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n<span class='strong'>" . sprintf($this->locale['fields_0601'], count($field_list[$_GET['cat_id']])) . "</span><br/>\n";
                         echo "<div class='well strong m-t-10'>\n";
                         foreach ($field_list[$_GET['cat_id']] as $arr => $field) {
                             echo "- " . $field . "<br/>\n";
                         }
                         echo "</div>\n";
                         echo "</div>\n<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n";
                         $exclude_list[] = $_GET['cat_id'];
                         foreach ($this->page_list as $page_id => $page_name) {
                             $exclude_list[] = $page_id;
                         }
                         echo form_select_tree('move_field', $this->locale['fields_0316'], '', array('no_root' => 1, 'disable_opts' => $exclude_list), $this->category_db, 'field_cat_name', 'field_cat_id', 'field_parent');
                         echo form_checkbox('delete_field', $this->locale['fields_0317'], '');
                         echo "</div></div>";
                     }
                     echo form_button('delete_cat', $this->locale['fields_0313'], $this->locale['fields_0313'], array('class' => 'btn-danger btn-sm'));
                     echo form_button('cancel', $this->locale['cancel'], $this->locale['cancel'], array('class' => 'btn-default m-l-10 btn-sm'));
                     echo closeform();
                     echo closemodal();
                     add_to_footer(ob_get_contents());
                     ob_end_clean();
                 }
             } else {
                 if ($this->debug) {
                     notify('Cat ID was not found. Please check again.', 'Category ID was not found. Please check again.');
                 } else {
                     redirect(FUSION_SELF . $aidlink);
                 }
             }
         }
     }
 }
Example #14
0
/**
 * Displays News Form
 */
function display_news_form()
{
    global $aidlink;
    if (isset($_POST['cancel'])) {
        redirect(FUSION_SELF . $aidlink);
    }
    $formaction = FUSION_REQUEST;
    $locale = fusion_get_locale();
    $userdata = fusion_get_userdata();
    $news_settings = fusion_get_settings("news");
    $edit = isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['news_id']) && isnum($_GET['news_id']) ? TRUE : FALSE;
    add_breadcrumb(array('link' => '', 'title' => $edit ? $locale['news_0003'] : $locale['news_0002']));
    $data = array('news_id' => 0, 'news_draft' => 0, 'news_sticky' => 0, 'news_news' => '', 'news_datestamp' => time(), 'news_extended' => '', 'news_keywords' => '', 'news_breaks' => 'n', 'news_allow_comments' => 1, 'news_allow_ratings' => 1, 'news_language' => LANGUAGE, 'news_visibility' => 0, 'news_subject' => '', 'news_start' => '', 'news_end' => '', 'news_cat' => 0, 'news_image' => '', 'news_ialign' => 'pull-left');
    if (fusion_get_settings("tinymce_enabled")) {
        $data['news_breaks'] = 'n';
    } else {
        $data['news_breaks'] = 'y';
    }
    if (isset($_POST['save']) or isset($_POST['save_and_close'])) {
        $news_news = "";
        if ($_POST['news_news']) {
            $news_news = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, fusion_get_settings('allow_php_exe') ? htmlspecialchars($_POST['news_news']) : stripslashes($_POST['news_news']));
            $news_news = parse_textarea($news_news);
        }
        $news_extended = "";
        if ($_POST['news_extended']) {
            $news_extended = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, fusion_get_settings('allow_php_exe') ? htmlspecialchars($_POST['news_extended']) : stripslashes($_POST['news_extended']));
            $news_extended = parse_textarea($news_extended);
        }
        $data = array('news_id' => form_sanitizer($_POST['news_id'], 0, 'news_id'), 'news_subject' => form_sanitizer($_POST['news_subject'], '', 'news_subject'), 'news_cat' => form_sanitizer($_POST['news_cat'], 0, 'news_cat'), 'news_news' => form_sanitizer($news_news, "", "news_news"), 'news_extended' => form_sanitizer($news_extended, "", "news_extended"), 'news_keywords' => form_sanitizer($_POST['news_keywords'], '', 'news_keywords'), 'news_datestamp' => form_sanitizer($_POST['news_datestamp'], '', 'news_datestamp'), 'news_start' => form_sanitizer($_POST['news_start'], 0, 'news_start'), 'news_end' => form_sanitizer($_POST['news_end'], 0, 'news_end'), 'news_visibility' => form_sanitizer($_POST['news_visibility'], 0, 'news_visibility'), 'news_draft' => isset($_POST['news_draft']) ? "1" : "0", 'news_sticky' => isset($_POST['news_sticky']) ? "1" : "0", 'news_allow_comments' => isset($_POST['news_allow_comments']) ? "1" : "0", 'news_allow_ratings' => isset($_POST['news_allow_ratings']) ? "1" : "0", 'news_language' => form_sanitizer($_POST['news_language'], '', 'news_language'), 'news_image' => "", 'news_ialign' => "", 'news_image_t1' => "", 'news_image_t2' => "");
        if (isset($_FILES['news_image'])) {
            // when files is uploaded.
            $upload = form_sanitizer($_FILES['news_image'], '', 'news_image');
            if (!empty($upload) && !$upload['error']) {
                $data['news_image'] = $upload['image_name'];
                $data['news_image_t1'] = $upload['thumb1_name'];
                $data['news_image_t2'] = $upload['thumb2_name'];
                $data['news_ialign'] = isset($_POST['news_ialign']) ? form_sanitizer($_POST['news_ialign'], "pull-left", "news_ialign") : "pull-left";
            }
        } else {
            // when files not uploaded. but there should be exist check.
            $data['news_image'] = isset($_POST['news_image']) ? $_POST['news_image'] : "";
            $data['news_image_t1'] = isset($_POST['news_image_t1']) ? $_POST['news_image_t1'] : "";
            $data['news_image_t2'] = isset($_POST['news_image_t2']) ? $_POST['news_image_t2'] : "";
            $data['news_ialign'] = isset($_POST['news_ialign']) ? form_sanitizer($_POST['news_ialign'], "pull-left", "news_ialign") : "pull-left";
        }
        if (fusion_get_settings('tinymce_enabled') != 1) {
            $data['news_breaks'] = isset($_POST['line_breaks']) ? "y" : "n";
        } else {
            $data['news_breaks'] = "n";
        }
        if ($data['news_sticky'] == "1") {
            $result = dbquery("UPDATE " . DB_NEWS . " SET news_sticky='0' WHERE news_sticky='1'");
        }
        // reset other sticky
        // delete image
        if (isset($_POST['del_image'])) {
            if (!empty($data['news_image']) && file_exists(IMAGES_N . $data['news_image'])) {
                unlink(IMAGES_N . $data['news_image']);
            }
            if (!empty($data['news_image_t1']) && file_exists(IMAGES_N_T . $data['news_image_t1'])) {
                unlink(IMAGES_N_T . $data['news_image_t1']);
            }
            if (!empty($data['news_image_t2']) && file_exists(IMAGES_N_T . $data['news_image_t2'])) {
                unlink(IMAGES_N_T . $data['news_image_t2']);
            }
            $data['news_image'] = "";
            $data['news_image_t1'] = "";
            $data['news_image_t2'] = "";
        }
        if (defender::safe()) {
            if (dbcount("('news_id')", DB_NEWS, "news_id='" . $data['news_id'] . "'")) {
                dbquery_insert(DB_NEWS, $data, 'update');
                addNotice('success', $locale['news_0101']);
            } else {
                $data['news_name'] = $userdata['user_id'];
                dbquery_insert(DB_NEWS, $data, 'save');
                addNotice('success', $locale['news_0100']);
            }
            if (isset($_POST['save_and_close'])) {
                redirect(clean_request("", array("ref"), FALSE));
            } else {
                redirect(FUSION_REQUEST);
            }
        }
    } elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_POST['news_id']) && isnum($_POST['news_id'])) || isset($_GET['news_id']) && isnum($_GET['news_id'])) {
        $result = dbquery("SELECT * FROM " . DB_NEWS . " WHERE news_id='" . (isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id']) . "'");
        if (dbrows($result)) {
            $data = dbarray($result);
        } else {
            redirect(FUSION_SELF . $aidlink);
        }
    }
    $result = dbquery("SELECT news_cat_id, news_cat_name FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY news_cat_name");
    $news_cat_opts = array();
    $news_cat_opts['0'] = $locale['news_0202'];
    if (dbrows($result)) {
        while ($odata = dbarray($result)) {
            $news_cat_opts[$odata['news_cat_id']] = $odata['news_cat_name'];
        }
    }
    echo "<div class='m-t-20'>\n";
    $news_settings = get_settings("news");
    echo openform('news_form', 'post', $formaction, array('enctype' => 1));
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
    echo form_hidden('news_id', "", $data['news_id']);
    echo form_text('news_subject', $locale['news_0200'], $data['news_subject'], array('required' => 1, 'max_length' => 200, 'error_text' => $locale['news_0250']));
    echo form_select('news_keywords', $locale['news_0205'], $data['news_keywords'], array("max_length" => 320, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
    echo "<div class='pull-left m-r-10 display-inline-block'>\n";
    echo form_datepicker('news_start', $locale['news_0206'], $data['news_start'], array('placeholder' => $locale['news_0208'], "join_to_id" => "news_end"));
    echo "</div>\n<div class='pull-left m-r-10 display-inline-block'>\n";
    echo form_datepicker('news_end', $locale['news_0207'], $data['news_end'], array('placeholder' => $locale['news_0208'], "join_from_id" => "news_start"));
    echo "</div>\n";
    echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
    openside('');
    echo form_select_tree("news_cat", $locale['news_0201'], $data['news_cat'], array("width" => "100%", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
    echo form_select('news_visibility', $locale['news_0209'], $data['news_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
    if (multilang_table("NS")) {
        echo form_select('news_language', $locale['global_ML100'], $data['news_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
    } else {
        echo form_hidden('news_language', '', $data['news_language']);
    }
    echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
    echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
    echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    closeside();
    echo "</div>\n</div>\n";
    $snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203a'], "form_name" => "news_form");
    if (fusion_get_settings("tinymce_enabled")) {
        $snippetSettings = array("required" => TRUE, "type" => "tinymce", "tinymce" => "advanced");
    }
    echo form_textarea('news_news', $locale['news_0203'], $data['news_news'], $snippetSettings);
    if (!fusion_get_settings("tinymce_enabled")) {
        $extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203b'], "form_name" => "news_form");
    } else {
        $extendedSettings = array("type" => "tinymce", "tinymce" => "advanced");
    }
    echo form_textarea('news_extended', $locale['news_0204'], $data['news_extended'], $extendedSettings);
    // second row
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
    openside('');
    if ($data['news_image'] != "" && $data['news_image_t1'] != "") {
        $image_thumb = get_news_image_path($data['news_image'], $data['news_image_t1'], $data['news_image_t2']);
        if (!$image_thumb) {
            $image_thumb = IMAGES . "imagenotfound70.jpg";
        }
        echo "<div class='row'>\n";
        echo "<div class='col-xs-12 col-sm-6'>\n";
        echo "<label><img class='img-responsive img-thumbnail' src='" . $image_thumb . "' alt='" . $locale['news_0216'] . "' /><br />\n";
        echo "<input type='checkbox' name='del_image' value='y' /> " . $locale['delete'] . "</label>\n";
        echo "</div>\n";
        echo "<div class='col-xs-12 col-sm-6'>\n";
        $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
        echo form_select('news_ialign', $locale['news_0218'], $data['news_ialign'], array("options" => $alignOptions, "inline" => FALSE));
        echo "</div>\n</div>\n";
        echo "<input type='hidden' name='news_image' value='" . $data['news_image'] . "' />\n";
        echo "<input type='hidden' name='news_image_t1' value='" . $data['news_image_t1'] . "' />\n";
        echo "<input type='hidden' name='news_image_t2' value='" . $data['news_image_t2'] . "' />\n";
    } else {
        $file_input_options = array('upload_path' => IMAGES_N, 'max_width' => $news_settings['news_photo_max_w'], 'max_height' => $news_settings['news_photo_max_h'], 'max_byte' => $news_settings['news_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $news_settings['news_thumb_w'], 'thumbnail_h' => $news_settings['news_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $news_settings['news_photo_w'], 'thumbnail2_h' => $news_settings['news_photo_h'], 'type' => 'image');
        echo form_fileinput("news_image", $locale['news_0216'], "", $file_input_options);
        echo "<div class='small m-b-10'>" . sprintf($locale['news_0217'], parsebytesize($news_settings['news_photo_max_b'])) . "</div>\n";
        $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
        echo form_select('news_ialign', $locale['news_0218'], $data['news_ialign'], array("options" => $alignOptions));
    }
    closeside();
    openside('');
    echo "<label><input type='checkbox' name='news_draft' value='yes'" . ($data['news_draft'] ? "checked='checked'" : "") . " /> " . $locale['news_0210'] . "</label><br />\n";
    echo "<label><input type='checkbox' name='news_sticky' value='yes'" . ($data['news_sticky'] ? "checked='checked'" : "") . "  /> " . $locale['news_0211'] . "</label><br />\n";
    echo form_hidden('news_datestamp', '', $data['news_datestamp']);
    if (fusion_get_settings("tinymce_enabled") != 1) {
        echo "<label><input type='checkbox' name='line_breaks' value='yes'" . ($data['news_breaks'] ? "checked='checked'" : "") . " /> " . $locale['news_0212'] . "</label><br />\n";
    }
    closeside();
    echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
    openside("");
    if (!fusion_get_settings("comments_enabled") || !fusion_get_settings("ratings_enabled")) {
        $sys = "";
        if (!fusion_get_settings("comments_enabled") && !fusion_get_settings("ratings_enabled")) {
            $sys = $locale['comments_ratings'];
        } elseif (!fusion_get_settings("comments_enabled")) {
            $sys = $locale['comments'];
        } else {
            $sys = $locale['ratings'];
        }
        echo "<div class='alert alert-warning'>" . sprintf($locale['news_0253'], $sys) . "</div>\n";
    }
    echo "<label><input type='checkbox' name='news_allow_comments' value='yes' onclick='SetRatings();'" . ($data['news_allow_comments'] ? "checked='checked'" : "") . " /> " . $locale['news_0213'] . "</label><br/>";
    echo "<label><input type='checkbox' name='news_allow_ratings' value='yes'" . ($data['news_allow_ratings'] ? "checked='checked'" : "") . " /> " . $locale['news_0214'] . "</label>";
    closeside();
    echo "</div>\n</div>\n";
    echo form_button('preview', $locale['news_0240'], $locale['news_0240'], array('class' => 'btn-default m-r-10'));
    echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
    echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    echo closeform();
    echo "</div>\n";
}
Example #15
0
/**
 * Displays News Category Form
 */
function display_news_cat_form()
{
    global $aidlink;
    $locale = fusion_get_locale();
    if (isset($_POST['cancel'])) {
        redirect(FUSION_SELF . $aidlink . "&section=news_category");
    }
    /**
     * Delete category images
     */
    if (isset($_GET['action']) && $_GET['action'] == "delete" && (isset($_GET['cat_id']) && isnum($_GET['cat_id']))) {
        $result = dbcount("(news_cat)", DB_NEWS, "news_cat='" . $_GET['cat_id'] . "'") || dbcount("(news_cat_id)", DB_NEWS_CATS, "news_cat_parent='" . $_GET['cat_id'] . "'");
        if (!empty($result)) {
            addNotice("success", $locale['news_0152'] . $locale['news_0153']);
        } else {
            $result = dbquery("DELETE FROM " . DB_NEWS_CATS . " WHERE news_cat_id='" . $_GET['cat_id'] . "'");
            addNotice("success", $locale['news_0154']);
        }
        // FUSION_REQUEST without the "action" gets
        redirect(clean_request("", array("action"), FALSE));
    }
    $data = array("news_cat_id" => 0, "news_cat_name" => "", "news_cat_hidden" => array(), "news_cat_parent" => 0, "news_cat_image" => "", "news_cat_draft" => FALSE, "news_cat_visibility" => iGUEST, "news_cat_sticky" => FALSE, "news_cat_featured" => FALSE, "news_cat_language" => LANGUAGE);
    $formAction = FUSION_REQUEST;
    $formTitle = $locale['news_0022'];
    // if edit, override $data
    if (isset($_POST['save_cat']) or isset($_POST['save_cat_and_close'])) {
        $inputArray = array("news_cat_id" => form_sanitizer($_POST['news_cat_id'], "", "news_cat_id"), "news_cat_name" => form_sanitizer($_POST['news_cat_name'], "", "news_cat_name"), "news_cat_parent" => form_sanitizer($_POST['news_cat_parent'], 0, "news_cat_parent"), "news_cat_visibility" => form_sanitizer($_POST['news_cat_visibility'], 0, "news_cat_visibility"), "news_cat_draft" => isset($_POST['news_cat_draft']) ? 1 : 0, "news_cat_sticky" => isset($_POST['news_cat_sticky']) ? 1 : 0, "news_cat_image" => form_sanitizer($_POST['news_cat_image'], "", "news_cat_image"), "news_cat_language" => form_sanitizer($_POST['news_cat_language'], LANGUAGE, "news_cat_language"));
        $categoryNameCheck = array("when_updating" => "news_cat_name='" . $inputArray['news_cat_name'] . "' and news_cat_id !='" . $inputArray['news_cat_id'] . "' " . (multilang_table("NS") ? "and news_cat_language = '" . LANGUAGE . "'" : ""), "when_saving" => "news_cat_name='" . $inputArray['news_cat_name'] . "' " . (multilang_table("NS") ? "and news_cat_language = '" . LANGUAGE . "'" : ""));
        if (defender::safe()) {
            // check category name is unique when updating
            if (dbcount("(news_cat_id)", DB_NEWS_CATS, "news_cat_id='" . $inputArray['news_cat_id'] . "'")) {
                if (!dbcount("(news_cat_id)", DB_NEWS_CATS, $categoryNameCheck['when_updating'])) {
                    dbquery_insert(DB_NEWS_CATS, $inputArray, "update");
                    addNotice("success", $locale['news_0151']);
                    if (isset($_POST['save_cat_and_close'])) {
                        redirect(clean_request("", array("action", "ref"), FALSE));
                    } else {
                        redirect(FUSION_REQUEST);
                    }
                } else {
                    addNotice('danger', $locale['news_0352']);
                }
            } else {
                // check category name is unique when saving new
                if (!dbcount("(news_cat_id)", DB_NEWS_CATS, $categoryNameCheck['when_saving'])) {
                    dbquery_insert(DB_NEWS_CATS, $inputArray, "save");
                    addNotice("success", $locale['news_0150']);
                    if (isset($_POST['save_cat_and_close'])) {
                        redirect(clean_request("", array("action", "ref"), FALSE));
                    } else {
                        redirect(FUSION_REQUEST);
                    }
                } else {
                    addNotice('danger', $locale['news_0352']);
                }
            }
        }
    } elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_GET['cat_id']) && isnum($_GET['cat_id']))) {
        $result = dbquery("SELECT * FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " news_cat_id='" . $_GET['cat_id'] . "'");
        if (dbrows($result)) {
            $data = dbarray($result);
            $data['news_cat_hidden'] = array($data['news_cat_id']);
            $formTitle = $locale['news_0021'];
        } else {
            // FUSION_REQUEST without the "action" gets
            redirect(clean_request("", array("action"), FALSE));
        }
    }
    add_breadcrumb(array('link' => "", 'title' => $formTitle));
    echo "<div class='m-t-20 m-b-20'>\n";
    echo openform("addcat", "post", $formAction);
    ?>
    <div class="row">
        <div class="col-xs-12 col-sm-8">
            <?php 
    echo form_hidden("news_cat_id", "", $data['news_cat_id']);
    echo form_text("news_cat_name", $locale['news_0300'], $data['news_cat_name'], array("required" => TRUE, "inline" => TRUE, "error_text" => $locale['news_0351']));
    echo form_select_tree("news_cat_parent", $locale['news_0305'], $data['news_cat_parent'], array("inline" => TRUE, "disable_opts" => $data['news_cat_hidden'], "hide_disabled" => TRUE, "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
    echo form_select("news_cat_image", $locale['news_0301'], $data['news_cat_image'], array("inline" => TRUE, "options" => newsCatImageOpts()));
    echo form_select('news_cat_visibility', $locale['news_0209'], $data['news_cat_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], "inline" => TRUE));
    ?>
        </div>
        <div class="col-xs-12 col-sm-4">
            <?php 
    if (multilang_table("NS")) {
        echo form_select("news_cat_language", $locale['global_ML100'], $data['news_cat_language'], array("inline" => TRUE, "options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose']));
    } else {
        echo form_hidden("news_cat_language", "", $data['news_cat_language']);
    }
    openside("");
    echo form_checkbox("news_cat_draft", "Save Category as Draft", $data['news_cat_draft'], array("reverse_label" => TRUE));
    echo form_checkbox("news_cat_sticky", "Make this Category Sticky", $data['news_cat_sticky'], array("reverse_label" => TRUE));
    echo form_button("cancel", $locale['cancel'], $locale['cancel'], array("class" => "btn-default"));
    echo form_button("save_cat", $locale['news_0302'], $locale['news_0302'], array("class" => "btn-success m-l-10"));
    echo form_button("save_cat_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    closeside();
    ?>
        </div>
    </div>
    <?php 
    echo form_button("cancel", $locale['cancel'], $locale['cancel'], array("class" => "btn-default"));
    echo form_button("save_cat", $locale['news_0302'], $locale['news_0302'], array("class" => "btn-success m-l-10"));
    echo form_button("save_cat_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    echo "</div>\n";
}
Example #16
0
 } else {
     $file_input_options = array('upload_path' => IMAGES_B, 'max_width' => $blog_settings['blog_photo_max_w'], 'max_height' => $blog_settings['blog_photo_max_h'], 'max_byte' => $blog_settings['blog_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $blog_settings['blog_thumb_w'], 'thumbnail_h' => $blog_settings['blog_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $blog_settings['blog_photo_w'], 'thumbnail2_h' => $blog_settings['blog_photo_h'], 'type' => 'image');
     echo form_fileinput("blog_image", $locale['blog_0439'], "", $file_input_options);
     echo "<div class='small m-b-10'>" . sprintf($locale['blog_0440'], parsebytesize($blog_settings['blog_photo_max_b'])) . "</div>\n";
     $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
     echo form_select('blog_ialign', $locale['blog_0442'], $callback_data['blog_ialign'], array("options" => $alignOptions));
 }
 closeside();
 $snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['blog_0425a'], "form_name" => "inputform");
 if (fusion_get_settings("tinymce_enabled")) {
     $snippetSettings = array("required" => TRUE);
 }
 echo form_textarea('blog_blog', $locale['blog_0425'], $callback_data['blog_blog'], $snippetSettings);
 echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
 openside("");
 echo form_select_tree("blog_cat", $locale['blog_0423'], $callback_data['blog_cat'], array("width" => "100%", "inline" => TRUE, "parent_value" => $locale['blog_0424'], "query" => multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : ""), DB_BLOG_CATS, "blog_cat_name", "blog_cat_id", "blog_cat_parent");
 echo form_select('blog_visibility', $locale['blog_0430'], $callback_data['blog_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
 if (multilang_table("NS")) {
     echo form_select('blog_language', $locale['global_ML100'], $callback_data['blog_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
 } else {
     echo form_hidden('blog_language', '', $callback_data['blog_language']);
 }
 echo form_hidden('blog_datestamp', '', $callback_data['blog_datestamp']);
 echo form_button('preview', $locale['blog_0436'], $locale['blog_0436'], array('class' => 'btn-default m-r-10'));
 echo form_button('publish', $locale['blog_0134'], $locale['blog_0134'], array('class' => 'btn-primary m-r-10'));
 closeside();
 openside("");
 echo "<label><input type='checkbox' name='blog_draft' value='1'" . ($callback_data['blog_draft'] ? "checked='checked'" : "") . " /> " . $locale['blog_0431'] . "</label><br />\n";
 echo "<label><input type='checkbox' name='blog_sticky' value='1'" . ($callback_data['blog_sticky'] ? "checked='checked'" : "") . "  /> " . $locale['blog_0432'] . "</label><br />\n";
 if (fusion_get_settings("tinymce_enabled") != 1) {
     echo "<label><input type='checkbox' name='blog_breaks' value='1'" . ($callback_data['blog_breaks'] ? "checked='checked'" : "") . " /> " . $locale['blog_0433'] . "</label><br />\n";
Example #17
0
 /**
  * New thread
  */
 public function set_newThreadInfo()
 {
     $userdata = fusion_get_userdata();
     $locale = fusion_get_locale("", FORUM_LOCALE);
     $locale += fusion_get_locale("", FORUM_TAGS_LOCALE);
     $forum_settings = ForumServer::get_forum_settings();
     // @todo: Reduce lines and optimize further
     if (iMEMBER) {
         // New thread directly to a specified forum
         if (!empty($_GET['forum_id']) && ForumServer::verify_forum($_GET['forum_id'])) {
             add_to_title($locale['forum_0000']);
             add_to_meta("description", $locale['forum_0000']);
             add_breadcrumb(array("link" => FORUM . "index.php", "title" => $locale['forum_0000']));
             add_to_title($locale['global_201'] . $locale['forum_0057']);
             $forum_data = dbarray(dbquery("SELECT f.*, f2.forum_name AS forum_cat_name\n\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n\t\t\t\tWHERE f.forum_id='" . intval($_GET['forum_id']) . "'\n\t\t\t\tAND " . groupaccess('f.forum_access') . "\n\t\t\t\t"));
             if ($forum_data['forum_type'] == 1) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             // Use the new permission settings
             self::setPermission($forum_data);
             $forum_data['lock_edit'] = $forum_settings['forum_edit_lock'];
             if (self::getPermission("can_post") && self::getPermission("can_access")) {
                 add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php?viewforum&amp;forum_id=' . $forum_data['forum_id'] . '&amp;parent_id=' . $forum_data['forum_cat'], 'title' => $forum_data['forum_name']));
                 add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php?viewforum&amp;forum_id=' . $forum_data['forum_id'] . '&amp;parent_id=' . $forum_data['forum_cat'], 'title' => $locale['forum_0057']));
                 /**
                  * Generate a poll form
                  */
                 $poll_form = "";
                 if (self::getPermission("can_create_poll")) {
                     // initial data to push downwards
                     $pollData = array('thread_id' => 0, 'forum_poll_title' => !empty($_POST['forum_poll_title']) ? form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title') : '', 'forum_poll_start' => time(), 'forum_poll_length' => 2, 'forum_poll_votes' => 0);
                     // counter of lengths
                     $option_data[1] = "";
                     $option_data[2] = "";
                     // Do a validation if checked add_poll
                     if (isset($_POST['add_poll'])) {
                         $pollData = array('thread_id' => 0, 'forum_poll_title' => isset($_POST['forum_poll_title']) ? form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title') : '', 'forum_poll_start' => time(), 'forum_poll_length' => count($option_data), 'forum_poll_votes' => 0);
                         // calculate poll lengths
                         if (!empty($_POST['poll_options']) && is_array($_POST['poll_options'])) {
                             foreach ($_POST['poll_options'] as $i => $value) {
                                 $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]");
                             }
                         }
                     }
                     if (isset($_POST['add_poll_option']) && isset($_POST['poll_options'])) {
                         // reindex the whole array with blank values.
                         foreach ($_POST['poll_options'] as $i => $value) {
                             $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]");
                         }
                         if (\defender::safe()) {
                             $option_data = array_values(array_filter($option_data));
                             array_unshift($option_data, NULL);
                             unset($option_data[0]);
                             $pollData['forum_poll_length'] = count($option_data);
                         }
                         array_push($option_data, '');
                     }
                     $poll_field = '';
                     $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $pollData['forum_poll_title'], array('max_length' => 255, 'placeholder' => $locale['forum_0604a'], 'inline' => TRUE, 'required' => TRUE));
                     for ($i = 1; $i <= count($option_data); $i++) {
                         $poll_field['poll_field'] .= form_text("poll_options[{$i}]", sprintf($locale['forum_0606'], $i), $option_data[$i], array('max_length' => 255, 'placeholder' => $locale['forum_0605'], 'inline' => TRUE, 'required' => $i <= 2 ? TRUE : FALSE));
                     }
                     $poll_field['poll_field'] .= "<div class='col-xs-12 col-sm-offset-3'>\n";
                     $poll_field['poll_field'] .= form_button('add_poll_option', $locale['forum_0608'], $locale['forum_0608'], array('class' => 'btn-primary btn-sm'));
                     $poll_field['poll_field'] .= "</div>\n";
                     $info = array('title' => $locale['forum_0366'], 'description' => $locale['forum_0630'], 'field' => $poll_field);
                     ob_start();
                     echo form_checkbox("add_poll", $locale['forum_0366'], isset($_POST['add_poll']) ? TRUE : FALSE, array('reverse_label' => TRUE));
                     echo "<div id='poll_form' class='poll-form' style='display:none;'>\n";
                     echo "<div class='well clearfix'>\n";
                     echo "<!--pre_form-->\n";
                     echo $info['field']['poll_field'];
                     echo "</div>\n";
                     echo "</div>\n";
                     $poll_form = ob_get_contents();
                     ob_end_clean();
                 }
                 $thread_data = array('forum_id' => $forum_data['forum_id'], 'thread_id' => 0, 'thread_subject' => isset($_POST['thread_subject']) ? form_sanitizer($_POST['thread_subject'], '', 'thread_subject') : '', 'thread_tags' => isset($_POST['thread_tags']) ? form_sanitizer($_POST['thread_tags'], '', 'thread_tags') : '', 'thread_author' => $userdata['user_id'], 'thread_views' => 0, 'thread_lastpost' => time(), 'thread_lastpostid' => 0, 'thread_lastuser' => $userdata['user_id'], 'thread_postcount' => 1, 'thread_poll' => 0, 'thread_sticky' => isset($_POST['thread_sticky']) ? 1 : 0, 'thread_locked' => isset($_POST['thread_sticky']) ? 1 : 0, 'thread_hidden' => 0);
                 $post_data = array('forum_id' => $forum_data['forum_id'], 'forum_cat' => $forum_data['forum_cat'], 'thread_id' => 0, 'post_id' => 0, 'post_message' => isset($_POST['post_message']) ? form_sanitizer($_POST['post_message'], '', 'post_message') : '', 'post_showsig' => isset($_POST['post_showsig']) ? 1 : 0, 'post_smileys' => !isset($_POST['post_smileys']) || isset($_POST['post_message']) && preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $_POST['post_message']) ? 0 : 1, 'post_author' => $userdata['user_id'], 'post_datestamp' => time(), 'post_ip' => USER_IP, 'post_ip_type' => USER_IP_TYPE, 'post_edituser' => 0, 'post_edittime' => 0, 'post_editreason' => '', 'post_hidden' => 0, 'notify_me' => isset($_POST['notify_me']) ? 1 : 0, 'post_locked' => 0);
                 // Execute post new thread
                 if (isset($_POST['post_newthread']) && \defender::safe()) {
                     require_once INCLUDES . "flood_include.php";
                     // all data is sanitized here.
                     if (!flood_control("post_datestamp", DB_FORUM_POSTS, "post_author='" . $userdata['user_id'] . "'")) {
                         // have notice
                         if (\defender::safe()) {
                             // create a new thread.
                             dbquery_insert(DB_FORUM_THREADS, $thread_data, 'save', array('primary_key' => 'thread_id', 'keep_session' => TRUE));
                             $post_data['thread_id'] = dblastid();
                             $pollData['thread_id'] = dblastid();
                             dbquery_insert(DB_FORUM_POSTS, $post_data, 'save', array('primary_key' => 'post_id', 'keep_session' => TRUE));
                             $post_data['post_id'] = dblastid();
                             // Attach files if permitted
                             if (!empty($_FILES) && is_uploaded_file($_FILES['file_attachments']['tmp_name'][0]) && self::getPermission("can_upload_attach")) {
                                 $upload = form_sanitizer($_FILES['file_attachments'], '', 'file_attachments');
                                 if ($upload['error'] == 0) {
                                     foreach ($upload['target_file'] as $arr => $file_name) {
                                         $attach_data = array('thread_id' => $post_data['thread_id'], 'post_id' => $post_data['post_id'], 'attach_name' => $file_name, 'attach_mime' => $upload['type'][$arr], 'attach_size' => $upload['source_size'][$arr], 'attach_count' => '0');
                                         dbquery_insert(DB_FORUM_ATTACHMENTS, $attach_data, "save", array('keep_session' => TRUE));
                                     }
                                 }
                             }
                             dbquery("UPDATE " . DB_USERS . " SET user_posts=user_posts+1 WHERE user_id='" . intval($post_data['post_author']) . "'");
                             // Update stats in forum and threads
                             // find all parents and update them
                             $list_of_forums = get_all_parent(dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'), $post_data['forum_id']);
                             if (is_array($list_of_forums)) {
                                 foreach ($list_of_forums as $forum_id) {
                                     $forum_update_sql = "\n                                        UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($post_data['post_datestamp']) . "',\n                                        forum_postcount=forum_postcount+1,\n                                        forum_threadcount=forum_threadcount+1,\n                                        forum_lastpostid='" . intval($post_data['post_id']) . "',\n                                        forum_lastuser='******'post_author']) . "' WHERE forum_id='" . intval($forum_id) . "'\n                                        ";
                                     dbquery($forum_update_sql);
                                 }
                             }
                             // update current forum
                             dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . $post_data['post_datestamp'] . "', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $post_data['forum_id'] . "'");
                             // update current thread
                             dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . $post_data['post_datestamp'] . "', thread_lastpostid='" . $post_data['post_id'] . "', thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $post_data['thread_id'] . "'");
                             // set notify
                             if ($forum_settings['thread_notify'] && isset($_POST['notify_me']) && $post_data['thread_id']) {
                                 if (!dbcount("(thread_id)", DB_FORUM_THREAD_NOTIFY, "thread_id='" . $post_data['thread_id'] . "' AND notify_user='******'post_author'] . "'")) {
                                     dbquery("INSERT INTO " . DB_FORUM_THREAD_NOTIFY . " (thread_id, notify_datestamp, notify_user, notify_status) VALUES('" . $post_data['thread_id'] . "', '" . $post_data['post_datestamp'] . "', '" . $post_data['post_author'] . "', '1')");
                                 }
                             }
                             // Add poll if exist
                             if (!empty($option_data) && isset($_POST['add_poll'])) {
                                 dbquery_insert(DB_FORUM_POLLS, $pollData, 'save');
                                 $poll_option_data['thread_id'] = $pollData['thread_id'];
                                 $i = 1;
                                 foreach ($option_data as $option_text) {
                                     if ($option_text) {
                                         $poll_option_data['forum_poll_option_id'] = $i;
                                         $poll_option_data['forum_poll_option_text'] = $option_text;
                                         $poll_option_data['forum_poll_option_votes'] = 0;
                                         dbquery_insert(DB_FORUM_POLL_OPTIONS, $poll_option_data, 'save');
                                         $i++;
                                     }
                                 }
                                 dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_poll='1' WHERE thread_id='" . $pollData['thread_id'] . "'");
                             }
                         }
                         if (\defender::safe()) {
                             redirect(INFUSIONS . "forum/postify.php?post=new&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;parent_id=" . intval($post_data['forum_cat']) . "&amp;thread_id=" . intval($post_data['thread_id'] . ""));
                         }
                     }
                 }
                 $this->info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', FORUM . "newthread.php?forum_id=" . $post_data['forum_id'], array('enctype' => self::getPermission("can_upload_attach"))), 'closeform' => closeform(), 'forum_id_field' => '', 'thread_id_field' => '', "forum_field" => "", 'subject_field' => form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => 1, 'placeholder' => $locale['forum_2001'], 'error_text' => '', 'class' => 'm-t-20 m-b-20')), 'tags_field' => form_select('thread_tags[]', $locale['forum_tag_0100'], $thread_data['thread_tags'], array('options' => $this->tag()->get_TagOpts(TRUE), 'width' => '100%', 'multiple' => TRUE, 'delimiter' => '.', 'max_select' => 3)), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => 1, 'error_text' => '', 'autosize' => 1, 'no_resize' => 1, 'preview' => 1, 'form_name' => 'input_form', 'bbcode' => 1)), 'attachment_field' => self::getPermission("can_upload_attach") ? form_fileinput('file_attachments[]', $locale['forum_0557'], "", array('input_id' => 'file_attachments', 'upload_path' => INFUSIONS . 'forum/attachments/', 'type' => 'object', 'preview_off' => TRUE, "multiple" => TRUE, "inline" => FALSE, 'max_count' => $forum_settings['forum_attachmax_count'], 'valid_ext' => $forum_settings['forum_attachtypes'], "class" => "m-b-0")) . " <div class='m-b-20'>\n<small>\n                            " . sprintf($locale['forum_0559'], parsebytesize($forum_settings['forum_attachmax']), str_replace('|', ', ', $forum_settings['forum_attachtypes']), $forum_settings['forum_attachmax_count']) . "</small>\n</div>\n" : "", 'poll_form' => $poll_form, 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0', 'reverse_label' => TRUE)), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'sticky_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'lock_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
                 // add a jquery to toggle the poll form
                 add_to_jquery("\n                        if (\$('#add_poll').is(':checked')) {\n                            \$('#poll_form').show();\n                        } else {\n                            \$('#poll_form').hide();\n                        }\n                        \$('#add_poll').bind('click', function() {\n                            if (\$(this).is(':checked')) {\n                                \$('#poll_form').slideDown();\n                            } else {\n                                \$('#poll_form').slideUp();\n                            }\n                        });\n                    ");
             } else {
                 redirect(FORUM . "index.php");
             }
         } else {
             /*
              * Quick New Forum Posting.
              * Does not require to run permissions.
              * Does not contain forum poll.
              * Does not contain attachment
              */
             if (!dbcount("(forum_id)", DB_FORUMS, "forum_type !='1'")) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             if (!dbcount("(forum_id)", DB_FORUMS, "forum_language ='" . LANGUAGE . "'")) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             add_breadcrumb(array("link" => FORUM . "newthread.php?forum_id=0", "title" => $locale['forum_0057']));
             $thread_data = array('forum_id' => isset($_POST['forum_id']) ? form_sanitizer($_POST['forum_id'], 0, "forum_id") : 0, 'thread_id' => 0, 'thread_subject' => isset($_POST['thread_subject']) ? form_sanitizer($_POST['thread_subject'], '', 'thread_subject') : '', 'thread_tags' => isset($_POST['thread_tags']) ? form_sanitizer($_POST['thread_tags'], '', 'thread_tags') : '', 'thread_author' => $userdata['user_id'], 'thread_views' => 0, 'thread_lastpost' => time(), 'thread_lastpostid' => 0, 'thread_lastuser' => $userdata['user_id'], 'thread_postcount' => 1, 'thread_poll' => 0, 'thread_sticky' => isset($_POST['thread_sticky']) ? TRUE : FALSE, 'thread_locked' => isset($_POST['thread_sticky']) ? TRUE : FALSE, 'thread_hidden' => 0);
             $post_data = array('forum_id' => isset($_POST['forum_id']) ? form_sanitizer($_POST['forum_id'], 0, "forum_id") : 0, "forum_cat" => 0, 'thread_id' => 0, 'post_id' => 0, 'post_message' => isset($_POST['post_message']) ? form_sanitizer($_POST['post_message'], '', 'post_message') : '', 'post_showsig' => isset($_POST['post_showsig']) ? TRUE : FALSE, 'post_smileys' => !isset($_POST['post_smileys']) || isset($_POST['post_message']) && preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $_POST['post_message']) ? FALSE : TRUE, 'post_author' => $userdata['user_id'], 'post_datestamp' => time(), 'post_ip' => USER_IP, 'post_ip_type' => USER_IP_TYPE, 'post_edituser' => 0, 'post_edittime' => 0, 'post_editreason' => '', 'post_hidden' => 0, 'notify_me' => isset($_POST['notify_me']) ? TRUE : FALSE, 'post_locked' => 0);
             // go for a new thread posting.
             // check data
             // and validate
             // do not run attach, and do not run poll.
             if (isset($_POST['post_newthread']) && \defender::safe()) {
                 require_once INCLUDES . "flood_include.php";
                 // all data is sanitized here.
                 if (!flood_control("post_datestamp", DB_FORUM_POSTS, "post_author='" . $userdata['user_id'] . "'")) {
                     // have notice
                     if (ForumServer::verify_forum($thread_data['forum_id'])) {
                         $forum_data = dbarray(dbquery("SELECT f.*, f2.forum_name AS forum_cat_name\n                            FROM " . DB_FORUMS . " f\n                            LEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n                            WHERE f.forum_id='" . intval($thread_data['forum_id']) . "'\n                            AND " . groupaccess('f.forum_access') . "\n                            "));
                         if ($forum_data['forum_type'] == 1) {
                             redirect(INFUSIONS . "forum/index.php");
                         }
                         // Use the new permission settings
                         self::setPermission($forum_data);
                         $forum_data['lock_edit'] = $forum_settings['forum_edit_lock'];
                         if (self::getPermission("can_post") && self::getPermission("can_access")) {
                             $post_data['forum_cat'] = $forum_data['forum_cat'];
                             // create a new thread.
                             dbquery_insert(DB_FORUM_THREADS, $thread_data, 'save', array('primary_key' => 'thread_id', 'keep_session' => TRUE));
                             $post_data['thread_id'] = dblastid();
                             dbquery_insert(DB_FORUM_POSTS, $post_data, 'save', array('primary_key' => 'post_id', 'keep_session' => TRUE));
                             $post_data['post_id'] = dblastid();
                             dbquery("UPDATE " . DB_USERS . " SET user_posts=user_posts+1 WHERE user_id='" . $post_data['post_author'] . "'");
                             // Update stats in forum and threads
                             // find all parents and update them
                             $list_of_forums = get_all_parent(dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'), $post_data['forum_id']);
                             foreach ($list_of_forums as $fid) {
                                 dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . time() . "', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $fid . "'");
                             }
                             // update current forum
                             dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost=''" . time() . "'', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $post_data['forum_id'] . "'");
                             // update current thread
                             dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost=''" . time() . "'', thread_lastpostid='" . $post_data['post_id'] . "', thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $post_data['thread_id'] . "'");
                             // set notify
                             if ($forum_settings['thread_notify'] && isset($_POST['notify_me']) && $post_data['thread_id']) {
                                 if (!dbcount("(thread_id)", DB_FORUM_THREAD_NOTIFY, "thread_id='" . $post_data['thread_id'] . "' AND notify_user='******'post_author'] . "'")) {
                                     dbquery("INSERT INTO " . DB_FORUM_THREAD_NOTIFY . " (thread_id, notify_datestamp, notify_user, notify_status) VALUES('" . $post_data['thread_id'] . "', '" . time() . "', '" . $post_data['post_author'] . "', 1)");
                                 }
                             }
                             if (\defender::safe()) {
                                 redirect(INFUSIONS . "forum/postify.php?post=new&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;parent_id=" . intval($post_data['forum_cat']) . "&amp;thread_id=" . intval($post_data['thread_id'] . ""));
                             }
                         } else {
                             addNotice("danger", $locale['forum_0186']);
                         }
                     } else {
                         addNotice("danger", $locale['forum_0187']);
                         redirect(INFUSIONS . "forum/index.php");
                     }
                 }
             }
             //Disable all parents
             $disabled_opts = array();
             $disable_query = "\n                SELECT forum_id FROM " . DB_FORUMS . " WHERE forum_type='1'\n                " . (multilang_table("FO") ? "AND forum_language='" . LANGUAGE . "'" : "") . "\n                ";
             $disable_query = dbquery(" {$disable_query} ");
             if (dbrows($disable_query) > 0) {
                 while ($d_forum = dbarray($disable_query)) {
                     $disabled_opts = $d_forum['forum_id'];
                 }
             }
             $this->info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', FORUM . "newthread.php", array('enctype' => FALSE)), 'closeform' => closeform(), 'forum_id_field' => '', 'thread_id_field' => '', 'forum_field' => form_select_tree("forum_id", $locale['forum_0395'], $thread_data['forum_id'], array("required" => TRUE, "width" => "320px", "no_root" => TRUE, "disable_opts" => $disabled_opts, "query" => multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "'" : ""), DB_FORUMS, "forum_name", "forum_id", "forum_cat"), 'subject_field' => form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => 1, 'placeholder' => $locale['forum_2001'], 'error_text' => '', 'class' => 'm-t-20 m-b-20')), 'tags_field' => form_select('thread_tags[]', $locale['forum_tag_0100'], $thread_data['thread_tags'], array('options' => $this->tag()->get_TagOpts(), 'width' => '100%', 'multiple' => TRUE, 'delimiter' => '.', 'max_select' => 3)), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => 1, 'error_text' => '', 'autosize' => 1, 'no_resize' => 1, 'preview' => 1, 'form_name' => 'input_form', 'bbcode' => 1)), 'attachment_field' => "", 'poll_form' => "", 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0', 'reverse_label' => TRUE)), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'sticky_field' => iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'lock_field' => iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
         }
     } else {
         redirect(INFUSIONS . 'forum/index.php');
     }
 }
Example #18
0
        if (dbrows($result)) {
            $data = dbarray($result);
        } else {
            redirect(FUSION_SELF . $aidlink);
        }
    }
    echo openform('inputform', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-8'>\n";
    echo form_hidden("weblink_datestamp", "", $data['weblink_datestamp']);
    echo form_hidden("weblink_id", "", $data['weblink_id']);
    echo form_text('weblink_name', $locale['wl_0100'], $data['weblink_name'], array("placeholder" => $locale['wl_0101'], "error_text" => $locale['wl_0102'], "inline" => TRUE, 'required' => TRUE));
    echo form_text('weblink_url', $locale['wl_0104'], $data['weblink_url'], array("type" => "url", "placeholder" => "http://", "required" => TRUE, "inline" => TRUE));
    echo form_textarea('weblink_description', $locale['wl_0103'], $data['weblink_description'], array("inline" => TRUE, "html" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE, "preview" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE, "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE, "form_name" => "inputform"));
    echo "</div>\n";
    echo "<div class='col-xs-12 col-sm-4'>\n";
    if ($weblink_edit) {
        echo form_checkbox("update_datestamp", $locale['wl_0107'], "");
    }
    openside("");
    echo form_select_tree("weblink_cat", $locale['wl_0105'], $data['weblink_cat'], array("inline" => TRUE, "no_root" => 1, "placeholder" => $locale['choose'], "query" => multilang_table("WL") ? "WHERE weblink_cat_language='" . LANGUAGE . "'" : ""), DB_WEBLINK_CATS, "weblink_cat_name", "weblink_cat_id", "weblink_cat_parent");
    echo form_select('weblink_visibility', $locale['wl_0106'], $data['weblink_visibility'], array("inline" => TRUE, 'options' => fusion_get_groups()));
    echo form_button('save_link', $locale['wl_0108'], $locale['wl_0108'], array("input_id" => "savelink2", 'class' => 'btn-primary m-t-10'));
    closeside();
    echo "</div>\n</div>\n";
    echo form_button('save_link', $locale['wl_0108'], $locale['wl_0108'], array('class' => 'btn-primary m-t-10'));
    echo closeform();
} else {
    echo "<div class='text-center'>\n" . $locale['537'] . "<br />\n" . $locale['538'] . "<br />\n<br />\n";
    echo "<a href='" . INFUSIONS . "weblinks/weblinks_admin.php" . $aidlink . "&amp;section=weblinks_category'>" . $locale['539'] . "</a>" . $locale['540'] . "</div>\n";
}
Example #19
0
function form_select_tree($title, $input_name, $input_id, $input_value = FALSE, $array = FALSE, $db, $name_col, $id_col, $cat_col, $self_id = FALSE, $id = FALSE, $level = FALSE, $index = FALSE, $data = FALSE)
{
    global $_POST, $locale;
    if (!defined("SELECT2")) {
        define("SELECT2", TRUE);
        add_to_footer("<script src='" . DYNAMICS . "assets/select2/select2.min.js' /></script>\n");
        add_to_head("<link href='" . DYNAMICS . "assets/select2/select2.css' rel='stylesheet' />\n");
    }
    $title2 = isset($title) && !empty($title) ? stripinput($title) : ucfirst(strtolower(str_replace("_", " ", $input_name)));
    $input_value = isset($input_value) ? stripinput($input_value) : '';
    if (isset($name) && $name != "") {
        $name = stripinput($name);
    } else {
        $name = "";
    }
    if (isset($id_col) && $id_col != "") {
        $id_col = stripinput($id_col);
    } else {
        $id_col = "";
    }
    if (isset($cat_col) && $cat_col != "") {
        $cat_col = stripinput($cat_col);
    } else {
        $cat_col = "";
    }
    if (!is_array($array)) {
        $array = array();
        $state_validation = "";
        $required = 0;
        $safemode = 0;
        $allowclear = "";
        $placeholder = $locale['choose'];
        $deactivate = "";
        $labeloff = "";
        $multiple = "";
        $stacking = 0;
        $width = "style='width:90%;'";
        $add_parent_opts = 0;
        $no_root = 0;
        $inline = '';
        $include_opts = '';
        // for selective input. will not show items if value not in array.
    } else {
        $multiple = array_key_exists('is_multiple', $array) ? $array['is_multiple'] : "";
        $placeholder = array_key_exists('placeholder', $array) ? $array['placeholder'] : $locale['choose'];
        $allowclear = !empty($placeholder) && $multiple !== 1 ? "allowClear:true" : "";
        $deactivate = array_key_exists('deactivate', $array) ? $array['deactivate'] : "";
        $labeloff = array_key_exists('labeloff', $array) ? $array['labeloff'] : "";
        $helper_text = array_key_exists("helper", $array) ? $array['helper'] : "";
        $required = array_key_exists('required', $array) && $array['required'] == 1 ? 1 : 0;
        $safemode = array_key_exists('safemode', $array) && $array['safemode'] == 1 ? 1 : 0;
        $stacking = array_key_exists('stacking', $array) && $array['stacking'] == 1 ? 1 : 0;
        $add_parent_opts = array_key_exists('add_parent_opts', $array) && $array['add_parent_opts'] == 1 ? 1 : 0;
        $no_root = array_key_exists('no_root', $array) && $array['no_root'] == 1 ? 1 : 0;
        $width = array_key_exists('width', $array) ? $array['width'] : '';
        $multiple = $multiple == 1 ? "multiple" : "";
        $inline = array_key_exists("rowstart", $array) ? 1 : 0;
        $include_opts = array_key_exists("include_opts", $array) ? $array['include_opts'] : '';
    }
    // Patterns
    if (!$level) {
        $level = 0;
        $html = "";
        $html .= "<div id='{$input_id}-field' class='form-group m-b-0'>\n";
        $html .= "<label class='control-label " . ($inline ? "col-sm-3 col-md-3 col-lg-3" : '') . "' for='{$input_id}'>{$title} " . ($required == 1 ? "<span class='required'>*</span>" : '') . "</label>\n";
        $html .= $inline ? "<div class='col-sm-9 col-md-9 col-lg-9'>\n" : "";
    }
    $opt_pattern = str_repeat("&#8212;", $level);
    // no need to count here, it's cosmetics.
    if ($level == "0") {
        add_to_jquery("\n            \$('#" . $input_id . "').select2({\n            placeholder: '" . $placeholder . "',\n            {$allowclear}\n            });\n            ");
        $html .= "<select name='{$input_name}' id='{$input_id}' " . ($width ? "style='width: {$width}'" : "style='min-width: 250px'") . " " . ($deactivate == "1" && isnum($deactivate) ? "readonly" : "") . " {$multiple}>";
        if ($allowclear) {
            $html .= "<option value=''></option>";
        }
        if ($no_root !== 1) {
            // api options to remove root from selector. used in items creation.
            $this_select = '';
            if ($input_value !== NULL) {
                if ($input_value == '0') {
                    $this_select = "selected";
                }
            }
            $html .= $add_parent_opts == '1' ? "<option value='0' " . $this_select . ">{$opt_pattern} " . $locale['parent'] . "</option>\n" : "<option value='0' {$this_select}>{$opt_pattern} Root</option>\n";
        }
        $index = dbquery_tree($db, $id_col, $cat_col);
        $data = dbquery_tree_data($db, $id_col, $cat_col);
    }
    if (!$id) {
        $id = 0;
    }
    if (isset($index[$id])) {
        foreach ($index[$id] as $key => $value) {
            $html =& $html;
            $name = $data[$value][$name_col];
            $select = $input_value !== "" && $input_value == $value ? 'selected' : '';
            if (isset($include_opts) && is_array($include_opts)) {
                $html .= in_array($value, $include_opts) ? "<option value='{$value}' " . $select . " " . ($self_id == $value ? 'disabled' : '') . ">{$opt_pattern} {$name} " . ($self_id == $value ? '(Current Item)' : '') . "</option>\n" : '';
            } else {
                $html .= "<option value='{$value}' " . $select . " " . ($self_id == $value ? 'disabled' : '') . ">{$opt_pattern} {$name} " . ($self_id == $value ? '(Current Item)' : '') . "</option>\n";
            }
            if (isset($index[$value])) {
                $html .= form_select_tree($title, $input_name, $input_id, $input_value, $array, $db, $name_col, $id_col, $cat_col, $self_id, $value, $level + 1, $index, $data);
            }
        }
    }
    if (!$level) {
        $html .= "</select>";
        $html .= "<br/><div id='{$input_id}-help' style='display:inline-block !important;'></div>";
        $html .= "<input type='hidden' name='def[{$input_name}]' value='[type=dropdown],[title={$title2}],[id={$input_id}],[required={$required}],[safemode={$safemode}]' readonly>";
        $html .= "</div>\n";
    }
    return $html;
}
Example #20
0
 /**
  * Js menu jumper
  */
 private function display_forum_jumper()
 {
     /* JS Menu Jumper */
     global $aidlink;
     echo "<div class='pull-right m-t-10'>\n";
     echo form_select_tree('forum_jump', '', $_GET['parent_id'], array('inline' => TRUE, 'class' => 'pull-right', 'parent_value' => self::$locale['forum_root']), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat');
     echo "<label for='forum_jump' class='text-dark strong pull-right m-r-10 m-t-3'>" . self::$locale['forum_044'] . "</label>\n";
     echo "</div>\n";
     add_to_jquery("\n\t    \$('#forum_jump').change(function() {\n\t\tlocation = '" . FUSION_SELF . $aidlink . "&parent_id='+\$(this).val();\n        });\n        ");
 }
Example #21
0
         }
         $data['cat_sort_order'] = $cat_sorting[1];
     } else {
         redirect(FUSION_SELF . $aidlink);
     }
 }
 $wlCatTab['title'] = array($locale['wl_0710'], $locale['wl_0004']);
 $wlCatTab['id'] = array("a", "b");
 $tab_active = tab_active($wlCatTab, isset($_GET['cat_view']) ? 1 : 0);
 echo opentab($wlCatTab, $tab_active, "wlCat_tab", FALSE, "m-t-20");
 echo opentabbody($wlCatTab['title'][0], $wlCatTab['id'][0], $tab_active);
 echo openform('addcat', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
 echo form_hidden("weblink_cat_id", "", $data['weblink_cat_id']);
 echo form_text('weblink_cat_name', $locale['wl_0700'], $data['weblink_cat_name'], array('required' => TRUE, "error_text" => $locale['wl_0701'], "inline" => TRUE));
 echo form_textarea('weblink_cat_description', $locale['wl_0702'], $data['weblink_cat_description'], array("html" => TRUE, "preview" => FALSE, "autosize" => TRUE, "inline" => TRUE));
 echo form_select_tree("weblink_cat_parent", $locale['wl_0703'], $data['weblink_cat_parent'], array("disable_opts" => $cat_hidden, "hide_disabled" => TRUE, "inline" => TRUE), DB_WEBLINK_CATS, "weblink_cat_name", "weblink_cat_id", "weblink_cat_parent");
 if (multilang_table("WL")) {
     echo form_select('weblink_cat_language', $locale['global_ML100'], $data['weblink_cat_language'], array('options' => fusion_get_enabled_languages(), "inline" => TRUE));
 } else {
     echo form_hidden('weblink_cat_language', '', $data['weblink_cat_language']);
 }
 echo "<div class='row m-0'>\n";
 echo "<label class='label-control col-xs-12 col-sm-3 p-l-0'>" . $locale['wl_0704'] . "</label>\n";
 echo "<div class='col-xs-12 col-sm-3  p-l-0'>\n";
 echo form_select('cat_sort_by', "", $data['cat_sort_by'], array("inline" => TRUE, "width" => "100%", 'options' => array('1' => $locale['wl_0705'], '2' => $locale['wl_0706'], '3' => $locale['wl_0707']), 'class' => 'pull-left m-r-10'));
 echo "</div>\n";
 echo "<div class='col-xs-12 col-sm-2'>\n";
 echo form_select('cat_sort_order', '', $data['cat_sort_order'], array("inline" => TRUE, "width" => "100%", 'options' => array('ASC' => $locale['wl_0708'], 'DESC' => $locale['wl_0709'])));
 echo "</div>\n";
 echo "</div>\n";
 echo form_button('save_cat', $locale['wl_0711'], $locale['wl_0711'], array('class' => 'btn-primary m-t-10'));
Example #22
0
    if (dbrows($result)) {
        $data = dbarray($result);
        $data['blog_cat_hidden'] = array($data['blog_cat_id']);
        $formTitle = $locale['blog_0402'];
    } else {
        // FUSION_REQUEST without the "action" gets
        redirect(clean_request("", array("action"), FALSE));
    }
}
add_breadcrumb(array('link' => "", 'title' => $formTitle));
opentable($formTitle);
echo openform("addcat", "post", $formAction);
openside("");
echo form_hidden("blog_cat_id", "", $data['blog_cat_id']);
echo form_text("blog_cat_name", $locale['blog_0530'], $data['blog_cat_name'], array("required" => TRUE, "inline" => TRUE, "error_text" => $locale['blog_0560']));
echo form_select_tree("blog_cat_parent", $locale['blog_0533'], $data['blog_cat_parent'], array("inline" => TRUE, "disable_opts" => $data['blog_cat_hidden'], "hide_disabled" => TRUE, "query" => multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : ""), DB_BLOG_CATS, "blog_cat_name", "blog_cat_id", "blog_cat_parent");
if (multilang_table("BL")) {
    echo form_select("blog_cat_language", $locale['global_ML100'], $data['blog_cat_language'], array("inline" => TRUE, "options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose']));
} else {
    echo form_hidden("blog_cat_language", "", $data['blog_cat_language']);
}
echo form_select("blog_cat_image", $locale['blog_0531'], $data['blog_cat_image'], array("inline" => TRUE, "options" => blogCatImageOpts()));
echo form_button("save_cat", $locale['blog_0532'], $locale['blog_0532'], array("class" => "btn-success"));
closeside();
openside($locale['blog_0407']);
$result = dbquery("SELECT blog_cat_id, blog_cat_name FROM " . DB_BLOG_CATS . " " . (multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY blog_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
    $counter = 0;
    $columns = 4;
    echo "<div class='row'>\n";
Example #23
0
 /**
  * The HTML form
  * @param $data
  */
 public static function customPage_form($data)
 {
     global $aidlink, $locale;
     if (isset($_POST['preview'])) {
         if (\defender::safe()) {
             echo openmodal("cp_preview", $locale['429']);
             echo "<h3>" . $data['page_title'] . "</h3>\n";
             if (fusion_get_settings("allow_php_exe")) {
                 ob_start();
                 eval("?>" . stripslashes($_POST['page_content']) . "<?php ");
                 $eval = ob_get_contents();
                 ob_end_clean();
                 echo $eval;
             } else {
                 echo "<p>" . nl2br(parse_textarea($_POST['page_content'])) . "</p>\n";
             }
             echo closemodal();
         }
         $data = array('page_id' => form_sanitizer($_POST['page_id'], 0, 'page_id'), 'link_id' => form_sanitizer($_POST['link_id'], 0, 'link_id'), 'link_order' => form_sanitizer($_POST['link_order'], 0, 'link_order'), 'page_link_cat' => form_sanitizer($_POST['page_link_cat'], 0, 'page_link_cat'), 'page_title' => form_sanitizer($_POST['page_title'], '', 'page_title'), 'page_access' => form_sanitizer($_POST['page_access'], 0, 'page_access'), 'page_content' => form_sanitizer($_POST['page_content'], "", "page_content"), 'page_keywords' => form_sanitizer($_POST['page_keywords'], '', 'page_keywords'), 'page_language' => implode('.', isset($_POST['page_language']) ? sanitize_array($_POST['page_language']) : array()), 'page_allow_comments' => isset($_POST['page_allow_comments']) ? 1 : 0, 'page_allow_ratings' => isset($_POST['page_allow_ratings']) ? 1 : 0);
     }
     echo openform('inputform', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
     if (isset($_POST['edit']) && isset($_POST['page_id'])) {
         echo form_hidden('edit', '', 'edit');
     }
     echo "<div class='row m-t-20' >\n";
     echo "<div class='col-xs-12 col-sm-8'>\n";
     echo form_text('page_title', $locale['422'], $data['page_title'], array('required' => 1));
     echo form_select('page_keywords', $locale['432'], $data['page_keywords'], array('max_length' => 320, 'width' => '100%', 'tags' => 1, 'multiple' => 1));
     $textArea_config = array('width' => '100%', 'height' => '260px', 'form_name' => 'inputform', 'type' => "html", 'class' => 'm-t-20');
     if (isset($_COOKIE['custom_pages_tinymce']) && $_COOKIE['custom_pages_tinymce'] == 1 && fusion_get_settings('tinymce_enabled')) {
         $textArea_config = array("type" => "tinymce", "tinymce" => "advanced", "class" => "m-t-20");
     }
     echo form_textarea('page_content', '', $data['page_content'], $textArea_config);
     echo "</div>\n";
     echo "<div class='col-xs-12 col-sm-4'>\n";
     openside("");
     echo form_button('save', $locale['430'], $locale['430'], array('class' => 'btn-primary m-r-10 m-t-10'));
     echo form_button('preview', $locale['429'], $locale['429'], array('class' => 'btn-default m-r-10 m-t-10'));
     closeside();
     if (fusion_get_settings('tinymce_enabled')) {
         openside('');
         $val = !isset($_COOKIE['custom_pages_tinymce']) || $_COOKIE['custom_pages_tinymce'] == 0 ? $locale['461'] . " TINYMCE" : $locale['462'] . " TINYMCE";
         echo form_button('tinymce_switch', $val, $val, array('class' => 'btn-default btn-block', 'type' => 'button'));
         add_to_jquery("\n\t\t\t\$('#tinymce_switch').bind('click', function() {\n\t\t\t\tSetTinyMCE(" . (!isset($_COOKIE['custom_pages_tinymce']) || $_COOKIE['custom_pages_tinymce'] == 0 ? 1 : 0) . ");\n\t\t\t});\n\t\t\t");
         closeside();
     }
     if (fusion_get_settings('comments_enabled') == "0" || fusion_get_settings('ratings_enabled') == "0") {
         echo "<div class='tbl2 well'>\n";
         if (fusion_get_settings('comments_enabled') == "0" && fusion_get_settings('ratings_enabled') == "0") {
             $sys = $locale['457'];
         } elseif (fusion_get_settings('comments_enabled') == "0") {
             $sys = $locale['455'];
         } else {
             $sys = $locale['456'];
         }
         echo sprintf($locale['454'], $sys);
         echo "</div>\n";
     }
     if (!$data['page_id']) {
         openside("");
         echo form_checkbox('add_link', $locale['426'], 1);
         echo "<div id='link_add_sel' style='display:none;'>\n";
         echo form_select_tree("page_link_cat", $locale['SL_0029'], $data['page_link_cat'], array("parent_value" => $locale['parent'], 'width' => '100%', 'query' => (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : '') . " link_position >= 2", 'disable_opts' => $data['link_id'], 'hide_disabled' => 1), DB_SITE_LINKS, "link_name", "link_id", "link_cat");
         echo "</div>\n";
         add_to_jquery("\n            var checked = \$('#add_link').is(':checked');\n            if (checked) {\n                \$('#link_add_sel').show();\n            } else {\n                \$('#link_add_sel').hide();\n            }\n            \$('#add_link').bind('click', function(e) {\n                var checked = \$(this).is(':checked');\n                if (checked) {\n                    \$('#link_add_sel').show();\n                } else {\n                    \$('#link_add_sel').hide();\n                }\n            });\n            ");
         closeside();
     }
     openside("");
     echo form_checkbox('page_allow_comments', $locale['427'], $data['page_allow_comments'], array('class' => 'm-b-0'));
     echo form_checkbox('page_allow_ratings', $locale['428'], $data['page_allow_ratings'], array('class' => 'm-b-0'));
     echo form_hidden('link_id', '', $data['link_id']);
     echo form_hidden('link_order', '', $data['link_order']);
     closeside();
     openside();
     if (multilang_table("CP")) {
         $page_lang = !empty($data['page_language']) ? explode('.', $data['page_language']) : array();
         foreach (fusion_get_enabled_languages() as $language => $language_name) {
             $isDisabled = LANGUAGE == $language ? TRUE : FALSE;
             echo form_checkbox('page_language[]', $language_name, in_array($language, $page_lang) ? TRUE : FALSE, array('class' => 'm-b-0', 'value' => $language, 'input_id' => 'page_lang-' . $language, "disabled" => $isDisabled ? TRUE : FALSE, "delimiter" => "."));
             if ($isDisabled) {
                 echo form_hidden("page_language[]", "", $language);
             }
         }
     } else {
         echo form_hidden('page_language', '', $data['page_language']);
     }
     closeside();
     openside();
     echo form_select('page_access', $locale['423'], $data['page_access'], array('options' => fusion_get_groups(), 'width' => '100%'));
     closeside();
     echo "</div></div>\n";
     echo form_hidden('page_id', '', $data['page_id']);
     echo form_button('save', $locale['430'], $locale['430'], array('class' => 'btn-primary m-r-10'));
     if (isset($_POST['edit'])) {
         echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
     }
     echo closeform();
     closetable();
     add_to_jquery("\n\t\t\t\$('#delete').bind('click', function() { confirm('" . $locale['450'] . "'); });\n\t\t\t\$('#save').bind('click', function() {\n\t\t\tvar page_title = \$('#page_title').val();\n\t\t\tif (page_title =='') { alert('" . $locale['451'] . "'); return false; }\n\t\t\t});\n\t\t");
     if (fusion_get_settings('tinymce_enabled')) {
         add_to_jquery("\n\t\t\tfunction SetTinyMCE(val) {\n\t\t\tnow=new Date();\n" . "now.setTime(now.getTime()+1000*60*60*24*365);\n\t\t\texpire=(now.toGMTString());\n" . "document.cookie=\"custom_pages_tinymce=\"+escape(val)+\";expires=\"+expire;\n\t\t\tlocation.href='" . FUSION_SELF . $aidlink . "&section=cp2';\n\t\t\t}\n\t\t    ");
     }
 }
Example #24
0
            echo "<p class='text-bigger'>" . $criteriaArray['article_snippet'] . "</p>";
            echo $criteriaArray['article_article'];
            closetable();
        }
        add_to_title($locale['global_200'] . $locale['articles_0060']);
        echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
        echo "<div class='alert alert-info m-b-20 submission-guidelines'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['articles_0063']) . "</div>\n";
        echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=a");
        echo form_text('article_subject', $locale['articles_0304'], $criteriaArray['article_subject'], array("required" => TRUE, "inline" => TRUE));
        if (multilang_table("AR")) {
            echo form_select('article_language', $locale['global_ML100'], $criteriaArray['article_language'], array("options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose'], "width" => "250px", "inline" => TRUE));
        } else {
            echo form_hidden('article_language', '', $criteriaArray['article_language']);
        }
        echo form_select('article_keywords', $locale['articles_0204'], $criteriaArray['article_keywords'], array("max_length" => 320, "inline" => TRUE, "placeholder" => $locale['articles_0204a'], "width" => "100%", "error_text" => $locale['articles_0204a'], "tags" => TRUE, "multiple" => TRUE));
        echo form_select_tree("article_cat", $locale['articles_0201'], $criteriaArray['article_cat'], array("width" => "250px", "inline" => TRUE, "no_root" => TRUE, "query" => multilang_table("AR") ? "WHERE article_cat_language='" . LANGUAGE . "'" : ""), DB_ARTICLE_CATS, "article_cat_name", "article_cat_id", "article_cat_parent");
        $textArea_opts = array("required" => TRUE, "type" => fusion_get_settings("tinymce_enabled") ? "tinymce" : "html", "tinymce" => fusion_get_settings("tinymce_enabled") && iADMIN ? "advanced" : "simple", "autosize" => TRUE, "form_name" => "submit_form");
        echo form_textarea('article_snippet', $locale['articles_0202'], $criteriaArray['article_snippet'], $textArea_opts);
        $textArea_opts['required'] = $article_settings['article_extended_required'] ? TRUE : FALSE;
        echo form_textarea('article_article', $locale['articles_0203'], $criteriaArray['article_article'], $textArea_opts);
        echo fusion_get_settings("site_seo") ? "" : form_button('preview_article', $locale['articles_0240'], $locale['articles_0240'], array('class' => 'btn-primary m-r-10'));
        echo form_button('submit_article', $locale['articles_0060'], $locale['articles_0060'], array('class' => 'btn-primary'));
        echo closeform();
        echo "</div>\n</div>\n";
    }
} else {
    echo "<div class='well text-center'>\n";
    if (!$cat_exist) {
        echo $locale['articles_0043a'];
    } else {
        echo $locale['articles_0043'];
Example #25
0
 /**
  * Site Links Form
  */
 public function menu_form()
 {
     global $locale, $aidlink;
     fusion_confirm_exit();
     $this->AdminInstance();
     if (isset($_POST['savelink'])) {
         $data = array("link_id" => form_sanitizer($_POST['link_id'], 0, 'link_id'), "link_cat" => form_sanitizer($_POST['link_cat'], 0, 'link_cat'), "link_name" => form_sanitizer($_POST['link_name'], '', 'link_name'), "link_url" => form_sanitizer($_POST['link_url'], '', 'link_url'), "link_icon" => form_sanitizer($_POST['link_icon'], '', 'link_icon'), "link_language" => form_sanitizer($_POST['link_language'], '', 'link_language'), "link_visibility" => form_sanitizer($_POST['link_visibility'], '', 'link_visibility'), "link_position" => form_sanitizer($_POST['link_position'], '', 'link_position'), "link_order" => form_sanitizer($_POST['link_order'], '', 'link_order'));
         if (!$data['link_order']) {
             $data['link_order'] = dbresult(dbquery("SELECT MAX(link_order) FROM " . DB_SITE_LINKS . " " . (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : "WHERE") . " link_cat='" . $data['link_cat'] . "'"), 0) + 1;
         }
         if (\defender::safe()) {
             if (self::verify_edit($data['link_id'])) {
                 dbquery_order(DB_SITE_LINKS, $data['link_order'], "link_order", $data['link_id'], "link_id", $data['link_cat'], "link_cat", multilang_table("SL"), "link_language", "update");
                 dbquery_insert(DB_SITE_LINKS, $data, 'update');
                 addNotice("success", $locale['SL_0016']);
                 redirect(FUSION_SELF . $aidlink . "&amp;link_cat=" . $data['link_cat']);
             } else {
                 dbquery_order(DB_SITE_LINKS, $data['link_order'], "link_order", $data['link_id'], "link_id", $data['link_cat'], "link_cat", multilang_table("SL"), "link_language", "save");
                 dbquery_insert(DB_SITE_LINKS, $data, 'save');
                 addNotice("success", $locale['SL_0015']);
                 redirect(FUSION_SELF . $aidlink . "&amp;link_cat=" . $data['link_cat']);
             }
         }
     }
     echo "<div class='m-t-20'>\n";
     echo openform('linkform', 'post', $this->form_action, array('max_tokens' => 1));
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-12 col-md-8 col-lg-8'>\n";
     echo form_hidden('link_id', '', $this->data['link_id']);
     echo form_text('link_name', $locale['SL_0020'], $this->data['link_name'], array('max_length' => 100, 'required' => TRUE, 'error_text' => $locale['SL_0085'], 'inline' => TRUE));
     echo form_text('link_icon', 'Link Icon', $this->data['link_icon'], array('max_length' => 100, 'inline' => TRUE));
     echo form_text('link_url', $locale['SL_0021'], $this->data['link_url'], array('required' => TRUE, 'error_text' => $locale['SL_0086'], 'inline' => TRUE));
     echo form_text('link_order', $locale['SL_0023'], $this->data['link_order'], array('number' => TRUE, 'class' => 'pull-left', 'inline' => TRUE));
     echo form_select('link_position', $locale['SL_0024'], $this->data['link_position'], array('options' => $this->position_opts, 'inline' => TRUE));
     echo "</div>\n";
     echo "<div class='col-xs-12 col-sm-12 col-md-4 col-lg-4'>\n";
     openside('');
     echo form_select_tree("link_cat", $locale['SL_0029'], $this->data['link_cat'], array('input_id' => 'link_categorys', "parent_value" => $locale['parent'], 'width' => '100%', 'query' => multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "'" : '', 'disable_opts' => $this->data['link_id'], 'hide_disabled' => 1), DB_SITE_LINKS, "link_name", "link_id", "link_cat");
     echo form_select('link_language', $locale['global_ML100'], $this->data['link_language'], array('options' => $this->language_opts, 'placeholder' => $locale['choose'], 'width' => '100%'));
     echo form_select('link_visibility', $locale['SL_0022'], $this->data['link_visibility'], array('options' => self::getVisibility(), 'placeholder' => $locale['choose'], 'width' => '100%'));
     echo form_checkbox('link_window', $locale['SL_0028'], $this->data['link_window']);
     closeside();
     echo "</div>\n";
     echo "</div>\n";
     echo form_button('savelink', $locale['SL_0040'], $locale['SL_0040'], array('class' => 'btn-primary'));
     echo closeform();
     echo "</div>\n";
 }