Example #1
0
// add features to purge all album photos and it's administration
// add features to move all album photos to another album.
echo openform('albumform', 'post', FUSION_REQUEST, array('enctype' => TRUE, 'class' => 'm-t-20'));
echo "<div class='row'>\n<div class='col-xs-12 col-sm-8'>\n";
echo form_hidden('album_id', '', $data['album_id']);
echo form_text('album_title', $locale['album_0001'], $data['album_title'], array('placeholder' => $locale['album_0002'], 'inline' => TRUE, 'required' => TRUE, "error_text" => $locale['album_0015']));
echo form_select("album_keywords", $locale['album_0005'], $data['album_keywords'], array('max_length' => 320, 'width' => '100%', 'placeholder' => $locale['album_0006'], 'tags' => TRUE, 'multiple' => TRUE, "inline" => TRUE));
echo form_textarea('album_description', $locale['album_0003'], $data['album_description'], array('placeholder' => $locale['album_0004'], 'inline' => 1));
if ($data['album_image'] || $data['album_thumb1']) {
    echo "<div class='well col-sm-offset-3'>\n";
    echo form_hidden("album_image", "", $data['album_image']);
    echo form_hidden("album_thumb2", "", $data['album_thumb2']);
    echo form_hidden("album_thumb1", "", $data['album_thumb1']);
    echo "<label for='del_image'>\n";
    echo displayAlbumImage($data['album_image'], $data['album_thumb1'], $data['album_thumb2'], "");
    echo "</label>\n";
    echo form_checkbox("del_image", $locale['album_0016'], "");
    echo "</div>\n";
} else {
    $album_upload_settings = array("upload_path" => INFUSIONS . "gallery/photos/", 'thumbnail_folder' => 'thumbs', 'thumbnail' => TRUE, 'thumbnail_w' => $gll_settings['thumb_w'], 'thumbnail_h' => $gll_settings['thumb_h'], 'thumbnail_suffix' => '_t1', 'thumbnail2' => TRUE, 'thumbnail2_w' => $gll_settings['photo_w'], 'thumbnail2_h' => $gll_settings['photo_h'], 'thumbnail2_suffix' => '_t2', 'max_width' => $gll_settings['photo_max_w'], 'max_height' => $gll_settings['photo_max_h'], 'max_byte' => $gll_settings['photo_max_b'], 'multiple' => 0, 'delete_original' => FALSE, "inline" => TRUE, "template" => "modern", "class" => "m-b-0");
    echo form_fileinput('album_image', $locale['album_0009'], "", $album_upload_settings);
    echo "<div class='m-b-10 col-xs-12 col-sm-offset-3'>" . sprintf($locale['album_0010'], parsebytesize($gll_settings['photo_max_b']), str_replace(',', ' ', ".jpg,.gif,.png"), $gll_settings['photo_max_w'], $gll_settings['photo_max_h']) . "</div>\n";
}
echo "</div>\n";
echo "<div class='col-xs-12 col-sm-4'>\n";
echo form_select('album_access', $locale['album_0007'], $data['album_access'], array('options' => fusion_get_groups(), 'inline' => TRUE));
echo form_select('album_language', $locale['album_0008'], $data['album_language'], array('options' => fusion_get_enabled_languages(), 'inline' => TRUE));
echo form_text('album_order', $locale['album_0011'], $data['album_order'], array("type" => "number", 'inline' => TRUE));
echo "</div>\n</div>\n";
echo form_button('save_album', $locale['album_0012'], $locale['album_0012'], array('class' => 'btn-success btn-sm m-r-10'));
echo closeform();
Example #2
0
function debonair_banner_widget()
{
    global $locale;
    $acceptedMode = array("edit", "new", "del");
    echo "<a class='btn btn-default m-t-10 m-b-20' href='" . clean_request("slides=new", array(), false) . "'>" . $locale['debonair_0203'] . "</a>\n";
    echo "<div class='alert alert-info'>" . $locale['debonair_0700'] . "</div>\n";
    if (isset($_GET['slides']) && in_array($_GET['slides'], $acceptedMode)) {
        $_GET['id'] = isset($_GET['id']) && isnum($_GET['id']) ? $_GET['id'] : 0;
        $data = array();
        $db_keys = fieldgenerator(DB_DEBONAIR);
        foreach ($db_keys as $keys) {
            $value = "";
            if ($keys == "banner_id") {
                $value = 0;
            }
            if ($keys == "banner_language") {
                $value = LANGUAGE;
            }
            if ($keys == "banner_visibility") {
                $value = iGUEST;
            }
            if ($keys == "banner_datestamp") {
                $value = time();
            }
            if ($keys == "banner_order") {
                $value = dbcount("(banner_id)", DB_DEBONAIR, "banner_language='" . LANGUAGE . "'") + 1;
            }
            $data[$keys] = $value;
        }
        if ($_GET['slides'] == "edit" || $_GET['slides'] == "del") {
            $data = dbarray(dbquery("select * from " . DB_DEBONAIR . " WHERE banner_id='" . intval($_GET['id']) . "'"));
            if ($_GET['slides'] == "del" && !empty($data)) {
                // process deletion
                if ($data['banner_image']) {
                    unlink(THEME . "upload/" . $data['banner_image']);
                    unlink(THEME . "upload/" . $data['banner_thumb']);
                }
                dbquery_insert(DB_DEBONAIR, $data, "delete");
                addNotice("success", $locale['debonair_0217']);
                redirect(clean_request("", array("slides"), false));
            }
        }
        if (isset($_POST['save_slide'])) {
            $data = array("banner_id" => form_sanitizer($_POST['banner_id'], 0, "banner_id"), "banner_subject" => form_sanitizer($_POST['banner_subject'], "", "banner_subject"), "banner_description" => form_sanitizer($_POST['banner_description'], "", "banner_description"), "banner_link" => form_sanitizer($_POST['banner_link'], "", "banner_link"), "banner_language" => form_sanitizer($_POST['banner_language'], LANGUAGE, "banner_language"), "banner_visibility" => form_sanitizer($_POST['banner_visibility'], iGUEST, "banner_visibility"), "banner_datestamp" => time());
            if (defender::safe()) {
                $upload = form_sanitizer($_FILES['banner_image'], "", "banner_image");
                if (isset($upload['error']) && !$upload['error']) {
                    $data['banner_image'] = $upload['image_name'];
                    $data['banner_thumb'] = $upload['thumb1'];
                }
                if ($data['banner_id'] > 0 && dbcount("(banner_id)", DB_DEBONAIR, "banner_id='" . $data['banner_id'] . "'")) {
                    // get old data. do ordering
                    $old_data = dbquery("select banner_image, banner_thumb, banner_order from " . DB_DEBONAIR . " where banner_id='" . $data['banner_id'] . "'");
                    if ($old_data['banner_image']) {
                        unlink(THEME . "upload/" . $old_data['banner_image']);
                        unlink(THEME . "upload/" . $old_data['banner_thumb']);
                    }
                    dbquery_insert(DB_DEBONAIR, $data, "update");
                } else {
                    dbquery_insert(DB_DEBONAIR, $data, "save");
                }
                addNotice("success", $locale['debonair_0212']);
                redirect(clean_request("", array("slides"), false));
            }
        }
        echo "<h3>" . $locale['debonair_0203'] . "</h3>\n";
        echo openform("debonair_banner", "post", FUSION_REQUEST, array("enctype" => true));
        echo "<div class='row'>\n";
        echo "<div class='col-xs-12 col-sm-8'>\n";
        openside("");
        echo form_hidden("banner_id", "", $data['banner_id']);
        echo form_text("banner_subject", $locale['debonair_0205'], $data['banner_subject'], array("required" => true, "inline" => true, "placeholder" => $locale['debonair_0206']));
        echo form_textarea("banner_description", $locale['debonair_0207'], $data['banner_subject'], array("required" => true, "inline" => true, "placeholder" => $locale['debonair_0208'], "bbcode" => true));
        echo form_text("banner_link", $locale['debonair_0209'], $data['banner_subject'], array("required" => true, "inline" => true, "placeholder" => "ie. news.php?readmore=1"));
        closeside();
        openside("");
        echo form_fileinput("banner_image", $locale['debonair_0210'], $data['banner_image'] ? THEME . "upload/" . $data['banner_image'] : "", array("upload_path" => THEME . "upload/", "inline" => true, "placeholder" => $locale['debonair_0210'], "template" => "modern"));
        closeside();
        echo "</div>\n<div class='col-xs-12 col-sm-4'>\n";
        openside("");
        echo form_select("banner_language", $locale['debonair_0214'], $data['banner_language'], array("options" => fusion_get_enabled_languages(), "inline" => true, "placeholder" => $locale['debonair_0206']));
        echo form_select("banner_visibility", $locale['debonair_0215'], $data['banner_visibility'], array("options" => fusion_get_groups(), "inline" => true, "placeholder" => $locale['debonair_0206']));
        closeside();
        echo form_button("save_slide", $locale['save_changes'], "save_slide", array("class" => "btn-primary"));
        echo "<a class='btn btn-default m-l-10' href='" . clean_request("", array("slides"), false) . "'>" . $locale['cancel'] . "</a>\n";
        echo "</div>\n</div>\n";
        echo closeform();
    } else {
        if (isset($_GET['move']) && isset($_GET['id']) && isnum($_GET['id'])) {
            $data = dbarray(dbquery("select banner_id, banner_order FROM " . DB_DEBONAIR . " where banner_id='" . intval($_GET['id']) . "' AND banner_language='" . LANGUAGE . "'"));
            if ($_GET['move'] == "md") {
                dbquery("UPDATE " . DB_DEBONAIR . " SET banner_order=banner_order-1 WHERE banner_order= '" . ($data['banner_order'] + 1) . "' AND banner_language='" . LANGUAGE . "'");
                dbquery("UPDATE " . DB_DEBONAIR . " SET banner_order=banner_order+1 WHERE banner_id='" . $data['banner_id'] . "' AND banner_language='" . LANGUAGE . "'");
            }
            if ($_GET['move'] == "mup") {
                dbquery("UPDATE " . DB_DEBONAIR . " SET banner_order=banner_order+1 WHERE banner_order= '" . ($data['banner_order'] - 1) . "' AND banner_language='" . LANGUAGE . "'");
                dbquery("UPDATE " . DB_DEBONAIR . " SET banner_order=banner_order-1 WHERE banner_id='" . $data['banner_id'] . "' AND banner_language='" . LANGUAGE . "'");
            }
            addNotice("success", $locale['debonair_0220']);
            redirect(clean_request("", array("move", "id"), false));
        }
        $result = dbquery("SELECT * FROM " . DB_DEBONAIR . " WHERE banner_language='" . LANGUAGE . "' order by banner_order ASC");
        if (dbrows($result) > 0) {
            echo "<table class='table table-striped'>\n";
            echo "<tr>\n\n\t\t<th>" . $locale['debonair_0205'] . "</th>\n\t\t<th>" . $locale['debonair_0210'] . "</th>\n\t\t<th>" . $locale['debonair_0214'] . "</th>\n<th>" . $locale['debonair_0215'] . "</th>\n\t\t<th>" . $locale['debonair_0211'] . "</th>\n\t\t<th>" . $locale['debonair_0216'] . "</th></tr>";
            while ($data = dbarray($result)) {
                echo "\n\t\t\t<tr>\n\n\t\t\t<td><a href='" . clean_request("slides=edit&id=" . $data['banner_id'], array(), false) . "'>" . $data['banner_subject'] . "</a></td>\n\n\t\t\t<td>" . ($data['banner_image'] ? $locale['yes'] : $locale['no']) . "</td>\n\n\t\t\t<td>" . $data['banner_language'] . "</td>\n\n\t\t\t<td>" . getgroupname($data['banner_visibility']) . "</td>\n";
                echo "<td>\n";
                if ($data['banner_order'] == 1) {
                    echo "<a href='" . clean_request("move=md&id=" . $data['banner_id'], array(), false) . "'>" . $locale['debonair_0219'] . "</a>";
                } elseif ($data['banner_order'] == dbrows($result)) {
                    echo "<a href='" . clean_request("move=mup&id=" . $data['banner_id'], array(), false) . "'>" . $locale['debonair_0218'] . "</a>";
                } else {
                    echo "<a href='" . clean_request("move=mup&id=" . $data['banner_id'], array(), false) . "'>" . $locale['debonair_0218'] . "</a> - ";
                    echo "<a href='" . clean_request("move=md&id=" . $data['banner_id'], array(), false) . "'>" . $locale['debonair_0219'] . "</a>";
                }
                echo "</td>\n\n\t\t\t<td>\n\t\t\t<a href='" . clean_request("slides=edit&id=" . $data['banner_id'], array(), false) . "'>" . $locale['edit'] . "</a>\n\t\t\t- <a href='" . clean_request("slides=del&id=" . $data['banner_id'], array(), false) . "'>" . $locale['delete'] . "</a>\n\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t";
            }
            echo "</table>\n";
        } else {
            echo "<div class='well text-center'>" . $locale['debonair_0213'] . "</div>\n";
        }
    }
}
Example #3
0
                if ($settings['tinymce_enabled'] == 1) {
                    include INCLUDES . "buildlist.php";
                }
                if (defender::safe()) {
                    addNotice('success', $locale['420']);
                    redirect(FUSION_SELF . $aidlink . "&amp;ifolder=" . $_GET['ifolder'] . "&img=" . $data['myfile']);
                }
            }
            redirect(FUSION_SELF . $aidlink . "&amp;ifolder=" . $_GET['ifolder']);
        }
    }
} else {
    opentable($locale['420']);
    add_breadcrumb(array('link' => ADMIN . "images.php" . $aidlink, 'title' => $locale['420']));
    echo openform('uploadform', 'post', FUSION_REQUEST, array('enctype' => TRUE));
    echo form_fileinput("myfile", $locale['421'], "", array('upload_path' => $afolder, 'type' => 'image', 'required' => true));
    echo form_button('uploadimage', $locale['420'], $locale['420'], array('class' => 'btn-primary'));
    echo closeform();
    closetable();
    if (isset($_GET['view']) && in_array($_GET['view'], $image_list)) {
        opentable($locale['440']);
        echo "<div style='text-align:center'><br />\n";
        $image_ext = strrchr($afolder . stripinput($_GET['view']), ".");
        if (in_array($image_ext, array(".gif", ".GIF", ".ico", ".jpg", ".JPG", ".jpeg", ".JPEG", ".png", ".PNG"))) {
            echo "<img class='img-responsive img-thumbnail' src='" . $afolder . stripinput($_GET['view']) . "' alt='" . stripinput($_GET['view']) . "' /><br /><br />\n";
        } else {
            echo "<strong>" . $locale['441'] . "</strong><br /><br />\n";
        }
        echo "<a href='" . FUSION_SELF . $aidlink . "&amp;ifolder=" . $_GET['ifolder'] . "&amp;del=" . stripinput($_GET['view']) . "' onclick=\"return confirm('" . $locale['470'] . "');\">" . $locale['442'] . "</a>";
        echo "<br /><br />\n<a href='" . FUSION_SELF . $aidlink . "'>" . $locale['402'] . "</a><br /><br />\n</div>\n";
        closetable();
Example #4
0
    echo "<a class='btn btn-default' href=\"javascript:void(0)\" onclick=\"javascript:backupSelectAll()\">" . $locale['436'] . "</a>\n";
    echo "<a class='btn btn-default' a href=\"javascript:void(0)\" onclick=\"javascript:backupSelectNone()\">" . $locale['437'] . "</a>\n";
    echo "</div>\n";
    echo "</div>\n";
    echo "</td>\n</tr>\n</tbody>\n</table>\n";
    echo "</td>\n";
    echo "</tr>\n<tr>\n";
    echo "<td align='center' colspan='2' class='tbl'>";
    echo form_button('btn_create_backup', $locale['459'], $locale['459'], array('class' => 'btn-primary'));
    echo "</td>\n</tr>\n</tbody>\n</table>\n</form>\n";
    closetable();
    opentable($locale['480']);
    $file_types = function_exists("gzencode") ? ".gz " : "";
    // added
    echo openform('restore', 'post', FUSION_SELF . $aidlink . "&amp;action=restore", array('enctype' => 1, "class" => 'list-group-item'));
    echo form_fileinput("upload_backup_file", $locale['431'], "", array('inline' => FALSE, 'type' => "object", "valid_ext" => $file_types));
    echo "<small>" . $locale['440'] . " " . $file_types . ".sql</small>\n";
    // added
    echo "<hr/>\n";
    echo form_button('restore', $locale['438'], $locale['438'], array('class' => 'btn-primary'));
    echo closeform();
    closetable();
}
function get_database_size($prefix = "")
{
    global $db_name;
    $db_size = 0;
    $result = dbquery("SHOW TABLE STATUS FROM `" . $db_name . "`");
    while ($row = dbarray($result)) {
        if (!isset($row['Type'])) {
            $row['Type'] = "";
Example #5
0
 public function get_profile_input()
 {
     global $locale;
     $this->method = "input";
     $section_links = $this->renderPageLink();
     $_GET['section'] = isset($_GET['section']) && isset($section_links[$_GET['section']]) ? $_GET['section'] : 1;
     if ($_GET['section'] == '1') {
         $user_name = isset($_POST['user_name']) ? $_POST['user_name'] : $this->userData['user_name'];
         $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : $this->userData['user_email'];
         $user_hide_email = isset($_POST['user_hide_email']) ? $_POST['user_hide_email'] : $this->userData['user_hide_email'];
         $this->info['user_name'] = form_para($locale['u129'], 'account', 'profile_category_name');
         if (iADMIN || $this->_userNameChange) {
             $this->info['user_name'] .= form_text('user_name', $locale['u127'], $user_name, array('max_length' => 30, 'required' => 1, 'error_text' => $locale['u122'], 'inline' => 1));
         }
         // User Password
         $this->info['user_password'] = form_para($locale['u132'], 'password', 'profile_category_name');
         if ($this->registration || $this->admin_mode) {
             $this->info['user_password'] .= form_text('user_password1', $locale['u134a'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u134'] . $locale['u143a'], 'required' => $this->admin_mode ? FALSE : TRUE));
             $this->info['user_password'] .= form_text('user_password2', $locale['u134b'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u133'], 'required' => $this->admin_mode ? FALSE : TRUE));
         } else {
             $this->info['user_password'] .= form_hidden('user_id', '', isset($this->userData['user_id']) && isnum($this->userData['user_id']) ? $this->userData['user_id'] : 0);
             $this->info['user_password'] .= form_text('user_password', $locale['u135a'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u133']));
             $this->info['user_password'] .= form_text('user_password1', $locale['u135b'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u133']));
             $this->info['user_password'] .= form_text('user_password2', $locale['u135c'], '', array('class' => 'm-b-0', 'type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u133']));
             $this->info['user_password'] .= "<input type='hidden' name='user_hash' value='" . $this->userData['user_password'] . "' />\n";
         }
         $this->info['user_password'] .= "<div class='col-xs-12 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-3'><span class='text-smaller'>" . $locale['u147'] . "</span></div>\n";
         // Admin Password - not available for everyone except edit profile.
         $this->info['user_admin_password'] = '';
         if (!$this->registration && iADMIN && !defined('ADMIN_PANEL')) {
             if ($this->userData['user_admin_password']) {
                 $this->info['user_admin_password'] = form_text('user_admin_password', $locale['u144a'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u136']));
                 $this->info['user_admin_password'] .= form_text('user_admin_password1', $locale['u144'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u136']));
             } else {
                 $this->info['user_admin_password'] = form_text('user_admin_password', $locale['u144'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u136']));
             }
             $this->info['user_admin_password'] .= form_text('user_admin_password2', $locale['u145'], '', array('class' => 'm-b-0', 'type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u136']));
             $this->info['user_admin_password'] .= "<div class='col-xs-12 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-3'><span class='text-smaller'>" . $locale['u147'] . "</span></div>\n";
         }
         // User Password Verification
         $this->info['user_password_verify'] = iADMIN && checkrights("M") ? "" : form_text('user_password_verify', $locale['u135a'], '', array('type' => 'password', 'autocomplete_off' => 1, 'inline' => 1, 'max_length' => 64, 'error_text' => $locale['u133']));
         // Avatar Field
         $this->info['user_avatar'] = '';
         if (!$this->registration) {
             if (isset($this->userData['user_avatar']) && $this->userData['user_avatar'] != "") {
                 $this->info['user_avatar'] = "<label for='user_avatar_upload'><img src='" . IMAGES . "avatars/" . $this->userData['user_avatar'] . "' alt='" . $locale['u185'] . "' />\n\t\t\t\t\t\t\t\t\t\t\t</label>\n<br />\n\n\t\t\t\t\t\t\t\t\t\t\t" . form_checkbox("delAvatar", $locale['u187'], "", array("reverse_label" => TRUE));
             } else {
                 $this->info['user_avatar'] = form_fileinput('user_avatar', $locale['u185'], '', array('upload_path' => IMAGES . "avatars/", 'input_id' => 'user_avatar_upload', 'type' => 'image', 'max_byte' => fusion_get_settings('avatar_filesize'), 'max_height' => fusion_get_settings('avatar_width'), 'max_width' => fusion_get_settings('avatar_height'), 'inline' => TRUE, 'thumbnail' => 0, 'width' => '100%', "delete_original" => FALSE, 'class' => 'm-t-10 m-b-0', "error_text" => $locale['u180'], "template" => "modern"));
                 $this->info['user_avatar'] .= "<div class='col-xs-12 col-sm-9 col-sm-offset-3 col-md-offset-3 col-lg-offset-3'>\n\t\t\t\t\t" . sprintf($locale['u184'], parsebytesize(fusion_get_settings('avatar_filesize')), fusion_get_settings('avatar_width'), fusion_get_settings('avatar_height')) . "</div>\n";
             }
         }
         // Email
         $this->info['user_email'] = form_text('user_email', $locale['u128'], $user_email, array('type' => 'email', "required" => TRUE, 'inline' => 1, 'max_length' => '100', 'error_text' => $locale['u126']));
         // Hide email toggler
         $this->info['user_hide_email'] = form_btngroup('user_hide_email', $locale['u051'], $user_hide_email, array('inline' => TRUE, $options = array($locale['u053'], $locale['u052'])));
         // Captcha
         if ($this->displayValidation == 1 && !defined('ADMIN_PANEL')) {
             $this->info['validate'] = $this->renderValidation();
         }
         // Website terms
         if ($this->displayTerms == 1) {
             $this->info['terms'] = $this->renderTerms();
         }
     }
     $this->info += array('register' => $this->registration, 'pages' => $this->paginate && !$this->registration ? $this->info['section'] = $section_links : '', 'openform' => openform($this->formname, 'post', FUSION_REQUEST, array('enctype' => $this->showAvatarInput ? TRUE : FALSE)), 'closeform' => closeform(), 'button' => $this->renderButton());
     $this->get_userFields();
     return (array) $this->info;
 }
Example #6
0
 public function render_edit_form()
 {
     global $locale, $userdata, $forum_settings, $defender;
     $thread_data = $this->thread_info['thread'];
     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");
         if (dbrows($result) > 0) {
             $post_data = dbarray($result);
             if ((iMOD or iSUPERADMIN) || $this->getThreadPermission("can_reply") && $post_data['post_author'] == $userdata['user_id']) {
                 $is_first_post = $post_data['post_id'] == $this->thread_info['post_firstpost'] ? TRUE : FALSE;
                 // no edit if locked
                 if ($post_data['post_locked'] && !iMOD) {
                     redirect(INFUSIONS . "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(INFUSIONS . "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";
                     // all data is sanitized here.
                     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' => 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 == TRUE) {
                             $post_data['thread_subject'] = form_sanitizer($_POST['thread_subject'], '', 'thread_subject');
                         }
                         if ($defender->safe()) {
                             // 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]) && $this->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(INFUSIONS . "forum/postify.php?post=edit&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;thread_id=" . intval($post_data['thread_id']) . "&amp;post_id=" . intval($post_data['post_id']));
                             }
                         }
                     }
                 }
                 // template data
                 $form_action = INFUSIONS . "forum/viewthread.php?action=edit&amp;forum_id=" . $thread_data['forum_id'] . "&amp;thread_id=" . $thread_data['thread_id'] . "&amp;post_id=" . $_GET['post_id'];
                 // get attachment.
                 $attachments = array();
                 $attach_rows = 0;
                 if ($this->getThreadPermission("can_upload_attach") && !empty($this->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' => $this->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']), "forum_field" => "", 'subject_field' => $this->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')), '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' => $this->getThreadPermission("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, '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')), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0')) : '', 'sticky_field' => (iMOD || iSUPERADMIN) && $is_first_post ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0')) : '', 'lock_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0')) : '', 'hide_edit_field' => form_checkbox('hide_edit', $locale['forum_0627'], '', array('class' => 'm-b-0')), 'post_locked_field' => iMOD || iSUPERADMIN ? form_checkbox('post_locked', $locale['forum_0628'], $post_data['post_locked'], array('class' => 'm-b-0')) : '', '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 .= "<label><input type='checkbox' name='delete_attach_" . $a_data['attach_id'] . "' value='1' /> " . $locale['forum_0625'] . "</label>\n" . "<a href='" . INFUSIONS . "forum/attachments/" . $a_data['attach_name'] . "'>" . $a_data['attach_name'] . "</a> [" . parsebytesize($a_data['attach_size']) . "]\n" . "<br/>\n";
                     }
                     $info['attachment_field'] = $a_info . $info['attachment_field'];
                 }
                 postform($info);
             } else {
                 redirect(INFUSIONS . 'forum/index.php');
                 // no access
             }
         } else {
             redirect(INFUSIONS . "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 {
         redirect(INFUSIONS . 'forum/index.php');
     }
 }
Example #7
0
 /**
  * Display fields for each fieldDB record entry
  * @param array  $data The array of the user field.
  * @param        $callback_data
  * @param string $method input or display. In case of any other value
  *                       the method return FALSE. See the description of return for more details.
  * @param array  $options
  *                       <ul>
  *                       <li><strong>deactivate</strong> (boolean): FALSE by default.
  *                       disable fields</li>
  *                       <li><strong>debug</strong> (bolean): FALSE by default.
  *                       Show some information to debug.</li>
  *                       <li><strong>encrypt</strong> (boolean): FALSE by default.
  *                       encrypt field names</li>
  *                       <li><strong>error_text</strong> (string): empty string by default.
  *                       sets the field error text</li>
  *                       <li><strong>hide_value</strong> (boolean): FALSE by default.
  *                       input value is not shown on fields render</li>
  *                       <li><strong>inline</strong> (boolean): FALSE by default.
  *                       sets the field inline</li>
  *                       <li><strong>required</strong> (boolean): FALSE by default.
  *                       input must be filled when validate</li>
  *                       <li><strong>show_title</strong> (boolean): FALSE by default.
  *                       display field label</li>
  *                       <li><strong>placeholder</strong> (string): empty string by default.
  *                       helper text in field value</li>
  *                       <li><strong>plugin_folder</strong> (string): INCLUDES.'user_fields/' by default
  *                       The folder's path where the field's source files are.</li>
  *                       <li><strong>plugin_locale_folder</strong> (string): LOCALE.LOCALESET.'/user_fields/' by default.
  *                       The folder's path where the field's locale files are.</li>
  *                       </ul>
  * @return array|bool|string
  *                       <ul>
  *                       <li>FALSE on failure</li>
  *                       <li>string if $method 'display'</li>
  *                       <li>array if $method is 'input'</li>
  *                       </ul>
  */
 public function display_fields(array $data, $callback_data, $method = 'input', array $options = array())
 {
     // Add compatibality to V7's UF module.
     // Security concerns: remove all password hashes and salt
     unset($callback_data['user_algo']);
     unset($callback_data['user_salt']);
     unset($callback_data['user_password']);
     unset($callback_data['user_admin_algo']);
     unset($callback_data['user_admin_salt']);
     unset($callback_data['user_admin_password']);
     $data += array('field_required' => TRUE, 'field_error' => '', 'field_default' => '');
     $default_options = array('hide_value' => FALSE, 'encrypt' => FALSE, 'show_title' => $method == "input" ? TRUE : FALSE, 'deactivate' => FALSE, 'inline' => FALSE, 'error_text' => $data['field_error'], 'required' => (bool) $data['field_required'], 'placeholder' => $data['field_default'], 'plugin_folder' => INCLUDES . 'user_fields/', 'plugin_locale_folder' => LOCALE . LOCALESET . '/user_fields/', 'debug' => FALSE);
     $options += $default_options;
     if (!$options['plugin_folder']) {
         $options['plugin_folder'] = $default_options['plugin_folder'];
     }
     if (!$options['plugin_locale_folder']) {
         $options['plugin_locale_folder'] = $default_options['plugin_locale_folder'];
     }
     if (substr($options['plugin_folder'], -1) !== '/') {
         $options['plugin_folder'] .= '/';
     }
     if (substr($options['plugin_locale_folder'], -1) !== '/') {
         $options['plugin_locale_folder'] .= '/';
     }
     // Sets callback data automatically.
     $option_list = $data['field_options'] ? explode(',', $data['field_options']) : array();
     // Format Callback Data
     $field_value = isset($callback_data[$data['field_name']]) ? $callback_data[$data['field_name']] : '';
     if (isset($_POST[$data['field_name']]) && !$options['hide_value']) {
         $field_value = $_POST[$data['field_name']];
     } elseif ($options['hide_value']) {
         $field_value = '';
     }
     switch ($data['field_type']) {
         case 'file':
             // Do not remove it. It is used in included files.
             $user_data = $callback_data;
             $profile_method = $method;
             // can access options vars
             if (file_exists($options['plugin_locale_folder'] . $data['field_name'] . ".php")) {
                 include $options['plugin_locale_folder'] . $data['field_name'] . ".php";
             }
             if (file_exists($options['plugin_folder'] . $data['field_name'] . "_include.php")) {
                 include $options['plugin_folder'] . $data['field_name'] . "_include.php";
             }
             if (isset($options['debug']) && $options['debug']) {
                 print_p("Finding " . $options['plugin_locale_folder'] . $data['field_name'] . ".php");
                 if (file_exists($options['plugin_locale_folder'] . $data['field_name'] . ".php")) {
                     print_p($data['field_name'] . " locale loaded");
                 }
                 print_p("Finding " . $options['plugin_folder'] . $data['field_name'] . "_include.php");
                 if (file_exists($options['plugin_folder'] . $data['field_name'] . "_include.php")) {
                     print_p($data['field_name'] . " module loaded");
                 }
             }
             if (isset($user_fields)) {
                 return $user_fields;
             }
             break;
         case 'textbox':
             if ($method == 'input') {
                 return form_text($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'number':
             if ($method == 'input') {
                 $options += array('type' => 'number');
                 return form_text($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'url':
             if ($method == 'input') {
                 $options += array('type' => 'url');
                 return form_text($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'email':
             if ($method == 'input') {
                 $options += array('type' => 'email');
                 return form_text($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'select':
             if ($method == 'input') {
                 $options['options'] = $option_list;
                 return form_select($data['field_name'], self::parse_label($data['field_title']), $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 $options_value = explode(",", $data['field_options']);
                 return array('title' => self::parse_label($data['field_title']), 'value' => !empty($options_value[$field_value]) ? $options_value[$field_value] : $field_value);
             }
             break;
         case 'tags':
             if ($method == 'input') {
                 $options += array('options' => $option_list, 'tags' => 1, 'multiple' => 1, 'width' => '100%');
                 return form_select($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'location':
             if ($method == 'input') {
                 $options += array('width' => '100%');
                 return form_location($data['field_name'], self::parse_label($data['field_title']), $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'textarea':
             if ($method == 'input') {
                 return form_textarea($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'checkbox':
             if ($method == 'input') {
                 return form_checkbox($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'datepicker':
             if ($method == 'input') {
                 return form_datepicker($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => showdate('shortdate', $field_value));
             }
             break;
         case 'colorpicker':
             if ($method == 'input') {
                 return form_colorpicker($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'uploader':
             if ($method == 'input') {
                 return form_fileinput($data['field_name'], self::parse_label($data['field_title']), $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'hidden':
             if ($method == 'input') {
                 return form_hidden($data['field_name'], self::parse_label($data['field_title']), $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
         case 'address':
             if ($method == 'input') {
                 return form_geo($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => implode('|', $field_value));
             }
             break;
         case 'toggle':
             $options['toggle'] = 1;
             $options['toggle_text'] = array($this->locale['off'], $this->locale['on']);
             if ($method == 'input') {
                 return form_checkbox($data['field_name'], $options['show_title'] ? self::parse_label($data['field_title']) : '', $field_value, $options);
             } elseif ($method == 'display' && $field_value) {
                 return array('title' => self::parse_label($data['field_title']), 'value' => $field_value);
             }
             break;
     }
     return FALSE;
 }
Example #8
0
 /**
  * New thread
  */
 public function set_newThreadInfo()
 {
     $userdata = fusion_get_userdata();
     $locale = fusion_get_locale("", FORUM_LOCALE);
     $locale += fusion_get_locale("", FORUM_TAGS_LOCALE);
     $forum_settings = ForumServer::get_forum_settings();
     // @todo: Reduce lines and optimize further
     if (iMEMBER) {
         // New thread directly to a specified forum
         if (!empty($_GET['forum_id']) && ForumServer::verify_forum($_GET['forum_id'])) {
             add_to_title($locale['forum_0000']);
             add_to_meta("description", $locale['forum_0000']);
             add_breadcrumb(array("link" => FORUM . "index.php", "title" => $locale['forum_0000']));
             add_to_title($locale['global_201'] . $locale['forum_0057']);
             $forum_data = dbarray(dbquery("SELECT f.*, f2.forum_name AS forum_cat_name\n\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n\t\t\t\tWHERE f.forum_id='" . intval($_GET['forum_id']) . "'\n\t\t\t\tAND " . groupaccess('f.forum_access') . "\n\t\t\t\t"));
             if ($forum_data['forum_type'] == 1) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             // Use the new permission settings
             self::setPermission($forum_data);
             $forum_data['lock_edit'] = $forum_settings['forum_edit_lock'];
             if (self::getPermission("can_post") && self::getPermission("can_access")) {
                 add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php?viewforum&amp;forum_id=' . $forum_data['forum_id'] . '&amp;parent_id=' . $forum_data['forum_cat'], 'title' => $forum_data['forum_name']));
                 add_breadcrumb(array('link' => INFUSIONS . 'forum/index.php?viewforum&amp;forum_id=' . $forum_data['forum_id'] . '&amp;parent_id=' . $forum_data['forum_cat'], 'title' => $locale['forum_0057']));
                 /**
                  * Generate a poll form
                  */
                 $poll_form = "";
                 if (self::getPermission("can_create_poll")) {
                     // initial data to push downwards
                     $pollData = array('thread_id' => 0, 'forum_poll_title' => !empty($_POST['forum_poll_title']) ? form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title') : '', 'forum_poll_start' => time(), 'forum_poll_length' => 2, 'forum_poll_votes' => 0);
                     // counter of lengths
                     $option_data[1] = "";
                     $option_data[2] = "";
                     // Do a validation if checked add_poll
                     if (isset($_POST['add_poll'])) {
                         $pollData = array('thread_id' => 0, 'forum_poll_title' => isset($_POST['forum_poll_title']) ? form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title') : '', 'forum_poll_start' => time(), 'forum_poll_length' => count($option_data), 'forum_poll_votes' => 0);
                         // calculate poll lengths
                         if (!empty($_POST['poll_options']) && is_array($_POST['poll_options'])) {
                             foreach ($_POST['poll_options'] as $i => $value) {
                                 $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]");
                             }
                         }
                     }
                     if (isset($_POST['add_poll_option']) && isset($_POST['poll_options'])) {
                         // reindex the whole array with blank values.
                         foreach ($_POST['poll_options'] as $i => $value) {
                             $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]");
                         }
                         if (\defender::safe()) {
                             $option_data = array_values(array_filter($option_data));
                             array_unshift($option_data, NULL);
                             unset($option_data[0]);
                             $pollData['forum_poll_length'] = count($option_data);
                         }
                         array_push($option_data, '');
                     }
                     $poll_field = '';
                     $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $pollData['forum_poll_title'], array('max_length' => 255, 'placeholder' => $locale['forum_0604a'], 'inline' => TRUE, 'required' => TRUE));
                     for ($i = 1; $i <= count($option_data); $i++) {
                         $poll_field['poll_field'] .= form_text("poll_options[{$i}]", sprintf($locale['forum_0606'], $i), $option_data[$i], array('max_length' => 255, 'placeholder' => $locale['forum_0605'], 'inline' => TRUE, 'required' => $i <= 2 ? TRUE : FALSE));
                     }
                     $poll_field['poll_field'] .= "<div class='col-xs-12 col-sm-offset-3'>\n";
                     $poll_field['poll_field'] .= form_button('add_poll_option', $locale['forum_0608'], $locale['forum_0608'], array('class' => 'btn-primary btn-sm'));
                     $poll_field['poll_field'] .= "</div>\n";
                     $info = array('title' => $locale['forum_0366'], 'description' => $locale['forum_0630'], 'field' => $poll_field);
                     ob_start();
                     echo form_checkbox("add_poll", $locale['forum_0366'], isset($_POST['add_poll']) ? TRUE : FALSE, array('reverse_label' => TRUE));
                     echo "<div id='poll_form' class='poll-form' style='display:none;'>\n";
                     echo "<div class='well clearfix'>\n";
                     echo "<!--pre_form-->\n";
                     echo $info['field']['poll_field'];
                     echo "</div>\n";
                     echo "</div>\n";
                     $poll_form = ob_get_contents();
                     ob_end_clean();
                 }
                 $thread_data = array('forum_id' => $forum_data['forum_id'], 'thread_id' => 0, 'thread_subject' => isset($_POST['thread_subject']) ? form_sanitizer($_POST['thread_subject'], '', 'thread_subject') : '', 'thread_tags' => isset($_POST['thread_tags']) ? form_sanitizer($_POST['thread_tags'], '', 'thread_tags') : '', 'thread_author' => $userdata['user_id'], 'thread_views' => 0, 'thread_lastpost' => time(), 'thread_lastpostid' => 0, 'thread_lastuser' => $userdata['user_id'], 'thread_postcount' => 1, 'thread_poll' => 0, 'thread_sticky' => isset($_POST['thread_sticky']) ? 1 : 0, 'thread_locked' => isset($_POST['thread_sticky']) ? 1 : 0, 'thread_hidden' => 0);
                 $post_data = array('forum_id' => $forum_data['forum_id'], 'forum_cat' => $forum_data['forum_cat'], 'thread_id' => 0, 'post_id' => 0, 'post_message' => isset($_POST['post_message']) ? form_sanitizer($_POST['post_message'], '', 'post_message') : '', 'post_showsig' => isset($_POST['post_showsig']) ? 1 : 0, 'post_smileys' => !isset($_POST['post_smileys']) || isset($_POST['post_message']) && preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $_POST['post_message']) ? 0 : 1, 'post_author' => $userdata['user_id'], 'post_datestamp' => time(), 'post_ip' => USER_IP, 'post_ip_type' => USER_IP_TYPE, 'post_edituser' => 0, 'post_edittime' => 0, 'post_editreason' => '', 'post_hidden' => 0, 'notify_me' => isset($_POST['notify_me']) ? 1 : 0, 'post_locked' => 0);
                 // Execute post new thread
                 if (isset($_POST['post_newthread']) && \defender::safe()) {
                     require_once INCLUDES . "flood_include.php";
                     // all data is sanitized here.
                     if (!flood_control("post_datestamp", DB_FORUM_POSTS, "post_author='" . $userdata['user_id'] . "'")) {
                         // have notice
                         if (\defender::safe()) {
                             // create a new thread.
                             dbquery_insert(DB_FORUM_THREADS, $thread_data, 'save', array('primary_key' => 'thread_id', 'keep_session' => TRUE));
                             $post_data['thread_id'] = dblastid();
                             $pollData['thread_id'] = dblastid();
                             dbquery_insert(DB_FORUM_POSTS, $post_data, 'save', array('primary_key' => 'post_id', 'keep_session' => TRUE));
                             $post_data['post_id'] = dblastid();
                             // Attach files if permitted
                             if (!empty($_FILES) && is_uploaded_file($_FILES['file_attachments']['tmp_name'][0]) && self::getPermission("can_upload_attach")) {
                                 $upload = form_sanitizer($_FILES['file_attachments'], '', 'file_attachments');
                                 if ($upload['error'] == 0) {
                                     foreach ($upload['target_file'] as $arr => $file_name) {
                                         $attach_data = array('thread_id' => $post_data['thread_id'], 'post_id' => $post_data['post_id'], 'attach_name' => $file_name, 'attach_mime' => $upload['type'][$arr], 'attach_size' => $upload['source_size'][$arr], 'attach_count' => '0');
                                         dbquery_insert(DB_FORUM_ATTACHMENTS, $attach_data, "save", array('keep_session' => TRUE));
                                     }
                                 }
                             }
                             dbquery("UPDATE " . DB_USERS . " SET user_posts=user_posts+1 WHERE user_id='" . intval($post_data['post_author']) . "'");
                             // Update stats in forum and threads
                             // find all parents and update them
                             $list_of_forums = get_all_parent(dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'), $post_data['forum_id']);
                             if (is_array($list_of_forums)) {
                                 foreach ($list_of_forums as $forum_id) {
                                     $forum_update_sql = "\n                                        UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($post_data['post_datestamp']) . "',\n                                        forum_postcount=forum_postcount+1,\n                                        forum_threadcount=forum_threadcount+1,\n                                        forum_lastpostid='" . intval($post_data['post_id']) . "',\n                                        forum_lastuser='******'post_author']) . "' WHERE forum_id='" . intval($forum_id) . "'\n                                        ";
                                     dbquery($forum_update_sql);
                                 }
                             }
                             // update current forum
                             dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . $post_data['post_datestamp'] . "', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $post_data['forum_id'] . "'");
                             // update current thread
                             dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . $post_data['post_datestamp'] . "', thread_lastpostid='" . $post_data['post_id'] . "', thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $post_data['thread_id'] . "'");
                             // set notify
                             if ($forum_settings['thread_notify'] && isset($_POST['notify_me']) && $post_data['thread_id']) {
                                 if (!dbcount("(thread_id)", DB_FORUM_THREAD_NOTIFY, "thread_id='" . $post_data['thread_id'] . "' AND notify_user='******'post_author'] . "'")) {
                                     dbquery("INSERT INTO " . DB_FORUM_THREAD_NOTIFY . " (thread_id, notify_datestamp, notify_user, notify_status) VALUES('" . $post_data['thread_id'] . "', '" . $post_data['post_datestamp'] . "', '" . $post_data['post_author'] . "', '1')");
                                 }
                             }
                             // Add poll if exist
                             if (!empty($option_data) && isset($_POST['add_poll'])) {
                                 dbquery_insert(DB_FORUM_POLLS, $pollData, 'save');
                                 $poll_option_data['thread_id'] = $pollData['thread_id'];
                                 $i = 1;
                                 foreach ($option_data as $option_text) {
                                     if ($option_text) {
                                         $poll_option_data['forum_poll_option_id'] = $i;
                                         $poll_option_data['forum_poll_option_text'] = $option_text;
                                         $poll_option_data['forum_poll_option_votes'] = 0;
                                         dbquery_insert(DB_FORUM_POLL_OPTIONS, $poll_option_data, 'save');
                                         $i++;
                                     }
                                 }
                                 dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_poll='1' WHERE thread_id='" . $pollData['thread_id'] . "'");
                             }
                         }
                         if (\defender::safe()) {
                             redirect(INFUSIONS . "forum/postify.php?post=new&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;parent_id=" . intval($post_data['forum_cat']) . "&amp;thread_id=" . intval($post_data['thread_id'] . ""));
                         }
                     }
                 }
                 $this->info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', FORUM . "newthread.php?forum_id=" . $post_data['forum_id'], array('enctype' => self::getPermission("can_upload_attach"))), 'closeform' => closeform(), 'forum_id_field' => '', 'thread_id_field' => '', "forum_field" => "", 'subject_field' => form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => 1, 'placeholder' => $locale['forum_2001'], 'error_text' => '', 'class' => 'm-t-20 m-b-20')), 'tags_field' => form_select('thread_tags[]', $locale['forum_tag_0100'], $thread_data['thread_tags'], array('options' => $this->tag()->get_TagOpts(TRUE), 'width' => '100%', 'multiple' => TRUE, 'delimiter' => '.', 'max_select' => 3)), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => 1, 'error_text' => '', 'autosize' => 1, 'no_resize' => 1, 'preview' => 1, 'form_name' => 'input_form', 'bbcode' => 1)), 'attachment_field' => self::getPermission("can_upload_attach") ? form_fileinput('file_attachments[]', $locale['forum_0557'], "", array('input_id' => 'file_attachments', 'upload_path' => INFUSIONS . 'forum/attachments/', 'type' => 'object', 'preview_off' => TRUE, "multiple" => TRUE, "inline" => FALSE, 'max_count' => $forum_settings['forum_attachmax_count'], 'valid_ext' => $forum_settings['forum_attachtypes'], "class" => "m-b-0")) . " <div class='m-b-20'>\n<small>\n                            " . sprintf($locale['forum_0559'], parsebytesize($forum_settings['forum_attachmax']), str_replace('|', ', ', $forum_settings['forum_attachtypes']), $forum_settings['forum_attachmax_count']) . "</small>\n</div>\n" : "", 'poll_form' => $poll_form, 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0', 'reverse_label' => TRUE)), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'sticky_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'lock_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
                 // add a jquery to toggle the poll form
                 add_to_jquery("\n                        if (\$('#add_poll').is(':checked')) {\n                            \$('#poll_form').show();\n                        } else {\n                            \$('#poll_form').hide();\n                        }\n                        \$('#add_poll').bind('click', function() {\n                            if (\$(this).is(':checked')) {\n                                \$('#poll_form').slideDown();\n                            } else {\n                                \$('#poll_form').slideUp();\n                            }\n                        });\n                    ");
             } else {
                 redirect(FORUM . "index.php");
             }
         } else {
             /*
              * Quick New Forum Posting.
              * Does not require to run permissions.
              * Does not contain forum poll.
              * Does not contain attachment
              */
             if (!dbcount("(forum_id)", DB_FORUMS, "forum_type !='1'")) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             if (!dbcount("(forum_id)", DB_FORUMS, "forum_language ='" . LANGUAGE . "'")) {
                 redirect(INFUSIONS . "forum/index.php");
             }
             add_breadcrumb(array("link" => FORUM . "newthread.php?forum_id=0", "title" => $locale['forum_0057']));
             $thread_data = array('forum_id' => isset($_POST['forum_id']) ? form_sanitizer($_POST['forum_id'], 0, "forum_id") : 0, 'thread_id' => 0, 'thread_subject' => isset($_POST['thread_subject']) ? form_sanitizer($_POST['thread_subject'], '', 'thread_subject') : '', 'thread_tags' => isset($_POST['thread_tags']) ? form_sanitizer($_POST['thread_tags'], '', 'thread_tags') : '', 'thread_author' => $userdata['user_id'], 'thread_views' => 0, 'thread_lastpost' => time(), 'thread_lastpostid' => 0, 'thread_lastuser' => $userdata['user_id'], 'thread_postcount' => 1, 'thread_poll' => 0, 'thread_sticky' => isset($_POST['thread_sticky']) ? TRUE : FALSE, 'thread_locked' => isset($_POST['thread_sticky']) ? TRUE : FALSE, 'thread_hidden' => 0);
             $post_data = array('forum_id' => isset($_POST['forum_id']) ? form_sanitizer($_POST['forum_id'], 0, "forum_id") : 0, "forum_cat" => 0, 'thread_id' => 0, 'post_id' => 0, 'post_message' => isset($_POST['post_message']) ? form_sanitizer($_POST['post_message'], '', 'post_message') : '', 'post_showsig' => isset($_POST['post_showsig']) ? TRUE : FALSE, 'post_smileys' => !isset($_POST['post_smileys']) || isset($_POST['post_message']) && preg_match("#(\\[code\\](.*?)\\[/code\\]|\\[geshi=(.*?)\\](.*?)\\[/geshi\\]|\\[php\\](.*?)\\[/php\\])#si", $_POST['post_message']) ? FALSE : TRUE, 'post_author' => $userdata['user_id'], 'post_datestamp' => time(), 'post_ip' => USER_IP, 'post_ip_type' => USER_IP_TYPE, 'post_edituser' => 0, 'post_edittime' => 0, 'post_editreason' => '', 'post_hidden' => 0, 'notify_me' => isset($_POST['notify_me']) ? TRUE : FALSE, 'post_locked' => 0);
             // go for a new thread posting.
             // check data
             // and validate
             // do not run attach, and do not run poll.
             if (isset($_POST['post_newthread']) && \defender::safe()) {
                 require_once INCLUDES . "flood_include.php";
                 // all data is sanitized here.
                 if (!flood_control("post_datestamp", DB_FORUM_POSTS, "post_author='" . $userdata['user_id'] . "'")) {
                     // have notice
                     if (ForumServer::verify_forum($thread_data['forum_id'])) {
                         $forum_data = dbarray(dbquery("SELECT f.*, f2.forum_name AS forum_cat_name\n                            FROM " . DB_FORUMS . " f\n                            LEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n                            WHERE f.forum_id='" . intval($thread_data['forum_id']) . "'\n                            AND " . groupaccess('f.forum_access') . "\n                            "));
                         if ($forum_data['forum_type'] == 1) {
                             redirect(INFUSIONS . "forum/index.php");
                         }
                         // Use the new permission settings
                         self::setPermission($forum_data);
                         $forum_data['lock_edit'] = $forum_settings['forum_edit_lock'];
                         if (self::getPermission("can_post") && self::getPermission("can_access")) {
                             $post_data['forum_cat'] = $forum_data['forum_cat'];
                             // create a new thread.
                             dbquery_insert(DB_FORUM_THREADS, $thread_data, 'save', array('primary_key' => 'thread_id', 'keep_session' => TRUE));
                             $post_data['thread_id'] = dblastid();
                             dbquery_insert(DB_FORUM_POSTS, $post_data, 'save', array('primary_key' => 'post_id', 'keep_session' => TRUE));
                             $post_data['post_id'] = dblastid();
                             dbquery("UPDATE " . DB_USERS . " SET user_posts=user_posts+1 WHERE user_id='" . $post_data['post_author'] . "'");
                             // Update stats in forum and threads
                             // find all parents and update them
                             $list_of_forums = get_all_parent(dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat'), $post_data['forum_id']);
                             foreach ($list_of_forums as $fid) {
                                 dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . time() . "', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $fid . "'");
                             }
                             // update current forum
                             dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost=''" . time() . "'', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastpostid='" . $post_data['post_id'] . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $post_data['forum_id'] . "'");
                             // update current thread
                             dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost=''" . time() . "'', thread_lastpostid='" . $post_data['post_id'] . "', thread_lastuser='******'post_author'] . "' WHERE thread_id='" . $post_data['thread_id'] . "'");
                             // set notify
                             if ($forum_settings['thread_notify'] && isset($_POST['notify_me']) && $post_data['thread_id']) {
                                 if (!dbcount("(thread_id)", DB_FORUM_THREAD_NOTIFY, "thread_id='" . $post_data['thread_id'] . "' AND notify_user='******'post_author'] . "'")) {
                                     dbquery("INSERT INTO " . DB_FORUM_THREAD_NOTIFY . " (thread_id, notify_datestamp, notify_user, notify_status) VALUES('" . $post_data['thread_id'] . "', '" . time() . "', '" . $post_data['post_author'] . "', 1)");
                                 }
                             }
                             if (\defender::safe()) {
                                 redirect(INFUSIONS . "forum/postify.php?post=new&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;parent_id=" . intval($post_data['forum_cat']) . "&amp;thread_id=" . intval($post_data['thread_id'] . ""));
                             }
                         } else {
                             addNotice("danger", $locale['forum_0186']);
                         }
                     } else {
                         addNotice("danger", $locale['forum_0187']);
                         redirect(INFUSIONS . "forum/index.php");
                     }
                 }
             }
             //Disable all parents
             $disabled_opts = array();
             $disable_query = "\n                SELECT forum_id FROM " . DB_FORUMS . " WHERE forum_type='1'\n                " . (multilang_table("FO") ? "AND forum_language='" . LANGUAGE . "'" : "") . "\n                ";
             $disable_query = dbquery(" {$disable_query} ");
             if (dbrows($disable_query) > 0) {
                 while ($d_forum = dbarray($disable_query)) {
                     $disabled_opts = $d_forum['forum_id'];
                 }
             }
             $this->info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', FORUM . "newthread.php", array('enctype' => FALSE)), 'closeform' => closeform(), 'forum_id_field' => '', 'thread_id_field' => '', 'forum_field' => form_select_tree("forum_id", $locale['forum_0395'], $thread_data['forum_id'], array("required" => TRUE, "width" => "320px", "no_root" => TRUE, "disable_opts" => $disabled_opts, "query" => multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "'" : ""), DB_FORUMS, "forum_name", "forum_id", "forum_cat"), 'subject_field' => form_text('thread_subject', $locale['forum_0600'], $thread_data['thread_subject'], array('required' => 1, 'placeholder' => $locale['forum_2001'], 'error_text' => '', 'class' => 'm-t-20 m-b-20')), 'tags_field' => form_select('thread_tags[]', $locale['forum_tag_0100'], $thread_data['thread_tags'], array('options' => $this->tag()->get_TagOpts(), 'width' => '100%', 'multiple' => TRUE, 'delimiter' => '.', 'max_select' => 3)), 'message_field' => form_textarea('post_message', $locale['forum_0601'], $post_data['post_message'], array('required' => 1, 'error_text' => '', 'autosize' => 1, 'no_resize' => 1, 'preview' => 1, 'form_name' => 'input_form', 'bbcode' => 1)), 'attachment_field' => "", 'poll_form' => "", 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0', 'reverse_label' => TRUE)), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'sticky_field' => iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'lock_field' => iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0', 'reverse_label' => TRUE)) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
         }
     } else {
         redirect(INFUSIONS . 'forum/index.php');
     }
 }
Example #9
0
 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();
 }
Example #10
0
echo form_text('text_input_safe', 'Required text input in SAFEMODE', $settings_test['text_input_safe'], array('required' => 1, 'safemode' => 1, 'inline' => 1));
echo form_text('password_input', 'Password input', $settings_test['password_input'], array('type' => 'password', 'autocomplete_off' => 1, 'required' => 1, 'error_text' => 'Ummm, please enter a valid password here', 'inline' => 1));
echo form_text('text_input', 'Text input', $settings_test['text_input'], array('required' => 1, 'inline' => 1));
echo form_text('text_input2', 'An extra text input<br /><small>This input is not accounted for and will be ignored</small>', 'something', array('required' => 1, 'inline' => 1));
echo form_text('email_input', 'Email', $settings_test['email_input'], array('required' => 0, 'type' => 'email', 'inline' => 1));
echo form_text('email_input_required', 'Email required', $settings_test['email_input_required'], array('required' => 1, 'type' => 'email', 'inline' => 1));
echo form_text('url_input', 'URL', $settings_test['url_input'], array('type' => 'url', 'inline' => 1));
echo form_text('regex_input', 'Regex', $settings_test['regex_input'], array('tip' => 'Characters from A to Z only', 'regex' => '[a-z]+', 'inline' => 1));
echo form_text('regex_input_required', 'Regex required', $settings_test['regex_input_required'], array('required' => 1, 'tip' => 'Characters from A to Z only', 'regex' => '[a-z]+', 'inline' => 1));
echo form_text('number_input', 'Number', $settings_test['number_input'], array('required' => 1, 'type' => 'number', 'inline' => 1));
echo form_checkbox('checkbox_input', 'Checkbox', $settings_test['checkbox_input'], array('required' => 1, 'inline' => 1));
// Experimental 'child_of'
echo form_checkbox('checkbox_input2', 'Checkbox 2, child of Checkbox', $settings_test['checkbox_input2'], array('child_of' => 'checkbox_input', 'inline' => 1));
echo form_checkbox('checkbox_input_bs', 'Bootstrap switch checkbox', $settings_test['checkbox_input_bs'], array('toggle' => 1, 'toggle_text' => array('OFF', 'ON'), 'disabled' => 0, 'inline' => 1));
//echo form_checkbox('Checkbox 3, child of Checkbox', 'checkbox_input3', 'checkbox_input3', $settings_test['checkbox_input3'], array('child_of' => 'checkbox_input', 'inline' => 1));
//echo form_checkbox('Checkbox 4, child of Checkbox 3', 'checkbox_input4', 'checkbox_input4', $settings_test['checkbox_input4'], array('child_of' => 'checkbox_input3', 'inline' => 1));
//echo form_name('Name', 'name_input', 'name_input', $settings_test['name_input'], array('required' => 1, 'inline' => 1));
//echo form_address('Address', 'address_input', 'address_input', explode('|', $settings_test['address_input']), array('inline' => 1));
echo form_textarea('textarea', 'Text area', $settings_test['textarea'], array('autosize' => 1, 'inline' => 1));
//var_dump($_SESSION['form_fields'][$_SERVER['PHP_SELF']]);
$file_options = array('upload_path' => DOWNLOADS . "images/", 'max_width' => $settings['download_screen_max_w'], 'max_height' => $settings['download_screen_max_w'], 'max_byte' => $settings['download_screen_max_b'], 'type' => 'image', 'required' => 0, 'delete_original' => 0, 'thumbnail_folder' => '', 'thumbnail' => 1, 'thumbnail_suffix' => '_thumb', 'thumbnail_w' => $settings['download_thumb_max_w'], 'thumbnail_h' => $settings['download_thumb_max_h'], 'error_text' => 'Please select an image', 'inline' => 1, 'thumbnail2' => 0);
echo form_fileinput('file_input', 'File upload', '', $file_options);
// all file types.
echo form_button('submit', 'Submit', 'value', array('class' => 'btn-success'));
echo closeform();
echo "<br>These are the default and posted settings merged, which would endup being inserted in the DB:";
var_dump($settings_test);
echo "<br>These are the tokens available for this form:";
var_dump($_SESSION['csrf_tokens']['form']);
closetable();
require_once THEMES . "templates/footer.php";
Example #11
0
        echo "<div class='well text-center'><p><strong>" . $locale['gallery_0101'] . "</strong></p>";
        echo "<p><a href='submit.php?stype=p'>" . $locale['gallery_0102'] . "</a></p>";
        echo "<p><a href='index.php'>" . $locale['gallery_0113'] . "</a></p>\n";
        echo "</div>\n";
    } else {
        $result = dbquery("SELECT album_id, album_title FROM " . DB_PHOTO_ALBUMS . " " . (multilang_table("PG") ? "WHERE album_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess("album_access") . " ORDER BY album_title");
        if (dbrows($result) > 0) {
            $opts = array();
            while ($data = dbarray($result)) {
                $opts[$data['album_id']] = $data['album_title'];
            }
            echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=p", array("enctype" => TRUE));
            echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
            echo "<div class='m-b-20 submission-guidelines'>" . $locale['gallery_0107'] . "</div>\n";
            echo form_select('album_id', $locale['gallery_0103'], '', array("options" => $opts, "inline" => TRUE));
            echo form_text('photo_title', $locale['gallery_0104'], '', array('required' => TRUE, "inline" => TRUE));
            echo form_select('photo_keywords', $locale['gallery_0105'], $data['photo_keywords'], array('placeholder' => $locale['photo_0007'], 'inline' => TRUE, 'multiple' => TRUE, "tags" => TRUE, 'width' => '100%'));
            echo form_textarea('photo_description', $locale['gallery_0106'], '', array("inline" => TRUE, "required" => $gll_settings['gallery_extended_required'] ? TRUE : FALSE));
            echo form_fileinput('photo_image', $locale['gallery_0109'], '', array("upload_path" => INFUSIONS . "gallery/submissions/", "required" => TRUE, 'thumbnail_folder' => 'thumbs', 'thumbnail' => TRUE, 'thumbnail_w' => $gll_settings['thumb_w'], 'thumbnail_h' => $gll_settings['thumb_h'], 'thumbnail_suffix' => '_t1', 'thumbnail2' => TRUE, 'thumbnail2_w' => $gll_settings['photo_w'], 'thumbnail2_h' => $gll_settings['photo_h'], 'thumbnail2_suffix' => '_t2', 'max_width' => $gll_settings['photo_max_w'], 'max_height' => $gll_settings['photo_max_h'], 'max_byte' => $gll_settings['photo_max_b'], 'delete_original' => FALSE, "multiple" => FALSE, "inline" => TRUE, "error_text" => $locale['gallery_0110']));
            echo "<div class='m-b-10 col-xs-12 col-sm-offset-3'>" . sprintf($locale['photo_0017'], parsebytesize($gll_settings['photo_max_b']), str_replace(',', ' ', ".jpg,.gif,.png"), $gll_settings['photo_max_w'], $gll_settings['photo_max_h']) . "</div>\n";
            echo "</div>\n</div>\n";
            echo form_button('submit_photo', $locale['gallery_0111'], $locale['gallery_0111'], array('class' => 'btn-primary'));
            echo closeform();
        } else {
            echo "<div class='well' style='text-align:center'><br />\n" . $locale['gallery_0024'] . "<br /><br />\n</div>\n";
        }
    }
} else {
    echo "<div class='well text-center'>" . $locale['gallery_0112'] . "</div>\n";
}
closetable();
Example #12
0
if ($dl_settings['download_screenshot']) {
    if (!empty($data['download_image']) && !empty($data['download_image_thumb'])) {
        echo "<div class='clearfix list-group-item m-b-20'>\n";
        echo "<div class='pull-left m-r-10'>\n";
        echo thumbnail(DOWNLOADS . "images/" . $data['download_image_thumb'], '80px');
        echo "</div>\n";
        echo "<div class='overflow-hide'>\n";
        echo "<span class='text-dark strong'>" . $locale['download_0220'] . "</span>\n";
        echo form_checkbox('del_image', $locale['download_0216'], '');
        echo form_hidden('download_image', '', $data['download_image']);
        echo form_hidden('download_image_thumb', '', $data['download_image_thumb']);
        echo "</div>\n</div>\n";
    } else {
        require_once INCLUDES . "mimetypes_include.php";
        $file_options = array('upload_path' => DOWNLOADS . "images/", 'max_width' => $dl_settings['download_screen_max_w'], 'max_height' => $dl_settings['download_screen_max_w'], 'max_byte' => $dl_settings['download_screen_max_b'], 'type' => 'image', 'delete_original' => 0, 'thumbnail_folder' => '', 'thumbnail' => 1, 'thumbnail_suffix' => '_thumb', 'thumbnail_w' => $dl_settings['download_thumb_max_w'], 'thumbnail_h' => $dl_settings['download_thumb_max_h'], 'thumbnail2' => 0, 'valid_ext' => implode('.', array_keys(img_mimeTypes())), "width" => "100%", "template" => "modern");
        echo form_fileinput('download_image', $locale['download_0220'], '', $file_options);
        // all file types.
        echo "<div class='m-b-10'>" . sprintf($locale['download_0219'], parsebytesize($dl_settings['download_screen_max_b']), str_replace(',', ' ', ".jpg,.gif,.png"), $dl_settings['download_screen_max_w'], $dl_settings['download_screen_max_h']) . "</div>\n";
    }
}
echo form_button('save_download', $locale['download_0212'], $locale['download_0212'], array('class' => 'btn-success m-r-10', 'icon' => 'fa fa-check-square-o'));
closeside();
openside('');
echo form_checkbox('download_allow_comments', $locale['download_0223'], $data['download_allow_comments'], array('class' => 'm-b-0'));
echo form_checkbox('download_allow_ratings', $locale['download_0224'], $data['download_allow_ratings'], array('class' => 'm-b-0'));
if (isset($_GET['action']) && $_GET['action'] == "edit") {
    echo form_checkbox('update_datestamp', $locale['download_0213'], '', array('class' => 'm-b-0'));
}
closeside();
openside();
echo form_text('download_license', $locale['download_0208'], $data['download_license'], array('inline' => 1));
Example #13
0
                                 $poll_option_data['forum_poll_option_text'] = $option_text;
                                 $poll_option_data['forum_poll_option_votes'] = 0;
                                 dbquery_insert(DB_FORUM_POLL_OPTIONS, $poll_option_data, 'save');
                                 $i++;
                             }
                         }
                         dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_poll='1' WHERE thread_id='" . $pollData['thread_id'] . "'");
                     }
                 }
                 if ($defender->safe()) {
                     redirect(INFUSIONS . "forum/postify.php?post=new&error=0&amp;forum_id=" . intval($post_data['forum_id']) . "&amp;parent_id=" . intval($post_data['forum_cat']) . "&amp;thread_id=" . intval($post_data['thread_id'] . ""));
                 }
             }
         }
         $form_action = INFUSIONS . "forum/newthread.php?forum_id=" . $post_data['forum_id'];
         $info = array('title' => $locale['forum_0057'], 'description' => '', 'openform' => openform('input_form', 'post', $form_action, array('enctype' => $permission['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')), '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' => $forum->getForumPermission("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")) . "\n\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' => $poll_form, 'smileys_field' => form_checkbox('post_smileys', $locale['forum_0622'], $post_data['post_smileys'], array('class' => 'm-b-0')), 'signature_field' => array_key_exists("user_sig", $userdata) && $userdata['user_sig'] ? form_checkbox('post_showsig', $locale['forum_0623'], $post_data['post_showsig'], array('class' => 'm-b-0')) : '', 'sticky_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_sticky', $locale['forum_0620'], $thread_data['thread_sticky'], array('class' => 'm-b-0')) : '', 'lock_field' => iMOD || iSUPERADMIN ? form_checkbox('thread_locked', $locale['forum_0621'], $thread_data['thread_locked'], array('class' => 'm-b-0')) : '', 'edit_reason_field' => '', 'delete_field' => '', 'hide_edit_field' => '', 'post_locked_field' => '', 'notify_field' => $forum_settings['thread_notify'] ? form_checkbox('notify_me', $locale['forum_0626'], $post_data['notify_me'], array('class' => 'm-b-0')) : '', 'post_buttons' => form_button('post_newthread', $locale['forum_0057'], $locale['forum_0057'], array('class' => 'btn-primary btn-sm')) . form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default btn-sm m-l-10')), 'last_posts_reply' => '');
         // add a jquery to toggle the poll form
         add_to_jquery("\n\t\t\tif (\$('#add_poll').is(':checked')) {\n\t\t\t\t\$('#poll_form').show();\n\t\t\t} else {\n\t\t\t\t\$('#poll_form').hide();\n\t\t\t}\n\t\t\t\$('#add_poll').bind('click', function() {\n\t\t\t\tif (\$(this).is(':checked')) {\n\t\t\t\t\t\$('#poll_form').slideDown();\n\t\t\t\t} else {\n\t\t\t\t\t\$('#poll_form').slideUp();\n\t\t\t\t}\n\t\t\t});\n\t\t\t");
         postform($info);
     } else {
         redirect(INFUSIONS . '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");
Example #14
0
     $formaction = FUSION_SELF . $aidlink . "&amp;album_id=" . $_GET['album_id'] . "";
     opentable($album_title . ": " . $locale['400']);
 }
 echo "<!--- start single photo -->\n";
 if (!isset($_GET['action'])) {
     echo "<div class='tbl2 list-group-item' id='show_singleform' style='font-weight:bold;cursor:pointer;margin-bottom:2px;'><i class='entypo camera'></i> " . $locale['493'] . "</div>";
 }
 require_once BASEDIR . 'includes/mimetypes_include.php';
 echo "<div class='panel panel-default image_upload' id='single_upload'>\n<div class='panel-body'>\n";
 echo openform('input_form', 'post', $formaction, array('enctype' => 1, 'max_tokens' => 1));
 echo "<div class='row'>\n";
 echo "<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n";
 echo form_text('photo_title', $locale['432'], $photo_title, array('max_length' => 100, 'required' => 1, 'error_text' => ''));
 echo form_textarea('photo_description', $locale['433'], $photo_description, array('bbcode' => 1, 'autosize' => 1, 'resize' => 0));
 if (!isset($_GET['action'])) {
     echo form_fileinput('photo_pic_file', $locale['436'], '', array('upload_path' => PHOTODIR, 'type' => 'image', 'thumbnail_path' => PHOTODIR, 'required' => 1, 'error_text' => $locale['421']));
 }
 echo form_text('photo_order', $locale['434'], $photo_order, array('number' => 1, 'width' => '100px'));
 echo "</div>\n<div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n";
 echo "<div class='panel panel-default'>\n<div class='panel-heading'>\n" . $locale['511'] . "</div>\n";
 echo "<div class='panel-body'>\n";
 if ($gallery_settings['comments_enabled'] == "0" || $gallery_settings['ratings_enabled'] == "0") {
     $sys = "";
     if ($gallery_settings['comments_enabled'] == "0" && $gallery_settings['ratings_enabled'] == "0") {
         $sys = $locale['523'];
     } elseif ($gallery_settings['comments_enabled'] == "0") {
         $sys = $locale['521'];
     } else {
         $sys = $locale['522'];
     }
     echo "<div class='alert alert-info m-b-10'>" . sprintf($locale['520'], $sys) . "</div>";
Example #15
0
 /**
  * Display Forum Form
  */
 public function display_forum_form()
 {
     require_once INCLUDES . 'photo_functions_include.php';
     require_once INCLUDES . 'infusions_include.php';
     $forum_settings = $this->get_forum_settings();
     $language_opts = fusion_get_enabled_languages();
     add_breadcrumb(array('link' => '', 'title' => self::$locale['forum_001']));
     if (!isset($_GET['action']) && $_GET['parent_id']) {
         $data['forum_cat'] = $_GET['parent_id'];
     }
     $type_opts = array('1' => self::$locale['forum_opts_001'], '2' => self::$locale['forum_opts_002'], '3' => self::$locale['forum_opts_003'], '4' => self::$locale['forum_opts_004']);
     $forum_image_path = FORUM . "images/";
     if (isset($_POST['remove_image']) && isset($_POST['forum_id'])) {
         $data['forum_id'] = form_sanitizer($_POST['forum_id'], '', 'forum_id');
         if ($data['forum_id']) {
             $data = self::get_forum($data['forum_id']);
             if (!empty($data)) {
                 $forum_image = $forum_image_path . $data['forum_image'];
                 if (!empty($data['forum_image']) && file_exists($forum_image) && !is_dir($forum_image)) {
                     @unlink($forum_image);
                     $data['forum_image'] = '';
                 }
                 dbquery_insert(DB_FORUMS, $data, 'update');
                 addNotice('success', self::$locale['forum_notice_8']);
                 redirect(FUSION_REQUEST);
             }
         }
     }
     opentable(self::$locale['forum_001']);
     echo openform('inputform', 'post', FUSION_REQUEST, array('enctype' => 1));
     echo "<div class='row'>\n<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n";
     echo form_text('forum_name', self::$locale['forum_006'], $this->data['forum_name'], array('required' => 1, 'error_text' => self::$locale['forum_error_1'])) . form_textarea('forum_description', self::$locale['forum_007'], $this->data['forum_description'], array('autosize' => 1, 'type' => 'bbcode', 'form_name' => 'inputform', 'preview' => TRUE)) . form_text('forum_alias', self::$locale['forum_011'], $this->data['forum_alias']);
     echo "</div><div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n";
     openside('');
     $self_id = $this->data['forum_id'] ? $this->data['forum_id'] : '';
     echo form_select_tree('forum_cat', self::$locale['forum_008'], $this->data['forum_cat'], array('add_parent_opts' => 1, 'disable_opts' => $self_id, 'hide_disabled' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $self_id) . form_select('forum_type', self::$locale['forum_009'], $this->data['forum_type'], array("options" => $type_opts)) . form_select('forum_language', self::$locale['forum_010'], $this->data['forum_language'], array("options" => $language_opts)) . form_text('forum_order', self::$locale['forum_043'], $this->data['forum_order'], array('number' => 1)) . form_button('save_forum', $this->data['forum_id'] ? self::$locale['forum_000a'] : self::$locale['forum_000'], self::$locale['forum_000'], array('class' => 'btn btn-sm btn-success'));
     closeside();
     echo "</div>\n</div>\n";
     echo "<div class='row'>\n<div class='col-xs-12 col-sm-8 col-md-8 col-lg-8'>\n";
     echo form_select('forum_meta', self::$locale['forum_012'], $this->data['forum_meta'], array('tags' => 1, 'multiple' => 1, 'width' => '100%'));
     if ($this->data['forum_image'] && file_exists(FORUM . "images/" . $this->data['forum_image'])) {
         openside();
         echo "<div class='pull-left m-r-10'>\n";
         echo thumbnail(FORUM . "images/" . $this->data['forum_image'], '80px', '80px');
         echo "</div>\n<div class='overflow-hide'>\n";
         echo "<span class='strong'>" . self::$locale['forum_013'] . "</span><br/>\n";
         $image_size = @getimagesize(FORUM . "images/" . $this->data['forum_image']);
         echo "<span class='text-smaller'>" . sprintf(self::$locale['forum_027'], $image_size[0], $image_size[1]) . "</span><br/>";
         echo form_hidden('forum_image', '', $this->data['forum_image']);
         echo form_button('remove_image', self::$locale['forum_028'], self::$locale['forum_028'], array('class' => 'btn-danger btn-sm m-t-10', 'icon' => 'fa fa-trash'));
         echo "</div>\n";
         closeside();
     } else {
         $tab_title['title'][] = self::$locale['forum_013'];
         $tab_title['id'][] = 'fir';
         $tab_title['icon'][] = '';
         $tab_title['title'][] = self::$locale['forum_014'];
         $tab_title['id'][] = 'ful';
         $tab_title['icon'][] = '';
         $tab_active = tab_active($tab_title, 0);
         echo opentab($tab_title, $tab_active, 'forum-image-tab', FALSE, "m-t-20 m-b-20");
         // Upload Image
         echo opentabbody($tab_title['title'][0], 'fir', $tab_active);
         echo "<span class='display-inline-block m-t-10 m-b-10'>" . sprintf(self::$locale['forum_015'], parsebytesize($forum_settings['forum_attachmax'])) . "</span>\n";
         $fileOptions = array("upload_path" => $forum_image_path, "thumbnail" => TRUE, "thumbnail_folder" => $forum_image_path, "type" => "image", "delete_original" => TRUE, "max_count" => $forum_settings['forum_attachmax']);
         echo form_fileinput('forum_image', "", '', $fileOptions);
         echo closetabbody();
         // Upload image via Web Address
         echo opentabbody($tab_title['title'][1], 'ful', $tab_active);
         echo "<span class='display-inline-block m-t-10 m-b-10'>" . self::$locale['forum_016'] . "</strong></span>\n";
         $header_opts = array('0' => 'Local Server', '1' => 'URL');
         echo form_select('forum_image_header', self::$locale['forum_056'], '', array('inline' => TRUE, 'options' => $header_opts));
         echo form_text('forum_image_url', self::$locale['forum_014'], '', array('placeholder' => 'images/forum/', 'inline' => TRUE));
         echo closetabbody();
         echo closetab();
     }
     echo form_textarea('forum_rules', self::$locale['forum_017'], $this->data['forum_rules'], array('autosize' => 1, 'bbcode' => 1));
     echo "</div><div class='col-xs-12 col-sm-4 col-md-4 col-lg-4'>\n";
     openside('');
     // need to get parent category
     echo form_select_tree('forum_permissions', self::$locale['forum_025'], $this->data['forum_branch'], array('no_root' => 1, 'deactivate' => $this->data['forum_id'] ? TRUE : FALSE), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat');
     if ($this->data['forum_id']) {
         echo form_button('jp_forum', self::$locale['forum_029'], self::$locale['forum_029'], array('class' => 'btn-sm btn-default m-r-10'));
     }
     closeside();
     openside('');
     echo form_checkbox('forum_lock', self::$locale['forum_026'], $this->data['forum_lock'], array("reverse_label" => TRUE)) . form_checkbox('forum_users', self::$locale['forum_024'], $this->data['forum_users'], array("reverse_label" => TRUE)) . form_checkbox('forum_quick_edit', self::$locale['forum_021'], $this->data['forum_quick_edit'], array("reverse_label" => TRUE)) . form_checkbox('forum_merge', self::$locale['forum_019'], $this->data['forum_merge'], array("reverse_label" => TRUE)) . form_checkbox('forum_allow_attach', self::$locale['forum_020'], $this->data['forum_allow_attach'], array("reverse_label" => TRUE)) . form_checkbox('forum_allow_poll', self::$locale['forum_022'], $this->data['forum_allow_poll'], array("reverse_label" => TRUE)) . form_hidden('forum_id', '', $this->data['forum_id']) . form_hidden('forum_branch', '', $this->data['forum_branch']);
     closeside();
     echo "</div>\n</div>\n";
     echo form_button('save_forum', $this->data['forum_id'] ? self::$locale['forum_000a'] : self::$locale['forum_000'], self::$locale['forum_000'], array('class' => 'btn-sm btn-success'));
     echo closeform();
     closetable();
 }
Example #16
0
     $file_options = array("class" => "m-10 p-10", "inline" => TRUE, "required" => TRUE, "upload_path" => DOWNLOADS . "submissions/", "max_byte" => $dl_settings['download_max_b'], 'valid_ext' => $dl_settings['download_types'], 'error_text' => $locale['download_0115'], "width" => "100%", "thumbnail" => FALSE, "thumbnail2" => FALSE, "type" => "object", "preview_off" => TRUE);
     echo form_fileinput('download_file', $locale['download_0214'], '', $file_options);
     echo "<div class='text-right'>\n<small>\n";
     echo sprintf($locale['download_0218'], parsebytesize($dl_settings['download_max_b']), str_replace(',', ' ', $dl_settings['download_types'])) . "<br />\n";
     echo "</small>\n</div>\n";
     echo closetabbody();
     echo opentabbody($tab_title['title'][1], 'dll', $tab_active);
     echo form_text('download_url', $locale['download_0206'], "", array("class" => "m-10 p-10", "error_text" => $locale['download_0116'], "inline" => TRUE, "required" => TRUE, "placeholder" => "http://"));
     echo closetabbody();
     echo closetab();
     echo "</div>\n";
     echo "</div>\n";
     echo "</div>\n";
     if ($dl_settings['download_screenshot']) {
         $screenshot_options = array("inline" => TRUE, "upload_path" => DOWNLOADS . "submissions/images/", "required" => $dl_settings['download_screenshot_required'] ? TRUE : FALSE, "max_width" => $dl_settings['download_screen_max_w'], "max_height" => $dl_settings['download_screen_max_h'], "max_byte" => $dl_settings['download_screen_max_b'], "type" => "image", "delete_original" => FALSE, "thumbnail_folder" => "", "thumbnail" => TRUE, "thumbnail_suffix" => "_thumb", "thumbnail_w" => $dl_settings['download_thumb_max_w'], "thumbnail_h" => $dl_settings['download_thumb_max_h'], "thumbnail2" => 0, "error_text" => $locale['download_0114'], "template" => "modern");
         echo form_fileinput('download_image', $locale['download_0220'], '', $screenshot_options);
     }
     // wrong
     echo "<div class='text-right m-b-10'>\n<small>\n";
     echo sprintf($locale['download_0219'], parsebytesize($dl_settings['download_screen_max_b']), str_replace(',', ' ', ".jpg,.gif,.png"), $dl_settings['download_screen_max_w'], $dl_settings['download_screen_max_h']) . "\n";
     echo "</small>\n</div>\n";
     echo form_text('download_license', $locale['download_0208'], $criteriaArray['download_license'], array("inline" => TRUE));
     echo form_text('download_os', $locale['download_0209'], $criteriaArray['download_os'], array("inline" => TRUE));
     echo form_text('download_version', $locale['download_0210'], $criteriaArray['download_version'], array("inline" => TRUE));
     echo form_text('download_homepage', $locale['download_0221'], $criteriaArray['download_homepage'], array("inline" => TRUE));
     echo form_text('download_copyright', $locale['download_0222'], $criteriaArray['download_copyright'], array("inline" => TRUE));
     echo form_hidden('calc_upload', '', '1');
     echo "</div>\n</div>\n";
     echo form_button('submit_download', $locale['download_0045'], $locale['download_0045'], array('class' => 'btn-primary'));
     echo closeform();
 } else {
Example #17
0
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-6'>\n";
    $image_thumb = get_blog_image_path($data['blog_image'], $data['blog_image_t1'], $data['blog_image_t2']);
    echo "<label>" . thumbnail($image_thumb, '100px');
    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'], 'blog-img-center' => $locale['center'], 'pull-right' => $locale['right']);
    echo form_select('blog_ialign', $locale['blog_0442'], $data['blog_ialign'], array("options" => $alignOptions, "inline" => FALSE));
    echo "</div>\n</div>\n";
    echo "<input type='hidden' name='blog_image' value='" . $data['blog_image'] . "' />\n";
    echo "<input type='hidden' name='blog_image_t1' value='" . $data['blog_image_t1'] . "' />\n";
    echo "<input type='hidden' name='blog_image_t2' value='" . $data['blog_image_t2'] . "' />\n";
} else {
    $file_input_options = array('upload_path' => IMAGES_B, 'max_width' => $blog_settings['blog_photo_max_w'], 'max_height' => $blog_settings['blog_photo_max_h'], 'max_byte' => $blog_settings['blog_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $blog_settings['blog_thumb_w'], 'thumbnail_h' => $blog_settings['blog_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $blog_settings['blog_photo_w'], 'thumbnail2_h' => $blog_settings['blog_photo_h'], 'type' => 'image');
    echo form_fileinput("blog_image", $locale['blog_0439'], "", $file_input_options);
    echo "<div class='small m-b-10'>" . sprintf($locale['blog_0440'], parsebytesize($blog_settings['blog_photo_max_b'])) . "</div>\n";
    $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
    echo form_select('blog_ialign', $locale['blog_0442'], $data['blog_ialign'], array("options" => $alignOptions));
}
closeside();
openside('');
echo "<label><input type='checkbox' name='blog_draft' value='yes'" . ($data['blog_draft'] ? "checked='checked'" : "") . " /> " . $locale['blog_0431'] . "</label><br />\n";
echo "<label><input type='checkbox' name='blog_sticky' value='yes'" . ($data['blog_sticky'] ? "checked='checked'" : "") . "  /> " . $locale['blog_0432'] . "</label><br />\n";
if (fusion_get_settings("tinymce_enabled") != 1) {
    echo "<label><input type='checkbox' name='line_breaks' value='yes'" . ($data['blog_breaks'] ? "checked='checked'" : "") . " /> " . $locale['blog_0433'] . "</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")) {
Example #18
0
/**
 * Displays News Form
 */
function display_news_form()
{
    global $aidlink;
    if (isset($_POST['cancel'])) {
        redirect(FUSION_SELF . $aidlink);
    }
    $formaction = FUSION_REQUEST;
    $locale = fusion_get_locale();
    $userdata = fusion_get_userdata();
    $news_settings = fusion_get_settings("news");
    $edit = isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['news_id']) && isnum($_GET['news_id']) ? TRUE : FALSE;
    add_breadcrumb(array('link' => '', 'title' => $edit ? $locale['news_0003'] : $locale['news_0002']));
    $data = array('news_id' => 0, 'news_draft' => 0, 'news_sticky' => 0, 'news_news' => '', 'news_datestamp' => time(), 'news_extended' => '', 'news_keywords' => '', 'news_breaks' => 'n', 'news_allow_comments' => 1, 'news_allow_ratings' => 1, 'news_language' => LANGUAGE, 'news_visibility' => 0, 'news_subject' => '', 'news_start' => '', 'news_end' => '', 'news_cat' => 0, 'news_image' => '', 'news_ialign' => 'pull-left');
    if (fusion_get_settings("tinymce_enabled")) {
        $data['news_breaks'] = 'n';
    } else {
        $data['news_breaks'] = 'y';
    }
    if (isset($_POST['save']) or isset($_POST['save_and_close'])) {
        $news_news = "";
        if ($_POST['news_news']) {
            $news_news = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, fusion_get_settings('allow_php_exe') ? htmlspecialchars($_POST['news_news']) : stripslashes($_POST['news_news']));
            $news_news = parse_textarea($news_news);
        }
        $news_extended = "";
        if ($_POST['news_extended']) {
            $news_extended = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, fusion_get_settings('allow_php_exe') ? htmlspecialchars($_POST['news_extended']) : stripslashes($_POST['news_extended']));
            $news_extended = parse_textarea($news_extended);
        }
        $data = array('news_id' => form_sanitizer($_POST['news_id'], 0, 'news_id'), 'news_subject' => form_sanitizer($_POST['news_subject'], '', 'news_subject'), 'news_cat' => form_sanitizer($_POST['news_cat'], 0, 'news_cat'), 'news_news' => form_sanitizer($news_news, "", "news_news"), 'news_extended' => form_sanitizer($news_extended, "", "news_extended"), 'news_keywords' => form_sanitizer($_POST['news_keywords'], '', 'news_keywords'), 'news_datestamp' => form_sanitizer($_POST['news_datestamp'], '', 'news_datestamp'), 'news_start' => form_sanitizer($_POST['news_start'], 0, 'news_start'), 'news_end' => form_sanitizer($_POST['news_end'], 0, 'news_end'), 'news_visibility' => form_sanitizer($_POST['news_visibility'], 0, 'news_visibility'), 'news_draft' => isset($_POST['news_draft']) ? "1" : "0", 'news_sticky' => isset($_POST['news_sticky']) ? "1" : "0", 'news_allow_comments' => isset($_POST['news_allow_comments']) ? "1" : "0", 'news_allow_ratings' => isset($_POST['news_allow_ratings']) ? "1" : "0", 'news_language' => form_sanitizer($_POST['news_language'], '', 'news_language'), 'news_image' => "", 'news_ialign' => "", 'news_image_t1' => "", 'news_image_t2' => "");
        if (isset($_FILES['news_image'])) {
            // when files is uploaded.
            $upload = form_sanitizer($_FILES['news_image'], '', 'news_image');
            if (!empty($upload) && !$upload['error']) {
                $data['news_image'] = $upload['image_name'];
                $data['news_image_t1'] = $upload['thumb1_name'];
                $data['news_image_t2'] = $upload['thumb2_name'];
                $data['news_ialign'] = isset($_POST['news_ialign']) ? form_sanitizer($_POST['news_ialign'], "pull-left", "news_ialign") : "pull-left";
            }
        } else {
            // when files not uploaded. but there should be exist check.
            $data['news_image'] = isset($_POST['news_image']) ? $_POST['news_image'] : "";
            $data['news_image_t1'] = isset($_POST['news_image_t1']) ? $_POST['news_image_t1'] : "";
            $data['news_image_t2'] = isset($_POST['news_image_t2']) ? $_POST['news_image_t2'] : "";
            $data['news_ialign'] = isset($_POST['news_ialign']) ? form_sanitizer($_POST['news_ialign'], "pull-left", "news_ialign") : "pull-left";
        }
        if (fusion_get_settings('tinymce_enabled') != 1) {
            $data['news_breaks'] = isset($_POST['line_breaks']) ? "y" : "n";
        } else {
            $data['news_breaks'] = "n";
        }
        if ($data['news_sticky'] == "1") {
            $result = dbquery("UPDATE " . DB_NEWS . " SET news_sticky='0' WHERE news_sticky='1'");
        }
        // reset other sticky
        // delete image
        if (isset($_POST['del_image'])) {
            if (!empty($data['news_image']) && file_exists(IMAGES_N . $data['news_image'])) {
                unlink(IMAGES_N . $data['news_image']);
            }
            if (!empty($data['news_image_t1']) && file_exists(IMAGES_N_T . $data['news_image_t1'])) {
                unlink(IMAGES_N_T . $data['news_image_t1']);
            }
            if (!empty($data['news_image_t2']) && file_exists(IMAGES_N_T . $data['news_image_t2'])) {
                unlink(IMAGES_N_T . $data['news_image_t2']);
            }
            $data['news_image'] = "";
            $data['news_image_t1'] = "";
            $data['news_image_t2'] = "";
        }
        if (defender::safe()) {
            if (dbcount("('news_id')", DB_NEWS, "news_id='" . $data['news_id'] . "'")) {
                dbquery_insert(DB_NEWS, $data, 'update');
                addNotice('success', $locale['news_0101']);
            } else {
                $data['news_name'] = $userdata['user_id'];
                dbquery_insert(DB_NEWS, $data, 'save');
                addNotice('success', $locale['news_0100']);
            }
            if (isset($_POST['save_and_close'])) {
                redirect(clean_request("", array("ref"), FALSE));
            } else {
                redirect(FUSION_REQUEST);
            }
        }
    } elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_POST['news_id']) && isnum($_POST['news_id'])) || isset($_GET['news_id']) && isnum($_GET['news_id'])) {
        $result = dbquery("SELECT * FROM " . DB_NEWS . " WHERE news_id='" . (isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id']) . "'");
        if (dbrows($result)) {
            $data = dbarray($result);
        } else {
            redirect(FUSION_SELF . $aidlink);
        }
    }
    $result = dbquery("SELECT news_cat_id, news_cat_name FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY news_cat_name");
    $news_cat_opts = array();
    $news_cat_opts['0'] = $locale['news_0202'];
    if (dbrows($result)) {
        while ($odata = dbarray($result)) {
            $news_cat_opts[$odata['news_cat_id']] = $odata['news_cat_name'];
        }
    }
    echo "<div class='m-t-20'>\n";
    $news_settings = get_settings("news");
    echo openform('news_form', 'post', $formaction, array('enctype' => 1));
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
    echo form_hidden('news_id', "", $data['news_id']);
    echo form_text('news_subject', $locale['news_0200'], $data['news_subject'], array('required' => 1, 'max_length' => 200, 'error_text' => $locale['news_0250']));
    echo form_select('news_keywords', $locale['news_0205'], $data['news_keywords'], array("max_length" => 320, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
    echo "<div class='pull-left m-r-10 display-inline-block'>\n";
    echo form_datepicker('news_start', $locale['news_0206'], $data['news_start'], array('placeholder' => $locale['news_0208'], "join_to_id" => "news_end"));
    echo "</div>\n<div class='pull-left m-r-10 display-inline-block'>\n";
    echo form_datepicker('news_end', $locale['news_0207'], $data['news_end'], array('placeholder' => $locale['news_0208'], "join_from_id" => "news_start"));
    echo "</div>\n";
    echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
    openside('');
    echo form_select_tree("news_cat", $locale['news_0201'], $data['news_cat'], array("width" => "100%", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
    echo form_select('news_visibility', $locale['news_0209'], $data['news_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
    if (multilang_table("NS")) {
        echo form_select('news_language', $locale['global_ML100'], $data['news_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
    } else {
        echo form_hidden('news_language', '', $data['news_language']);
    }
    echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
    echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
    echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    closeside();
    echo "</div>\n</div>\n";
    $snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203a'], "form_name" => "news_form");
    if (fusion_get_settings("tinymce_enabled")) {
        $snippetSettings = array("required" => TRUE, "type" => "tinymce", "tinymce" => "advanced");
    }
    echo form_textarea('news_news', $locale['news_0203'], $data['news_news'], $snippetSettings);
    if (!fusion_get_settings("tinymce_enabled")) {
        $extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203b'], "form_name" => "news_form");
    } else {
        $extendedSettings = array("type" => "tinymce", "tinymce" => "advanced");
    }
    echo form_textarea('news_extended', $locale['news_0204'], $data['news_extended'], $extendedSettings);
    // second row
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
    openside('');
    if ($data['news_image'] != "" && $data['news_image_t1'] != "") {
        $image_thumb = get_news_image_path($data['news_image'], $data['news_image_t1'], $data['news_image_t2']);
        if (!$image_thumb) {
            $image_thumb = IMAGES . "imagenotfound70.jpg";
        }
        echo "<div class='row'>\n";
        echo "<div class='col-xs-12 col-sm-6'>\n";
        echo "<label><img class='img-responsive img-thumbnail' src='" . $image_thumb . "' alt='" . $locale['news_0216'] . "' /><br />\n";
        echo "<input type='checkbox' name='del_image' value='y' /> " . $locale['delete'] . "</label>\n";
        echo "</div>\n";
        echo "<div class='col-xs-12 col-sm-6'>\n";
        $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
        echo form_select('news_ialign', $locale['news_0218'], $data['news_ialign'], array("options" => $alignOptions, "inline" => FALSE));
        echo "</div>\n</div>\n";
        echo "<input type='hidden' name='news_image' value='" . $data['news_image'] . "' />\n";
        echo "<input type='hidden' name='news_image_t1' value='" . $data['news_image_t1'] . "' />\n";
        echo "<input type='hidden' name='news_image_t2' value='" . $data['news_image_t2'] . "' />\n";
    } else {
        $file_input_options = array('upload_path' => IMAGES_N, 'max_width' => $news_settings['news_photo_max_w'], 'max_height' => $news_settings['news_photo_max_h'], 'max_byte' => $news_settings['news_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $news_settings['news_thumb_w'], 'thumbnail_h' => $news_settings['news_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $news_settings['news_photo_w'], 'thumbnail2_h' => $news_settings['news_photo_h'], 'type' => 'image');
        echo form_fileinput("news_image", $locale['news_0216'], "", $file_input_options);
        echo "<div class='small m-b-10'>" . sprintf($locale['news_0217'], parsebytesize($news_settings['news_photo_max_b'])) . "</div>\n";
        $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
        echo form_select('news_ialign', $locale['news_0218'], $data['news_ialign'], array("options" => $alignOptions));
    }
    closeside();
    openside('');
    echo "<label><input type='checkbox' name='news_draft' value='yes'" . ($data['news_draft'] ? "checked='checked'" : "") . " /> " . $locale['news_0210'] . "</label><br />\n";
    echo "<label><input type='checkbox' name='news_sticky' value='yes'" . ($data['news_sticky'] ? "checked='checked'" : "") . "  /> " . $locale['news_0211'] . "</label><br />\n";
    echo form_hidden('news_datestamp', '', $data['news_datestamp']);
    if (fusion_get_settings("tinymce_enabled") != 1) {
        echo "<label><input type='checkbox' name='line_breaks' value='yes'" . ($data['news_breaks'] ? "checked='checked'" : "") . " /> " . $locale['news_0212'] . "</label><br />\n";
    }
    closeside();
    echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
    openside("");
    if (!fusion_get_settings("comments_enabled") || !fusion_get_settings("ratings_enabled")) {
        $sys = "";
        if (!fusion_get_settings("comments_enabled") && !fusion_get_settings("ratings_enabled")) {
            $sys = $locale['comments_ratings'];
        } elseif (!fusion_get_settings("comments_enabled")) {
            $sys = $locale['comments'];
        } else {
            $sys = $locale['ratings'];
        }
        echo "<div class='alert alert-warning'>" . sprintf($locale['news_0253'], $sys) . "</div>\n";
    }
    echo "<label><input type='checkbox' name='news_allow_comments' value='yes' onclick='SetRatings();'" . ($data['news_allow_comments'] ? "checked='checked'" : "") . " /> " . $locale['news_0213'] . "</label><br/>";
    echo "<label><input type='checkbox' name='news_allow_ratings' value='yes'" . ($data['news_allow_ratings'] ? "checked='checked'" : "") . " /> " . $locale['news_0214'] . "</label>";
    closeside();
    echo "</div>\n</div>\n";
    echo form_button('preview', $locale['news_0240'], $locale['news_0240'], array('class' => 'btn-default m-r-10'));
    echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
    echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    echo closeform();
    echo "</div>\n";
}
Example #19
0
        }
        add_to_title($locale['global_200'] . $locale['news_0400']);
        echo "<div class='panel panel-default tbl-border'>\n<div class='panel-body'>\n";
        echo "<div class='alert alert-info m-b-20 submission-guidelines'>" . str_replace("[SITENAME]", fusion_get_settings("sitename"), $locale['news_0703']) . "</div>\n";
        echo openform('submit_form', 'post', BASEDIR . "submit.php?stype=n", array("enctype" => $news_settings['news_allow_submission_files'] ? TRUE : FALSE));
        echo form_text('news_subject', $locale['news_0200'], $criteriaArray['news_subject'], array("required" => TRUE, "inline" => TRUE));
        if (multilang_table("NS")) {
            echo form_select('news_language', $locale['global_ML100'], $criteriaArray['news_language'], array("options" => fusion_get_enabled_languages(), "placeholder" => $locale['choose'], "width" => "250px", "inline" => TRUE));
        } else {
            echo form_hidden('news_language', '', $criteriaArray['news_language']);
        }
        echo form_select('news_keywords', $locale['news_0205'], $criteriaArray['news_keywords'], array("max_length" => 320, "inline" => TRUE, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
        echo form_select_tree("news_cat", $locale['news_0201'], $criteriaArray['news_cat'], array("width" => "250px", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
        if ($news_settings['news_allow_submission_files']) {
            $file_input_options = array('upload_path' => IMAGES_N, 'max_width' => $news_settings['news_photo_max_w'], 'max_height' => $news_settings['news_photo_max_h'], 'max_byte' => $news_settings['news_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $news_settings['news_thumb_w'], 'thumbnail_h' => $news_settings['news_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $news_settings['news_photo_w'], 'thumbnail2_h' => $news_settings['news_photo_h'], 'type' => 'image', "inline" => TRUE);
            echo form_fileinput("news_image", $locale['news_0216'], "", $file_input_options);
            echo "<div class='small col-sm-offset-3 m-b-10'><span class='p-l-15'>" . sprintf($locale['news_0217'], parsebytesize($news_settings['news_photo_max_b'])) . "</span></div>\n";
            $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
            echo form_select('news_ialign', $locale['news_0218'], $criteriaArray['news_ialign'], array("options" => $alignOptions, "inline" => TRUE));
        }
        echo form_textarea('news_news', $locale['news_0203'], $criteriaArray['news_snippet'], array("required" => TRUE, "html" => TRUE, "form_name" => "submit_form", "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE));
        echo form_textarea('news_body', $locale['news_0203b'], $criteriaArray['news_body'], array("required" => $news_settings['news_extended_required'] ? TRUE : FALSE, "html" => TRUE, "form_name" => "submit_form", "autosize" => fusion_get_settings("tinymce_enabled") ? FALSE : TRUE));
        echo fusion_get_settings("site_seo") ? "" : form_button('preview_news', $locale['news_0240'], $locale['news_0240'], array('class' => 'btn-primary m-r-10'));
        echo form_button('submit_news', $locale['news_0700'], $locale['news_0700'], array('class' => 'btn-primary'));
        echo closeform();
        echo "</div>\n</div>\n";
    }
} else {
    echo "<div class='well text-center'>" . $locale['news_0138'] . "</div>\n";
}
closetable();
Example #20
0
function mass_photo_form()
{
    global $locale, $aidlink, $gll_settings, $userdata;
    $albumRows = dbcount("(album_id)", DB_PHOTO_ALBUMS, multilang_table("PG") ? "album_language='" . LANGUAGE . "'" : "");
    if ($albumRows) {
        if (isset($_POST['upload_photo'])) {
            $data['album_id'] = form_sanitizer($_POST['album_id'], 0, "album_id");
            if (defender::safe()) {
                $upload = form_sanitizer($_FILES['photo_mass_image'], "", "photo_mass_image");
                $success_upload = 0;
                $failed_upload = 0;
                if (!empty($upload)) {
                    $total_files_uploaded = count($upload);
                    for ($i = 0; $i < $total_files_uploaded; $i++) {
                        $current_upload = $upload[$i];
                        if ($current_upload['error'] == 0) {
                            $current_photos = array("album_id" => $data['album_id'], "photo_title" => $current_upload['image_name'], "photo_filename" => $current_upload['image_name'], "photo_thumb1" => $current_upload['thumb1_name'], "photo_thumb2" => $current_upload['thumb2_name'], "photo_datestamp" => time(), "photo_user" => $userdata['user_id'], "photo_order" => dbresult(dbquery("SELECT MAX(photo_order) FROM " . DB_PHOTOS . " where album_id='" . $data['album_id'] . "'"), 0) + 1);
                            dbquery("\n\t\t\t\t\t\t\tinsert into " . DB_PHOTOS . "\n\t\t\t\t\t\t\t(" . implode(", ", array_keys($current_photos)) . ") values ('" . implode("','", array_values($current_photos)) . "')\n\t\t\t\t\t\t\t");
                            $success_upload++;
                        } else {
                            $failed_upload++;
                        }
                    }
                    addNotice("success", sprintf($locale['photo_0021'], $success_upload));
                    if ($failed_upload) {
                        addNotice("warning", sprintf($locale['photo_0021a'], $failed_upload));
                    }
                    redirect(FUSION_SELF . $aidlink . "&amp;album_id='" . $data['album_id']);
                }
            }
        }
        $upload_settings = array("upload_path" => IMAGES_G, "required" => TRUE, 'thumbnail_folder' => 'thumbs', 'thumbnail' => TRUE, 'thumbnail_w' => $gll_settings['thumb_w'], 'thumbnail_h' => $gll_settings['thumb_h'], 'thumbnail_suffix' => '_t1', 'thumbnail2' => TRUE, 'thumbnail2_w' => $gll_settings['photo_w'], 'thumbnail2_h' => $gll_settings['photo_h'], 'thumbnail2_suffix' => '_t2', 'max_width' => $gll_settings['photo_max_w'], 'max_height' => $gll_settings['photo_max_h'], 'max_byte' => $gll_settings['photo_max_b'], 'delete_original' => FALSE, "template" => "modern", "multiple" => TRUE, "inline" => TRUE, "error_text" => $locale['photo_0014']);
        echo openform("mass_form", "post", FUSION_REQUEST, array("enctype" => TRUE, "class" => "clearfix"));
        echo "<div class='well text-center'>\n" . $locale['photo_0019'] . "</div>\n";
        echo form_select('album_id', $locale['photo_0003'], "", array("input_id" => "album", "options" => get_albumOpts(), "inline" => TRUE));
        echo form_fileinput('photo_mass_image[]', $locale['photo_0004'], "", $upload_settings);
        echo "<div class='m-b-10 col-xs-12 col-sm-offset-3'>" . sprintf($locale['photo_0017'], parsebytesize($gll_settings['photo_max_b']), str_replace(',', ' ', ".jpg,.gif,.png"), $gll_settings['photo_max_w'], $gll_settings['photo_max_h']) . "</div>\n";
        echo form_button("upload_photo", $locale['photo_0020'], $locale['photo_0020'], array("class" => "btn-primary"));
        echo closeform();
    } else {
        echo "<div class='well m-t-20 text-center'>\n";
        echo sprintf($locale['gallery_0012'], FUSION_SELF . $aidlink . "&amp;section=album_form");
        echo "</div>\n";
    }
}