function fusion_console()
{
    if (iADMIN && checkrights('ERRO') || iSUPERADMIN) {
        $error_logs = new \PHPFusion\ErrorLogs();
        $error_logs->compressed = 1;
        if (!defined('no_debugger')) {
            ob_start();
            echo openmodal('tbody', 'Error Console', array('class' => 'modal-lg modal-center zindex-boost', 'button_id' => 'turbo_debugger'));
            $error_logs->show_footer_logs();
            echo closemodal();
            add_to_footer(ob_get_contents());
            ob_end_clean();
        }
    }
}
Beispiel #2
0
function print_p($array, $modal = FALSE)
{
    echo $modal ? openmodal('Debug', 'Debug') : '';
    echo "<pre style='white-space:pre-wrap !important;'>";
    print_r($array);
    echo "</pre>";
    echo $modal ? closemodal() : '';
}
Beispiel #3
0
    $blog_extended = "";
    if ($_POST['blog_extended']) {
        $blog_extended = str_replace("src='" . str_replace("../", "", IMAGES_B), "src='" . IMAGES_B, stripslashes($_POST['blog_extended']));
        $blog_extended = parse_textarea($blog_extended);
    }
    $data = array("blog_id" => form_sanitizer($_POST['blog_id'], 0, "blog_id"), "blog_subject" => form_sanitizer($_POST['blog_subject'], '', 'blog_subject'), "blog_cat" => isset($_POST['blog_cat']) && isnum($_POST['blog_cat']) ? $_POST['blog_cat'] : 0, "blog_language" => form_sanitizer($_POST['blog_language'], '', 'blog_language'), "blog_blog" => form_sanitizer($blog_blog, "", "blog_blog"), "blog_extended" => form_sanitizer($blog_extended, "", "blog_extended"), "blog_keywords" => form_sanitizer($_POST['blog_keywords'], '', 'blog_keywords'), "blog_start" => isset($_POST['blog_start']) && $_POST['blog_start'] ? $_POST['blog_start'] : '', "blog_end" => isset($_POST['blog_end']) && $_POST['blog_end'] ? $_POST['blog_end'] : '', "blog_image" => isset($_POST['blog_image']) ? $_POST['blog_image'] : '', "blog_image_t1" => isset($_POST['blog_image_t1']) ? $_POST['blog_image_t1'] : "", "blog_image_t2" => isset($_POST['blog_image_t2']) ? $_POST['blog_image_t2'] : "", "blog_ialign" => isset($_POST['blog_ialign']) ? $_POST['blog_ialign'] : "pull-left", "blog_visibility" => isnum($_POST['blog_visibility']) ? $_POST['blog_visibility'] : "0", "blog_draft" => isset($_POST['blog_draft']) ? TRUE : FALSE, "blog_sticky" => isset($_POST['blog_sticky']) ? TRUE : FALSE, "blog_breaks" => isset($_POST['line_breaks']) ? TRUE : FALSE, "blog_allow_comments" => isset($_POST['blog_allow_comments']) ? TRUE : FALSE, "blog_allow_ratings" => isset($_POST['blog_allow_ratings']) ? TRUE : FALSE, "blog_datestamp" => isset($_POST['blog_datestamp']) ? $_POST['blog_datestamp'] : "");
    $data['blog_breaks'] = "";
    if (isset($_POST['line_breaks'])) {
        $data['blog_breaks'] = TRUE;
        $data['blog_blog'] = nl2br(parse_textarea($data['blog_blog']));
        if ($data['blog_extended']) {
            $data['blog_extended'] = nl2br(parse_textarea($data['blog_extended']));
        }
    }
    if (defender::safe()) {
        echo openmodal('blog_preview', $locale['blog_0141']);
        echo "<h4>" . $data['blog_subject'] . "</h4>\n";
        echo "<p class='text-bigger'>" . parse_textarea($data['blog_blog']) . "</p>\n";
        if (isset($data['blog_extended'])) {
            echo parse_textarea($data['blog_extended']);
        }
        echo closemodal();
    }
}
echo "<div class='m-t-20'>\n";
echo openform('inputform', 'post', $formaction, array('enctype' => 1, 'max_tokens' => 1));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
echo form_hidden("blog_id", "", $data['blog_id']);
echo form_hidden("blog_datestamp", "", $data['blog_datestamp']);
echo form_text('blog_subject', $locale['blog_0422'], $data['blog_subject'], array('required' => TRUE, 'max_length' => 200, 'error_text' => $locale['blog_0450']));
Beispiel #4
0
                        while ($photo_data = dbarray($photosResult)) {
                            purgePhotoImage($photo_data);
                            dbquery("delete from " . DB_COMMENTS . " where comment_item_id='" . intval($photo_data['photo_id']) . "' and comment_type='P'");
                            dbquery("delete from " . DB_RATINGS . " where rating_item_id='" . intval($photo_data['photo_id']) . "' and rating_type='P'");
                            dbquery_insert(DB_PHOTOS, $photo_data, 'delete');
                            $photoRows++;
                        }
                        addNotice("success", sprintf($locale['album_0032'], $photoRows));
                    }
                }
                purgeAlbumImage($albumData);
                dbquery_insert(DB_PHOTO_ALBUMS, $albumData, "delete");
                redirect(FUSION_SELF . $aidlink);
            } else {
                // Confirmation form
                echo openmodal('confirm_steps', $locale['album_0027']);
                echo openform('inputform', 'post', FUSION_REQUEST);
                echo form_select('target_album', $locale['choose'], '', array('options' => $albumArray, 'inline' => TRUE, 'width' => '300px'));
                echo form_button('confirm_delete', $locale['confirm'], $_GET['cat_id'], array('class' => 'btn-sm btn-danger col-sm-offset-3', 'icon' => 'fa fa-trash'));
                echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-sm btn-default m-l-10'));
                echo closeform();
                echo closemodal();
            }
        } else {
            purgeAlbumImage($albumData);
            dbquery_insert(DB_PHOTO_ALBUMS, $albumData, "delete");
            addNotice("success", $locale['album_0030']);
            redirect(FUSION_SELF . $aidlink);
        }
    }
}
Beispiel #5
0
 /**
  * HTML template for forum move
  */
 private function display_forum_move_form()
 {
     ob_start();
     echo openmodal('move', self::$locale['forum_060'], array('static' => 1, 'class' => 'modal-md'));
     echo openform('moveform', 'post', FUSION_REQUEST);
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-5 col-md-5 col-lg-5'>\n";
     echo "<span class='text-dark strong'>" . self::$locale['forum_052'] . "</span><br/>\n";
     echo "</div><div class='col-xs-12 col-sm-7 col-md-7 col-lg-7'>\n";
     echo form_select_tree('move_threads', '', $_GET['forum_id'], array('width' => '100%', 'inline' => TRUE, 'disable_opts' => $_GET['forum_id'], 'hide_disabled' => 1, 'no_root' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $_GET['forum_id']);
     echo form_checkbox('delete_threads', self::$locale['forum_053'], '');
     echo "</div>\n</div>\n";
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-5 col-md-5 col-lg-5'>\n";
     echo "<span class='text-dark strong'>" . self::$locale['forum_054'] . "</span><br/>\n";
     // if you move, then need new hcat_key
     echo "</div><div class='col-xs-12 col-sm-7 col-md-7 col-lg-7'>\n";
     echo form_select_tree('move_forums', '', $_GET['forum_id'], array('width' => '100%', 'inline' => TRUE, 'disable_opts' => $_GET['forum_id'], 'hide_disabled' => 1, 'no_root' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $_GET['forum_id']);
     echo form_checkbox('delete_forums', self::$locale['forum_055'], '');
     echo "</div>\n</div>\n";
     echo "<div class='clearfix'>\n";
     echo form_hidden('forum_id', '', $_GET['forum_id']);
     echo form_hidden('forum_branch', '', $_GET['forum_branch']);
     echo form_button('forum_remove', self::$locale['forum_049'], 'forum_remove', array('class' => 'btn-sm btn-danger m-r-10', 'icon' => 'fa fa-trash'));
     echo "<button type='button' class='btn btn-sm btn-default' data-dismiss='modal'>" . self::$locale['close'] . "</button>\n";
     echo "</div>\n";
     echo closeform();
     echo closemodal();
     add_to_footer(ob_get_contents());
     ob_end_clean();
 }
Beispiel #6
0
 function forum_newtopic()
 {
     global $settings, $locale;
     if (isset($_POST['select_forum'])) {
         $_POST['forum_sel'] = isset($_POST['forum_sel']) && isnum($_POST['forum_sel']) ? $_POST['forum_sel'] : 0;
         redirect(FORUM . 'post.php?action=newthread&forum_id=' . $_POST['forum_sel']);
     }
     echo openmodal('newtopic', $locale['forum_0057'], array('button_id' => 'newtopic', 'class' => 'modal-md'));
     $index = dbquery_tree(DB_FORUMS, 'forum_id', 'forum_cat');
     $result = dbquery("SELECT a.forum_id, a.forum_name, b.forum_name as forum_cat_name, a.forum_post\n\t\t FROM " . DB_FORUMS . " a\n\t\t LEFT JOIN " . DB_FORUMS . " b ON a.forum_cat=b.forum_id\n\t\t WHERE " . groupaccess('a.forum_access') . " " . (multilang_table("FO") ? "AND a.forum_language='" . LANGUAGE . "' AND" : "AND") . "\n\t\t (a.forum_type ='2' or a.forum_type='4') AND a.forum_post < " . USER_LEVEL_PUBLIC . " AND a.forum_lock !='1' ORDER BY a.forum_cat ASC, a.forum_branch ASC, a.forum_name ASC");
     $options = array();
     if (dbrows($result) > 0) {
         while ($data = dbarray($result)) {
             $depth = get_depth($index, $data['forum_id']);
             if (checkgroup($data['forum_post'])) {
                 $options[$data['forum_id']] = str_repeat("&#8212;", $depth) . $data['forum_name'] . " " . ($data['forum_cat_name'] ? "(" . $data['forum_cat_name'] . ")" : '');
             }
         }
         echo "<div class='well clearfix m-t-10'>\n";
         echo form_select('forum_sel', $locale['forum_0395'], '', array('options' => $options, 'inline' => 1, 'width' => '100%'));
         echo "<div class='display-inline-block col-xs-12 col-sm-offset-3'>\n";
         echo form_button('select_forum', $locale['forum_0396'], 'select_forum', array('class' => 'btn-primary btn-sm'));
         echo "</div>\n";
         echo "</div>\n";
         echo closeform();
     } else {
         echo "<div class='well text-center'>\n";
         echo $locale['forum_0328'];
         echo "</div>\n";
     }
     echo closemodal();
 }
Beispiel #7
0
 /**
  * The Panel Editor Form
  */
 public function add_panel_form()
 {
     global $locale;
     fusion_confirm_exit();
     if (isset($_POST['panel_preview'])) {
         $panel_title = form_sanitizer($_POST['panel_name'], "", "panel_name");
         if (\defender::safe()) {
             echo openmodal("cp_preview", $panel_title);
             if (fusion_get_settings("allow_php_exe")) {
                 ob_start();
                 eval("?>" . stripslashes($_POST['panel_content']) . "<?php ");
                 $eval = ob_get_contents();
                 ob_end_clean();
                 echo $eval;
             } else {
                 echo "<p>" . nl2br(parse_textarea($_POST['panel_content'])) . "</p>\n";
             }
             echo closemodal();
         }
         $this->data = array("panel_id" => form_sanitizer($_POST['panel_id'], 0, "panel_id"), "panel_name" => form_sanitizer($_POST['panel_name'], "", "panel_name"), "panel_filename" => form_sanitizer($_POST['panel_filename'], "", "panel_filename"), "panel_side" => form_sanitizer($_POST['panel_side'], "", "panel_side"), "panel_content" => form_sanitizer($_POST['panel_content'], "", "panel_content"), "panel_restriction" => form_sanitizer($_POST['panel_restriction'], "", "panel_restriction"), "panel_url_list" => form_sanitizer($_POST['panel_url_list'], "", "panel_url_list"), "panel_display" => form_sanitizer($_POST['panel_display'], "", "panel_display"), "panel_access" => form_sanitizer($_POST['panel_access'], iGUEST, "panel_access"), "panel_languages" => !empty($_POST['panel_languages']) ? form_sanitizer($_POST['panel_languages'], "", "panel_languages") : LANGUAGE);
     }
     echo "<div class='m-t-20'>\n";
     echo openform('panel_form', 'post', $this->formaction, array('max_tokens' => 1));
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-8'>\n";
     openside('');
     echo form_hidden('panel_id', '', $this->data['panel_id']);
     echo form_text('panel_name', $locale['452'], $this->data['panel_name'], array('inline' => 1, 'required' => 1));
     //'error_text'=>$locale['470']
     echo form_select('panel_filename', $locale['453'], $this->data['panel_filename'], array('options' => self::get_panelOpts(), 'inline' => 1));
     $grid_opts = self::get_panel_grid();
     echo form_select('panel_side', $locale['457'], $this->data['panel_side'], array('options' => $grid_opts, 'inline' => TRUE));
     closeside();
     openside('');
     add_to_jquery("\n\t\t" . ($this->data['panel_restriction'] == 3 || $this->data['panel_restriction'] == 2 ? "\$('#panel_url_list-grp').hide();" : '') . "\n\t\t\$('#panel_restriction').bind('change', function(e) {\n\t\t\tif (\$(this).val() == '3' || \$(this).val() == '2') { \$('#panel_url_list-grp').hide(); } else { \$('#panel_url_list-grp').show(); }\n\t\t});\n\t\t");
     echo form_select('panel_restriction', $locale['468'], $this->data['panel_restriction'], array('options' => self::get_includeOpts(), 'inline' => 1));
     echo "<div id='panel_url_list-grp'>\n";
     echo "<div class='text-smaller'></div>\n";
     echo form_select('panel_url_list', $locale['462'], $this->data['panel_url_list'], array('options' => self::get_panel_url_list(), 'inline' => 1, 'tags' => 1, 'multiple' => 1, 'width' => '100%'));
     echo "</div>\n";
     echo form_hidden('panel_display', '', $this->data['panel_display']);
     closeside();
     add_to_jquery("\n\t\t" . ($this->data['panel_filename'] > 0 ? "\$('#pgrp').hide();" : "\$('#pgrp').show();") . "\n\t\t\$('#panel_filename').bind('change', function(e) {\n\t\t\tif (\$(this).val() > 0) { \$('#pgrp').hide(); } else { \$('#pgrp').show(); }\n\t\t});\n\t\t");
     echo "<div id='pgrp'>\n";
     echo form_textarea('panel_content', $locale['455'], $this->data['panel_content'], array('html' => fusion_get_settings("allow_php_exe") ? FALSE : TRUE, 'form_name' => 'panel_form', 'autosize' => 1, 'preview' => fusion_get_settings("allow_php_exe") ? FALSE : TRUE));
     echo "</div>\n";
     echo "</div>\n<div class='col-xs-12 col-sm-4'>\n";
     openside('');
     echo form_select('panel_access', $locale['458'], $this->data['panel_access'], array("options" => self::get_accessOpts()));
     echo form_button('panel_save', $locale['461'], $locale['461'], array('class' => 'btn-primary'));
     echo form_button('panel_preview', $locale['preview'], $locale['preview'], array('input_id' => 'prev2', 'class' => 'm-l-10 btn-default'));
     closeside();
     openside('');
     echo "<label class='label-control m-b-10'>" . $locale['466'] . "</label>\n";
     $languages = !empty($this->data['panel_languages']) ? explode('.', $this->data['panel_languages']) : array();
     foreach (fusion_get_enabled_languages() as $language => $language_name) {
         echo form_checkbox('panel_languages[]', $language_name, in_array($language, $languages) ? 1 : 0, array('class' => 'm-b-0', 'value' => $language, "reverse_label" => TRUE, 'input_id' => 'panel_lang-' . $language));
     }
     closeside();
     echo "</div>\n";
     echo "</div>\n";
     echo form_button('panel_save', $locale['461'], $locale['460'], array('class' => 'btn-primary'));
     echo form_button('panel_preview', $locale['preview'], $locale['preview'], array('class' => 'm-l-10 btn-default'));
     echo closeform();
     echo "</div>\n";
 }
Beispiel #8
0
 /**
  * Moving Posts
  */
 private function mod_move_posts()
 {
     global $locale;
     if (isset($_POST['move_posts']) && iMOD) {
         $remove_first_post = FALSE;
         $f_post_blo = FALSE;
         if (isset($_POST['delete_post']) && !empty($_POST['delete_post'])) {
             $first_post = dbarray(dbquery("SELECT post_id FROM " . DB_FORUM_POSTS . " WHERE thread_id='" . intval($this->thread_id) . "' ORDER BY post_datestamp ASC LIMIT 1"));
             /**
              * Scan for Posts
              */
             $move_posts = "";
             $array_post = array();
             $first_post_found = FALSE;
             foreach ($_POST['delete_post'] as $move_post_id) {
                 if (isnum($move_post_id)) {
                     $move_posts .= ($move_posts ? "," : "") . $move_post_id;
                     $array_post[] = $move_post_id;
                     if ($move_post_id == $first_post['post_id']) {
                         $first_post_found = TRUE;
                     }
                 }
             }
             // triggered move post
             if ($move_posts) {
                 // validate whether the selected post exists
                 $move_result = dbquery("SELECT forum_id, thread_id, COUNT(post_id) 'num_posts'\n\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . "\n\t\t\t\t\t\t\t\t\tWHERE post_id IN (" . $move_posts . ")\n\t\t\t\t\t\t\t\t\tAND thread_id='" . intval($this->thread_id) . "'\n\t\t\t\t\t\t\t\t\tGROUP BY thread_id");
                 if (dbrows($move_result) > 0) {
                     $pdata = dbarray($move_result);
                     $post_count = dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "'");
                     ob_start();
                     echo openmodal('forum0300', $locale['forum_0300'], array('class' => 'modal-md'));
                     if ($first_post_found) {
                         // there is a first post.
                         echo "<div id='close-message'><div class='admin-message alert alert-info m-t-10'>";
                         if ($pdata['num_posts'] != $post_count) {
                             $remove_first_post = TRUE;
                             echo $locale['forum_0305'] . "<br />\n";
                             // trying to remove first post with other post in the thread
                         } else {
                             echo $locale['forum_0306'] . "<br />\n";
                             // confirm ok to remove first post.
                         }
                         if ($remove_first_post && count($array_post) == 1) {
                             echo "<br /><strong>" . $locale['forum_0307'] . "</strong><br /><br />\n";
                             // no post to move.
                             echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'] . "'>" . $locale['forum_0309'] . "</a>";
                             $f_post_blo = TRUE;
                         }
                         echo "</div></div>\n";
                     }
                     if (!isset($_POST['new_forum_id']) && !$f_post_blo) {
                         $fl_result = dbquery("\n\t\t\t\t\t\t\t\t\t\tSELECT f.forum_id, f.forum_name, f.forum_type, f2.forum_name 'forum_cat_name',\n\t\t\t\t\t\t\t\t\t\t(\tSELECT COUNT(thread_id) FROM " . DB_FORUM_THREADS . " th WHERE f.forum_id=th.forum_id AND th.thread_id !='" . intval($this->thread_id) . "'\n\t\t\t\t\t\t\t\t\t\t\tGROUP BY th.forum_id\n\t\t\t\t\t\t\t\t\t\t) AS threadcount\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB_FORUMS . " f\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB_FORUMS . " f2 ON f.forum_cat=f2.forum_id\n\t\t\t\t\t\t\t\t\t\tWHERE " . groupaccess('f.forum_access') . "\n\t\t\t\t\t\t\t\t\t\tORDER BY f2.forum_order ASC, f.forum_order ASC\n\t\t\t\t\t\t\t\t\t\t");
                         if (dbrows($fl_result) > 0) {
                             $exclude_opts = array();
                             while ($data = dbarray($fl_result)) {
                                 if (empty($data['threadcount']) || $data['forum_type'] == '1') {
                                     $exclude_opts[] = $data['forum_id'];
                                 }
                             }
                             echo openform('modopts', 'post', $this->form_action);
                             echo form_select_tree('new_forum_id', $locale['forum_0301'], '', array('disable_opts' => $exclude_opts, 'no_root' => 1, 'inline' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat');
                             foreach ($array_post as $value) {
                                 echo form_hidden("delete_post[]", "", $value, array("input_id" => "delete_post[{$value}]"));
                             }
                             echo form_hidden('move_posts', '', 1);
                             echo "<div class='clearfix'>\n<div class='col-xs-12 col-md-offset-3 col-lg-offset-3'>\n";
                             echo form_button($locale['forum_0302'], $locale['forum_0208'], $locale['forum_0208'], array('inline' => 1, 'class' => 'btn-primary'));
                             echo "</div>\n</div>\n";
                             echo closeform();
                         } else {
                             echo "<div class='well'>\n";
                             echo "<strong>" . $locale['forum_0310'] . "</strong><br /><br />\n";
                             echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "&amp;rowstart=" . $_GET['rowstart'] . "'>" . $locale['forum_0309'] . "</a><br /><br />\n";
                             echo "</div>\n";
                         }
                     } elseif (isset($_POST['new_forum_id']) && isnum($_POST['new_forum_id']) && !isset($_POST['new_thread_id']) && !$f_post_blo) {
                         // Select Threads in Selected Forum.
                         // build the list.
                         $tl_result = dbquery("\n\t\t\t\t\t\t\tSELECT thread_id, thread_subject\n\t\t\t\t\t\t\tFROM " . DB_FORUM_THREADS . "\n\t\t\t\t\t\t\tWHERE forum_id='" . intval($_POST['new_forum_id']) . "' AND thread_id !='" . intval($pdata['thread_id']) . "' AND thread_hidden='0'\n\t\t\t\t\t\t\tORDER BY thread_subject ASC\n\t\t\t\t\t\t\t");
                         if (dbrows($tl_result) > 0) {
                             $forum_list = array();
                             while ($tl_data = dbarray($tl_result)) {
                                 $forum_list[$tl_data['thread_id']] = $tl_data['thread_subject'];
                             }
                             echo openform('modopts', 'post', $this->form_action . "&amp;sv", array('max_tokens' => 1, 'downtime' => 1));
                             echo form_hidden('new_forum_id', '', $_POST['new_forum_id']);
                             echo form_select('new_thread_id', $locale['forum_0303'], '', array('options' => $forum_list, 'inline' => 1));
                             foreach ($array_post as $value) {
                                 echo form_hidden("delete_post[]", "", $value, array("input_id" => "delete_post[{$value}]"));
                             }
                             echo form_hidden('move_posts', '', 1);
                             echo form_button($locale['forum_0304'], $locale['forum_0208'], $locale['forum_0208'], array('class' => 'btn-primary btn-sm'));
                         } else {
                             echo $locale['forum_0308'] . "<br /><br />\n";
                             echo "<a href='" . INFUSIONS . "forum/viewthread.php?thread_id=" . $pdata['thread_id'] . "'>" . $locale['forum_0309'] . "</a>\n";
                         }
                     } elseif (isset($_GET['sv']) && isset($_POST['new_forum_id']) && isnum($_POST['new_forum_id']) && isset($_POST['new_thread_id']) && isnum($_POST['new_thread_id'])) {
                         // Execute move and redirect after
                         $move_posts_add = "";
                         if (!dbcount("(thread_id)", DB_FORUM_THREADS, "thread_id='" . intval($_POST['new_thread_id']) . "' AND forum_id='" . intval($_POST['new_forum_id']) . "'")) {
                             redirect($this->form_action . "&amp;error=1");
                         }
                         foreach ($array_post as $move_post_id) {
                             if (isnum($move_post_id)) {
                                 if ($first_post_found && $remove_first_post) {
                                     if ($move_post_id != $first_post['post_id']) {
                                         $move_posts_add .= ($move_posts_add ? "," : "") . $move_post_id;
                                     }
                                     $pdata['num_posts'] = $pdata['num_posts'] - 1;
                                 } else {
                                     $move_posts_add = $move_post_id . ($move_posts_add ? "," : "") . $move_posts_add;
                                 }
                             }
                         }
                         if ($move_posts_add) {
                             $posts_ex = dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "' AND post_id IN (" . $move_posts_add . ")");
                             if ($posts_ex) {
                                 $result = dbquery("UPDATE " . DB_FORUM_POSTS . " SET forum_id='" . intval($_POST['new_forum_id']) . "', thread_id='" . intval($_POST['new_thread_id']) . "' WHERE post_id IN (" . $move_posts_add . ")");
                                 $result = dbquery("UPDATE " . DB_FORUM_ATTACHMENTS . " SET thread_id='" . intval($_POST['new_thread_id']) . "' WHERE post_id IN(" . $move_posts_add . ")");
                                 $new_thread = dbarray(dbquery("\n\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT forum_id, thread_id, post_id, post_author, post_datestamp\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE thread_id='" . intval($_POST['new_thread_id']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY post_datestamp DESC\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t"));
                                 $result = dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . intval($new_thread['post_datestamp']) . "', thread_lastpostid='" . intval($new_thread['post_id']) . "',\n\t\t\t\t\t\t\t\t\tthread_postcount=thread_postcount+" . intval($pdata['num_posts']) . ", thread_lastuser='******'post_author']) . "' WHERE thread_id='" . intval($_POST['new_thread_id']) . "'");
                                 $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($new_thread['post_datestamp']) . "', forum_postcount=forum_postcount+" . intval($pdata['num_posts']) . ", forum_lastuser='******'post_author'] . "' WHERE forum_id='" . intval($_POST['new_forum_id']) . "'");
                                 $old_thread = dbarray(dbquery("\n\t\t\t\t\t\t\t\t\tSELECT forum_id, thread_id, post_id, post_author, post_datestamp\n\t\t\t\t\t\t\t\t\tFROM " . DB_FORUM_POSTS . " WHERE thread_id='" . intval($pdata['thread_id']) . "' ORDER BY post_datestamp DESC\n\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t"));
                                 if (!dbcount("(post_id)", DB_FORUM_POSTS, "thread_id='" . intval($pdata['thread_id']) . "'")) {
                                     $new_last_post = dbarray(dbquery("SELECT post_author, post_datestamp FROM " . DB_FORUM_POSTS . " WHERE forum_id='" . intval($pdata['forum_id']) . "' ORDER BY post_datestamp DESC LIMIT 1 "));
                                     $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($new_last_post['post_datestamp']) . "', forum_postcount=forum_postcount-" . intval($pdata['num_posts']) . ", forum_threadcount=forum_threadcount-1, forum_lastuser='******'post_author']) . "' WHERE forum_id='" . intval($pdata['forum_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_THREADS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_THREAD_NOTIFY . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_POLL_VOTERS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("DELETE FROM " . DB_FORUM_POLLS . " WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                 } else {
                                     $result = dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . intval($old_thread['post_datestamp']) . "',\n\t\t\t\t\t\t\t\t\t\tthread_lastpostid='" . intval($old_thread['post_id']) . "', thread_postcount=thread_postcount-" . intval($pdata['num_posts']) . ", thread_lastuser='******'post_author']) . "' WHERE thread_id='" . intval($pdata['thread_id']) . "'");
                                     $result = dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . intval($old_thread['post_datestamp']) . "', forum_postcount=forum_postcount-" . intval($pdata['num_posts']) . ", forum_lastuser='******'post_author']) . "' WHERE forum_id='" . intval($pdata['forum_id']) . "'");
                                 }
                                 $pid = count($array_post) - 1;
                                 redirect(INFUSIONS . "forum/viewthread.php?thread_id=" . intval($_POST['new_thread_id']) . "&amp;pid=" . $array_post[$pid] . "#post_" . $array_post[$pid]);
                             } else {
                                 addNotice('danger', $locale['error-MP002']);
                                 redirect($this->form_action);
                             }
                         } else {
                             addNotice('danger', $locale['error-MP003']);
                             redirect($this->form_action);
                         }
                     }
                     echo closemodal();
                     add_to_footer(ob_get_contents());
                     ob_end_clean();
                 } else {
                     addNotice('danger', $locale['error-MP002']);
                     redirect($this->form_action);
                 }
             } else {
                 addNotice('danger', $locale['error-MP003']);
                 redirect($this->form_action);
             }
         } else {
             addNotice('danger', $locale['error-MP003']);
             redirect($this->form_action);
         }
     }
 }
/**
 * Formatted value of a variable to debug
 * @param mixed   $array
 * @param boolean $modal TRUE if you want to render it as a modal dialog
 */
function print_p($array, $modal = FALSE)
{
    if ($modal == TRUE) {
        ob_start();
        echo openmodal('Debug', 'Debug');
    }
    echo "<pre style='white-space:pre-wrap !important;'>";
    echo htmlspecialchars(print_r($array, TRUE), ENT_QUOTES, 'utf-8');
    echo "</pre>";
    if ($modal == TRUE) {
        echo closemodal();
        add_to_footer(ob_get_contents());
        ob_end_clean();
    }
}
Beispiel #10
0
 /**
  * The HTML form
  * @param $data
  */
 public static function customPage_form($data)
 {
     global $aidlink, $locale;
     if (isset($_POST['preview'])) {
         if (\defender::safe()) {
             echo openmodal("cp_preview", $locale['429']);
             echo "<h3>" . $data['page_title'] . "</h3>\n";
             if (fusion_get_settings("allow_php_exe")) {
                 ob_start();
                 eval("?>" . stripslashes($_POST['page_content']) . "<?php ");
                 $eval = ob_get_contents();
                 ob_end_clean();
                 echo $eval;
             } else {
                 echo "<p>" . nl2br(parse_textarea($_POST['page_content'])) . "</p>\n";
             }
             echo closemodal();
         }
         $data = array('page_id' => form_sanitizer($_POST['page_id'], 0, 'page_id'), 'link_id' => form_sanitizer($_POST['link_id'], 0, 'link_id'), 'link_order' => form_sanitizer($_POST['link_order'], 0, 'link_order'), 'page_link_cat' => form_sanitizer($_POST['page_link_cat'], 0, 'page_link_cat'), 'page_title' => form_sanitizer($_POST['page_title'], '', 'page_title'), 'page_access' => form_sanitizer($_POST['page_access'], 0, 'page_access'), 'page_content' => form_sanitizer($_POST['page_content'], "", "page_content"), 'page_keywords' => form_sanitizer($_POST['page_keywords'], '', 'page_keywords'), 'page_language' => implode('.', isset($_POST['page_language']) ? sanitize_array($_POST['page_language']) : array()), 'page_allow_comments' => isset($_POST['page_allow_comments']) ? 1 : 0, 'page_allow_ratings' => isset($_POST['page_allow_ratings']) ? 1 : 0);
     }
     echo openform('inputform', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
     if (isset($_POST['edit']) && isset($_POST['page_id'])) {
         echo form_hidden('edit', '', 'edit');
     }
     echo "<div class='row m-t-20' >\n";
     echo "<div class='col-xs-12 col-sm-8'>\n";
     echo form_text('page_title', $locale['422'], $data['page_title'], array('required' => 1));
     echo form_select('page_keywords', $locale['432'], $data['page_keywords'], array('max_length' => 320, 'width' => '100%', 'tags' => 1, 'multiple' => 1));
     $textArea_config = array('width' => '100%', 'height' => '260px', 'form_name' => 'inputform', 'type' => "html", 'class' => 'm-t-20');
     if (isset($_COOKIE['custom_pages_tinymce']) && $_COOKIE['custom_pages_tinymce'] == 1 && fusion_get_settings('tinymce_enabled')) {
         $textArea_config = array("type" => "tinymce", "tinymce" => "advanced", "class" => "m-t-20");
     }
     echo form_textarea('page_content', '', $data['page_content'], $textArea_config);
     echo "</div>\n";
     echo "<div class='col-xs-12 col-sm-4'>\n";
     openside("");
     echo form_button('save', $locale['430'], $locale['430'], array('class' => 'btn-primary m-r-10 m-t-10'));
     echo form_button('preview', $locale['429'], $locale['429'], array('class' => 'btn-default m-r-10 m-t-10'));
     closeside();
     if (fusion_get_settings('tinymce_enabled')) {
         openside('');
         $val = !isset($_COOKIE['custom_pages_tinymce']) || $_COOKIE['custom_pages_tinymce'] == 0 ? $locale['461'] . " TINYMCE" : $locale['462'] . " TINYMCE";
         echo form_button('tinymce_switch', $val, $val, array('class' => 'btn-default btn-block', 'type' => 'button'));
         add_to_jquery("\n\t\t\t\$('#tinymce_switch').bind('click', function() {\n\t\t\t\tSetTinyMCE(" . (!isset($_COOKIE['custom_pages_tinymce']) || $_COOKIE['custom_pages_tinymce'] == 0 ? 1 : 0) . ");\n\t\t\t});\n\t\t\t");
         closeside();
     }
     if (fusion_get_settings('comments_enabled') == "0" || fusion_get_settings('ratings_enabled') == "0") {
         echo "<div class='tbl2 well'>\n";
         if (fusion_get_settings('comments_enabled') == "0" && fusion_get_settings('ratings_enabled') == "0") {
             $sys = $locale['457'];
         } elseif (fusion_get_settings('comments_enabled') == "0") {
             $sys = $locale['455'];
         } else {
             $sys = $locale['456'];
         }
         echo sprintf($locale['454'], $sys);
         echo "</div>\n";
     }
     if (!$data['page_id']) {
         openside("");
         echo form_checkbox('add_link', $locale['426'], 1);
         echo "<div id='link_add_sel' style='display:none;'>\n";
         echo form_select_tree("page_link_cat", $locale['SL_0029'], $data['page_link_cat'], array("parent_value" => $locale['parent'], 'width' => '100%', 'query' => (multilang_table("SL") ? "WHERE link_language='" . LANGUAGE . "' AND" : '') . " link_position >= 2", 'disable_opts' => $data['link_id'], 'hide_disabled' => 1), DB_SITE_LINKS, "link_name", "link_id", "link_cat");
         echo "</div>\n";
         add_to_jquery("\n            var checked = \$('#add_link').is(':checked');\n            if (checked) {\n                \$('#link_add_sel').show();\n            } else {\n                \$('#link_add_sel').hide();\n            }\n            \$('#add_link').bind('click', function(e) {\n                var checked = \$(this).is(':checked');\n                if (checked) {\n                    \$('#link_add_sel').show();\n                } else {\n                    \$('#link_add_sel').hide();\n                }\n            });\n            ");
         closeside();
     }
     openside("");
     echo form_checkbox('page_allow_comments', $locale['427'], $data['page_allow_comments'], array('class' => 'm-b-0'));
     echo form_checkbox('page_allow_ratings', $locale['428'], $data['page_allow_ratings'], array('class' => 'm-b-0'));
     echo form_hidden('link_id', '', $data['link_id']);
     echo form_hidden('link_order', '', $data['link_order']);
     closeside();
     openside();
     if (multilang_table("CP")) {
         $page_lang = !empty($data['page_language']) ? explode('.', $data['page_language']) : array();
         foreach (fusion_get_enabled_languages() as $language => $language_name) {
             $isDisabled = LANGUAGE == $language ? TRUE : FALSE;
             echo form_checkbox('page_language[]', $language_name, in_array($language, $page_lang) ? TRUE : FALSE, array('class' => 'm-b-0', 'value' => $language, 'input_id' => 'page_lang-' . $language, "disabled" => $isDisabled ? TRUE : FALSE, "delimiter" => "."));
             if ($isDisabled) {
                 echo form_hidden("page_language[]", "", $language);
             }
         }
     } else {
         echo form_hidden('page_language', '', $data['page_language']);
     }
     closeside();
     openside();
     echo form_select('page_access', $locale['423'], $data['page_access'], array('options' => fusion_get_groups(), 'width' => '100%'));
     closeside();
     echo "</div></div>\n";
     echo form_hidden('page_id', '', $data['page_id']);
     echo form_button('save', $locale['430'], $locale['430'], array('class' => 'btn-primary m-r-10'));
     if (isset($_POST['edit'])) {
         echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
     }
     echo closeform();
     closetable();
     add_to_jquery("\n\t\t\t\$('#delete').bind('click', function() { confirm('" . $locale['450'] . "'); });\n\t\t\t\$('#save').bind('click', function() {\n\t\t\tvar page_title = \$('#page_title').val();\n\t\t\tif (page_title =='') { alert('" . $locale['451'] . "'); return false; }\n\t\t\t});\n\t\t");
     if (fusion_get_settings('tinymce_enabled')) {
         add_to_jquery("\n\t\t\tfunction SetTinyMCE(val) {\n\t\t\tnow=new Date();\n" . "now.setTime(now.getTime()+1000*60*60*24*365);\n\t\t\texpire=(now.toGMTString());\n" . "document.cookie=\"custom_pages_tinymce=\"+escape(val)+\";expires=\"+expire;\n\t\t\tlocation.href='" . FUSION_SELF . $aidlink . "&section=cp2';\n\t\t\t}\n\t\t    ");
     }
 }
Beispiel #11
0
 /**
  * Theme Styler Page
  * Edit done, save done. Now load.
  */
 public function theme_editor()
 {
     global $aidlink, $locale;
     if (isset($_GET['e_action']) && $_GET['e_action'] == "edit" && isset($_GET['preset']) && isnum($_GET['preset'])) {
         $result = dbquery("SELECT * FROM " . DB_THEME . " WHERE theme_name='" . $this->theme_name . "' AND theme_id='" . intval($_GET['preset']) . "'");
         if (dbrows($result) > 0) {
             $this->data = dbarray($result);
             if ($this->data['theme_config']) {
                 $this->data += unserialize(stripslashes($this->data['theme_config']));
             }
         }
     }
     self::save_theme();
     $this->font_decoration_options = array($locale['theme_5000'], $locale['theme_5001'], $locale['theme_5002'], $locale['theme_5003'], $locale['theme_5004'], $locale['theme_5005'], $locale['theme_5006'], $locale['theme_5007']);
     $this->fills = array($locale['theme_5008'], $locale['theme_5009'], $locale['theme_5010'], $locale['theme_5011'], $locale['theme_5012']);
     $tab_title['title'][] = $locale['theme_2001'];
     $tab_title['id'][] = 'font';
     $tab_title['icon'][] = 'fa fa-text-width m-r-10';
     $tab_title['title'][] = $locale['theme_2002'];
     $tab_title['id'][] = 'grid';
     $tab_title['icon'][] = 'fa fa-magic m-r-10';
     $tab_title['title'][] = $locale['theme_2003'];
     $tab_title['id'][] = 'nav';
     $tab_title['icon'][] = 'fa fa-navicon m-r-10';
     $tab_active = tab_active($tab_title, 0);
     if ($this->debug) {
         print_p($_POST);
     }
     // Use a modal to block user to avoid double clicking the save button.
     echo openmodal('dbi', sprintf($locale['theme_2005'], ucwords($this->theme_name)), array('class' => 'zindex-boost modal-center', 'button_id' => 'save_theme', 'static' => 1));
     echo "<div class='pull-left m-r-20'><i class='icon_notify n-magic'></i></div>\n";
     echo "<div class='overflow-hide text-smaller'>" . $locale['theme_2006'] . "</div>\n";
     echo closemodal();
     // how come my multiple preset missing now?
     echo openform('theme_edit', 'post', FUSION_REQUEST, array("class" => "m-t-20"));
     echo "<div class='list-group-item m-b-20 clearfix'>\n";
     echo "<div class='pull-right m-l-10'>\n";
     echo form_button('save_theme', $locale['theme_5013'], 'save_theme', array('class' => 'btn-primary m-r-10'));
     echo form_button('close_theme', $locale['close'], 'close_theme', array('class' => 'btn-default'));
     echo "</div>\n";
     echo "<div class='overflow-hide'>\n";
     echo form_hidden('theme_id', '', $this->data['theme_id']);
     echo form_hidden("theme_datestamp", '', time());
     echo form_text('theme_title', $locale['theme_2007'], $this->data['theme_title'], array('inline' => 1, 'required' => TRUE));
     echo form_hidden('theme_name', $locale['theme_2008'], $this->theme_name, array('inline' => 1, 'deactivate' => 1));
     echo "</div>\n";
     echo "</div>\n";
     echo opentab($tab_title, $tab_active, 'atom');
     echo opentabbody($tab_title['title'][0], $tab_title['id'][0], $tab_active);
     echo "<div class='m-t-20'>\n";
     $this->font_admin();
     echo "</div>\n";
     echo closetabbody();
     echo opentabbody($tab_title['title'][1], $tab_title['id'][1], $tab_active);
     echo "<div class='m-t-20'>\n";
     $this->layout_admin();
     echo "</div>\n";
     echo closetabbody();
     echo opentabbody($tab_title['title'][2], $tab_title['id'][2], $tab_active);
     echo "<div class='m-t-20'>\n";
     $this->nav_admin();
     echo "</div>\n";
     echo closetabbody();
     echo closetab();
     echo closeform();
 }
Beispiel #12
0
 /**
  * HTML template for forum move
  */
 private function display_forum_move_form()
 {
     global $aidlink, $locale;
     echo openmodal('move', $locale['forum_060'], array('static' => 1, 'class' => 'modal-md'));
     echo openform('moveform', 'post', FUSION_SELF . $aidlink . $this->ext, array('max_tokens' => 1));
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-5 col-md-5 col-lg-5'>\n";
     echo "<span class='text-dark strong'>" . $locale['forum_052'] . "</span><br/>\n";
     echo "</div><div class='col-xs-12 col-sm-7 col-md-7 col-lg-7'>\n";
     echo form_select_tree('move_threads', '', $_GET['forum_id'], array('width' => '100%', 'inline' => TRUE, 'disable_opts' => $_GET['forum_id'], 'hide_disabled' => 1, 'no_root' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $_GET['forum_id']);
     echo form_checkbox('delete_threads', $locale['forum_053'], '');
     echo "</div>\n</div>\n";
     echo "<div class='row'>\n";
     echo "<div class='col-xs-12 col-sm-5 col-md-5 col-lg-5'>\n";
     echo "<span class='text-dark strong'>" . $locale['forum_054'] . "</span><br/>\n";
     // if you move, then need new hcat_key
     echo "</div><div class='col-xs-12 col-sm-7 col-md-7 col-lg-7'>\n";
     echo form_select_tree('move_forums', '', $_GET['forum_id'], array('width' => '100%', 'inline' => TRUE, 'disable_opts' => $_GET['forum_id'], 'hide_disabled' => 1, 'no_root' => 1), DB_FORUMS, 'forum_name', 'forum_id', 'forum_cat', $_GET['forum_id']);
     echo form_checkbox('delete_forums', $locale['forum_055'], '');
     echo "</div>\n</div>\n";
     echo "<div class='clearfix'>\n";
     echo form_hidden('forum_remove', '', 1);
     // key to launch next sequence
     echo form_hidden('forum_id', '', $_GET['forum_id']);
     echo form_hidden('forum_branch', '', $_GET['forum_branch']);
     echo form_button('submit_move', $locale['forum_049'], 'submit_move', array('class' => 'btn-sm btn-danger m-r-10', 'icon' => 'fa fa-trash'));
     echo "<button type='button' class='btn btn-sm btn-default' data-dismiss='modal'><i class='entypo cross'></i> " . $locale['close'] . "</button>\n";
     echo "</div>\n";
     echo closeform();
     echo closemodal();
 }
Beispiel #13
0
 /** Use this function to show error logs */
 public function showFooterErrors()
 {
     $locale = self::$locale;
     $aidlink = fusion_get_aidlink();
     $html = "";
     if (iADMIN && checkrights("ERRO") && (count($this->errors) || count($this->new_errors)) && !defined("NO_DEBUGGER")) {
         $html = "<i class='fa fa-bug fa-lg'></i></button><strong>\n";
         $html .= str_replace(array("[ERROR_LOG_URL]", "[/ERROR_LOG_URL]"), array("<a id='footer_debug' href='" . ADMIN . "errors.php" . $aidlink . "'>", "</a>"), $locale['err_101']);
         $html .= "</strong><span class='badge m-l-10'>L: " . count($this->errors) . "</span>\n";
         $html .= "<span class='badge m-l-10'>N: " . count($this->new_errors) . "</span>\n";
         $cHtml = openmodal('tbody', 'Error Console', array('class' => 'modal-lg modal-center zindex-boost', 'button_id' => 'footer_debug'));
         $cHtml .= $this->getErrorLogs();
         $cHtml .= closemodal();
         add_to_footer($cHtml);
     }
     return $html;
 }
         $article_article = parse_textarea($_POST['article_article']);
         $article_article = str_replace("src='" . str_replace("../", "", IMAGES_A), "src='" . IMAGES_A, $article_article);
     }
     $callback_data = array("article_subject" => form_sanitizer($_POST['article_subject'], '', 'article_subject'), "article_cat" => isnum($_POST['article_cat']) ? $_POST['article_cat'] : 0, "article_language" => form_sanitizer($_POST['article_language'], '', 'article_language'), "article_snippet" => form_sanitizer($article_snippet, "", "article_snippet"), "article_article" => form_sanitizer($article_article, "", "article_article"), "article_keywords" => form_sanitizer($_POST['article_keywords'], '', 'article_keywords'), "article_visibility" => isnum($_POST['article_visibility']) ? $_POST['article_visibility'] : "0", "article_draft" => isset($_POST['article_draft']) ? TRUE : FALSE, "article_datestamp" => $callback_data['article_datestamp']);
     $callback_data['article_breaks'] = "";
     $callback_data['article_snippet'] = parse_textarea($callback_data['article_snippet']);
     $callback_data['article_article'] = parse_textarea($callback_data['article_article']);
     if (isset($_POST['article_breaks'])) {
         $callback_data['article_breaks'] = TRUE;
         $callback_data['article_snippet'] = nl2br($callback_data['article_snippet']);
         if ($callback_data['article_article']) {
             $callback_data['article_article'] = nl2br($callback_data['article_article']);
         }
     }
     if (defender::safe()) {
         echo openmodal('article_preview', $locale['articles_0240']);
         echo "<h3>" . $callback_data['article_snippet'] . "</h3>\n";
         echo $callback_data['article_snippet'];
         echo "<hr/>\n";
         if (isset($callback_data['article_article'])) {
             echo $callback_data['article_article'];
         }
         echo closemodal();
     }
 }
 echo openform("publish_article", "post", FUSION_REQUEST);
 echo "<div class='well clearfix'>\n";
 echo "<div class='pull-left'>\n";
 echo display_avatar($data, "30px", "", "", "");
 echo "</div>\n";
 echo "<div class='overflow-hide'>\n";
Beispiel #15
0
     $news_extended = "";
     if ($_POST['news_extended']) {
         $news_extended = phpentities(stripslash($_POST['news_extended']));
         $news_extended = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, stripslash($_POST['news_extended']));
     }
     $callback_data = array("news_subject" => form_sanitizer($_POST['news_subject'], '', 'news_subject'), "news_cat" => isnum($_POST['news_cat']) ? $_POST['news_cat'] : 0, "news_language" => form_sanitizer($_POST['news_language'], '', 'news_language'), "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_start" => isset($_POST['news_start']) && $_POST['news_start'] ? $_POST['news_start'] : '', "news_end" => isset($_POST['news_end']) && $_POST['news_end'] ? $_POST['news_end'] : '', "news_visibility" => isnum($_POST['news_visibility']) ? $_POST['news_visibility'] : "0", "news_draft" => isset($_POST['news_draft']) ? TRUE : FALSE, "news_sticky" => isset($_POST['news_sticky']) ? TRUE : FALSE, "news_datestamp" => $callback_data['news_datestamp'], "news_ialign" => isset($_POST['news_ialign']) ? $_POST['news_ialign'] : '', "news_image" => isset($_POST['news_image']) ? $_POST['news_image'] : '', "news_image_t1" => isset($_POST['news_image_t1']) ? $_POST['news_image_t1'] : "", "news_image_t2" => isset($_POST['news_image_t2']) ? $_POST['news_image_t2'] : "");
     $callback_data['news_breaks'] = "";
     if (isset($_POST['news_breaks'])) {
         $callback_data['news_breaks'] = TRUE;
         $callback_data['news_news'] = nl2br($callback_data['news_news']);
         if ($callback_data['news_extended']) {
             $callback_data['news_extended'] = nl2br($callback_data['news_extended']);
         }
     }
     if (defender::safe()) {
         echo openmodal('news_preview', $locale['news_0141']);
         echo "<h3>" . $callback_data['news_subject'] . "</h3>\n";
         echo $callback_data['news_news'];
         echo "<hr/>\n";
         if (isset($callback_data['news_extended'])) {
             echo $callback_data['news_extended'];
         }
         echo closemodal();
     }
 }
 echo openform("publish_news", "post", FUSION_REQUEST);
 echo "<div class='well clearfix'>\n";
 echo "<div class='pull-left'>\n";
 echo display_avatar($data, "30px", "", "", "");
 echo "</div>\n";
 echo "<div class='overflow-hide'>\n";
Beispiel #16
0
$tab['icon'][] = "";
$tab['title'][] = "Permalink Settings";
$tab['id'][] = "pls";
$tab['icon'][] = "";
opentable($locale['428']);
echo "<div class='well'>\n";
echo $locale['415'];
echo "</div>\n";
echo opentab($tab, $_GET['section'], "permalinkTab", TRUE, "m-t-20 m-b-20");
switch ($_GET['section']) {
    case "pl":
        // edit
        if (!empty($edit_name) && !empty($driver)) {
            echo openform('editpatterns', 'post', FUSION_SELF . $aidlink);
            ob_start();
            echo openmodal("permalinkHelper", $locale['408'], array("button_id" => "pButton"));
            if (!empty($regex)) {
                echo "<table class='table table-responsive table-striped'>\n";
                foreach ($regex as $key => $values) {
                    echo "<tr>\n";
                    echo "<td>" . $key . "</td>\n";
                    echo "<td>" . $values . "</td>\n";
                    echo "<td>\n";
                    echo isset($permalink_tags_desc[$key]) ? $permalink_tags_desc[$key] : $locale['na'];
                    echo "</td>\n";
                    echo "</tr>\n";
                }
                echo "</table>\n";
            }
            echo closemodal();
            add_to_footer(ob_get_contents());
Beispiel #17
0
 private function _delete_category()
 {
     global $aidlink;
     $this->locale = fusion_get_locale();
     $this->debug = FALSE;
     $data = array();
     if (isset($_POST['cancel'])) {
         redirect(FUSION_SELF . $aidlink);
     }
     if (isset($_GET['action']) && $_GET['action'] == 'cat_delete' && isset($_GET['cat_id']) && self::validate_fieldCat($_GET['cat_id'])) {
         // do action of the interior form
         if (isset($_POST['delete_cat'])) {
             // get root node
             $target_database = '';
             $field_list = array();
             if (isset($_POST['delete_subcat']) or isset($_POST['delete_field'])) {
                 if (in_array($_GET['cat_id'], $this->page_list)) {
                     // this is root.
                     $result = dbquery("\n                                  SELECT field_cat_id, field_parent, field_cat_db FROM " . $this->category_db . "\n                                  WHERE field_cat_id='" . intval($_GET['cat_id']) . "'\n                                  ");
                 } else {
                     // is is not a root.
                     $result = dbquery("\n                        SELECT uf.field_cat_id, root.field_cat_db FROM " . $this->category_db . " uf\n\t\t\t\t\t\tLEFT JOIN " . $this->category_db . " root ON uf.field_parent = root.field_cat_id\n\t\t\t\t\t\tWHERE uf.field_cat_id='" . intval($_GET['cat_id']) . "'\n\t\t\t\t\t\t");
                 }
                 if ($result == NULL) {
                     die("no result");
                 }
                 if (dbrows($result) > 0) {
                     $data += dbarray($result);
                     $target_database = $data['field_cat_db'] ? DB_PREFIX . $data['field_cat_db'] : DB_USERS;
                     $field_list = fieldgenerator($target_database);
                 }
                 if ($this->debug) {
                     print_p($field_list);
                     print_p($target_database);
                 }
             }
             if (isset($_POST['delete_subcat'])) {
                 // When deletion of a master page and involving all subcategories
                 if ($this->debug) {
                     print_p($this->page[$_GET['cat_id']]);
                 }
                 // execute removal on child fields and cats
                 foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
                     $result = dbquery("\n                                  SELECT field_id, field_name FROM " . $this->field_db . "\n                                  WHERE field_cat='" . $field_category['field_cat_id'] . "'\n                                  ");
                     // find all child > 1
                     if (dbrows($result) > 0) {
                         while ($data = dbarray($result)) {
                             // remove column from db , and fields
                             if (in_array($data['field_name'], $field_list)) {
                                 // verify table integrity
                                 if ($this->debug) {
                                     print_p("DROP " . $data['field_name'] . " FROM " . $target_database);
                                     print_p("DELETE " . $data['field_id'] . " FROM " . $this->field_db);
                                 } else {
                                     dbquery("DELETE FROM " . $this->field_db . " WHERE field_id='" . $data['field_id'] . "'");
                                     if (!empty($target_database) && !empty($data['field_name'])) {
                                         self::drop_column($target_database, $data['field_name']);
                                     }
                                 }
                             }
                             // remove category.
                             if ($this->debug) {
                                 print_p("DELETE " . $field_category['field_cat_id'] . " FROM " . $this->category_db);
                             } else {
                                 dbquery("DELETE FROM " . $this->category_db . " WHERE field_cat_id='" . $field_category['field_cat_id'] . "'");
                             }
                         }
                         // end while
                     }
                 }
             } elseif (isset($_POST['move_subcat']) && $_POST['move_subcat'] > 0) {
                 // When deletion to move subcategory
                 foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
                     $new_parent = form_sanitizer($_POST['move_subcat'], 0, 'move_subcat');
                     if ($this->debug) {
                         print_p("MOVED " . $field_category['field_cat_id'] . " TO category " . $new_parent);
                         print_p("DELETE " . $_GET['cat_id'] . " FROM " . $this->category_db);
                     } else {
                         dbquery("UPDATE " . $this->category_db . " SET field_parent='" . $new_parent . "' WHERE field_cat_id='" . $field_category['field_cat_id'] . "'");
                     }
                 }
             } elseif (isset($_POST['delete_field']) && isset($_GET['cat_id']) && isnum($_GET['cat_id'])) {
                 // Delete fields
                 $this->debug = FALSE;
                 if ($this->debug) {
                     print_p('Delete Fields');
                 }
                 // Delete Fields - Bug with Isset errors
                 $result = dbquery("SELECT field_id, field_name FROM " . $this->field_db . " WHERE field_cat='" . intval($_GET['cat_id']) . "'");
                 if (dbrows($result) > 0) {
                     while ($data = dbarray($result)) {
                         if (in_array($data['field_name'], $field_list)) {
                             // verify table integrity
                             if ($this->debug) {
                                 print_p("DROP " . $data['field_name'] . " FROM " . $target_database);
                                 print_p("DELETE " . $data['field_id'] . " FROM " . $this->field_db);
                             } else {
                                 $field_del_sql = "DELETE FROM " . $this->field_db . " WHERE field_id='" . $data['field_id'] . "'";
                                 $field_count = $this->validate_field($data['field_id']);
                                 if ($field_count) {
                                     dbquery($field_del_sql);
                                 }
                                 // drop a column
                                 if (!empty($target_database)) {
                                     self::drop_column($target_database, $data['field_name']);
                                 }
                             }
                         }
                     }
                     addNotice('success', $this->locale['field_0200']);
                     redirect(FUSION_SELF . $aidlink);
                 }
             } elseif (!isset($_POST['delete_field']) && isset($_POST['move_field']) && $_POST['move_field'] > 0) {
                 $rows = dbcount("(field_id)", $this->field_db, "field_cat='" . intval($_GET['cat_id']) . "'");
                 if ($rows) {
                     $new_parent = form_sanitizer($_POST['move_field'], 0, 'move_field');
                     dbquery("UPDATE " . $this->field_db . " SET field_cat='" . intval($new_parent) . "' WHERE field_cat='" . intval($_GET['cat_id']) . "'");
                 }
             }
             // Delete the current category
             $delete_cat_sql = "DELETE FROM " . $this->category_db . " WHERE field_cat_id='" . intval($_GET['cat_id']) . "'";
             if ($this->debug) {
                 print_p($delete_cat_sql);
             } else {
                 dbquery($delete_cat_sql);
                 addNotice('success', $this->locale['field_0200']);
                 redirect(FUSION_SELF . $aidlink);
             }
         } else {
             // show interior form
             $field_list = array();
             $form_action = FUSION_SELF . $aidlink . "&amp;action=cat_delete&amp;cat_id=" . $_GET['cat_id'];
             $result = dbquery("SELECT * FROM " . $this->category_db . " WHERE field_cat_id='" . $_GET['cat_id'] . "' OR field_cat_id='" . get_hkey($this->category_db, "field_cat_id", "field_parent", $_GET['cat_id']) . "'");
             if (dbrows($result) > 0) {
                 $data += dbarray($result);
                 // get field list - populate child fields of a category.
                 $result = dbquery("SELECT field_id, field_name, field_cat FROM " . $this->field_db . " WHERE field_cat='" . intval($_GET['cat_id']) . "'");
                 if (dbrows($result) > 0) {
                     // get field list.
                     while ($data = dbarray($result)) {
                         $field_list[$data['field_cat']][$data['field_id']] = $data['field_name'];
                     }
                 }
                 if (isset($this->page[$data['field_parent']]) or !empty($field_list) && $field_list[$_GET['cat_id']] > 0) {
                     ob_start();
                     echo openmodal("delete", $this->locale['fields_0313'], array('class' => 'modal-lg modal-center', 'static' => TRUE));
                     echo openform('delete_cat_form', 'post', $form_action);
                     if (isset($this->page[$_GET['cat_id']])) {
                         echo "<div class='row'>\n";
                         echo "<div class='col-xs-12 col-sm-6'>\n<span class='strong'>" . sprintf($this->locale['fields_0600'], count($this->page[$_GET['cat_id']])) . "</span><br/>\n";
                         echo "<div class='alert alert-info m-t-10'>\n";
                         echo "<ol style='list-style:inherit !important; margin-bottom:0;'>\n";
                         foreach ($this->page[$_GET['cat_id']] as $arr => $field_category) {
                             echo "<li style='list-style-type:decimal;'>" . self::parse_label($field_category['field_cat_name']) . "</li>\n";
                         }
                         echo "</ol>\n";
                         echo "</div>\n";
                         echo "</div>\n<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n";
                         $page_list = $this->page_list;
                         unset($page_list[$_GET['cat_id']]);
                         if (count($page_list) > 0) {
                             echo form_select('move_subcat', $this->locale['fields_0314'], '', array("options" => $page_list));
                         }
                         echo form_checkbox('delete_subcat', $this->locale['fields_0315'], count($page_list) < 1 ? TRUE : FALSE);
                         echo "</div></div>";
                     }
                     if (isset($field_list[$_GET['cat_id']])) {
                         echo "<div class='row'>\n";
                         echo "<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n<span class='strong'>" . sprintf($this->locale['fields_0601'], count($field_list[$_GET['cat_id']])) . "</span><br/>\n";
                         echo "<div class='well strong m-t-10'>\n";
                         foreach ($field_list[$_GET['cat_id']] as $arr => $field) {
                             echo "- " . $field . "<br/>\n";
                         }
                         echo "</div>\n";
                         echo "</div>\n<div class='col-xs-12 col-sm-6 col-md-6 col-lg-6'>\n";
                         $exclude_list[] = $_GET['cat_id'];
                         foreach ($this->page_list as $page_id => $page_name) {
                             $exclude_list[] = $page_id;
                         }
                         echo form_select_tree('move_field', $this->locale['fields_0316'], '', array('no_root' => 1, 'disable_opts' => $exclude_list), $this->category_db, 'field_cat_name', 'field_cat_id', 'field_parent');
                         echo form_checkbox('delete_field', $this->locale['fields_0317'], '');
                         echo "</div></div>";
                     }
                     echo form_button('delete_cat', $this->locale['fields_0313'], $this->locale['fields_0313'], array('class' => 'btn-danger btn-sm'));
                     echo form_button('cancel', $this->locale['cancel'], $this->locale['cancel'], array('class' => 'btn-default m-l-10 btn-sm'));
                     echo closeform();
                     echo closemodal();
                     add_to_footer(ob_get_contents());
                     ob_end_clean();
                 }
             } else {
                 if ($this->debug) {
                     notify('Cat ID was not found. Please check again.', 'Category ID was not found. Please check again.');
                 } else {
                     redirect(FUSION_SELF . $aidlink);
                 }
             }
         }
     }
 }