function showratings($rating_type, $rating_item_id, $rating_link) { global $locale, $userdata; $settings = \fusion_get_settings(); if ($settings['ratings_enabled'] == "1") { if (iMEMBER) { $d_rating = dbarray(dbquery("SELECT rating_vote,rating_datestamp FROM " . DB_RATINGS . " WHERE rating_item_id='" . $rating_item_id . "' AND rating_type='" . $rating_type . "' AND rating_user='******'user_id'] . "'")); if (isset($_POST['post_rating'])) { // Rate if (isnum($_POST['rating']) && $_POST['rating'] > 0 && $_POST['rating'] < 6 && !isset($d_rating['rating_vote'])) { $result = dbquery("INSERT INTO " . DB_RATINGS . " (rating_item_id, rating_type, rating_user, rating_vote, rating_datestamp, rating_ip, rating_ip_type) VALUES ('{$rating_item_id}', '{$rating_type}', '" . $userdata['user_id'] . "', '" . $_POST['rating'] . "', '" . time() . "', '" . USER_IP . "', '" . USER_IP_TYPE . "')"); if ($result) { defender::unset_field_session(); } } redirect($rating_link); } elseif (isset($_POST['remove_rating'])) { // Unrate $result = dbquery("DELETE FROM " . DB_RATINGS . " WHERE rating_item_id='{$rating_item_id}' AND rating_type='{$rating_type}' AND rating_user='******'user_id'] . "'"); if ($result) { defender::unset_field_session(); } redirect($rating_link); } } $ratings = array(5 => $locale['r120'], 4 => $locale['r121'], 3 => $locale['r122'], 2 => $locale['r123'], 1 => $locale['r124']); if (!iMEMBER) { $message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a>", $locale['r104']); if (fusion_get_settings("enable_registration") == TRUE) { $message = str_replace("[RATING_ACTION]", "<a href='" . BASEDIR . "login.php'>" . $locale['login'] . "</a> " . $locale['or'] . " <a href='" . BASEDIR . "register.php'>" . $locale['register'] . "</a>", $locale['r104']); } echo "<div class='text-center'>" . $message . "</div>\n"; } elseif (isset($d_rating['rating_vote'])) { echo "<div class='display-block'>\n"; echo openform('removerating', 'post', $rating_link, array('class' => 'display-block text-center')); echo sprintf($locale['r105'], $ratings[$d_rating['rating_vote']], showdate("longdate", $d_rating['rating_datestamp'])) . "<br /><br />\n"; echo form_button('remove_rating', $locale['r102'], $locale['r102'], array('class' => 'btn-default', 'icon' => 'fa fa-times m-r-10')); echo closeform(); echo "</div>\n"; } else { echo "<div class='display-block'>\n"; echo openform('postrating', 'post', $rating_link, array('max_tokens' => 1, 'notice' => 0, 'class' => 'm-b-20 text-center')); echo form_select('rating', $locale['r106'], '', array('options' => $ratings, 'class' => 'display-block text-center')); echo form_button('post_rating', $locale['r103'], $locale['r103'], array('class' => 'btn-primary btn-sm', 'icon' => 'fa fa-thumbs-up m-r-10')); echo closeform(); echo "</div>\n"; } $rating_votes = dbarray(dbquery("\n\t\tSELECT\n\t\tSUM(IF(rating_vote='5', 1, 0)) as r120,\n\t\tSUM(IF(rating_vote='4', 1, 0)) as r121,\n\t\tSUM(IF(rating_vote='3', 1, 0)) as r122,\n\t\tSUM(IF(rating_vote='2', 1, 0)) as r123,\n\t\tSUM(IF(rating_vote='1', 1, 0)) as r124\n\t\tFROM " . DB_RATINGS . " WHERE rating_type='" . $rating_type . "' and rating_item_id='" . intval($rating_item_id) . "'\n\t\t")); if (!empty($rating_votes)) { echo "<div id='ratings' class='rating_container'>\n"; foreach ($rating_votes as $key => $num) { echo progress_bar($num, $locale[$key], FALSE, '10px', TRUE, FALSE); } echo "</div>\n"; } else { echo "<div class='text-center'>" . $locale['r101'] . "</div>\n"; } } }
function render_admin_login() { global $locale, $aidlink, $userdata, $defender; // TODO: Remove this, add the required styling to acp_styles.css add_to_head("<link rel='stylesheet' href='" . THEMES . "templates/setup_styles.css' type='text/css' />"); echo "<aside class='block-container'>\n"; echo "<div class='block'>\n"; echo "<div class='block-content clearfix' style='font-size:13px;'>\n"; echo "<h6><strong>" . $locale['280'] . "</strong></h6>\n"; echo "<img src='" . IMAGES . "php-fusion-icon.png' class='pf-logo position-absolute' alt='PHP-Fusion'/>"; echo "<p class='fusion-version text-right mid-opacity text-smaller'>" . $locale['version'] . fusion_get_settings('version') . "</p>"; echo "<div class='row m-0'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>"; $form_action = FUSION_SELF . $aidlink == ADMIN . "index.php" . $aidlink ? FUSION_SELF . $aidlink . "&pagenum=0" : FUSION_SELF . "?" . FUSION_QUERY; echo openform('admin-login-form', 'post', $form_action, array('max_tokens' => 1)); openside(''); if (!$defender->safe()) { setNotice('danger', $locale['global_182']); } // Get all notices $notices = getNotices(); echo renderNotices($notices); echo "<div class='m-t-10 clearfix row'>\n"; echo "<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3'>\n"; echo "<div class='pull-right'>\n"; echo display_avatar($userdata, '90px'); echo "</div>\n"; echo "</div>\n<div class='col-xs-9 col-sm-9 col-md-8 col-lg-7'>\n"; echo "<div class='clearfix'>\n"; $label = "<span class='h5 display-inline' style='color: #222'><strong>" . $locale['welcome'] . ", " . $userdata['user_name'] . "</strong><br/>" . getuserlevel($userdata['user_level']) . "</span>"; add_to_head('<style>#admin_password-field .required {display:none}</style>'); echo form_text('admin_password', $label, '', array('callback_check' => 'check_admin_pass', 'placeholder' => $locale['281'], 'autocomplete_off' => 1, 'type' => 'password', 'required' => 1)); echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; closeside(); echo form_button('admin_login', $locale['login'], 'Sign in', array('class' => 'btn-primary btn-block')); echo closeform(); echo "</div>\n</div>\n"; // .col-*, .row echo "</div>\n"; // .block-content echo "</div>\n"; // .block echo "<div class='copyright-note clearfix m-t-10'>" . showcopyright() . "</div>\n"; echo "</aside>\n"; }
function render_admin_login() { global $locale, $aidlink, $userdata; echo "<section class='login-bg'>\n"; echo "<aside class='block-container'>\n"; echo "<div class='block'>\n"; echo "<div class='block-content clearfix' style='font-size:13px;'>\n"; echo "<h6><strong>" . $locale['280'] . "</strong></h6>\n"; echo "<img src='" . IMAGES . "php-fusion-icon.png' class='pf-logo position-absolute' alt='PHP-Fusion'/>"; echo "<p class='fusion-version text-right mid-opacity text-smaller'>" . $locale['version'] . fusion_get_settings('version') . "</p>"; echo "<div class='row m-0'>\n<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>"; $form_action = FUSION_SELF . $aidlink == ADMIN . "index.php" . $aidlink ? FUSION_SELF . $aidlink . "&pagenum=0" : FUSION_SELF . "?" . FUSION_QUERY; // Get all notices $notices = getNotices(); echo renderNotices($notices); echo openform('admin-login-form', 'post', $form_action); openside(''); echo "<div class='m-t-10 clearfix row'>\n"; echo "<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3'>\n"; echo "<div class='pull-right'>\n"; echo display_avatar($userdata, '90px'); echo "</div>\n"; echo "</div>\n<div class='col-xs-9 col-sm-9 col-md-8 col-lg-7'>\n"; echo "<div class='clearfix'>\n"; add_to_head('<style>#admin_password-field .required {display:none}</style>'); echo "<h5><strong>" . $locale['welcome'] . ", " . $userdata['user_name'] . "</strong><br/>" . getuserlevel($userdata['user_level']) . "</h5>"; echo form_text('admin_password', "", "", array('callback_check' => 'check_admin_pass', 'placeholder' => $locale['281'], 'error_text' => $locale['global_182'], 'autocomplete_off' => TRUE, 'type' => 'password', 'required' => TRUE)); echo "</div>\n"; echo "</div>\n"; echo "</div>\n"; closeside(); echo form_button('admin_login', $locale['login'], $locale['login'], array('class' => 'btn-primary btn-block')); echo closeform(); echo "</div>\n</div>\n"; // .col-*, .row echo "</div>\n"; // .block-content echo "</div>\n"; // .block echo "<div class='copyright-note clearfix m-t-10'>" . showcopyright() . "</div>\n"; echo "</aside>\n"; echo "</section>\n"; }
protected function displayRanksForm() { global $aidlink; if (isset($_POST['cancel_rank'])) { redirect(clean_request("", array("rank_id", "ref"), FALSE)); } add_to_footer("<script src='" . FORUM . "admin/admin_rank.js'></script>"); $this->data['rank_language'] = LANGUAGE; $array_apply_normal_opts = array(USER_LEVEL_MEMBER => self::$locale['424'], '104' => self::$locale['425'], USER_LEVEL_ADMIN => self::$locale['426'], USER_LEVEL_SUPER_ADMIN => self::$locale['427']); // Special Select $groups_arr = getusergroups(); $groups_except = array(USER_LEVEL_PUBLIC, USER_LEVEL_MEMBER, USER_LEVEL_ADMIN, USER_LEVEL_SUPER_ADMIN); $group_opts = array(); foreach ($groups_arr as $group) { if (!in_array($group[0], $groups_except)) { $group_opts[$group[0]] = $group[1]; } } $language_opts = fusion_get_enabled_languages(); $this->post_forum_ranks(); $form_action = FUSION_SELF . $aidlink . '§ion=fr'; if (isset($_GET['rank_id']) && isnum($_GET['rank_id'])) { $result = dbquery("SELECT * FROM " . DB_FORUM_RANKS . " WHERE rank_id='" . intval($_GET['rank_id']) . "'"); if (dbrows($result) > 0) { $this->data = dbarray($result); $form_action = FUSION_SELF . $aidlink . "§ion=fr&rank_id=" . $_GET['rank_id']; } else { redirect(clean_request("", array("rank_id", "ref"), FALSE)); } } $html = openform('rank_form', 'post', $form_action, array('class' => 'm-t-20')) . form_text('rank_title', self::$locale['420'], $this->data['rank_title'], array('required' => 1, 'error_text' => self::$locale['414'], "inline" => TRUE)) . form_select('rank_image', self::$locale['421'], $this->data['rank_image'], array('options' => $this->get_rank_images(), 'placeholder' => self::$locale['choose'], "inline" => TRUE)); if (multilang_table("FR")) { $html .= form_select('rank_language', self::$locale['global_ML100'], $this->data['rank_language'], array('options' => $language_opts, 'placeholder' => self::$locale['choose'], "inline" => TRUE)); } else { $html .= form_hidden('rank_language', '', $this->data['rank_language']); } $html .= form_checkbox('rank_type', self::$locale['429'], $this->data['rank_type'], array("options" => array(2 => self::$locale['429a'], 1 => self::$locale['429b'], 0 => self::$locale['429c']), "type" => "radio", "inline" => TRUE)) . form_text('rank_posts', self::$locale['422'], $this->data['rank_posts'], array('inline' => TRUE, 'type' => 'number', 'width' => '10%', 'disabled' => $this->data['rank_type'] != 0)) . "<span id='select_normal' " . ($this->data['rank_type'] == 2 ? "class='display-none'" : "") . " >" . form_select('rank_apply_normal', self::$locale['423'], $this->data['rank_apply'], array('options' => $array_apply_normal_opts, 'placeholder' => self::$locale['choose'], "inline" => TRUE)) . "</span>\n<span id='select_special'" . ($this->data['rank_type'] != 2 ? " class='display-none'" : "") . ">" . form_select('rank_apply_special', self::$locale['423'], $this->data['rank_apply'], array('options' => $group_opts, 'placeholder' => self::$locale['choose'], "inline" => TRUE)) . "</span>\n" . form_button('save_rank', self::$locale['428'], self::$locale['428'], array('class' => 'btn-primary m-r-10')) . form_button('cancel_rank', self::$locale['cancel'], self::$locale['cancel'], array('class' => 'btn-default')) . closeform(); return $html; /* echo "<td class='tbl'><strong>".self::$locale['429']."</strong></td>\n"; echo "<td class='tbl'>\n"; echo "<label><input type='radio' name='rank_type' value='2'".($rank_type == 2 ? " checked='checked'" : "")." /> ".self::$locale['429a']."</label>\n"; echo "<label><input type='radio' name='rank_type' value='1'".($rank_type == 1 ? " checked='checked'" : "")." /> ".self::$locale['429b']."</label>\n"; echo "<label><input type='radio' name='rank_type' value='0'".($rank_type == 0 ? " checked='checked'" : "")." /> ".self::$locale['429c']."</label>\n"; echo "</td>\n"; echo "</tr>\n<tr>\n"; */ }
function forum_newtopic() { global $settings, $locale; if (isset($_POST['select_forum'])) { $_POST['forum_sel'] = isset($_POST['forum_sel']) && isnum($_POST['forum_sel']) ? $_POST['forum_sel'] : 0; redirect(FORUM . 'post.php?action=newthread&forum_id=' . $_POST['forum_sel']); } echo openmodal('newtopic', $locale['forum_0057'], array('button_id' => 'newtopic', 'class' => 'modal-md')); $index = dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'); $result = dbquery("SELECT a.forum_id, a.forum_name, b.forum_name as forum_cat_name, a.forum_post\n\t\t FROM " . DB_FORUMS . " a\n\t\t LEFT JOIN " . DB_FORUMS . " b ON a.forum_cat=b.forum_id\n\t\t WHERE " . groupaccess('a.forum_access') . " " . (multilang_table("FO") ? "AND a.forum_language='" . LANGUAGE . "' AND" : "AND") . "\n\t\t (a.forum_type ='2' or a.forum_type='4') AND a.forum_post < " . USER_LEVEL_PUBLIC . " AND a.forum_lock !='1' ORDER BY a.forum_cat ASC, a.forum_branch ASC, a.forum_name ASC"); $options = array(); if (dbrows($result) > 0) { while ($data = dbarray($result)) { $depth = get_depth($index, $data['forum_id']); if (checkgroup($data['forum_post'])) { $options[$data['forum_id']] = str_repeat("—", $depth) . $data['forum_name'] . " " . ($data['forum_cat_name'] ? "(" . $data['forum_cat_name'] . ")" : ''); } } echo "<div class='well clearfix m-t-10'>\n"; echo form_select('forum_sel', $locale['forum_0395'], '', array('options' => $options, 'inline' => 1, 'width' => '100%')); echo "<div class='display-inline-block col-xs-12 col-sm-offset-3'>\n"; echo form_button('select_forum', $locale['forum_0396'], 'select_forum', array('class' => 'btn-primary btn-sm')); echo "</div>\n"; echo "</div>\n"; echo closeform(); } else { echo "<div class='well text-center'>\n"; echo $locale['forum_0328']; echo "</div>\n"; } echo closemodal(); }
/** * 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&forum_id=' . $forum_data['forum_id'] . '&parent_id=' . $forum_data['forum_cat'], 'title' => $forum_data['forum_name'])); add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php?viewforum&forum_id=' . $forum_data['forum_id'] . '&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&forum_id=" . intval($post_data['forum_id']) . "&parent_id=" . intval($post_data['forum_cat']) . "&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&forum_id=" . intval($post_data['forum_id']) . "&parent_id=" . intval($post_data['forum_cat']) . "&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'); } }
public function render_edit_form() { $thread = $this->thread(); $thread_info = $thread->get_threadInfo(); $thread_data = $thread_info['thread']; $forum_settings = $this->get_forum_settings(); $locale = fusion_get_locale("", FORUM_LOCALE); $locale += fusion_get_locale("", FORUM_TAGS_LOCALE); $userdata = fusion_get_userdata(); if ((!iMOD or !iSUPERADMIN) && $thread_data['thread_locked']) { redirect(INFUSIONS . 'forum/index.php'); } if (isset($_GET['post_id']) && isnum($_GET['post_id'])) { add_to_title($locale['global_201'] . $locale['forum_0503']); add_breadcrumb(array('link' => '', 'title' => $locale['forum_0503'])); $result = dbquery("SELECT tp.*, tt.thread_subject, tt.thread_poll, tt.thread_author, tt.thread_locked, MIN(tp2.post_id) AS first_post\n\t\t\t\tFROM " . DB_FORUM_POSTS . " tp\n\t\t\t\tINNER JOIN " . DB_FORUM_THREADS . " tt on tp.thread_id=tt.thread_id\n\t\t\t\tINNER JOIN " . DB_FORUM_POSTS . " tp2 on tp.thread_id=tp2.thread_id\n\t\t\t\tWHERE tp.post_id='" . intval($_GET['post_id']) . "' AND tp.thread_id='" . intval($thread_data['thread_id']) . "' AND tp.forum_id='" . intval($thread_data['forum_id']) . "'\n\t\t\t\tGROUP BY tp2.post_id\n\t\t\t\t"); // Permission to edit if (dbrows($result) > 0) { $post_data = dbarray($result); if ((iMOD or iSUPERADMIN) || $thread->getThreadPermission("can_reply") && $post_data['post_author'] == $userdata['user_id']) { $is_first_post = $post_data['post_id'] == $thread_info['post_firstpost'] ? TRUE : FALSE; // no edit if locked if ($post_data['post_locked'] && !iMOD) { redirect(FORUM . "postify.php?post=edit&error=5&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "&post_id=" . $post_data['post_id']); } // no edit if time limit reached if (!iMOD && ($forum_settings['forum_edit_timelimit'] > 0 && time() - $forum_settings['forum_edit_timelimit'] * 60 > $post_data['post_datestamp'])) { redirect(FORUM . "postify.php?post=edit&error=6&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "&post_id=" . $post_data['post_id']); } // execute form post actions if (isset($_POST['post_edit'])) { require_once INCLUDES . "flood_include.php"; if (!flood_control("post_datestamp", DB_FORUM_POSTS, "post_author='" . $userdata['user_id'] . "'")) { // have notice $post_data = array('forum_id' => $thread_data['forum_id'], 'thread_id' => $thread_data['thread_id'], 'post_id' => $post_data['post_id'], 'thread_subject' => '', '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']) ? 1 : 0, 'post_author' => $userdata['user_id'], 'post_datestamp' => $post_data['post_datestamp'], 'post_ip' => USER_IP, 'post_ip_type' => USER_IP_TYPE, 'post_edituser' => $userdata['user_id'], 'post_edittime' => isset($_POST['hide_edit']) ? 0 : time(), 'post_editreason' => form_sanitizer($_POST['post_editreason'], '', 'post_editreason'), 'post_hidden' => 0, 'notify_me' => 0, 'post_locked' => $forum_settings['forum_edit_lock'] || isset($_POST['post_locked']) ? 1 : 0); // require thread_subject if first post if ($is_first_post) { $post_data['thread_subject'] = form_sanitizer($_POST['thread_subject'], '', 'thread_subject'); $current_thread_tags = form_sanitizer($_POST['thread_tags'], '', 'thread_tags'); if ($thread_data['thread_tags'] !== $current_thread_tags) { // Assign the old ones into history $thread_data['thread_tags_old'] = $thread_data['thread_tags']; $thread_data['thread_tags_change'] = time(); } $thread_data['thread_tags'] = $current_thread_tags; $thread_data['thread_subject'] = $post_data['thread_subject']; } $thread_data['thread_sticky'] = isset($_POST['thread_sticky']) ? 1 : 0; if (\defender::safe()) { // If post delete checkbox $this->delete_post($post_data['post_id'], $post_data['thread_id'], $post_data['forum_id']); // Update thread subject if ($is_first_post) { dbquery_insert(DB_FORUM_THREADS, $thread_data, "update", array("keep_session" => TRUE)); } // Prepare forum merging action $last_post_author = dbarray(dbquery("SELECT post_author FROM " . DB_FORUM_POSTS . " WHERE thread_id='" . $thread_data['thread_id'] . "' ORDER BY post_id DESC LIMIT 1")); if ($last_post_author == $post_data['post_author'] && $thread_data['forum_merge']) { $last_message = dbarray(dbquery("SELECT post_id, post_message FROM " . DB_FORUM_POSTS . " WHERE thread_id='" . $thread_data['thread_id'] . "' ORDER BY post_id DESC")); $post_data['post_id'] = $last_message['post_id']; $post_data['post_message'] = $last_message['post_message'] . "\n\n" . $locale['forum_0640'] . " " . showdate("longdate", time()) . ":\n" . $post_data['post_message']; dbquery_insert(DB_FORUM_POSTS, $post_data, 'update', array('primary_key' => 'post_id', 'keep_session' => TRUE)); } else { dbquery_insert(DB_FORUM_POSTS, $post_data, 'update', array('primary_key' => 'post_id', 'keep_session' => TRUE)); } // Delete attachments if there is any foreach ($_POST as $key => $value) { if (!strstr($key, "delete_attach")) { continue; } $key = str_replace("delete_attach_", "", $key); $result = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . $post_data['post_id'] . "' AND attach_id='" . (isnum($key) ? $key : 0) . "'"); if (dbrows($result) != 0 && $value) { $adata = dbarray($result); unlink(FORUM . "attachments/" . $adata['attach_name']); dbquery("DELETE FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . $post_data['post_id'] . "' AND attach_id='" . (isnum($key) ? $key : 0) . "'"); } } if (!empty($_FILES) && is_uploaded_file($_FILES['file_attachments']['tmp_name'][0]) && $thread->getThreadPermission("can_upload_attach")) { $upload = form_sanitizer($_FILES['file_attachments'], '', 'file_attachments'); if ($upload['error'] == 0) { foreach ($upload['target_file'] as $arr => $file_name) { $attachment = array('thread_id' => $thread_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, $attachment, 'save', array('keep_session' => TRUE)); } } } if (\defender::safe()) { redirect(FORUM . "postify.php?post=edit&error=0&forum_id=" . intval($post_data['forum_id']) . "&thread_id=" . intval($post_data['thread_id']) . "&post_id=" . intval($post_data['post_id'])); } } } } // template data $form_action = FORUM . "viewthread.php?action=edit&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "&post_id=" . $_GET['post_id']; // get attachment. $attachments = array(); $attach_rows = 0; if ($thread->getThreadPermission("can_upload_attach") && !empty($thread_info['post_items'][$post_data['post_id']]['post_attachments'])) { // need id $a_result = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . intval($post_data['post_id']) . "' AND thread_id='" . intval($thread_data['thread_id']) . "'"); $attach_rows = dbrows($a_result); if ($attach_rows > 0) { while ($a_data = dbarray($a_result)) { $attachments[] = $a_data; } } } $info = array('title' => $locale['forum_0507'], 'description' => $locale['forum_2000'] . $thread_data['thread_subject'], 'openform' => openform('input_form', 'post', $form_action, array('enctype' => $thread->getThreadPermission("can_upload_attach") ? TRUE : FALSE)), 'closeform' => closeform(), 'forum_id_field' => form_hidden('forum_id', '', $post_data['forum_id']), 'thread_id_field' => form_hidden('thread_id', '', $post_data['thread_id']), 'tags_field' => $is_first_post ? 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)) : '', "forum_field" => "", 'subject_field' => $thread_info['post_firstpost'] == $_GET['post_id'] ? form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => TRUE, 'placeholder' => $locale['forum_2001'], "class" => 'm-t-20 m-b-20')) : form_hidden("thread_subject", "", $thread_data['thread_subject']), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => TRUE, 'autosize' => TRUE, 'no_resize' => TRUE, 'preview' => TRUE, 'form_name' => 'input_form', 'bbcode' => TRUE)), 'delete_field' => form_checkbox('delete', $locale['forum_0624'], '', array('class' => 'm-b-0', 'reverse_label' => TRUE)), 'edit_reason_field' => form_text('post_editreason', $locale['forum_0611'], $post_data['post_editreason'], array('placeholder' => '', 'class' => 'm-t-20 m-b-20')), 'attachment_field' => $thread->getThreadPermission("can_upload_attach") ? form_fileinput('file_attachments[]', $locale['forum_0557'], "", array('input_id' => 'file_attachments', 'upload_path' => FORUM . 'attachments/', 'type' => 'object', 'preview_off' => TRUE, 'multiple' => TRUE, 'max_count' => $attach_rows > 0 ? $forum_settings['forum_attachmax_count'] - $attach_rows : $forum_settings['forum_attachmax_count'], 'valid_ext' => $forum_settings['forum_attachtypes'])) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t <div class='m-b-20'>\n<small>" . 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" => "", '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) && $is_first_post ? 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)) : '', 'hide_edit_field' => form_checkbox('hide_edit', $locale['forum_0627'], !empty($post_data['post_editreason']) && empty($post_data['post_edittime']) ? 1 : 0, array('class' => 'm-b-0', 'reverse_label' => TRUE)), 'post_locked_field' => iMOD || iSUPERADMIN ? form_checkbox('post_locked', $locale['forum_0628'], $post_data['post_locked'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'notify_field' => '', 'post_buttons' => form_button('post_edit', $locale['forum_0504'], $locale['forum_0504'], array('class' => 'btn-primary')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-l-10')), 'last_posts_reply' => ''); $a_info = ''; if (!empty($attachments)) { foreach ($attachments as $a_data) { $a_info .= form_checkbox("delete_attach_" . $a_data['attach_id'], $locale['forum_0625'], 0, array("reverse_label" => TRUE, "ext_tip" => "<a href='" . FORUM . "attachments/" . $a_data['attach_name'] . "'>" . $a_data['attach_name'] . "</a> [" . parsebytesize($a_data['attach_size']) . "]")); } $info['attachment_field'] = $a_info . $info['attachment_field']; } display_forum_postform($info); } else { if (fusion_get_settings("site_seo")) { redirect(fusion_get_settings("siteurl") . "infusions/forum/index.php"); } redirect(FORUM . 'index.php'); // no access } } else { redirect(FORUM . "postify.php?post=edit&error=4&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id'] . "&post_id=" . $_GET['post_id']); } } else { if (fusion_get_settings("site_seo")) { redirect(fusion_get_settings("siteurl") . "infusions/forum/index.php"); } redirect(FORUM . "index.php"); } }
function display_quickReply($info) { $locale = fusion_get_locale("", FORUM_LOCALE); $forum_settings = \PHPFusion\Forums\ForumServer::get_forum_settings(); $userdata = fusion_get_userdata(); $qr_form = "<!--sub_forum_thread-->\n"; $form_url = INFUSIONS . "forum/viewthread.php?thread_id=" . $info['thread_id']; $qr_form .= openform('quick_reply_form', 'post', $form_url, array('class' => 'm-b-20 m-t-20')); $qr_form .= "<h4 class='m-t-20 pull-left'>" . $locale['forum_0168'] . "</h4>\n"; $qr_form .= form_textarea('post_message', $locale['forum_0601'], '', array('bbcode' => true, 'required' => true, 'autosize' => true, 'preview' => true, 'form_name' => 'quick_reply_form')); $qr_form .= "<div class='m-t-10 pull-right'>\n"; $qr_form .= form_button('post_quick_reply', $locale['forum_0172'], $locale['forum_0172'], array('class' => 'btn-primary btn-sm m-r-10')); $qr_form .= "</div>\n"; $qr_form .= "<div class='overflow-hide'>\n"; $qr_form .= form_checkbox('post_smileys', $locale['forum_0169'], '', array('class' => 'm-b-0', 'reverse_label' => TRUE)); if (array_key_exists("user_sig", $userdata) && $userdata['user_sig']) { $qr_form .= form_checkbox('post_showsig', $locale['forum_0170'], '1', array('class' => 'm-b-0', 'reverse_label' => TRUE)); } if ($forum_settings['thread_notify']) { $qr_form .= form_checkbox('notify_me', $locale['forum_0171'], $info['user_tracked'], array('class' => 'm-b-0', 'reverse_label' => TRUE)); } $qr_form .= "</div>\n"; $qr_form .= closeform(); return (string) $qr_form; }
/** * @param $comment_type - abbr or short ID * @param $comment_db - Current Application DB - DB_BLOG for example. * @param $comment_col - current sql primary key column - 'blog_id' for example * @param $comment_item_id - current sql primary key value '$_GET['blog_id']' for example * @param $clink - current page link 'FUSION_SELF' is ok. */ function showcomments($comment_type, $comment_db, $comment_col, $comment_item_id, $clink) { global $settings, $locale, $userdata, $aidlink; $link = FUSION_SELF . (FUSION_QUERY ? "?" . FUSION_QUERY : ""); $link = preg_replace("^(&|\\?)c_action=(edit|delete)&comment_id=\\d*^", "", $link); $_GET['comment'] = isset($_GET['comment']) && isnum($_GET['comment']) ? $_GET['comment'] : 0; $cpp = $settings['comments_per_page']; if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "delete") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $_GET['comment_id'] . "' AND comment_name='" . $userdata['user_id'] . "'")) { $result = dbquery("DELETE FROM " . DB_COMMENTS . "\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "'" . (iADMIN ? "" : "\n\t\t\t\tAND comment_name='" . $userdata['user_id'] . "'")); } redirect($clink . ($settings['comments_sorting'] == "ASC" ? "" : "&c_start=0")); } if ($settings['comments_enabled'] == "1") { if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) { if (!iMEMBER && $settings['guestpost'] == 1) { if (!isset($_POST['comment_name'])) { redirect($link); } if (isnum($_POST['comment_name'])) { $_POST['comment_name'] = ''; } $_CAPTCHA_IS_VALID = FALSE; include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_check.php"; if (!isset($_POST['captcha_code']) || $_CAPTCHA_IS_VALID == FALSE) { redirect($link); } } $comment_data = array('comment_id' => isset($_GET['comment_id']) && isnum($_GET['comment_id']) ? $_GET['comment_id'] : 0, 'comment_name' => iMEMBER ? $userdata['user_id'] : form_sanitizer($_POST['comment_name'], '', 'comment_name'), 'comment_message' => form_sanitizer($_POST['comment_message'], '', 'comment_message'), 'comment_datestamp' => time(), 'comment_item_id' => $comment_item_id, 'comment_type' => $comment_type, 'comment_cat' => 0, 'comment_ip' => USER_IP, 'comment_ip_type' => USER_IP_TYPE, 'comment_hidden' => 0); if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && $comment_data['comment_id']) { $comment_updated = FALSE; if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $comment_data['comment_id'] . "' \n\t\t\t\tAND comment_item_id='" . $comment_item_id . "'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tAND comment_type='" . $comment_type . "' \n\t\t\t\tAND comment_name='" . $userdata['user_id'] . "' \n\t\t\t\tAND comment_hidden='0'")) { dbquery_insert(DB_COMMENTS, $comment_data, 'update'); if ($comment_data['comment_message']) { $result = dbquery("UPDATE " . DB_COMMENTS . " SET comment_message='" . $comment_data['comment_message'] . "'\n \t\t\t\t\t\t\t\t\t WHERE comment_id='" . $_GET['comment_id'] . "' " . (iADMIN ? "" : "AND comment_name='" . $userdata['user_id'] . "'")); if ($result) { $comment_updated = TRUE; } } } if ($comment_updated) { if ($settings['comments_sorting'] == "ASC") { $c_operator = "<="; } else { $c_operator = ">="; } $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_id" . $c_operator . "'" . $comment_data['comment_id'] . "'\n\t\t\t\t\t\t\t\tAND comment_item_id='" . $comment_item_id . "'\n\t\t\t\t\t\t\t\tAND comment_type='" . $comment_type . "'"); $c_start = (ceil($c_count / $cpp) - 1) * $cpp; } redirect($clink . "&c_start=" . (isset($c_start) && isnum($c_start) ? $c_start : "")); } else { if (!dbcount("(" . $comment_col . ")", $comment_db, $comment_col . "='" . $comment_item_id . "'")) { redirect(BASEDIR . "index.php"); } $id = 0; if ($comment_data['comment_name'] && $comment_data['comment_message']) { require_once INCLUDES . "flood_include.php"; if (!flood_control("comment_datestamp", DB_COMMENTS, "comment_ip='" . USER_IP . "'")) { dbquery_insert(DB_COMMENTS, $comment_data, 'save'); $id = dblastid(); } } if ($settings['comments_sorting'] == "ASC") { $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "'"); $c_start = (ceil($c_count / $cpp) - 1) * $cpp; } else { $c_start = 0; } //if (!$settings['site_seo']) { redirect($clink . "&c_start=" . $c_start . "#c" . $id); //} } } $c_arr = array("c_con" => array(), "c_info" => array("c_makepagenav" => FALSE, "admin_link" => FALSE)); $c_rows = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'"); if (!isset($_GET['c_start']) && $c_rows > $cpp) { $_GET['c_start'] = (ceil($c_rows / $cpp) - 1) * $cpp; } if (!isset($_GET['c_start']) || !isnum($_GET['c_start'])) { $_GET['c_start'] = 0; } $result = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcm.comment_datestamp,\n\t\t\t\t\ttcu.user_id, tcu.user_name, tcu.user_avatar, tcu.user_status\n\t\t\t\t\tFROM " . DB_COMMENTS . " tcm\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n\t\t\t\t\tWHERE comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'\n\t\t\t\t\tORDER BY comment_datestamp " . $settings['comments_sorting'] . " LIMIT " . $_GET['c_start'] . "," . $cpp); if (dbrows($result) > 0) { $i = $settings['comments_sorting'] == "ASC" ? $_GET['c_start'] + 1 : $c_rows - $_GET['c_start']; if ($c_rows > $cpp) { $c_arr['c_info']['c_makepagenav'] = makepagenav($_GET['c_start'], $cpp, $c_rows, 3, $clink . "&", "c_start"); } while ($data = dbarray($result)) { $c_arr['c_con'][$i]['comment_id'] = $data['comment_id']; $c_arr['c_con'][$i]['edit_dell'] = FALSE; $c_arr['c_con'][$i]['i'] = $i; if ($data['user_name']) { $c_arr['c_con'][$i]['comment_name'] = profile_link($data['comment_name'], $data['user_name'], $data['user_status'], 'strong text-dark'); } else { $c_arr['c_con'][$i]['comment_name'] = $data['comment_name']; } $c_arr['c_con'][$i]['user_avatar'] = display_avatar($data, '35px', '', true, 'img-rounded'); $c_arr['c_con'][$i]['user'] = array('user_id' => $data['user_id'], 'user_name' => $data['user_name'], 'user_avatar' => $avatar = $data['user_avatar'] !== '' && file_exists(IMAGES . 'avatars/' . $data['user_avatar']) ? IMAGES . 'avatars/' . $data['user_avatar'] : IMAGES . "avatars/noavatar50.png", 'user_status' => $data['user_status']); $c_arr['c_con'][$i]['comment_datestamp'] = showdate('shortdate', $data['comment_datestamp']); $c_arr['c_con'][$i]['comment_time'] = timer($data['comment_datestamp']); $c_arr['c_con'][$i]['comment_message'] = "<!--comment_message-->\n" . nl2br(parseubb(parsesmileys($data['comment_message']))); if (iADMIN && checkrights("C") || iMEMBER && $data['comment_name'] == $userdata['user_id'] && isset($data['user_name'])) { $edit_link = clean_request('c_action=edit&comment_id=' . $data['comment_id'], array('c_action', 'comment_id'), false) . "#edit_comment"; $delete_link = clean_request('c_action=delete&comment_id=' . $data['comment_id'], array('c_action', 'comment_id'), false); $c_arr['c_con'][$i]['edit_link'] = array('link' => $edit_link, 'name' => $locale['c108']); $c_arr['c_con'][$i]['delete_link'] = array('link' => $delete_link, 'name' => $locale['c109']); $c_arr['c_con'][$i]['edit_dell'] = "<!--comment_actions-->\n"; $c_arr['c_con'][$i]['edit_dell'] .= "<div class='btn-group'>"; $c_arr['c_con'][$i]['edit_dell'] .= "<a class='btn btn-xs btn-default' href='" . $edit_link . "'>"; $c_arr['c_con'][$i]['edit_dell'] .= $locale['c108'] . "</a>\n"; $c_arr['c_con'][$i]['edit_dell'] .= "<a class='btn btn-xs btn-default' href='" . $delete_link . "' onclick=\"return confirm('" . $locale['c110'] . "');\">"; $c_arr['c_con'][$i]['edit_dell'] .= "<i class='fa fa-trash'></i> " . $locale['c109'] . "</a>"; $c_arr['c_con'][$i]['edit_dell'] .= "</div>\n"; } $settings['comments_sorting'] == "ASC" ? $i++ : $i--; } if (iADMIN && checkrights("C")) { $c_arr['c_info']['admin_link'] = "<!--comment_admin-->\n"; $c_arr['c_info']['admin_link'] .= "<a href='" . ADMIN . "comments.php" . $aidlink . "&ctype=" . $comment_type . "&comment_item_id=" . $comment_item_id . "'>" . $locale['c106'] . "</a>"; } } opentable($locale['c102']); $comment_message = ""; if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { $eresult = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcu.user_name\n\t\t\t\tFROM " . DB_COMMENTS . " tcm\n\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "' AND comment_item_id='" . $comment_item_id . "'\n\t\t\t\tAND comment_type='" . $comment_type . "' AND comment_hidden='0'"); if (dbrows($eresult) > 0) { $edata = dbarray($eresult); if (iADMIN && checkrights("C") || iMEMBER && $edata['comment_name'] == $userdata['user_id'] && isset($edata['user_name'])) { $clink .= "&c_action=edit&comment_id=" . $edata['comment_id']; $comment_message = $edata['comment_message']; } } else { $comment_message = ""; } } if (iMEMBER || $settings['guestposts'] == "1") { require_once INCLUDES . "bbcode_include.php"; echo "<a id='edit_comment' name='edit_comment'></a>\n"; echo openform('inputform', 'post', $clink, array('class' => 'm-b-20', 'max_tokens' => 1)); if (iGUEST) { echo form_text('comment_name', $locale['c104'], '', array('max_length' => 30)); } echo form_textarea('comment_message', '', $comment_message, array('required' => 1, 'autosize' => 1, 'form_name' => 'inputform', 'bbcode' => 1)); if (iGUEST && (!isset($_CAPTCHA_HIDE_INPUT) || isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT)) { $_CAPTCHA_HIDE_INPUT = FALSE; echo "<div style='width:360px; margin:10px auto;'>"; echo $locale['global_150'] . "<br />\n"; include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_display.php"; if (!$_CAPTCHA_HIDE_INPUT) { echo "<br />\n<label for='captcha_code'>" . $locale['global_151'] . "</label>"; echo "<br />\n<input type='text' id='captcha_code' name='captcha_code' class='textbox' autocomplete='off' style='width:100px' />\n"; } echo "</div>\n"; } echo form_button('post_comment', $comment_message ? $locale['c103'] : $locale['c102'], $comment_message ? $locale['c103'] : $locale['c102'], array('class' => 'btn-success m-t-10')); echo closeform(); } else { echo "<div class='well'>\n"; echo $locale['c105'] . "\n"; echo "</div>\n"; } closetable(); echo "<a id='comments' name='comments'></a>"; render_comments($c_arr['c_con'], $c_arr['c_info']); } }
/** * 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 . "§ion=cp2';\n\t\t\t}\n\t\t "); } }
/** * Mood should be present. * Static calls for caching, so only single query * Label parsing * @return string */ public function display_mood_buttons() { $html = openform('mood_form-' . $this->post_id, 'post', FUSION_REQUEST . "#post_" . $this->post_id); $mood_cache = $this->cache_mood(); if (!empty($mood_cache)) { foreach ($mood_cache as $mood_id => $mood_data) { //jQuery data model for ajax $html .= form_hidden('post_author', '', $this->post_author); $html .= form_hidden('post_id', '', $this->post_id); if (!$this->mood_exists($this->post_author, $mood_id, $this->post_id)) { // Post Button $html .= "<button name='post_mood' id='" . $this->post_id . "-{$mood_id}' class='btn btn-sm btn-default m-r-5' data-mood='{$mood_id}' data-post='{$this->post_id}' value='" . $mood_id . "'>" . (!empty($mood_data['mood_icon']) ? "<i class='" . $mood_data['mood_icon'] . "'></i>" : "") . QuantumFields::parse_label($mood_data['mood_name']) . "</button>"; } else { // Unpost Button $html .= "<button name='unpost_mood' id='" . $this->post_id . "-{$mood_id}' class='btn btn-sm btn-default active m-r-5' data-mood='{$mood_id}' data-post='{$this->post_id}' value='" . $mood_id . "'>" . (!empty($mood_data['mood_icon']) ? "<i class='" . $mood_data['mood_icon'] . "'></i>" : "") . QuantumFields::parse_label($mood_data['mood_name']) . "</button>"; } } } $html .= closeform(); return (string) $html; }
/** * Language switcher function * Icon - True or False (True = Icon mode, False = Dropdown Selector) */ function lang_switcher($icon = TRUE) { global $locale; $enabled_languages = fusion_get_enabled_languages(); if (count($enabled_languages) <= 1) { return; } openside($locale['global_ML102']); echo "<h5><strong>" . $locale['UM101'] . "</strong></h5>\n"; if ($icon) { $language_switch = fusion_get_language_switch(); if (!empty($language_switch)) { $row = 0; foreach ($language_switch as $folder => $langData) { $icon = "<img class='display-block img-responsive' alt='" . $langData['language_name'] . "' src='" . $langData['language_icon'] . "' title='" . $langData['language_name'] . "' style='min-width:20px;'/>\n"; if ($folder != LANGUAGE) { $icon = "<a class='side pull-left display-block' href='" . $langData['language_link'] . "'>" . $icon . "</a>\n "; } echo ($row > 0 and $row % 4 === 0) ? '<br />' : ''; echo "<div class='display-inline-block clearfix'>\n" . $icon . "</div>\n"; $row++; } } } else { include_once INCLUDES . "translate_include.php"; echo openform('lang_menu_form', 'post', FUSION_SELF, array('max_tokens' => 1)); echo form_select('lang_menu', '', fusion_get_settings('locale'), array("options" => fusion_get_enabled_languages(), "width" => "100%")); echo closeform(); add_to_jquery("\n\t\t\tfunction showflag(item){\n\t\t\t\treturn '<div class=\"clearfix\" style=\"width:100%; padding-left:10px;\"><img style=\"height:20px; margin-top:3px !important;\" class=\"img-responsive pull-left\" src=\"" . LOCALE . "' + item.text + '/'+item.text + '-s.png\"/><span class=\"p-l-10\">'+ item.text +'</span></div>';\n\t\t\t}\n\t\t\t\$('#lang_menu').select2({\n\t\t\tplaceholder: 'Switch Language',\n\t\t\tformatSelection: showflag,\n\t\t\tescapeMarkup: function(m) { return m; },\n\t\t\tformatResult: showflag,\n\t\t\t}).bind('change', function(item) {\n\t\t\t\twindow.location.href = '" . FUSION_REQUEST . "?lang='+\$(this).val();\n\t\t\t});\n\t\t"); } closeside(); }
/** * Septenary Header */ public function displayHeader() { global $aidlink; $userdata = fusion_get_userdata(); $locale = self::$locale; echo "<header id='top'>"; echo "<div class='overlay'>\n"; $this->open_grid('section-1', 1); echo "<div class='row hidden-xs'>\n"; echo "<div id='logo' class='hidden-xs hidden-md col-lg-3 p-t-5 text-smaller'>\n</div>\n"; echo "<div class='col-xs-12 col-md-9 col-lg-9 text-right clearfix'>\n"; echo "<div class='display-inline-block' style='width:30%; float:right;'>\n"; echo openform('searchform', 'post', BASEDIR . 'search.php?stype=all', array('class' => 'm-b-10')); echo form_text('stext', '', '', array('placeholder' => $locale['sept_006'], 'append_button' => TRUE, 'append_type' => "submit", "append_form_value" => $locale['sept_006'], "append_value" => "<i class='fa fa-search'></i> " . $locale['sept_006'], "append_button_name" => "search", 'class' => 'no-border m-b-0')); echo closeform(); echo "</div>\n"; echo "<ul id='head_nav' class='display-inline-block'>\n"; $language_opts = ''; if (count(fusion_get_enabled_languages()) > 1) { $language_opts = "<li class='dropdown'>\n"; $language_opts .= "<a class='dropdown-toggle pointer' data-toggle='dropdown' title='" . fusion_get_locale('UM101') . "'><i class='fa fa-globe fa-lg'></i> " . translate_lang_names(LANGUAGE) . " <span class='caret'></span></a>\n"; $language_opts .= "<ul class='dropdown-menu' role='menu'>\n"; $language_switch = fusion_get_language_switch(); if (!empty($language_switch)) { foreach ($language_switch as $folder => $langData) { $language_opts .= "<li class='text-left'><a href='" . $langData['language_link'] . "'>\n"; $language_opts .= "<img alt='" . $langData['language_name'] . "' class='m-r-5' src='" . $langData['language_icon_s'] . "'/>\n"; $language_opts .= $langData['language_name']; $language_opts .= "</a></li>\n"; } } $language_opts .= "</ul>\n"; $language_opts .= "</li>\n"; } if (!iMEMBER) { echo "<li><a href='" . BASEDIR . "login.php'>" . $locale['sept_001'] . "</a></li>\n"; if (fusion_get_settings("enable_registration")) { echo "<li><a href='" . BASEDIR . "register.php'>" . $locale['sept_002'] . "</a></li>\n"; } echo $language_opts; } else { if (iADMIN) { echo "<li>\n<a href='" . ADMIN . $aidlink . "&pagenum=0'>" . $locale['sept_003'] . "</a>\n</li>\n"; } echo "<li>\n<a href='" . BASEDIR . "profile.php?lookup=" . $userdata['user_id'] . "'>" . $locale['sept_004'] . "</a>\n</li>\n"; echo $language_opts; echo "<li>\n<a href='" . BASEDIR . "index.php?logout=yes'>" . $locale['sept_005'] . "</a></li>\n"; } echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; $this->close_grid(1); $this->open_grid('section-2', 1); echo "<div class='header-nav'>\n"; echo showsublinks('') . "\n"; echo "</div>\n"; $this->close_grid(); echo "</div>\n"; $this->display_Showcase(); echo "</header>\n"; }
function user_posts_migrate_console() { global $aidlink, $locale; $result = dbquery("SELECT user_id, user_name FROM " . DB_USERS . ""); if (dbrows($result) > 0) { while ($user_data = dbarray($result)) { $data[$user_data['user_id']] = "" . $user_data['user_name'] . ""; } } else { $data['0'] = $locale['124']; } echo openform('inputform', 'post', "" . FUSION_SELF . $aidlink . "", array('max_tokens' => 1)); echo "<table style='width:100%' class='table table-striped'>\n"; echo "<thead>\n"; echo "<tr style='height:30px;'><th style='width:33%; text-align:left'>" . $locale['125'] . "</th><th style='width:33%; text-align:left;'>" . $locale['126'] . "</th><th class='text-left'> </th>\n</tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; echo "<tr>\n"; echo "<td>\n"; echo form_user_select('user_primary', '', isset($_POST['user_primary']) && isnum($_POST['user_primary'] ?: ''), array('placeholder' => $locale['127'])); echo "</td>\n"; echo "<td>\n"; echo form_user_select('user_migrate', '', isset($_POST['user_migrate']) && isnum($_POST['user_migrate'] ?: ''), array('placeholder' => $locale['128'])); echo "</td>\n"; echo "<td>\n"; echo form_button('migrate', $locale['129'], $locale['129'], array('inline' => '1', 'class' => 'btn btn-sm btn-primary')); echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>" . $locale['130'] . "</td>"; echo "<td colspan='2'>\n"; echo "<input type='checkbox' name='comments' value='1' " . (isset($_POST['comments']) == '1' ? 'checked' : '') . "> " . $locale['132'] . "<br />"; echo "<input type='checkbox' name='ratings' value='1' " . (isset($_POST['ratings']) == '1' ? 'checked' : '') . "> " . $locale['133'] . "<br />"; echo "<input type='checkbox' name='polls' value='1' " . (isset($_POST['polls']) == '1' ? 'checked' : '') . "> " . $locale['134'] . "<br />"; echo "<input type='checkbox' name='messages' value='1' " . (isset($_POST['messages']) == '1' ? 'checked' : '') . "> " . $locale['136'] . "<br />"; echo "<input type='checkbox' name='user_level' value='1' " . (isset($_POST['user_level']) == '1' ? 'checked' : '') . "> " . $locale['142'] . "<br />"; if (db_exists(DB_FORUMS)) { echo "<input type='checkbox' name='forum' value='1' " . (isset($_POST['forum']) == '1' ? 'checked' : '') . "> " . $locale['131'] . "<br />\n"; } if (db_exists(DB_ARTICLES)) { echo "<input type='checkbox' name='articles' value='1' " . (isset($_POST['articles']) == '1' ? 'checked' : '') . "> " . $locale['137'] . "<br />"; } if (db_exists(DB_NEWS)) { echo "<input type='checkbox' name='news' value='1' " . (isset($_POST['news']) == '1' ? 'checked' : '') . "> " . $locale['138'] . "<br />"; } if (db_exists(DB_BLOG)) { echo "<input type='checkbox' name='blog' value='1' " . (isset($_POST['blog']) == '1' ? 'checked' : '') . "> " . $locale['139'] . "<br />"; } if (db_exists(DB_DOWNLOADS)) { echo "<input type='checkbox' name='downloads' value='1' " . (isset($_POST['downloads']) == '1' ? 'checked' : '') . "> " . $locale['140'] . "<br />"; } if (db_exists(DB_PHOTOS)) { echo "<input type='checkbox' name='photos' value='1' " . (isset($_POST['photos']) == '1' ? 'checked' : '') . "> " . $locale['141'] . "<br />"; } $shoutbox = dbcount("(inf_id)", DB_INFUSIONS, "inf_folder='shoutbox_panel'"); if ($shoutbox > 0) { echo "<input type='checkbox' name='shoutbox' value='1' " . (isset($_POST['shoutbox']) == '1' ? 'checked' : '') . "> " . $locale['135'] . "<br />"; } echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>" . $locale['143'] . "</td>"; echo "<td colspan='3'>\n"; echo "<input type='checkbox' name='del_user' value='1'> " . $locale['144'] . "<br /> " . $locale['145'] . "\n"; echo "</td>\n"; echo "</tr>\n"; echo "</tbody>\n"; echo "</table>\n"; echo closeform(); }
protected function displayTagForm() { global $aidlink; if (isset($_POST['cancel_tag'])) { redirect(clean_request("", array("tag_id", "ref"), FALSE)); } $this->data['rank_language'] = LANGUAGE; // Special Select $groups_arr = getusergroups(); $groups_except = array(USER_LEVEL_PUBLIC, USER_LEVEL_MEMBER, USER_LEVEL_ADMIN, USER_LEVEL_SUPER_ADMIN); $group_opts = array(); foreach ($groups_arr as $group) { if (!in_array($group[0], $groups_except)) { $group_opts[$group[0]] = $group[1]; } } $language_opts = fusion_get_enabled_languages(); $this->post_tags(); $form_action = FUSION_SELF . $aidlink . '&section=ft&ref=tag_form'; if (isset($_GET['tag_id']) && isnum($_GET['tag_id'])) { $result = dbquery("SELECT * FROM " . DB_FORUM_TAGS . " WHERE tag_id='" . intval($_GET['tag_id']) . "'"); if (dbrows($result) > 0) { $this->data = dbarray($result); $form_action = FUSION_SELF . $aidlink . "&section=ft&ref=tag_form&tag_id=" . $_GET['tag_id']; } else { redirect(clean_request("", array("rank_id", "ref"), FALSE)); } } $button_locale = $this->data['tag_id'] ? self::$locale['forum_tag_0208'] : self::$locale['forum_tag_0207']; $html = openform('tag_form', 'post', $form_action, array('class' => 'm-t-20')) . form_text('tag_title', self::$locale['forum_tag_0200'], $this->data['tag_title'], array('required' => 1, 'error_text' => self::$locale['414'], "inline" => TRUE)) . form_textarea('tag_description', self::$locale['forum_tag_0201'], $this->data['tag_description'], array('inline' => TRUE, 'type' => 'bbcode', 'autosize' => TRUE, 'preview' => TRUE)) . form_colorpicker('tag_color', self::$locale['forum_tag_0202'], $this->data['tag_color'], array('inline' => TRUE, 'required' => TRUE)); if (multilang_table("FR")) { $html .= form_select('tag_language', self::$locale['forum_tag_0203'], $this->data['tag_language'], array('options' => $language_opts, 'placeholder' => self::$locale['choose'], "inline" => TRUE)); } else { $html .= form_hidden('tag_language', '', $this->data['tag_language']); } $html .= form_checkbox('tag_status', self::$locale['forum_tag_0204'], $this->data['tag_status'], array("options" => array(1 => self::$locale['forum_tag_0205'], 0 => self::$locale['forum_tag_0206']), "type" => "radio", "inline" => TRUE)) . form_button('save_tag', $button_locale, $button_locale, array('class' => 'btn-primary m-r-10')) . form_button('cancel_tag', self::$locale['cancel'], self::$locale['cancel'], array('class' => 'btn-default')) . closeform(); return $html; }
public static function theme_uploader() { global $locale, $aidlink, $defender; if (isset($_POST['upload'])) { require_once INCLUDES . "infusions_include.php"; $src_file = 'theme_files'; $target_folder = THEMES; $valid_ext = '.zip'; $max_size = 5 * 1000 * 1000; $upload = upload_file($src_file, '', $target_folder, $valid_ext, $max_size); if ($upload['error'] != '0') { $defender->stop(); switch ($upload['error']) { case 1: addNotice('danger', sprintf($locale['theme_error_001'], parsebytesize($max_size, 2))); break; case 2: addNotice('danger', $locale['theme_error_002']); break; case 3: addNotice('danger', $locale['theme_error_003']); break; case 4: addNotice('danger', $locale['theme_error_004']); break; default: addNotice('danger', $locale['theme_error_003']); } } else { $target_file = $target_folder . $upload['target_file']; if (is_file($target_file)) { $path = pathinfo(realpath($target_file), PATHINFO_DIRNAME); if (class_exists('ZipArchive')) { $zip = new ZipArchive(); $res = $zip->open($target_file); if ($res === TRUE) { // checks if first folder is theme.php if ($zip->locateName('theme.php') !== FALSE) { // extract it to the path we determined above $zip->extractTo($path); addNotice('success', $locale['theme_success_001']); } else { $defender->stop(); addNotice('danger', $locale['theme_error_005']); } $zip->close(); @unlink($target_file); redirect(FUSION_SELF . $aidlink); } else { addNotice('danger', $locale['theme_error_005']); @unlink($target_file); redirect(FUSION_SELF . $aidlink); } } else { addNotice('warning', $locale['theme_error_006']); @unlink($target_file); redirect(FUSION_SELF . $aidlink); } } } } echo openform('inputform', 'post', FUSION_SELF . $aidlink, array('enctype' => 1, 'max_tokens' => 1)); echo form_fileinput('theme_files', $locale['theme_1007'], '', array()); echo form_button('upload', $locale['theme_1007'], 'upload theme', array('class' => 'btn btn-primary')); echo closeform(); }
function debonair_theme_widget() { global $locale; require_once "functions.php"; $settings = get_theme_settings("debonair"); /** * data parsing */ $ubanner_col_1_data = uncomposeSelection($settings['ubanner_col_1']); $ubanner_col_2_data = uncomposeSelection($settings['ubanner_col_2']); $ubanner_col_3_data = uncomposeSelection($settings['ubanner_col_3']); $settings = array("main_banner_url" => $settings['main_banner_url'], "ubanner_col_1" => !empty($ubanner_col_1_data['selected']) ? $ubanner_col_1_data['selected'] : 0, "ubanner_col_2" => !empty($ubanner_col_2_data['selected']) ? $ubanner_col_2_data['selected'] : 0, "ubanner_col_3" => !empty($ubanner_col_3_data['selected']) ? $ubanner_col_3_data['selected'] : 0, "lbanner_col_1" => $settings['lbanner_col_1'], "lbanner_col_2" => $settings['lbanner_col_2'], "lbanner_col_3" => $settings['lbanner_col_3'], "lbanner_col_4" => $settings['lbanner_col_4'], "facebook_url" => $settings['facebook_url'], "twitter_url" => $settings['twitter_url']); if (isset($_POST['save_settings'])) { $inputArray = array("main_banner_url" => form_sanitizer($_POST['main_banner_url'], "", "main_banner_url"), "ubanner_col_1" => composeSelection(form_sanitizer($_POST['ubanner_col_1'], "", "ubanner_col_1")), "ubanner_col_2" => composeSelection(form_sanitizer($_POST['ubanner_col_2'], "", "ubanner_col_2")), "ubanner_col_3" => composeSelection(form_sanitizer($_POST['ubanner_col_3'], "", "ubanner_col_3")), "lbanner_col_1" => form_sanitizer($_POST['lbanner_col_1'], "", "lbanner_col_1"), "lbanner_col_2" => form_sanitizer($_POST['lbanner_col_2'], "", "lbanner_col_2"), "lbanner_col_3" => form_sanitizer($_POST['lbanner_col_3'], "", "lbanner_col_3"), "lbanner_col_4" => form_sanitizer($_POST['lbanner_col_4'], "", "lbanner_col_4"), "facebook_url" => form_sanitizer($_POST['facebook_url'], "", "facebook_url"), "twitter_url" => form_sanitizer($_POST['twitter_url'], "", "twitter_url")); foreach ($inputArray as $settings_name => $settings_value) { $sqlArray = array("settings_name" => $settings_name, "settings_value" => $settings_value, "settings_theme" => "debonair"); dbquery_insert(DB_SETTINGS_THEME, $sqlArray, "update", array("primary_key" => "settings_name")); } if (defender::safe()) { redirect(FUSION_REQUEST); } } echo openform("debonair_theme_settings", "post", FUSION_REQUEST); $exclude_list = ".|..|.htaccess|.DS_Store|config.php|config.temp.php|.gitignore|LICENSE|README.md|robots.txt|reactivate.php|rewrite.php|maintenance.php|maincore.php|lostpassword.php|index.php|error.php"; $list = array(); $file_list = makefilelist(BASEDIR, $exclude_list); foreach ($file_list as $files) { $list[] = $files; } $include_list = array(); $file_list = makefilelist(THEMES . "/debonair/include/", $exclude_list); foreach ($file_list as $files) { $include_list[$files] = str_replace(".php", "", str_replace("_", " ", ucwords($files))); } openside(""); echo form_select("main_banner_url", $locale['debonair_0300'], $settings['main_banner_url'], array("options" => $list, "tags" => true, "multiple" => true, "width" => "100%", "inline" => false)); echo "<p>" . $locale['debonair_0301'] . "</p>"; closeside(); openside(""); echo form_text("facebook_url", $locale['debonair_0321'], $settings['facebook_url'], array("type" => "url", "inline" => true, "placeholder" => "http://www.facebook.com/your-page-id")); echo form_text("twitter_url", $locale['debonair_0322'], $settings['twitter_url'], array("type" => "url", "inline" => true, "placeholder" => "http://www.twitter.com/your-page-id")); closeside(); $templateOpts[0] = $locale['debonair_0302']; /** * Article Selector */ $articleOpts = array(); if (db_exists(DB_ARTICLES)) { $article_result = dbquery("select article_id, article_subject, article_cat_language FROM " . DB_ARTICLES . " a\n\t \t\t\t\tleft join " . DB_ARTICLE_CATS . " ac on a.article_cat = ac.article_cat_id\n\t \t\t\t\torder by article_datestamp DESC\n\t \t\t\t\t"); if (dbrows($article_result) > 0) { while ($data = dbarray($article_result)) { $articleOpts[$data['article_cat_language']][$data['article_id']] = $data['article_subject']; } } if (!empty($articleOpts)) { $templateOpts['articles'] = $locale['debonair_0303']; } } /** * News Selector */ $newsOpts = array(); if (db_exists(DB_NEWS)) { $news_result = dbquery("select news_id, news_subject, news_language FROM " . DB_NEWS . " order by news_datestamp DESC"); if (dbrows($news_result) > 0) { while ($data = dbarray($news_result)) { $newsOpts[$data['news_language']][$data['news_id']] = $data['news_subject']; } } if (!empty($newsOpts)) { $templateOpts['news'] = $locale['debonair_0304']; } } /** * Blog Selector */ $blogOpts = array(); if (db_exists(DB_BLOG)) { $blog_result = dbquery("select blog_id, blog_subject, blog_language FROM " . DB_BLOG . "\n\t \t\t\t\torder by blog_datestamp DESC\n\t \t\t\t\t"); if (dbrows($blog_result) > 0) { while ($data = dbarray($blog_result)) { $blogOpts[$data['blog_language']][$data['blog_id']] = $data['blog_subject']; } } if (!empty($blogOpts)) { $templateOpts['blog'] = $locale['debonair_0305']; } } /** * Custom Page Selector * Note: custom page has a different multilanguage setup. */ $cpOpts = array(); if (db_exists(DB_CUSTOM_PAGES)) { $cp_result = dbquery("select page_id, page_title, page_language FROM " . DB_CUSTOM_PAGES . " order by page_id ASC"); if (dbrows($cp_result) > 0) { while ($data = dbarray($cp_result)) { $acceptedLang = stristr($data['page_language'], ".") ? explode(".", $data['page_language']) : array(0 => $data['page_language']); foreach (fusion_get_enabled_languages() as $lang) { if (in_array($lang, $acceptedLang)) { $cpOpts[$lang][$data['page_id']] = $data['page_title']; } } } } if (!empty($cpOpts)) { $templateOpts['cp'] = $locale['debonair_0306']; } } openside(""); echo "<div class='row'>\n"; echo "<div class='col-xs-12 col-sm-4'>\n"; echo form_select("ubanner_col_1", $locale['debonair_0307'], $settings['ubanner_col_1'], array("options" => $templateOpts, "inline" => false)); if (!empty($articleOpts)) { echo "<div id='ubanner_col_1-articles-choices' class='choices1' " . ($settings['ubanner_col_1'] === "articles" ? "" : "style='display:none;'") . "'>\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_1'] === "articles" && !empty($ubanner_col_1_data['options'][$lang]) ? $ubanner_col_1_data['options'][$lang] : ""; echo form_select("articles-" . $lang, sprintf($locale['debonair_0310'], $lang), $callback_value, array("options" => isset($articleOpts[$lang]) ? $articleOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($newsOpts)) { echo "<div id='ubanner_col_1-news-choices' class='choices1' " . ($settings['ubanner_col_1'] === "news" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_1'] === "news" && !empty($ubanner_col_1_data['options'][$lang]) ? $ubanner_col_1_data['options'][$lang] : ""; echo form_select("news-" . $lang, sprintf($locale['debonair_0311'], $lang), $callback_value, array("options" => isset($newsOpts[$lang]) ? $newsOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($blogOpts)) { echo "<div id='ubanner_col_1-blog-choices' class='choices1' " . ($settings['ubanner_col_1'] === "blog" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_1'] === "blog" && !empty($ubanner_col_1_data['options'][$lang]) ? $ubanner_col_1_data['options'][$lang] : ""; echo form_select("blog-" . $lang, sprintf($locale['debonair_0312'], $lang), $callback_value, array("options" => isset($blogOpts[$lang]) ? $blogOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($cpOpts)) { echo "<div id='ubanner_col_1-cp-choices' class='choices1' " . ($settings['ubanner_col_1'] === "cp" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_1'] === "cp" && !empty($ubanner_col_1_data['options'][$lang]) ? $ubanner_col_1_data['options'][$lang] : ""; echo form_select("cp-" . $lang, sprintf($locale['debonair_0313'], $lang), $callback_value, array("options" => isset($cpOpts[$lang]) ? $cpOpts[$lang] : array())); } echo "</div>\n"; } echo "</div><div class='col-xs-12 col-sm-4'>\n"; echo form_select("ubanner_col_2", $locale['debonair_0308'], $settings['ubanner_col_2'], array("options" => $templateOpts, "inline" => false)); if (!empty($articleOpts)) { echo "<div id='ubanner_col_2-articles-choices' class='choices2' " . ($settings['ubanner_col_2'] === "articles" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_2'] === "articles" && !empty($ubanner_col_2_data['options'][$lang]) ? $ubanner_col_2_data['options'][$lang] : ""; echo form_select("articles2-" . $lang, sprintf($locale['debonair_0310'], $lang), $callback_value, array("options" => isset($articleOpts[$lang]) ? $articleOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($newsOpts)) { echo "<div id='ubanner_col_2-news-choices' class='choices2' " . ($settings['ubanner_col_2'] === "news" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_2'] === "news" && !empty($ubanner_col_2_data['options'][$lang]) ? $ubanner_col_2_data['options'][$lang] : ""; echo form_select("news2-" . $lang, sprintf($locale['debonair_0311'], $lang), $callback_value, array("options" => isset($newsOpts[$lang]) ? $newsOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($blogOpts)) { echo "<div id='ubanner_col_2-blog-choices' class='choices2' " . ($settings['ubanner_col_2'] === "blog" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_2'] === "blog" && !empty($ubanner_col_2_data['options'][$lang]) ? $ubanner_col_2_data['options'][$lang] : ""; echo form_select("blog2-" . $lang, sprintf($locale['debonair_0312'], $lang), $callback_value, array("options" => isset($blogOpts[$lang]) ? $blogOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($cpOpts)) { echo "<div id='ubanner_col_2-cp-choices' class='choices2' " . ($settings['ubanner_col_2'] === "cp" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_2'] === "cp" && !empty($ubanner_col_2_data['options'][$lang]) ? $ubanner_col_2_data['options'][$lang] : ""; echo form_select("cp2-" . $lang, sprintf($locale['debonair_0313'], $lang), $callback_value, array("options" => isset($cpOpts[$lang]) ? $cpOpts[$lang] : array())); } echo "</div>\n"; } echo "</div><div class='col-xs-12 col-sm-4'>\n"; // 3rd echo form_select("ubanner_col_3", $locale['debonair_0309'], $settings['ubanner_col_3'], array("options" => $templateOpts, "inline" => false)); if (!empty($articleOpts)) { echo "<div id='ubanner_col_3-articles-choices' class='choices3' " . ($settings['ubanner_col_3'] == "articles" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_3'] === "articles" && !empty($ubanner_col_3_data['options'][$lang]) ? $ubanner_col_3_data['options'][$lang] : ""; echo form_select("articles3-" . $lang, sprintf($locale['debonair_0310'], $lang), $callback_value, array("options" => isset($articleOpts[$lang]) ? $articleOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($newsOpts)) { echo "<div id='ubanner_col_3-news-choices' class='choices3' " . ($settings['ubanner_col_3'] === "news" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_3'] === "news" && !empty($ubanner_col_3_data['options'][$lang]) ? $ubanner_col_3_data['options'][$lang] : ""; echo form_select("news3-" . $lang, sprintf($locale['debonair_0311'], $lang), $callback_value, array("options" => isset($newsOpts[$lang]) ? $newsOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($blogOpts)) { echo "<div id='ubanner_col_3-blog-choices' class='choices3' " . ($settings['ubanner_col_3'] === "blog" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_3'] === "blog" && !empty($ubanner_col_3_data['options'][$lang]) ? $ubanner_col_3_data['options'][$lang] : ""; echo form_select("blog3-" . $lang, sprintf($locale['debonair_0312'], $lang), $callback_value, array("options" => isset($blogOpts[$lang]) ? $blogOpts[$lang] : array())); } echo "</div>\n"; } if (!empty($cpOpts)) { echo "<div id='ubanner_col_3-cp-choices' class='choices3' " . ($settings['ubanner_col_3'] === "cp" ? "" : "style='display:none;'") . ">\n"; foreach (fusion_get_enabled_languages() as $lang) { $callback_value = $settings['ubanner_col_3'] === "cp" && !empty($ubanner_col_3_data['options'][$lang]) ? $ubanner_col_3_data['options'][$lang] : ""; echo form_select("cp3-" . $lang, sprintf($locale['debonair_0313'], $lang), $callback_value, array("options" => isset($cpOpts[$lang]) ? $cpOpts[$lang] : array())); } echo "</div>\n"; } echo "</div>\n</div>\n"; echo $locale['debonair_0315']; closeside(); openside(""); echo form_select("lbanner_col_1", $locale['debonair_0317'], $settings['lbanner_col_1'], array("options" => $include_list, "inline" => true)); echo form_select("lbanner_col_2", $locale['debonair_0318'], $settings['lbanner_col_2'], array("options" => $include_list, "inline" => true)); echo form_select("lbanner_col_3", $locale['debonair_0319'], $settings['lbanner_col_3'], array("options" => $include_list, "inline" => true)); echo form_select("lbanner_col_4", $locale['debonair_0320'], $settings['lbanner_col_4'], array("options" => $include_list, "inline" => true)); echo $locale['debonair_0316']; closeside(); echo form_button("save_settings", $locale['save_changes'], "save", array("class" => "btn-success")); echo closeform(); // Now use Jquery to chain the selectors - add_to_jquery combines, include into a single min. document ready script add_to_jquery("\n\tfunction switchSelection(selector, value) {\n\t\t\$('.choices'+selector).hide();\n\t\tif (value == '0') {\n\t\t\t\$('.choices'+selector).hide();\n\t\t} else {\n\t\t\t\$('#ubanner_col_'+selector+'-'+value+'-choices').show();\n\t\t}\n\t}\n\t\$('#ubanner_col_1').bind('change', function() { switchSelection(1, \$(this).val()); });\n\t\$('#ubanner_col_2').bind('change', function() { switchSelection(2, \$(this).val()); });\n\t\$('#ubanner_col_3').bind('change', function() { switchSelection(3, \$(this).val()); });\n\t"); }
/** * 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'] . "&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'] . "&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 . "&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 . "&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']) . "&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); } } }
function render_comments_form($comment_type, $clink, $comment_item_id, $_CAPTCHA_HIDE_INPUT) { $userdata = fusion_get_userdata(); $settings = fusion_get_settings(); $locale = fusion_get_locale(); $comment_cat = ""; $comment_message = ""; if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { $eresult = dbquery("SELECT tcm.*, tcu.user_name\n\t\t\t\tFROM " . DB_COMMENTS . " tcm\n\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "' AND comment_item_id='" . $comment_item_id . "'\n\t\t\t\tAND comment_type='" . $comment_type . "' AND comment_hidden='0'"); if (dbrows($eresult) > 0) { $edata = dbarray($eresult); if (iADMIN && checkrights("C") || iMEMBER && $edata['comment_name'] == $userdata['user_id'] && isset($edata['user_name'])) { $clink .= "&c_action=edit&comment_id=" . $edata['comment_id']; $comment_message = $edata['comment_message']; $comment_cat = $edata['comment_cat']; } } } // Comments form if (iMEMBER || fusion_get_settings("guestposts") == 1) { $comments_form = openform('inputform', 'post', $clink); $comments_form .= form_hidden("comment_cat", "", $comment_cat); if (iGUEST) { $comments_form .= form_text('comment_name', $locale['c104'], '', array('max_length' => 30, 'required' => TRUE)); } $comments_form .= form_textarea('comment_message', '', $comment_message, array('required' => 1, 'autosize' => 1, 'form_name' => 'inputform', "tinymce" => "simple", 'type' => fusion_get_settings("tinymce_enabled") ? "tinymce" : "bbcode")); if (iGUEST && (!isset($_CAPTCHA_HIDE_INPUT) || isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT)) { $_CAPTCHA_HIDE_INPUT = FALSE; $comments_form .= "<div class='m-t-10 m-b-10'>"; $comments_form .= "<label class='col-xs-12 col-sm-3'>" . $locale['global_150'] . "</label><div class='col-xs-12 col-sm-9'>\n"; ob_start(); include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_display.php"; $comments_form .= ob_get_contents(); ob_end_clean(); if (!$_CAPTCHA_HIDE_INPUT) { $comments_form .= "<br />\n<label for='captcha_code'>" . $locale['global_151'] . "</label>"; $comments_form .= "<br />\n<input type='text' id='captcha_code' name='captcha_code' class='textbox' autocomplete='off' style='width:100px' />\n"; } $comments_form .= "</div>\n"; $comments_form .= "</div>\n"; } $comments_form .= form_button('post_comment', $comment_message ? $locale['c103'] : $locale['c102'], $comment_message ? $locale['c103'] : $locale['c102'], array('class' => 'btn-success m-t-10')); $comments_form .= closeform(); } else { $comments_form = "<div class='well'>\n"; $comments_form .= $locale['c105'] . "\n"; $comments_form .= "</div>\n"; } ?> <!---comments form---> <div class="comments-form-panel"> <!---comments header--> <div class="comments-form-header"> <?php echo $locale['c102']; ?> </div> <!---//comments header--> <div class="comments-form"> <div class="pull-left"> <?php echo display_avatar(fusion_get_userdata(), "50px", "", FALSE, "img-rounded"); ?> </div> <div class="overflow-hide"> <a id="edit_comment" name="edit_comment"></a> <?php echo $comments_form; ?> </div> </div> </div> <!---//comments form---> <?php }
/** * 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"; }
function showcomments($ctype, $cdb, $ccol, $cid, $clink) { global $settings, $locale, $userdata, $aidlink; $link = FUSION_SELF . (FUSION_QUERY ? "?" . FUSION_QUERY : ""); $link = preg_replace("^(&|\\?)c_action=(edit|delete)&comment_id=\\d*^", "", $link); $cpp = $settings['comments_per_page']; if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "delete") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $_GET['comment_id'] . "' AND comment_name='" . $userdata['user_id'] . "'")) { $result = dbquery("DELETE FROM " . DB_COMMENTS . "\r\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "'" . (iADMIN ? "" : "\r\n\t\t\t\t\tAND comment_name='" . $userdata['user_id'] . "'")); } redirect($clink . ($settings['comments_sorting'] == "ASC" ? "" : "&c_start=0")); } if ($settings['comments_enabled'] == "1") { if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) { if (iMEMBER) { $comment_name = $userdata['user_id']; } elseif ($settings['guestposts'] == "1") { if (!isset($_POST['comment_name'])) { redirect($link); } $comment_name = trim(stripinput($_POST['comment_name'])); $comment_name = preg_replace("(^[+0-9\\s]*)", "", $comment_name); if (isnum($comment_name)) { $comment_name = ""; } $_CAPTCHA_IS_VALID = FALSE; include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_check.php"; if (!isset($_POST['captcha_code']) || $_CAPTCHA_IS_VALID == FALSE) { redirect($link); } } $comment_message = trim(stripinput(censorwords($_POST['comment_message']))); if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { $comment_updated = FALSE; if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $_GET['comment_id'] . "' AND comment_item_id='" . $cid . "'\r\n\t\t\t\t\t\tAND comment_type='" . $ctype . "' AND comment_name='" . $userdata['user_id'] . "'\r\n\t\t\t\t\t\tAND comment_hidden='0'")) { if ($comment_message) { $result = dbquery("UPDATE " . DB_COMMENTS . " SET comment_message='" . $comment_message . "'\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "'" . (iADMIN ? "" : "\r\n\t\t\t\t\t\t\t\t\t\t\tAND comment_name='" . $userdata['user_id'] . "'")); $comment_updated = TRUE; } } if ($comment_updated) { if ($settings['comments_sorting'] == "ASC") { $c_operator = "<="; } else { $c_operator = ">="; } $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_id" . $c_operator . "'" . $_GET['comment_id'] . "'\r\n\t\t\t\t\t\t\t\tAND comment_item_id='" . $cid . "'\r\n\t\t\t\t\t\t\t\tAND comment_type='" . $ctype . "'"); $c_start = (ceil($c_count / $cpp) - 1) * $cpp; } redirect($clink . "&c_start=" . (isset($c_start) && isnum($c_start) ? $c_start : "")); } else { if (!dbcount("(" . $ccol . ")", $cdb, $ccol . "='" . $cid . "'")) { redirect(BASEDIR . "index.php"); } if ($comment_name && $comment_message) { require_once INCLUDES . "flood_include.php"; if (!flood_control("comment_datestamp", DB_COMMENTS, "comment_ip='" . USER_IP . "'")) { $result = dbquery("INSERT INTO " . DB_COMMENTS . " (\r\n\t\t\t\t\t\t\t\tcomment_item_id, comment_type, comment_name, comment_message, comment_datestamp,\r\n\t\t\t\t\t\t\t\tcomment_ip, comment_ip_type, comment_hidden\r\n\t\t\t\t\t\t\t) VALUES (\r\n\t\t\t\t\t\t\t\t'" . $cid . "', '" . $ctype . "', '" . $comment_name . "', '" . $comment_message . "', '" . time() . "',\r\n\t\t\t\t\t\t\t\t'" . USER_IP . "', '" . USER_IP_TYPE . "', '0'\r\n\t\t\t\t\t\t\t)"); } } if ($settings['comments_sorting'] == "ASC") { $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $cid . "'\r\n\t\t\t\t\t\t\t\t\t\tAND comment_type='" . $ctype . "'"); $c_start = (ceil($c_count / $cpp) - 1) * $cpp; } else { $c_start = 0; } redirect($clink . "&c_start=" . $c_start); } } $c_arr = array("c_con" => array(), "c_info" => array("c_makepagenav" => FALSE, "admin_link" => FALSE)); $c_rows = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $cid . "'\r\n\t\t\t\t\t\t\tAND comment_type='" . $ctype . "' AND comment_hidden='0'"); if (!isset($_GET['c_start']) && $c_rows > $cpp) { $_GET['c_start'] = (ceil($c_rows / $cpp) - 1) * $cpp; } if (!isset($_GET['c_start']) || !isnum($_GET['c_start'])) { $_GET['c_start'] = 0; } $result = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcm.comment_datestamp,\r\n\t\t\t\t\ttcu.user_id, tcu.user_name, tcu.user_avatar, tcu.user_status\r\n\t\t\tFROM " . DB_COMMENTS . " tcm\r\n\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\r\n\t\t\tWHERE comment_item_id='" . $cid . "' AND comment_type='" . $ctype . "' AND comment_hidden='0'\r\n\t\t\tORDER BY comment_datestamp " . $settings['comments_sorting'] . " LIMIT " . $_GET['c_start'] . "," . $cpp); if (dbrows($result)) { $i = $settings['comments_sorting'] == "ASC" ? $_GET['c_start'] + 1 : $c_rows - $_GET['c_start']; if ($c_rows > $cpp) { $c_arr['c_info']['c_makepagenav'] = makepagenav($_GET['c_start'], $cpp, $c_rows, 3, $clink . "&", "c_start"); } while ($data = dbarray($result)) { $c_arr['c_con'][$i]['comment_id'] = $data['comment_id']; $c_arr['c_con'][$i]['edit_dell'] = FALSE; $c_arr['c_con'][$i]['i'] = $i; if ($data['user_name']) { $c_arr['c_con'][$i]['comment_name'] = profile_link($data['comment_name'], $data['user_name'], $data['user_status']); } else { $c_arr['c_con'][$i]['comment_name'] = $data['comment_name']; } //Add user avatar in comments new feature in v7.02.04 $c_arr['c_con'][$i]['user_avatar'] = display_avatar($data, '80px'); $c_arr['c_con'][$i]['comment_datestamp'] = $locale['global_071'] . showdate("longdate", $data['comment_datestamp']); $c_arr['c_con'][$i]['comment_message'] = "<!--comment_message-->\n" . nl2br(parseubb(parsesmileys($data['comment_message']))); if (iADMIN && checkrights("C") || iMEMBER && $data['comment_name'] == $userdata['user_id'] && isset($data['user_name'])) { $c_arr['c_con'][$i]['edit_dell'] = "<!--comment_actions-->\n"; $c_arr['c_con'][$i]['edit_dell'] .= "<a href='" . FUSION_REQUEST . "&c_action=edit&comment_id=" . $data['comment_id'] . "#edit_comment'>"; $c_arr['c_con'][$i]['edit_dell'] .= $locale['c108'] . "</a> |\n"; $c_arr['c_con'][$i]['edit_dell'] .= "<a href='" . FUSION_REQUEST . "&c_action=delete&comment_id=" . $data['comment_id'] . "' onclick=\"return confirm('" . $locale['c110'] . "');\">"; $c_arr['c_con'][$i]['edit_dell'] .= $locale['c109'] . "</a>"; } $settings['comments_sorting'] == "ASC" ? $i++ : $i--; } if (iADMIN && checkrights("C")) { $c_arr['c_info']['admin_link'] = "<!--comment_admin-->\n"; $c_arr['c_info']['admin_link'] .= "<a href='" . ADMIN . "comments.php" . $aidlink . "&ctype=" . $ctype . "&cid=" . $cid . "'>" . $locale['c106'] . "</a>"; } } // Render comments echo "<a id='comments' name='comments'></a>"; render_comments($c_arr['c_con'], $c_arr['c_info']); // Add / edit comment opentable($locale['c102']); if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { $eresult = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcu.user_name\r\n\t\t\t\tFROM " . DB_COMMENTS . " tcm\r\n\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\r\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "' AND comment_item_id='" . $cid . "'\r\n\t\t\t\t\tAND comment_type='" . $ctype . "' AND comment_hidden='0'"); if (dbrows($eresult)) { $edata = dbarray($eresult); if (iADMIN && checkrights("C") || iMEMBER && $edata['comment_name'] == $userdata['user_id'] && isset($edata['user_name'])) { $clink .= "&c_action=edit&comment_id=" . $edata['comment_id']; $comment_message = $edata['comment_message']; } } else { $comment_message = ""; } } else { $comment_message = ""; } if (iMEMBER || $settings['guestposts'] == "1") { require_once INCLUDES . "bbcode_include.php"; echo "<a id='edit_comment' name='edit_comment'></a>\n"; echo openform('inputform', 'inputform', 'post', $clink); if (iGUEST) { echo "<div align='center' class='tbl'>\n" . $locale['c104'] . "<br />\n"; echo "<input type='text' name='comment_name' maxlength='30' class='textbox' style='width:360px' />\n"; echo "</div>\n"; } echo "<div class='row'>\n"; echo "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>\n"; echo form_textarea('', 'comment_message', 'comment_message', $comment_message, array('required' => 1)); echo display_bbcodes("360px", "comment_message"); if (iGUEST && (!isset($_CAPTCHA_HIDE_INPUT) || isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT)) { $_CAPTCHA_HIDE_INPUT = FALSE; echo "<div style='width:360px; margin:10px auto;'>"; echo $locale['global_150'] . "<br />\n"; include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_display.php"; if (!$_CAPTCHA_HIDE_INPUT) { echo "<br />\n<label for='captcha_code'>" . $locale['global_151'] . "</label>"; echo "<br />\n<input type='text' id='captcha_code' name='captcha_code' class='textbox' autocomplete='off' style='width:100px' />\n"; } echo "</div>\n"; } echo form_button($comment_message ? $locale['c103'] : $locale['c102'], 'post_comment', 'post_comment', $comment_message ? $locale['c103'] : $locale['c102'], array('class' => 'btn btn-primary m-t-10')); echo "</div>\n</div>\n"; echo closeform(); } else { echo $locale['c105'] . "\n"; } closetable(); } }
function render_article($subject, $article, $info) { echo "<table width='100%' cellpadding='0' cellspacing='0'>\n<tr>\n<td class='capmain'>{$subject}</td>\n</tr>\n<tr>\n<td class='main-body'>\n" . ($info['article_breaks'] == "y" ? nl2br($article) : $article) . "\n</td>\n</tr>\n<tr>\n<td align='center' class='news-footer'>\n"; echo openform("A", $info['article_id']) . articleposter($info, " ·") . articleopts($info, "·") . closeform("A", $info['article_id']); echo "</td>\n</tr>\n</table>\n"; }
/** * Quick create */ private function quick_create_forum() { opentable(self::$locale['forum_001']); echo openform('forum_create_form', 'post', FUSION_REQUEST); echo form_text('forum_name', self::$locale['forum_006'], '', array('required' => 1, 'inline' => TRUE, 'placeholder' => self::$locale['forum_018'])); echo form_button('init_forum', self::$locale['forum_001'], 'init_forum', array('class' => 'btn btn-sm btn-primary')); echo closeform(); closetable(); }
public function viewSettingsAdmin() { global $aidlink; pageAccess('F'); $forum_settings = $this->get_forum_settings(); add_breadcrumb(array('link' => ADMIN . 'settings_forum.php' . $aidlink, 'title' => self::$locale['forum_settings'])); if (isset($_POST['recount_user_post'])) { $result = dbquery("SELECT post_author, COUNT(post_id) as num_posts FROM " . DB_FORUM_POSTS . " GROUP BY post_author"); if (dbrows($result)) { while ($data = dbarray($result)) { $result2 = dbquery("UPDATE " . DB_USERS . " SET user_posts='" . $data['num_posts'] . "' WHERE user_id='" . $data['post_author'] . "'"); } addNotice('success', self::$locale['forum_061']); } } if (isset($_POST['savesettings'])) { $numofthreads = form_sanitizer($_POST['numofthreads'], 20, 'numofthreads'); $threads_num = form_sanitizer($_POST['threads_per_page'], 20, 'threads_per_page'); $posts_num = form_sanitizer($_POST['posts_per_page'], 20, 'posts_per_page'); $forum_ips = form_sanitizer($_POST['forum_ips'], -103, 'forum_ips'); $attachmax = form_sanitizer($_POST['calc_b'], 1, 'calc_b') * form_sanitizer($_POST['calc_c'], 1000000, 'calc_c'); $attachmax_count = form_sanitizer($_POST['forum_attachmax_count'], 5, 'forum_attachmax_count'); $attachtypes = form_sanitizer($_POST['forum_attachtypes'], '.pdf,.gif,.jpg,.png,.zip,.rar,.tar,.bz2,.7z', 'forum_attachtypes'); $thread_notify = form_sanitizer($_POST['thread_notify'], '0', 'thread_notify'); $forum_ranks = form_sanitizer($_POST['forum_ranks'], '0', 'forum_ranks'); $forum_rank_style = form_sanitizer($_POST['forum_rank_style'], '0', 'forum_rank_style'); $forum_edit_lock = form_sanitizer($_POST['forum_edit_lock'], '0', 'forum_edit_lock'); $forum_edit_timelimit = form_sanitizer($_POST['forum_edit_timelimit'], '0', 'forum_edit_timelimit'); $popular_threads_timeframe = form_sanitizer($_POST['popular_threads_timeframe'], '604800', 'popular_threads_timeframe'); $forum_last_posts_reply = form_sanitizer($_POST['forum_last_posts_reply'], '0', 'forum_last_posts_reply'); $forum_last_post_avatar = form_sanitizer($_POST['forum_last_post_avatar'], '0', 'forum_last_post_avatar'); $forum_editpost_to_lastpost = form_sanitizer($_POST['forum_editpost_to_lastpost'], '0', 'forum_editpost_to_lastpost'); if (\defender::safe()) { dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$numofthreads}' WHERE settings_name='numofthreads' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$threads_num}' WHERE settings_name='threads_per_page' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$posts_num}' WHERE settings_name='posts_per_page' AND settings_inf='forum'"); //".(isnum($_POST['forum_ips']) ? $_POST['forum_ips'] : "103")." dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ips}' WHERE settings_name='forum_ips' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax}' WHERE settings_name='forum_attachmax' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachmax_count}' WHERE settings_name='forum_attachmax_count' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$attachtypes}' WHERE settings_name='forum_attachtypes' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$thread_notify}' WHERE settings_name='thread_notify' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_ranks}' WHERE settings_name='forum_ranks' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_rank_style}' WHERE settings_name='forum_rank_style' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_lock}' WHERE settings_name='forum_edit_lock' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_edit_timelimit}' WHERE settings_name='forum_edit_timelimit' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$popular_threads_timeframe}' WHERE settings_name='popular_threads_timeframe' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_posts_reply}' WHERE settings_name='forum_last_posts_reply' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_last_post_avatar}' WHERE settings_name='forum_last_post_avatar' AND settings_inf='forum'"); dbquery("UPDATE " . DB_SETTINGS_INF . " SET settings_value='{$forum_editpost_to_lastpost}' WHERE settings_name='forum_editpost_to_lastpost' AND settings_inf='forum'"); addNotice('success', self::$locale['900']); redirect(FUSION_SELF . $aidlink . '§ion=fs'); } } $yes_no_array = array('1' => self::$locale['yes'], '0' => self::$locale['no']); echo "<div class='well'>" . self::$locale['forum_description'] . "</div>"; echo openform('forum_settings_form', '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 "<span class='small pull-right'>* " . self::$locale['506'] . "</span><br/>\n"; echo form_text('numofthreads', self::$locale['505'], $forum_settings['numofthreads'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number')); closeside(); openside(''); echo form_text('threads_per_page', self::$locale['forum_080'], $forum_settings['threads_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number')); echo form_text('posts_per_page', self::$locale['forum_081'], $forum_settings['posts_per_page'], array('error_text' => self::$locale['error_value'], 'inline' => 1, 'width' => '150px', 'type' => 'number')); closeside(); openside(''); echo form_select('thread_notify', self::$locale['512'], $forum_settings['thread_notify'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); closeside(); openside(''); echo "<span class='pull-right position-absolute small' style='right:30px;'>" . self::$locale['537'] . "</span>\n"; echo form_select('forum_edit_timelimit', self::$locale['536'], $forum_settings['forum_edit_timelimit'], array('options' => array('0', '10', '30', '45', '60'), 'max_length' => 2, 'width' => '100px', 'required' => 1, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_ips', self::$locale['507'], $forum_settings['forum_ips'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_ranks', self::$locale['520'], $forum_settings['forum_ranks'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_rank_style', self::$locale['forum_064'], $forum_settings['forum_rank_style'], array('options' => array(self::$locale['forum_063'], self::$locale['forum_062']), 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_last_post_avatar', self::$locale['539'], $forum_settings['forum_last_post_avatar'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_edit_lock', self::$locale['521'], $forum_settings['forum_edit_lock'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); echo form_select('forum_editpost_to_lastpost', self::$locale['538'], $forum_settings['forum_editpost_to_lastpost'], array('options' => $yes_no_array, 'error_text' => self::$locale['error_value'], 'inline' => 1)); closeside(); echo "</div>\n"; echo "<div class='col-xs-12 col-sm-4'>\n"; openside(''); $calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)'); $calc_c = self::calculate_byte($forum_settings['forum_attachmax']); $calc_b = $forum_settings['forum_attachmax'] / $calc_c; require_once INCLUDES . "mimetypes_include.php"; $mime = mimeTypes(); $mime_opts = array(); foreach ($mime as $m => $Mime) { $ext = ".{$m}"; $mime_opts[$ext] = $ext; } sort($mime_opts); echo "<div class='clearfix'>\n"; echo "<span class='pull-right small'>" . self::$locale['509'] . "</span>"; echo "<label for='calc_c'>" . self::$locale['508'] . "</label><br />\n"; echo form_text('calc_b', '', $calc_b, array('required' => 1, 'number' => 1, 'error_text' => self::$locale['error_rate'], 'width' => '100px', 'max_length' => '3', 'class' => 'm-r-10 pull-left')); echo form_select('calc_c', '', $calc_c, array('options' => $calc_opts, 'placeholder' => self::$locale['choose'], 'class' => 'pull-left', 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo "<span class='small pull-right'>" . self::$locale['535'] . "</span>\n"; echo "<label for='attachmax_count'>" . self::$locale['534'] . "</label>\n"; echo form_select('forum_attachmax_count', '', $forum_settings['forum_attachmax_count'], array('options' => range(1, 10), 'error_text' => self::$locale['error_value'], 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo "<span class='small pull-right'>" . self::$locale['511'] . "</span>\n"; echo form_select('forum_attachtypes', self::$locale['510'], $forum_settings['forum_attachtypes'], array('options' => $mime_opts, 'width' => '100%', 'error_text' => self::$locale['error_type'], 'tags' => 1, 'multiple' => 1, 'placeholder' => self::$locale['choose'])); echo "</div>\n"; closeside(); openside(''); $timeframe_opts = array('604800' => self::$locale['527'], '2419200' => self::$locale['528'], '31557600' => self::$locale['529'], '0' => self::$locale['530']); $lastpost_opts = array('0' => self::$locale['519'], '1' => self::$locale['533']); for ($i = 2; $i <= 20; $i++) { $array_opts[$i] = sprintf(self::$locale['532'], $i); } if (isset($_GET['action']) && $_GET['action'] == "count_posts") { echo alert(self::$locale['524'], '', array('class' => 'warning')); } echo "<div class='clearfix'>\n"; echo form_select('popular_threads_timeframe', self::$locale['525'], $forum_settings['popular_threads_timeframe'], array('options' => $timeframe_opts, 'error_text' => self::$locale['error_value'], 'width' => '100%')); echo "</div>\n"; echo "<div class='clearfix'>\n"; echo form_select('forum_last_posts_reply', self::$locale['531'], $forum_settings['forum_last_posts_reply'], array('options' => $lastpost_opts, 'error_text' => self::$locale['error_value'], 'width' => '100%')); echo "</div>\n"; echo form_button('recount_user_post', self::$locale['523'], '1', array('class' => 'btn-primary btn-block')); closeside(); echo "</div>\n"; echo "</div>\n"; echo form_button('savesettings', self::$locale['750'], self::$locale['750'], array('class' => 'btn-success')); echo closeform(); }
/** * The Panel Editor Form */ public function add_panel_form() { global $locale; fusion_confirm_exit(); if (isset($_POST['panel_preview'])) { $panel_title = form_sanitizer($_POST['panel_name'], "", "panel_name"); if (\defender::safe()) { echo openmodal("cp_preview", $panel_title); if (fusion_get_settings("allow_php_exe")) { ob_start(); eval("?>" . stripslashes($_POST['panel_content']) . "<?php "); $eval = ob_get_contents(); ob_end_clean(); echo $eval; } else { echo "<p>" . nl2br(parse_textarea($_POST['panel_content'])) . "</p>\n"; } echo closemodal(); } $this->data = array("panel_id" => form_sanitizer($_POST['panel_id'], 0, "panel_id"), "panel_name" => form_sanitizer($_POST['panel_name'], "", "panel_name"), "panel_filename" => form_sanitizer($_POST['panel_filename'], "", "panel_filename"), "panel_side" => form_sanitizer($_POST['panel_side'], "", "panel_side"), "panel_content" => form_sanitizer($_POST['panel_content'], "", "panel_content"), "panel_restriction" => form_sanitizer($_POST['panel_restriction'], "", "panel_restriction"), "panel_url_list" => form_sanitizer($_POST['panel_url_list'], "", "panel_url_list"), "panel_display" => form_sanitizer($_POST['panel_display'], "", "panel_display"), "panel_access" => form_sanitizer($_POST['panel_access'], iGUEST, "panel_access"), "panel_languages" => !empty($_POST['panel_languages']) ? form_sanitizer($_POST['panel_languages'], "", "panel_languages") : LANGUAGE); } echo "<div class='m-t-20'>\n"; echo openform('panel_form', 'post', $this->formaction, array('max_tokens' => 1)); echo "<div class='row'>\n"; echo "<div class='col-xs-12 col-sm-8'>\n"; openside(''); echo form_hidden('panel_id', '', $this->data['panel_id']); echo form_text('panel_name', $locale['452'], $this->data['panel_name'], array('inline' => 1, 'required' => 1)); //'error_text'=>$locale['470'] echo form_select('panel_filename', $locale['453'], $this->data['panel_filename'], array('options' => self::get_panelOpts(), 'inline' => 1)); $grid_opts = self::get_panel_grid(); echo form_select('panel_side', $locale['457'], $this->data['panel_side'], array('options' => $grid_opts, 'inline' => TRUE)); closeside(); openside(''); add_to_jquery("\n\t\t" . ($this->data['panel_restriction'] == 3 || $this->data['panel_restriction'] == 2 ? "\$('#panel_url_list-grp').hide();" : '') . "\n\t\t\$('#panel_restriction').bind('change', function(e) {\n\t\t\tif (\$(this).val() == '3' || \$(this).val() == '2') { \$('#panel_url_list-grp').hide(); } else { \$('#panel_url_list-grp').show(); }\n\t\t});\n\t\t"); echo form_select('panel_restriction', $locale['468'], $this->data['panel_restriction'], array('options' => self::get_includeOpts(), 'inline' => 1)); echo "<div id='panel_url_list-grp'>\n"; echo "<div class='text-smaller'></div>\n"; echo form_select('panel_url_list', $locale['462'], $this->data['panel_url_list'], array('options' => self::get_panel_url_list(), 'inline' => 1, 'tags' => 1, 'multiple' => 1, 'width' => '100%')); echo "</div>\n"; echo form_hidden('panel_display', '', $this->data['panel_display']); closeside(); add_to_jquery("\n\t\t" . ($this->data['panel_filename'] > 0 ? "\$('#pgrp').hide();" : "\$('#pgrp').show();") . "\n\t\t\$('#panel_filename').bind('change', function(e) {\n\t\t\tif (\$(this).val() > 0) { \$('#pgrp').hide(); } else { \$('#pgrp').show(); }\n\t\t});\n\t\t"); echo "<div id='pgrp'>\n"; echo form_textarea('panel_content', $locale['455'], $this->data['panel_content'], array('html' => fusion_get_settings("allow_php_exe") ? FALSE : TRUE, 'form_name' => 'panel_form', 'autosize' => 1, 'preview' => fusion_get_settings("allow_php_exe") ? FALSE : TRUE)); echo "</div>\n"; echo "</div>\n<div class='col-xs-12 col-sm-4'>\n"; openside(''); echo form_select('panel_access', $locale['458'], $this->data['panel_access'], array("options" => self::get_accessOpts())); echo form_button('panel_save', $locale['461'], $locale['461'], array('class' => 'btn-primary')); echo form_button('panel_preview', $locale['preview'], $locale['preview'], array('input_id' => 'prev2', 'class' => 'm-l-10 btn-default')); closeside(); openside(''); echo "<label class='label-control m-b-10'>" . $locale['466'] . "</label>\n"; $languages = !empty($this->data['panel_languages']) ? explode('.', $this->data['panel_languages']) : array(); foreach (fusion_get_enabled_languages() as $language => $language_name) { echo form_checkbox('panel_languages[]', $language_name, in_array($language, $languages) ? 1 : 0, array('class' => 'm-b-0', 'value' => $language, "reverse_label" => TRUE, 'input_id' => 'panel_lang-' . $language)); } closeside(); echo "</div>\n"; echo "</div>\n"; echo form_button('panel_save', $locale['461'], $locale['460'], array('class' => 'btn-primary')); echo form_button('panel_preview', $locale['preview'], $locale['preview'], array('class' => 'm-l-10 btn-default')); echo closeform(); echo "</div>\n"; }
if (isset($_GET['action']) && $_GET['action'] == "delete" && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { $result = dbquery("DELETE FROM " . DB_COMMENTS . " WHERE comment_id='" . $_GET['comment_id'] . "'"); addNotice('warning', $locale['411']); redirect("comments.php" . $aidlink . "&ctype=" . $_GET['ctype'] . "&comment_item_id=" . $_GET['comment_item_id']); } if (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) { $result = dbquery("SELECT comment_message FROM " . DB_COMMENTS . " WHERE comment_id='" . $_GET['comment_id'] . "'"); if (dbrows($result)) { require_once INCLUDES . "bbcode_include.php"; $data = dbarray($result); opentable($locale['400']); $form_action = FUSION_SELF . $aidlink . "&comment_id=" . $_GET['comment_id'] . "&ctype=" . $_GET['ctype'] . "&comment_item_id=" . $_GET['comment_item_id']; echo openform('settingsform', 'post', $form_action, array('max_tokens' => 1)); echo form_textarea('comment_message', '', $data['comment_message'], array('autosize' => true, 'bbcode' => true, 'preview' => true, 'form_name' => 'settingsform')); echo form_button('save_comment', $locale['421'], $locale['421'], array('class' => 'btn-primary btn-sm')); closeform(); closetable(); } } opentable($locale['401']); $i = 0; $result = dbquery("SELECT c.comment_id, c.comment_name, c.comment_message, c.comment_datestamp, c.comment_ip, u.user_id, u.user_name, u.user_status FROM " . DB_COMMENTS . " c\n\tLEFT JOIN " . DB_USERS . " u\n\tON c.comment_name=u.user_id\n\tWHERE c.comment_type='" . $_GET['ctype'] . "' AND c.comment_item_id='" . $_GET['comment_item_id'] . "' ORDER BY c.comment_datestamp ASC"); if (dbrows($result)) { while ($data = dbarray($result)) { echo "<div class='list-group-item'>\n"; echo "<div class='btn-group pull-right'>\n"; echo "<a class='btn btn-xs btn-default' href='" . FUSION_SELF . $aidlink . "&action=edit&comment_id=" . $data['comment_id'] . "&ctype=" . $_GET['ctype'] . "&comment_item_id=" . $_GET['comment_item_id'] . "'>" . $locale['430'] . "</a>"; echo "<a class='btn btn-xs btn-default' href='" . FUSION_SELF . $aidlink . "&action=delete&comment_id=" . $data['comment_id'] . "&ctype=" . $_GET['ctype'] . "&comment_item_id=" . $_GET['comment_item_id'] . "' onclick=\"return confirm('" . $locale['433'] . "');\">" . $locale['431'] . "</a>"; echo "</div>\n"; echo "<span class='comment-name'>"; if ($data['user_name']) {
public function render_poll_form($edit = 0) { global $locale, $defender; $poll_field = ''; // Build Polls Info. $thread_data = $this->thread_info['thread']; if ($edit ? $this->getThreadPermission("can_edit_poll") : $this->getThreadPermission("can_create_poll")) { // if permitted to create new poll. $data = array('thread_id' => $thread_data['thread_id'], 'forum_poll_title' => isset($_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] = ""; // calculate poll lengths if (isset($_POST['poll_options'])) { // callback on post. foreach ($_POST['poll_options'] as $i => $value) { $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]"); } // reindex the whole array with blank values. if ($defender->safe()) { $option_data = array_values(array_filter($option_data)); array_unshift($option_data, NULL); unset($option_data[0]); $data['forum_poll_length'] = count($option_data); } } // add a Blank Poll option if (isset($_POST['add_poll_option']) && $defender->safe()) { array_push($option_data, ''); } if ($edit) { $result = dbquery("SELECT * FROM " . DB_FORUM_POLLS . " WHERE thread_id='" . $thread_data['thread_id'] . "'"); if (dbrows($result) > 0) { if (isset($_POST['update_poll']) || isset($_POST['add_poll_option'])) { $load = FALSE; $data += dbarray($result); // append if not available. } else { $load = TRUE; $data = dbarray($result); // call } if (isset($_POST['update_poll'])) { $data = array('thread_id' => $thread_data['thread_id'], 'forum_poll_title' => form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title'), 'forum_poll_start' => $data['forum_poll_start'], 'forum_poll_length' => $data['forum_poll_length']); dbquery_insert(DB_FORUM_POLLS, $data, 'update', array('primary_key' => 'thread_id', 'no_unique' => TRUE)); $i = 1; // populate data for matches $poll_result = dbquery("SELECT forum_poll_option_id FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $thread_data['thread_id'] . "'"); while ($_data = dbarray($poll_result)) { $_poll[$_data['forum_poll_option_id']] = $_data; // Prune the emptied fields AND field is not required. if (empty($option_data[$_data['forum_poll_option_id']]) && $defender->safe()) { dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $thread_data['thread_id'] . "' AND forum_poll_option_id='" . $_data['forum_poll_option_id'] . "'"); } } foreach ($option_data as $option_text) { if ($option_text) { if ($defender->safe()) { if (isset($_poll[$i])) { // has record dbquery("UPDATE " . DB_FORUM_POLL_OPTIONS . " SET forum_poll_option_text='" . $option_text . "' WHERE thread_id='" . $thread_data['thread_id'] . "' AND forum_poll_option_id='" . $i . "'"); } else { // no record - create $array = array('thread_id' => $thread_data['thread_id'], 'forum_poll_option_id' => $i, 'forum_poll_option_text' => $option_text, 'forum_poll_option_votes' => 0); dbquery_insert(DB_FORUM_POLL_OPTIONS, $array, 'save'); } } $i++; } } if ($defender->safe()) { redirect(INFUSIONS . "forum/postify.php?post=editpoll&error=0&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']); } } // how to make sure values containing options votes $poll_field['openform'] = openform('pollform', 'post', INFUSIONS . 'forum/viewthread.php?action=editpoll&forum_id=' . $_GET['forum_id'] . '&thread_id=' . $_GET['thread_id']); $poll_field['openform'] .= "<div class='text-info m-b-20 m-t-10'>" . $locale['forum_0613'] . "</div>\n"; $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $data['forum_poll_title'], array('max_length' => 255, 'placeholder' => $locale['forum_0604a'], 'inline' => TRUE, 'required' => TRUE)); if ($load == FALSE) { 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' => 1, 'required' => $i <= 2 ? TRUE : FALSE)); } } else { $result = dbquery("SELECT forum_poll_option_text, forum_poll_option_votes FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $_GET['thread_id'] . "' ORDER BY forum_poll_option_id ASC"); $i = 1; while ($_pdata = dbarray($result)) { $poll_field['poll_field'] .= form_text("poll_options[{$i}]", $locale['forum_0605'] . ' ' . $i, $_pdata['forum_poll_option_text'], array('max_length' => 255, 'placeholder' => 'Poll Options', 'inline' => 1, 'required' => $i <= 2 or $_pdata['forum_poll_option_votes'] ? TRUE : FALSE)); $i++; } } $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"; $poll_field['poll_button'] = form_button('update_poll', $locale['forum_2013'], $locale['forum_2013'], array('class' => 'btn-default')); $poll_field['closeform'] = closeform(); } else { redirect(INFUSIONS . 'forum/index.php'); // redirect because the poll id is not available. } } else { // Save New Poll if (isset($_POST['add_poll'])) { dbquery_insert(DB_FORUM_POLLS, $data, 'save'); $data['forum_poll_id'] = dblastid(); $i = 1; foreach ($option_data as $option_text) { if ($option_text) { $data['forum_poll_option_id'] = $i; $data['forum_poll_option_text'] = $option_text; $data['forum_poll_option_votes'] = 0; dbquery_insert(DB_FORUM_POLL_OPTIONS, $data, 'save'); $i++; } } if ($defender->safe()) { dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_poll='1' WHERE thread_id='" . $thread_data['thread_id'] . "'"); redirect(INFUSIONS . "forum/postify.php?post=newpoll&error=0&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']); } } // blank poll - no poll on edit or new thread $poll_field['openform'] = openform('pollform', 'post', INFUSIONS . 'forum/viewthread.php?action=newpoll&forum_id=' . $_GET['forum_id'] . '&thread_id=' . $_GET['thread_id'], array('max_tokens' => 1)); $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $data['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' => 1, '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"; $poll_field['poll_button'] = form_button('add_poll', $locale['forum_2011'], $locale['forum_2011'], array('class' => 'btn-success btn-md')); $poll_field['closeform'] = closeform(); } $info = array('title' => $locale['forum_0366'], 'description' => $locale['forum_2000'] . $thread_data['thread_subject'], 'field' => $poll_field); pollform($info); } else { redirect(FORUM . "index.php"); } }
/** * News Page Template * @param $info */ function render_main_news($info) { global $userdata, $settings, $news_settings, $locale; add_to_head("<link href='" . INFUSIONS . "news/templates/css/news.css' rel='stylesheet'/>\n"); add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/jquery.cookie.js'></script>"); if (isset($_POST['switchview'])) { add_to_jquery("\$.cookie('fusion_news_view', '" . $_POST['switchview'] . "', {expires: 7});"); $_COOKIE['fusion_news_view'] = $_POST['switchview']; } opentable($locale['news_0004']); echo render_breadcrumbs(); /* Slideshow */ $carousel_indicators = ''; $carousel_item = ''; $res = 0; $carousel_height = "300"; if (!empty($info['news_items'])) { $i = 0; foreach ($info['news_items'] as $news_item) { if ($news_item['news_image_src'] && file_exists($news_item['news_image_src'])) { $carousel_active = $res == 0 ? 'active' : ''; $res++; $carousel_indicators .= "<li data-target='#news-carousel' data-slide-to='{$i}' class='" . $carousel_active . "'></li>\n"; $carousel_item .= "<div class='item " . $carousel_active . "'>\n"; $carousel_item .= "<img class='img-responsive' style='position:absolute; width:100%; margin-top:-25%' src='" . $news_item['news_image_src'] . "' alt='" . $news_item['news_subject'] . "'>\n"; $carousel_item .= "\n\t\t\t\t\t<div class='carousel-caption'>\n\t\t\t\t\t\t<div class='overflow-hide'>\n\t\t\t\t\t\t<a class='text-white' href='" . INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "'><h4 class='text-white m-t-10'>" . $news_item['news_subject'] . "</h4></a>\n\n\t\t\t\t\t\t<span class='news-carousel-action m-r-10'><i class='fa fa-eye fa-fw'></i>" . $news_item['news_reads'] . "</span>\n\t\t\t\t\t\t" . ($news_item['news_allow_comments'] ? "<span class='m-r-10'>" . display_comments($news_item['news_comments'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#comments") . "</span>" : '') . "\n\t\t\t\t\t\t" . ($news_item['news_allow_ratings'] ? "<span class='m-r-10'>" . display_ratings($news_item['news_sum_rating'], $news_item['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $news_item['news_id'] . "#postrating") . " </span>" : '') . "\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t</div>\n</div>\n\n\t\t\t\t\t"; $i++; } } } /* Title Panel */ if (!isset($_GET['readmore'])) { if ($res) { echo "<div id='news-carousel' class='carousel slide' data-interval='20000' data-ride='carousel'>\n"; if ($res > 1) { echo "<ol class='carousel-indicators'>\n"; echo $carousel_indicators; echo "</ol>"; } echo "<div class='carousel-inner' style='height:" . $carousel_height . "px' role='listbox'>\n"; echo $carousel_item; echo "</div>\n"; echo "\n\t\t\t\t<a class='left carousel-control' href='#news-carousel' role='button' data-slide='prev'>\n\t\t\t\t\t<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['previous'] . "</span>\n\t\t\t \t</a>\n\t\t\t \t<a class='right carousel-control' href='#news-carousel' role='button' data-slide='next'>\n\t\t\t\t\t<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>\n\t\t\t\t\t<span class='sr-only'>" . $locale['next'] . "</span>\n\t\t\t \t</a>\n\n\t\t\t\t"; echo "</div>\n"; } echo "<div class='panel panel-default panel-news-header'>\n"; echo "<div class='panel-body'>\n"; echo "<div class='pull-right'>\n"; echo "<a class='btn btn-sm btn-default text-dark' href='" . INFUSIONS . "news/news.php'><i class='entypo newspaper'></i>" . $locale['news_0007'] . "</a>\n"; echo "<button type='button' class='btn btn-sm btn-primary' data-toggle='collapse' data-target='#newscat' aria-expanded='true' aria-controls='newscat'><i class='entypo book open'></i>" . $locale['news_0009'] . "</button>\n"; echo "</div>\n"; echo "<div class='pull-left m-r-10' style='position:relative; margin-top:-30px;'>\n"; echo "<div style='max-width:80px;'>\n"; echo $info['news_cat_image']; echo "</div>\n"; echo "</div>\n"; echo "<div class='overflow-hide'>\n"; echo "<h3 class='display-inline text-dark'>" . $info['news_cat_name'] . "</h3><br/><span class='strong'>" . $locale['news_0008'] . ":</span> <span class='text-dark'>\n\n\t\t\t" . ($info['news_last_updated'] > 0 ? showdate('newsdate', $info['news_last_updated']) : $locale['na']) . "</span>"; echo "</div>\n"; echo "</div>\n"; echo "<div id='newscat' class='panel-collapse collapse m-b-10'>\n"; echo "<!--pre_news_cat_idx-->"; echo "<ul class='list-group'>\n"; echo "<li class='list-group-item'><hr class='m-t-0 m-b-5'>\n"; echo "<span class='display-inline-block m-b-10 strong text-smaller text-uppercase'> " . $locale['news_0010'] . "</span><br/>\n"; foreach ($info['news_categories'] as $cat_id => $cat_data) { echo isset($_GET['cat_id']) && $_GET['cat_id'] == $cat_id ? '' : "<a href='" . INFUSIONS . "news/news.php?cat_id=" . $cat_id . "' class='btn btn-sm btn-default'>" . $cat_data['name'] . "</a>"; } echo "<a href='" . INFUSIONS . "news/news.php?cat_id=0' class='btn btn-sm btn-default'>" . $locale['news_0006'] . "</a>\n"; echo "</li>"; echo "</ul>\n"; echo "<!--sub_news_cat_idx-->\n"; echo "</div>\n</div>\n"; echo "<div class='row m-b-20 m-t-20'>\n"; echo "<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>\n"; echo openform('viewform', 'post', FUSION_REQUEST, array('max_tokens' => 1, 'class' => 'pull-right display-inline-block m-l-10')); echo "<div class='btn-group'>\n"; $active = isset($_COOKIE['fusion_news_view']) ? $_COOKIE['fusion_news_view'] : ''; echo form_button('switchview', '', '1', array('class' => "btn-sm btn-default nsv " . ($active == 1 ? 'active' : '') . " ", 'icon' => 'entypo layout', 'alt' => $locale['news_0014'])); echo form_button('switchview', '', '2', array('class' => "btn-sm btn-default nsv " . ($active == 2 ? 'active' : '') . "", 'icon' => 'entypo menu', 'alt' => $locale['news_0015'])); echo "</div>\n"; echo closeform(); // Filters echo "<div class='display-inline-block'>\n"; echo "<span class='text-dark strong m-r-10'>" . $locale['show'] . " :</span>"; $i = 0; foreach ($info['news_filter'] as $link => $title) { $filter_active = !isset($_GET['type']) && $i == '0' || isset($_GET['type']) && stristr($link, $_GET['type']) ? 'text-dark strong' : ''; echo "<a href='" . $link . "' class='display-inline {$filter_active} m-r-10'>" . $title . "</a>"; $i++; } echo "</div>\n"; // end filter. echo "</div>\n</div>\n"; $news_span = $active == 2 ? 12 : 4; if (!empty($info['news_items'])) { echo "<div class='row'>\n"; foreach ($info['news_items'] as $i => $news_info) { echo "<div class='col-xs-12 col-sm-{$news_span} col-md-{$news_span} col-lg-{$news_span}'>\n"; echo isset($_GET['cat_id']) ? "<!--pre_news_cat_idx-->\n" : "<!--news_prepost_" . $i . "-->\n"; render_news($news_info['news_subject'], $news_info['news_news'], $news_info, $active == 2); echo isset($_GET['cat_id']) ? "<!--sub_news_cat_idx-->" : "<!--sub_news_idx-->\n"; echo "</div>\n"; } echo "</div>\n"; if ($info['news_item_rows'] > $news_settings['news_pagination']) { $type_start = isset($_GET['type']) ? "type=" . $_GET['type'] . "&" : ''; $cat_start = isset($_GET['cat_id']) ? "cat_id=" . $_GET['cat_id'] . "&" : ''; echo "<div class='text-center m-t-10 m-b-10'>" . makepagenav($_GET['rowstart'], $news_settings['news_pagination'], $info['news_item_rows'], 3, INFUSIONS . "news/news.php?" . $cat_start . $type_start) . "</div>\n"; } } else { echo "<div class='well text-center'>" . $locale['news_0005'] . "</div>\n"; } } else { render_news_item($info); } closetable(); }
} $result = dbquery("SELECT article_id, article_subject, article_draft FROM " . DB_ARTICLES . " ORDER BY article_draft DESC, article_datestamp DESC"); if (dbrows($result)) { $editlist = array(); while ($data = dbarray($result)) { $editlist[$data['article_id']] = "" . ($data['article_draft'] ? $locale['433'] . " " : "") . $data['article_subject'] . ""; } opentable($locale['402']); echo openform('selectform', 'selectform', 'post', FUSION_SELF . $aidlink . "&action=edit", array('downtime' => 0)); echo "<div class='text-center'>\n"; echo form_select('', 'article_id', 'article_id', $editlist, '', array('placeholder' => $locale['choose'], 'inline' => 1, 'class' => 'pull-left')); echo form_button($locale['420'], 'edit', 'edit', $locale['420'], array('class' => 'pull-left btn-primary m-l-10 m-r-10')); echo form_button($locale['421'], 'delete', 'delete', $locale['421'], array('class' => 'pull-left btn-primary')); add_to_jquery("\r\n \$('#delete').bind('click',function(e){ DeleteArticle(); });\r\n "); echo "</div>\n"; echo closeform(); closetable(); } if (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_POST['article_id']) && isnum($_POST['article_id'])) || isset($_GET['article_id']) && isnum($_GET['article_id'])) { $id = ""; if (isset($_POST['article_id']) && isnum($_POST['article_id'])) { $id = $_POST['article_id']; } elseif (isset($_GET['article_id']) && isnum($_GET['article_id'])) { $id = $_GET['article_id']; } $result = dbquery("SELECT article_cat, article_subject, article_snippet, article_article, article_draft, article_breaks, article_allow_comments, article_allow_ratings FROM " . DB_ARTICLES . " WHERE article_id='" . $id . "'"); if (dbrows($result)) { $data = dbarray($result); $article_cat = $data['article_cat']; $subject = $data['article_subject']; $body = phpentities(stripslashes($data['article_snippet']));
private function renderAdminOptions() { global $locale, $aidlink, $userdata; $groups_cache = cache_groups(); $user_groups_opts = ""; if (iADMIN && checkrights("UG") && isset($_GET['lookup']) && $_GET['lookup'] != $userdata['user_id']) { if (isset($_POST['add_to_group']) && (isset($_POST['user_group']) && isnum($_POST['user_group']))) { if (!preg_match("(^\\.{$_POST['user_group']}\$|\\.{$_POST['user_group']}\\.|\\.{$_POST['user_group']}\$)", $this->userData['user_groups'])) { $result = dbquery("UPDATE " . DB_USERS . " SET user_groups='" . $this->userData['user_groups'] . "." . $_POST['user_group'] . "' WHERE user_id='" . $_GET['lookup'] . "'"); } if (isset($_GET['step']) && $_GET['step'] == "view") { redirect(ADMIN . "members.php" . $aidlink . "&step=view&user_id=" . $this->userData['user_id']); } else { redirect(BASEDIR . "profile.php?lookup=" . $_GET['lookup']); } } } $html = ""; $html .= "<div class='row'>\n"; $html .= "<div class='col-xs-12 col-sm-3'>\n"; $html .= form_para($locale['u058'], "admin_options"); $html .= "</div>\n<div class='col-xs-12 col-sm-9 p-l-5'>\n"; $html .= "<div class='well'>\n"; $html .= "<div class='btn-group m-l-10 m-b-20'>\n<!--profile_admin_options-->\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&step=edit&user_id=" . $this->userData['user_id'] . "'>" . $locale['u069'] . "</a>\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&action=1&user_id=" . $this->userData['user_id'] . "'>" . $locale['u070'] . "</a>\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&action=3&user_id=" . $this->userData['user_id'] . "'>" . $locale['u071'] . "</a>\n"; $html .= "<a class='btn btn-default' href='" . ADMIN . "members.php" . $aidlink . "&step=delete&status=0&user_id=" . $this->userData['user_id'] . "' onclick=\"return confirm('" . $locale['u073'] . "');\">" . $locale['u072'] . "</a>\n"; $html .= "</div>\n"; if (count($groups_cache) > 0) { foreach ($groups_cache as $group) { if (!preg_match("(^{$group['group_id']}|\\.{$group['group_id']}\\.|\\.{$group['group_id']}\$)", $this->userData['user_groups'])) { $user_groups_opts[$group['group_id']] = $group['group_name']; //"<option value='".$group['group_id']."'>".$group['group_name']."</option>\n"; } } if (iADMIN && checkrights("UG") && $user_groups_opts) { $submit_link = FUSION_SELF . "?lookup=" . $this->userData['user_id']; if (isset($_GET['step']) && $_GET['step'] == "view") { $submit_link = ADMIN . "members.php" . $aidlink . "&step=view&user_id=" . $this->userData['user_id'] . "&lookup=" . $this->userData['user_id']; } $html .= openform("admin_form", "post", $submit_link, array("class" => "p-l-10")); $html .= form_select("user_group", $locale['u061'], "", array("options" => $user_groups_opts, "inline" => TRUE, "class" => "m-b-10")); $html .= form_button("add_to_group", $locale['u059'], $locale['u059']); $html .= closeform(); } } $html .= "</div>\n</div>\n</div>\n"; return $html; }