当前位置: 首页>>代码示例>>PHP>>正文


PHP dbquery_insert函数代码示例

本文整理汇总了PHP中dbquery_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP dbquery_insert函数的具体用法?PHP dbquery_insert怎么用?PHP dbquery_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dbquery_insert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_forumVotes

/**
 * Cast Question Votes
 * @param     $info
 * @param int $points
 * @todo: move and improvise the voting system
 */
function set_forumVotes($info, $points = 0)
{
    global $userdata;
    // @todo: extend on user's rank threshold before can vote. - Reputation threshold- Roadmap 9.1
    // @todo: allow multiple votes / drop $res - Roadmap 9.1
    if (checkgroup($info['forum_vote']) && dbcount("('thread_id')", DB_FORUM_THREADS, "thread_locked='0'")) {
        $data = array('forum_id' => $_GET['forum_id'], 'thread_id' => $_GET['thread_id'], 'post_id' => $_GET['post_id'], 'vote_points' => $points, 'vote_user' => $userdata['user_id'], 'vote_datestamp' => time());
        $hasVoted = dbcount("('vote_user')", DB_FORUM_VOTES, "vote_user='" . intval($userdata['user_id']) . "' AND thread_id='" . intval($_GET['thread_id']) . "'");
        if (!$hasVoted) {
            $isSelfPost = dbcount("('post_id')", DB_FORUM_POSTS, "post_id='" . intval($_GET['post_id']) . "' AND post_user='" . intval($userdata['user_id']) . "");
            if (!$isSelfPost) {
                $result = dbquery_insert(DB_FORUM_VOTES, $data, 'save', array('noredirect' => 1, 'no_unique' => 1));
                if ($result && $info['forum_answer_threshold'] > 0) {
                    $vote_result = dbquery("SELECT SUM('vote_points'), thread_id FROM " . DB_FORUM_VOTES . " WHERE post_id='" . $data['post_id'] . "'");
                    $v_data = dbarray($vote_result);
                    if ($info['forum_answer_threshold'] != 0 && $v_data['vote_points'] >= $info['forum_answer_threshold']) {
                        $result = dbquery("UPDATE " . DB_FORUM_THREADS . " SET 'thread_locked'='1' WHERE thread_id='" . $v_data['thread_id'] . "'");
                    }
                }
                redirect(FORUM . "viewthread.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $_GET['post_id']);
            } else {
                redirect(FORUM . "viewthread.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $_GET['post_id'] . '&error=vote_self');
            }
        } else {
            redirect(FORUM . "viewthread.php?thread_id=" . $_GET['thread_id'] . "&post_id=" . $_GET['post_id'] . '&error=vote');
        }
    }
}
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:34,代码来源:forum_include.php

示例2: post_tags

 protected function post_tags()
 {
     global $aidlink;
     if (isset($_POST['save_tag'])) {
         $this->data = array('tag_id' => isset($_GET['tag_id']) && isnum($_GET['tag_id']) ? intval($_GET['tag_id']) : 0, 'tag_title' => form_sanitizer($_POST['tag_title'], '', 'tag_title'), 'tag_language' => form_sanitizer($_POST['tag_language'], '', 'tag_language'), 'tag_color' => form_sanitizer($_POST['tag_color'], '', 'tag_color'), 'tag_description' => form_sanitizer($_POST['tag_description'], '', 'tag_description'), 'tag_status' => isset($_POST['tag_status']) && isnum($_POST['tag_status']) ? intval($_POST['tag_status']) : 0);
         if (\defender::safe()) {
             if (!empty($this->data['tag_id'])) {
                 /**
                  * Update
                  */
                 dbquery_insert(DB_FORUM_TAGS, $this->data, "update");
                 addNotice('success', self::$locale['forum_tag_0105']);
                 redirect(FUSION_SELF . $aidlink . '&section=ft');
             } else {
                 /**
                  * Save New
                  */
                 dbquery_insert(DB_FORUM_TAGS, $this->data, "save");
                 addNotice('success', self::$locale['forum_tag_0106']);
                 redirect(FUSION_SELF . $aidlink . '&section=ft');
             }
         }
     }
     if (isset($_GET['delete']) && isnum($_GET['delete'])) {
         $result = dbquery("DELETE FROM " . DB_FORUM_TAGS . " WHERE tag_id='" . $_GET['delete'] . "'");
         if ($result) {
             addNotice("success", self::$locale['forum_tag_0107']);
             redirect(FUSION_SELF . $aidlink . '&section=ft');
         }
     }
 }
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:31,代码来源:tags.php

示例3: post_forum_ranks

 protected function post_forum_ranks()
 {
     global $aidlink;
     if (isset($_POST['save_rank'])) {
         $this->data = array('rank_id' => isset($_GET['rank_id']) && isnum($_GET['rank_id']) ? intval($_GET['rank_id']) : 0, 'rank_title' => form_sanitizer($_POST['rank_title'], '', 'rank_title'), 'rank_image' => form_sanitizer($_POST['rank_image'], "", "rank_image"), 'rank_language' => form_sanitizer($_POST['rank_language'], "", "rank_language"), 'rank_posts' => isset($_POST['rank_posts']) && isnum($_POST['rank_posts']) ? $_POST['rank_posts'] : 0, 'rank_type' => isset($_POST['rank_type']) && isnum($_POST['rank_type']) ? $_POST['rank_type'] : 0, 'rank_apply_normal' => isset($_POST['rank_apply_normal']) && isnum($_POST['rank_apply_normal']) ? $_POST['rank_apply_normal'] : USER_LEVEL_MEMBER, 'rank_apply_special' => isset($_POST['rank_apply_special']) && isnum($_POST['rank_apply_special']) ? $_POST['rank_apply_special'] : 1);
         $this->data += array('rank_apply' => $this->data['rank_type'] == 2 ? $this->data['rank_apply_special'] : $this->data['rank_apply_normal']);
         if (\defender::safe()) {
             if (!empty($this->data['rank_id']) && !$this->check_duplicate_ranks()) {
                 /**
                  * Update
                  */
                 dbquery_insert(DB_FORUM_RANKS, $this->data, "update");
                 addNotice('info', self::$locale['411']);
                 redirect(FUSION_SELF . $aidlink . '&section=fr');
             } elseif (!$this->check_duplicate_ranks()) {
                 /**
                  * Save New
                  */
                 dbquery_insert(DB_FORUM_RANKS, $this->data, "save");
                 addNotice('info', self::$locale['410']);
                 redirect(FUSION_SELF . $aidlink . '&section=fr');
             }
         }
     }
     if (isset($_GET['delete']) && isnum($_GET['delete'])) {
         $result = dbquery("DELETE FROM " . DB_FORUM_RANKS . " WHERE rank_id='" . $_GET['delete'] . "'");
         if ($result) {
             addNotice("success", self::$locale['412']);
             redirect(FUSION_SELF . $aidlink . '&section=fr');
         }
     }
 }
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:32,代码来源:ranks.php

示例4: post_Mood

 /**
  * Post execution of forum mood
  */
 protected function post_Mood()
 {
     $locale = fusion_get_locale('', FORUM_ADMIN_LOCALE);
     if (isset($_POST['cancel_mood'])) {
         redirect(clean_request('', array('mood_id', 'ref'), FALSE));
     }
     if (isset($_POST['save_mood'])) {
         $this->data = array("mood_id" => form_sanitizer($_POST['mood_id'], 0, 'mood_id'), "mood_name" => form_sanitizer($_POST['mood_name'], '', 'mood_name', TRUE), "mood_description" => form_sanitizer($_POST['mood_description'], '', 'mood_description', TRUE), "mood_icon" => form_sanitizer($_POST['mood_icon'], '', 'mood_icon'), "mood_status" => form_sanitizer($_POST['mood_status'], '', 'mood_status'), "mood_notify" => form_sanitizer($_POST['mood_notify'], '', 'mood_notify'), "mood_access" => form_sanitizer($_POST['mood_access'], '', 'mood_access'));
         if (\defender::safe()) {
             if (!empty($this->data['mood_id'])) {
                 dbquery_insert(DB_FORUM_MOODS, $this->data, 'update');
                 addNotice('success', $locale['forum_notice_16']);
             } else {
                 dbquery_insert(DB_FORUM_MOODS, $this->data, 'save');
                 addNotice('success', $locale['forum_notice_15']);
             }
             redirect(clean_request('', array('mood_id', 'ref'), FALSE));
         }
     }
 }
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:23,代码来源:mood.php

示例5: post_mood

 public function post_mood()
 {
     $response = FALSE;
     // this is general single static output
     if (isset($_POST['post_mood']) && isnum($_POST['post_mood'])) {
         // if is a valid mood
         // insert into post notify
         $notify_data = array('post_id' => form_sanitizer($_POST['post_id'], 0, 'post_id'), 'notify_mood_id' => intval($_POST['post_mood']), 'notify_datestamp' => time(), 'notify_user' => form_sanitizer($_POST['post_author'], 0, 'post_author'), 'notify_sender' => fusion_get_userdata('user_id'), 'notify_status' => 1);
         if (\defender::safe() && dbcount('(mood_id)', DB_FORUM_MOODS, "mood_id='" . $notify_data['notify_mood_id'] . "'") && !$this->mood_exists($notify_data['notify_sender'], $notify_data['notify_mood_id'], $notify_data['post_id'])) {
             dbquery_insert(DB_POST_NOTIFY, $notify_data, 'save');
             $response = TRUE;
         }
     } elseif (isset($_POST['unpost_mood']) && isnum($_POST['unpost_mood'])) {
         // if is a valid mood
         // insert into post notify
         $notify_data = array('post_id' => form_sanitizer($_POST['post_id'], 0, 'post_id'), 'notify_mood_id' => intval($_POST['unpost_mood']), 'notify_user' => form_sanitizer($_POST['post_author'], 0, 'post_author'), 'notify_sender' => fusion_get_userdata('user_id'));
         if (\defender::safe() && dbcount('(mood_id)', DB_FORUM_MOODS, "mood_id='" . $notify_data['notify_mood_id'] . "'") && $this->mood_exists($notify_data['notify_sender'], $notify_data['notify_mood_id'], $notify_data['post_id'])) {
             dbquery("DELETE FROM " . DB_POST_NOTIFY . " WHERE post_id=" . $notify_data['post_id'] . "\n                AND notify_mood_id=" . $notify_data['notify_mood_id'] . "\n                AND notify_user=" . $notify_data['notify_user'] . "\n                AND notify_sender=" . $notify_data['notify_sender']);
             $response = TRUE;
         }
     }
     return (bool) $response;
 }
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:23,代码来源:mood.php

示例6: display_forum_form

 /**
  * 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();
 }
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:96,代码来源:view.php

示例7: form_sanitizer

                $data['album_thumb2'] = form_sanitizer(isset($_POST['album_thumb2']) ? $_POST['album_thumb2'] : "", "", "album_thumb2");
                $data['album_thumb1'] = form_sanitizer(isset($_POST['album_thumb1']) ? $_POST['album_thumb1'] : "", "", "album_thumb1");
            }
        }
    }
    if (defender::safe()) {
        if (dbcount("(album_id)", DB_PHOTO_ALBUMS, "album_id='" . intval($data['album_id']) . "'")) {
            // update album
            $result = dbquery_order(DB_PHOTO_ALBUMS, $data['album_order'], 'album_order', $data['album_id'], 'album_id', FALSE, FALSE, TRUE, 'album_language', 'update');
            dbquery_insert(DB_PHOTO_ALBUMS, $data, "update");
            addNotice('success', $locale['album_0013']);
            redirect(FUSION_SELF . $aidlink);
        } else {
            // create album
            $result = dbquery_order(DB_PHOTO_ALBUMS, $data['album_order'], 'album_order', 0, "album_id", FALSE, FALSE, TRUE, 'album_language', 'save');
            dbquery_insert(DB_PHOTO_ALBUMS, $data, "save");
            addNotice('success', $locale['album_0014']);
            redirect(FUSION_SELF . $aidlink);
        }
    }
}
// callback
if ($album_edit) {
    $result = dbquery("SELECT * FROM " . DB_PHOTO_ALBUMS . " WHERE album_id='" . intval($_GET['cat_id']) . "'");
    if (dbrows($result) > 0) {
        $data = dbarray($result);
    }
}
// edit features - add more in roadmap.
// add features to purge all album photos and it's administration
// add features to move all album photos to another album.
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:31,代码来源:gallery_cat.php

示例8: author

| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once INCLUDES . "mimetypes_include.php";
if (isset($_POST['savesettings'])) {
    // redo this part
    $StoreArray = array("download_max_b" => form_sanitizer($_POST['calc_b'], 1, "calc_b") * form_sanitizer($_POST['calc_c'], 1500000, "calc_c"), "download_types" => form_sanitizer($_POST['download_types'], "", "download_types"), "download_screen_max_w" => form_sanitizer($_POST['download_screen_max_w'], 500, "download_screen_max_w"), "download_screen_max_h" => form_sanitizer($_POST['download_screen_max_h'], 500, "download_screen_max_h"), "download_screen_max_b" => form_sanitizer($_POST['calc_bb'], 1, "calc_bb") * form_sanitizer($_POST['calc_cc'], 1500000, "calc_cc"), "download_thumb_max_h" => form_sanitizer($_POST['download_thumb_max_h'], 500, 'download_thumb_max_h'), "download_thumb_max_w" => form_sanitizer($_POST['download_thumb_max_w'], 500, 'download_thumb_max_w'), "download_screenshot" => form_sanitizer($_POST['download_screenshot'], 0, 'download_screenshot'), "download_pagination" => form_sanitizer($_POST['download_pagination'], 12, 'download_pagination'), "download_allow_submission" => form_sanitizer($_POST['download_allow_submission'], "", "download_allow_submission"), "download_screenshot_required" => isset($_POST['download_screenshot_required']) ? true : false, "download_extended_required" => isset($_POST['download_extended_required']) ? true : false);
    if ($defender->safe()) {
        foreach ($StoreArray as $key => $value) {
            $result = NULL;
            if ($defender->safe()) {
                $Array = array("settings_name" => $key, "settings_value" => $value, "settings_inf" => "downloads");
                dbquery_insert(DB_SETTINGS_INF, $Array, 'update', array("primary_key" => "settings_name"));
            }
        }
        addNotice('success', $locale['900']);
    } else {
        // send message your settings was not safe.
        addNotice('danger', $locale['901']);
        addNotice('danger', $locale['696']);
        addNotice('danger', $locale['900']);
    }
    redirect(FUSION_SELF . $aidlink . "&amp;section=download_settings");
}
/**
 * Options for dropdown field
 */
$calc_opts = array(1 => 'Bytes (bytes)', 1000 => 'KB (Kilobytes)', 1000000 => 'MB (Megabytes)');
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:31,代码来源:download_settings.php

示例9: debonair_theme_widget

function debonair_theme_widget()
{
    global $locale;
    require_once "functions.php";
    $settings = get_theme_settings("debonair");
    /**
     * data parsing
     */
    $ubanner_col_1_data = uncomposeSelection($settings['ubanner_col_1']);
    $ubanner_col_2_data = uncomposeSelection($settings['ubanner_col_2']);
    $ubanner_col_3_data = uncomposeSelection($settings['ubanner_col_3']);
    $settings = array("main_banner_url" => $settings['main_banner_url'], "ubanner_col_1" => !empty($ubanner_col_1_data['selected']) ? $ubanner_col_1_data['selected'] : 0, "ubanner_col_2" => !empty($ubanner_col_2_data['selected']) ? $ubanner_col_2_data['selected'] : 0, "ubanner_col_3" => !empty($ubanner_col_3_data['selected']) ? $ubanner_col_3_data['selected'] : 0, "lbanner_col_1" => $settings['lbanner_col_1'], "lbanner_col_2" => $settings['lbanner_col_2'], "lbanner_col_3" => $settings['lbanner_col_3'], "lbanner_col_4" => $settings['lbanner_col_4'], "facebook_url" => $settings['facebook_url'], "twitter_url" => $settings['twitter_url']);
    if (isset($_POST['save_settings'])) {
        $inputArray = array("main_banner_url" => form_sanitizer($_POST['main_banner_url'], "", "main_banner_url"), "ubanner_col_1" => composeSelection(form_sanitizer($_POST['ubanner_col_1'], "", "ubanner_col_1")), "ubanner_col_2" => composeSelection(form_sanitizer($_POST['ubanner_col_2'], "", "ubanner_col_2")), "ubanner_col_3" => composeSelection(form_sanitizer($_POST['ubanner_col_3'], "", "ubanner_col_3")), "lbanner_col_1" => form_sanitizer($_POST['lbanner_col_1'], "", "lbanner_col_1"), "lbanner_col_2" => form_sanitizer($_POST['lbanner_col_2'], "", "lbanner_col_2"), "lbanner_col_3" => form_sanitizer($_POST['lbanner_col_3'], "", "lbanner_col_3"), "lbanner_col_4" => form_sanitizer($_POST['lbanner_col_4'], "", "lbanner_col_4"), "facebook_url" => form_sanitizer($_POST['facebook_url'], "", "facebook_url"), "twitter_url" => form_sanitizer($_POST['twitter_url'], "", "twitter_url"));
        foreach ($inputArray as $settings_name => $settings_value) {
            $sqlArray = array("settings_name" => $settings_name, "settings_value" => $settings_value, "settings_theme" => "debonair");
            dbquery_insert(DB_SETTINGS_THEME, $sqlArray, "update", array("primary_key" => "settings_name"));
        }
        if (defender::safe()) {
            redirect(FUSION_REQUEST);
        }
    }
    echo openform("debonair_theme_settings", "post", FUSION_REQUEST);
    $exclude_list = ".|..|.htaccess|.DS_Store|config.php|config.temp.php|.gitignore|LICENSE|README.md|robots.txt|reactivate.php|rewrite.php|maintenance.php|maincore.php|lostpassword.php|index.php|error.php";
    $list = array();
    $file_list = makefilelist(BASEDIR, $exclude_list);
    foreach ($file_list as $files) {
        $list[] = $files;
    }
    $include_list = array();
    $file_list = makefilelist(THEMES . "/debonair/include/", $exclude_list);
    foreach ($file_list as $files) {
        $include_list[$files] = str_replace(".php", "", str_replace("_", " ", ucwords($files)));
    }
    openside("");
    echo form_select("main_banner_url", $locale['debonair_0300'], $settings['main_banner_url'], array("options" => $list, "tags" => true, "multiple" => true, "width" => "100%", "inline" => false));
    echo "<p>" . $locale['debonair_0301'] . "</p>";
    closeside();
    openside("");
    echo form_text("facebook_url", $locale['debonair_0321'], $settings['facebook_url'], array("type" => "url", "inline" => true, "placeholder" => "http://www.facebook.com/your-page-id"));
    echo form_text("twitter_url", $locale['debonair_0322'], $settings['twitter_url'], array("type" => "url", "inline" => true, "placeholder" => "http://www.twitter.com/your-page-id"));
    closeside();
    $templateOpts[0] = $locale['debonair_0302'];
    /**
     * Article Selector
     */
    $articleOpts = array();
    if (db_exists(DB_ARTICLES)) {
        $article_result = dbquery("select article_id, article_subject, article_cat_language FROM " . DB_ARTICLES . " a\n\t \t\t\t\tleft join " . DB_ARTICLE_CATS . " ac on a.article_cat = ac.article_cat_id\n\t \t\t\t\torder by article_datestamp DESC\n\t \t\t\t\t");
        if (dbrows($article_result) > 0) {
            while ($data = dbarray($article_result)) {
                $articleOpts[$data['article_cat_language']][$data['article_id']] = $data['article_subject'];
            }
        }
        if (!empty($articleOpts)) {
            $templateOpts['articles'] = $locale['debonair_0303'];
        }
    }
    /**
     * News Selector
     */
    $newsOpts = array();
    if (db_exists(DB_NEWS)) {
        $news_result = dbquery("select news_id, news_subject, news_language FROM " . DB_NEWS . " order by news_datestamp DESC");
        if (dbrows($news_result) > 0) {
            while ($data = dbarray($news_result)) {
                $newsOpts[$data['news_language']][$data['news_id']] = $data['news_subject'];
            }
        }
        if (!empty($newsOpts)) {
            $templateOpts['news'] = $locale['debonair_0304'];
        }
    }
    /**
     * Blog Selector
     */
    $blogOpts = array();
    if (db_exists(DB_BLOG)) {
        $blog_result = dbquery("select blog_id, blog_subject, blog_language FROM " . DB_BLOG . "\n\t \t\t\t\torder by blog_datestamp DESC\n\t \t\t\t\t");
        if (dbrows($blog_result) > 0) {
            while ($data = dbarray($blog_result)) {
                $blogOpts[$data['blog_language']][$data['blog_id']] = $data['blog_subject'];
            }
        }
        if (!empty($blogOpts)) {
            $templateOpts['blog'] = $locale['debonair_0305'];
        }
    }
    /**
     * Custom Page Selector
     * Note: custom page has a different multilanguage setup.
     */
    $cpOpts = array();
    if (db_exists(DB_CUSTOM_PAGES)) {
        $cp_result = dbquery("select page_id, page_title, page_language FROM " . DB_CUSTOM_PAGES . " order by page_id ASC");
        if (dbrows($cp_result) > 0) {
            while ($data = dbarray($cp_result)) {
                $acceptedLang = stristr($data['page_language'], ".") ? explode(".", $data['page_language']) : array(0 => $data['page_language']);
                foreach (fusion_get_enabled_languages() as $lang) {
                    if (in_array($lang, $acceptedLang)) {
//.........这里部分代码省略.........
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:101,代码来源:widget.php

示例10: display_news_form

/**
 * 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)) {
//.........这里部分代码省略.........
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:101,代码来源:news.php

示例11: render_poll_form

 public function render_poll_form($edit = 0)
 {
     global $locale, $defender;
     $poll_field = '';
     // Build Polls Info.
     $thread_data = $this->thread_info['thread'];
     if ($edit ? $this->getThreadPermission("can_edit_poll") : $this->getThreadPermission("can_create_poll")) {
         // if permitted to create new poll.
         $data = array('thread_id' => $thread_data['thread_id'], 'forum_poll_title' => isset($_POST['forum_poll_title']) ? form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title') : '', 'forum_poll_start' => time(), 'forum_poll_length' => 2, 'forum_poll_votes' => 0);
         // counter of lengths
         $option_data[1] = "";
         $option_data[2] = "";
         // calculate poll lengths
         if (isset($_POST['poll_options'])) {
             // callback on post.
             foreach ($_POST['poll_options'] as $i => $value) {
                 $option_data[$i] = form_sanitizer($value, '', "poll_options[{$i}]");
             }
             // reindex the whole array with blank values.
             if ($defender->safe()) {
                 $option_data = array_values(array_filter($option_data));
                 array_unshift($option_data, NULL);
                 unset($option_data[0]);
                 $data['forum_poll_length'] = count($option_data);
             }
         }
         // add a Blank Poll option
         if (isset($_POST['add_poll_option']) && $defender->safe()) {
             array_push($option_data, '');
         }
         if ($edit) {
             $result = dbquery("SELECT * FROM " . DB_FORUM_POLLS . " WHERE thread_id='" . $thread_data['thread_id'] . "'");
             if (dbrows($result) > 0) {
                 if (isset($_POST['update_poll']) || isset($_POST['add_poll_option'])) {
                     $load = FALSE;
                     $data += dbarray($result);
                     // append if not available.
                 } else {
                     $load = TRUE;
                     $data = dbarray($result);
                     // call
                 }
                 if (isset($_POST['update_poll'])) {
                     $data = array('thread_id' => $thread_data['thread_id'], 'forum_poll_title' => form_sanitizer($_POST['forum_poll_title'], '', 'forum_poll_title'), 'forum_poll_start' => $data['forum_poll_start'], 'forum_poll_length' => $data['forum_poll_length']);
                     dbquery_insert(DB_FORUM_POLLS, $data, 'update', array('primary_key' => 'thread_id', 'no_unique' => TRUE));
                     $i = 1;
                     // populate data for matches
                     $poll_result = dbquery("SELECT forum_poll_option_id FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $thread_data['thread_id'] . "'");
                     while ($_data = dbarray($poll_result)) {
                         $_poll[$_data['forum_poll_option_id']] = $_data;
                         // Prune the emptied fields AND field is not required.
                         if (empty($option_data[$_data['forum_poll_option_id']]) && $defender->safe()) {
                             dbquery("DELETE FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $thread_data['thread_id'] . "' AND forum_poll_option_id='" . $_data['forum_poll_option_id'] . "'");
                         }
                     }
                     foreach ($option_data as $option_text) {
                         if ($option_text) {
                             if ($defender->safe()) {
                                 if (isset($_poll[$i])) {
                                     // has record
                                     dbquery("UPDATE " . DB_FORUM_POLL_OPTIONS . " SET forum_poll_option_text='" . $option_text . "' WHERE thread_id='" . $thread_data['thread_id'] . "' AND forum_poll_option_id='" . $i . "'");
                                 } else {
                                     // no record - create
                                     $array = array('thread_id' => $thread_data['thread_id'], 'forum_poll_option_id' => $i, 'forum_poll_option_text' => $option_text, 'forum_poll_option_votes' => 0);
                                     dbquery_insert(DB_FORUM_POLL_OPTIONS, $array, 'save');
                                 }
                             }
                             $i++;
                         }
                     }
                     if ($defender->safe()) {
                         redirect(INFUSIONS . "forum/postify.php?post=editpoll&error=0&forum_id=" . $thread_data['forum_id'] . "&thread_id=" . $thread_data['thread_id']);
                     }
                 }
                 // how to make sure values containing options votes
                 $poll_field['openform'] = openform('pollform', 'post', INFUSIONS . 'forum/viewthread.php?action=editpoll&forum_id=' . $_GET['forum_id'] . '&thread_id=' . $_GET['thread_id']);
                 $poll_field['openform'] .= "<div class='text-info m-b-20 m-t-10'>" . $locale['forum_0613'] . "</div>\n";
                 $poll_field['poll_field'] = form_text('forum_poll_title', $locale['forum_0604'], $data['forum_poll_title'], array('max_length' => 255, 'placeholder' => $locale['forum_0604a'], 'inline' => TRUE, 'required' => TRUE));
                 if ($load == FALSE) {
                     for ($i = 1; $i <= count($option_data); $i++) {
                         $poll_field['poll_field'] .= form_text("poll_options[{$i}]", sprintf($locale['forum_0606'], $i), $option_data[$i], array('max_length' => 255, 'placeholder' => $locale['forum_0605'], 'inline' => 1, 'required' => $i <= 2 ? TRUE : FALSE));
                     }
                 } else {
                     $result = dbquery("SELECT forum_poll_option_text, forum_poll_option_votes FROM " . DB_FORUM_POLL_OPTIONS . " WHERE thread_id='" . $_GET['thread_id'] . "' ORDER BY forum_poll_option_id ASC");
                     $i = 1;
                     while ($_pdata = dbarray($result)) {
                         $poll_field['poll_field'] .= form_text("poll_options[{$i}]", $locale['forum_0605'] . ' ' . $i, $_pdata['forum_poll_option_text'], array('max_length' => 255, 'placeholder' => 'Poll Options', 'inline' => 1, 'required' => $i <= 2 or $_pdata['forum_poll_option_votes'] ? TRUE : FALSE));
                         $i++;
                     }
                 }
                 $poll_field['poll_field'] .= "<div class='col-xs-12 col-sm-offset-3'>\n";
                 $poll_field['poll_field'] .= form_button('add_poll_option', $locale['forum_0608'], $locale['forum_0608'], array('class' => 'btn-primary btn-sm'));
                 $poll_field['poll_field'] .= "</div>\n";
                 $poll_field['poll_button'] = form_button('update_poll', $locale['forum_2013'], $locale['forum_2013'], array('class' => 'btn-default'));
                 $poll_field['closeform'] = closeform();
             } else {
                 redirect(INFUSIONS . 'forum/index.php');
                 // redirect because the poll id is not available.
             }
         } else {
//.........这里部分代码省略.........
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:101,代码来源:Viewthread.php

示例12: showcomments

/**
 * @param $comment_type - abbr or short ID
 * @param $comment_db - Current Application DB - DB_BLOG for example.
 * @param $comment_col - current sql primary key column - 'blog_id' for example
 * @param $comment_item_id - current sql primary key value '$_GET['blog_id']' for example
 * @param $clink - current page link 'FUSION_SELF' is ok.
 */
function showcomments($comment_type, $comment_db, $comment_col, $comment_item_id, $clink)
{
    global $settings, $locale, $userdata, $aidlink;
    $link = FUSION_SELF . (FUSION_QUERY ? "?" . FUSION_QUERY : "");
    $link = preg_replace("^(&amp;|\\?)c_action=(edit|delete)&amp;comment_id=\\d*^", "", $link);
    $_GET['comment'] = isset($_GET['comment']) && isnum($_GET['comment']) ? $_GET['comment'] : 0;
    $cpp = $settings['comments_per_page'];
    if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "delete") && (isset($_GET['comment_id']) && isnum($_GET['comment_id']))) {
        if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $_GET['comment_id'] . "' AND comment_name='" . $userdata['user_id'] . "'")) {
            $result = dbquery("DELETE FROM " . DB_COMMENTS . "\n\t\t\t\tWHERE comment_id='" . $_GET['comment_id'] . "'" . (iADMIN ? "" : "\n\t\t\t\tAND comment_name='" . $userdata['user_id'] . "'"));
        }
        redirect($clink . ($settings['comments_sorting'] == "ASC" ? "" : "&amp;c_start=0"));
    }
    if ($settings['comments_enabled'] == "1") {
        if ((iMEMBER || $settings['guestposts'] == "1") && isset($_POST['post_comment'])) {
            if (!iMEMBER && $settings['guestpost'] == 1) {
                if (!isset($_POST['comment_name'])) {
                    redirect($link);
                }
                if (isnum($_POST['comment_name'])) {
                    $_POST['comment_name'] = '';
                }
                $_CAPTCHA_IS_VALID = FALSE;
                include INCLUDES . "captchas/" . $settings['captcha'] . "/captcha_check.php";
                if (!isset($_POST['captcha_code']) || $_CAPTCHA_IS_VALID == FALSE) {
                    redirect($link);
                }
            }
            $comment_data = array('comment_id' => isset($_GET['comment_id']) && isnum($_GET['comment_id']) ? $_GET['comment_id'] : 0, 'comment_name' => iMEMBER ? $userdata['user_id'] : form_sanitizer($_POST['comment_name'], '', 'comment_name'), 'comment_message' => form_sanitizer($_POST['comment_message'], '', 'comment_message'), 'comment_datestamp' => time(), 'comment_item_id' => $comment_item_id, 'comment_type' => $comment_type, 'comment_cat' => 0, 'comment_ip' => USER_IP, 'comment_ip_type' => USER_IP_TYPE, 'comment_hidden' => 0);
            if (iMEMBER && (isset($_GET['c_action']) && $_GET['c_action'] == "edit") && $comment_data['comment_id']) {
                $comment_updated = FALSE;
                if (iADMIN && checkrights("C") || iMEMBER && dbcount("(comment_id)", DB_COMMENTS, "comment_id='" . $comment_data['comment_id'] . "' \n\t\t\t\tAND comment_item_id='" . $comment_item_id . "'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tAND comment_type='" . $comment_type . "' \n\t\t\t\tAND comment_name='" . $userdata['user_id'] . "' \n\t\t\t\tAND comment_hidden='0'")) {
                    dbquery_insert(DB_COMMENTS, $comment_data, 'update');
                    if ($comment_data['comment_message']) {
                        $result = dbquery("UPDATE " . DB_COMMENTS . " SET comment_message='" . $comment_data['comment_message'] . "'\n  \t\t\t\t\t\t\t\t\t   WHERE comment_id='" . $_GET['comment_id'] . "' " . (iADMIN ? "" : "AND comment_name='" . $userdata['user_id'] . "'"));
                        if ($result) {
                            $comment_updated = TRUE;
                        }
                    }
                }
                if ($comment_updated) {
                    if ($settings['comments_sorting'] == "ASC") {
                        $c_operator = "<=";
                    } else {
                        $c_operator = ">=";
                    }
                    $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_id" . $c_operator . "'" . $comment_data['comment_id'] . "'\n\t\t\t\t\t\t\t\tAND comment_item_id='" . $comment_item_id . "'\n\t\t\t\t\t\t\t\tAND comment_type='" . $comment_type . "'");
                    $c_start = (ceil($c_count / $cpp) - 1) * $cpp;
                }
                redirect($clink . "&amp;c_start=" . (isset($c_start) && isnum($c_start) ? $c_start : ""));
            } else {
                if (!dbcount("(" . $comment_col . ")", $comment_db, $comment_col . "='" . $comment_item_id . "'")) {
                    redirect(BASEDIR . "index.php");
                }
                $id = 0;
                if ($comment_data['comment_name'] && $comment_data['comment_message']) {
                    require_once INCLUDES . "flood_include.php";
                    if (!flood_control("comment_datestamp", DB_COMMENTS, "comment_ip='" . USER_IP . "'")) {
                        dbquery_insert(DB_COMMENTS, $comment_data, 'save');
                        $id = dblastid();
                    }
                }
                if ($settings['comments_sorting'] == "ASC") {
                    $c_count = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "'");
                    $c_start = (ceil($c_count / $cpp) - 1) * $cpp;
                } else {
                    $c_start = 0;
                }
                //if (!$settings['site_seo']) {
                redirect($clink . "&amp;c_start=" . $c_start . "#c" . $id);
                //}
            }
        }
        $c_arr = array("c_con" => array(), "c_info" => array("c_makepagenav" => FALSE, "admin_link" => FALSE));
        $c_rows = dbcount("(comment_id)", DB_COMMENTS, "comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'");
        if (!isset($_GET['c_start']) && $c_rows > $cpp) {
            $_GET['c_start'] = (ceil($c_rows / $cpp) - 1) * $cpp;
        }
        if (!isset($_GET['c_start']) || !isnum($_GET['c_start'])) {
            $_GET['c_start'] = 0;
        }
        $result = dbquery("SELECT tcm.comment_id, tcm.comment_name, tcm.comment_message, tcm.comment_datestamp,\n\t\t\t\t\ttcu.user_id, tcu.user_name, tcu.user_avatar, tcu.user_status\n\t\t\t\t\tFROM " . DB_COMMENTS . " tcm\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " tcu ON tcm.comment_name=tcu.user_id\n\t\t\t\t\tWHERE comment_item_id='" . $comment_item_id . "' AND comment_type='" . $comment_type . "' AND comment_hidden='0'\n\t\t\t\t\tORDER BY comment_datestamp " . $settings['comments_sorting'] . " LIMIT " . $_GET['c_start'] . "," . $cpp);
        if (dbrows($result) > 0) {
            $i = $settings['comments_sorting'] == "ASC" ? $_GET['c_start'] + 1 : $c_rows - $_GET['c_start'];
            if ($c_rows > $cpp) {
                $c_arr['c_info']['c_makepagenav'] = makepagenav($_GET['c_start'], $cpp, $c_rows, 3, $clink . "&amp;", "c_start");
            }
            while ($data = dbarray($result)) {
                $c_arr['c_con'][$i]['comment_id'] = $data['comment_id'];
                $c_arr['c_con'][$i]['edit_dell'] = FALSE;
                $c_arr['c_con'][$i]['i'] = $i;
                if ($data['user_name']) {
                    $c_arr['c_con'][$i]['comment_name'] = profile_link($data['comment_name'], $data['user_name'], $data['user_status'], 'strong text-dark');
//.........这里部分代码省略.........
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:101,代码来源:comments_include.php

示例13: array

    $categoryNameCheck = array("when_updating" => "blog_cat_name='" . $inputArray['blog_cat_name'] . "' and blog_cat_id !='" . $inputArray['blog_cat_id'] . "' " . (multilang_table("BL") ? "and blog_cat_language = '" . LANGUAGE . "'" : ""), "when_saving" => "blog_cat_name='" . $inputArray['blog_cat_name'] . "' " . (multilang_table("BL") ? "and blog_cat_language = '" . LANGUAGE . "'" : ""));
    if (defender::safe()) {
        // check category name is unique when updating
        if (dbcount("(blog_cat_id)", DB_BLOG_CATS, "blog_cat_id='" . $inputArray['blog_cat_id'] . "'")) {
            if (!dbcount("(blog_cat_id)", DB_BLOG_CATS, $categoryNameCheck['when_updating'])) {
                dbquery_insert(DB_BLOG_CATS, $inputArray, "update");
                addNotice("success", $locale['blog_0521']);
                // FUSION_REQUEST without the "action" gets
                redirect(clean_request("", array("action"), FALSE));
            } else {
                addNotice('danger', $locale['blog_0561']);
            }
        } else {
            // check category name is unique when saving new
            if (!dbcount("(blog_cat_id)", DB_BLOG_CATS, $categoryNameCheck['when_saving'])) {
                dbquery_insert(DB_BLOG_CATS, $inputArray, "save");
                addNotice("success", $locale['blog_0520']);
                redirect(FUSION_REQUEST);
            } else {
                addNotice('danger', $locale['blog_0561']);
            }
        }
    }
} elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_GET['cat_id']) && isnum($_GET['cat_id']))) {
    $result = dbquery("SELECT blog_cat_id, blog_cat_name, blog_cat_parent, blog_cat_image, blog_cat_language FROM " . DB_BLOG_CATS . " " . (multilang_table("BL") ? "WHERE blog_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " blog_cat_id='" . intval($_GET['cat_id']) . "'");
    if (dbrows($result)) {
        $data = dbarray($result);
        $data['blog_cat_hidden'] = array($data['blog_cat_id']);
        $formTitle = $locale['blog_0402'];
    } else {
        // FUSION_REQUEST without the "action" gets
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:31,代码来源:blog_cat.php

示例14: author

| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
pageAccess('S6');
require_once THEMES . "templates/admin_header.php";
include LOCALE . LOCALESET . "admin/settings.php";
add_breadcrumb(array('link' => ADMIN . "settings_misc.php" . $aidlink, 'title' => $locale['misc_settings']));
if (isset($_POST['savesettings'])) {
    $inputData = array("tinymce_enabled" => form_sanitizer($_POST['tinymce_enabled'], 0, "tinymce_enabled"), "smtp_host" => form_sanitizer($_POST['smtp_host'], "", "smtp_host"), "smtp_port" => form_sanitizer($_POST['smtp_port'], "", "smtp_port"), "smtp_auth" => isset($_POST['smtp_auth']) && !empty($_POST['smtp_username']) && !empty($_POST['smtp_password']) ? TRUE : FALSE, "smtp_username" => form_sanitizer($_POST['smtp_username'], "", "smtp_username"), "login_method" => form_sanitizer($_POST['login_method'], 0, "login_method"), "thumb_compression" => form_sanitizer($_POST['thumb_compression'], 0, "thumb_compression"), "mime_check" => form_sanitizer($_POST['mime_check'], 0, "mime_check"), "guestposts" => form_sanitizer($_POST['guestposts'], 0, "guestposts"), "comments_enabled" => form_sanitizer($_POST['comments_enabled'], 0, "comments_enabled"), "comments_per_page" => form_sanitizer($_POST['comments_per_page'], 10, "comments_per_page"), "ratings_enabled" => form_sanitizer($_POST['ratings_enabled'], 0, "ratings_enabled"), "visitorcounter_enabled" => form_sanitizer($_POST['visitorcounter_enabled'], 0, "visitorcounter_enabled"), "rendertime_enabled" => form_sanitizer($_POST['rendertime_enabled'], 0, "rendertime_enabled"), "comments_sorting" => form_sanitizer($_POST['comments_sorting'], "DESC", "comments_sorting"), "index_url_bbcode" => form_sanitizer($_POST['index_url_bbcode'], 0, "index_url_bbcode"), "index_url_userweb" => form_sanitizer($_POST['index_url_userweb'], 0, "index_url_userweb"));
    if (defender::safe()) {
        foreach ($inputData as $settings_name => $settings_value) {
            $data = array("settings_name" => $settings_name, "settings_value" => $settings_value);
            dbquery_insert(DB_SETTINGS, $data, "update", array("primary_key" => "settings_name"));
        }
        addNotice('success', $locale['900']);
        redirect(FUSION_SELF . $aidlink);
    } else {
        addNotice('danger', $locale['901']);
    }
}
opentable($locale['misc_settings']);
echo "<div class='well'>" . $locale['misc_description'] . "</div>";
echo openform('settingsform', 'post', FUSION_SELF . $aidlink, array('max_tokens' => 1));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-12 col-md-8'>\n";
openside('');
echo "<div class='pull-right m-b-10'><span class='small2'>" . $locale['663'] . "</span></div>\n";
$choice_arr = array('1' => $locale['yes'], '0' => $locale['no']);
开发者ID:knapnet,项目名称:PHP-Fusion,代码行数:31,代码来源:settings_misc.php

示例15: array

         }
     }
     $inputArray = array("article_cat_id" => $cat_id, "article_cat_name" => $cat_name, "article_cat_parent" => $cat_parent, "article_cat_description" => $cat_description, "article_cat_language" => $cat_language, "article_cat_sorting" => $cat_sorting);
     $categoryNameCheck = array("when_updating" => "article_cat_name='" . $inputArray['article_cat_name'] . "' and article_cat_id !='" . $inputArray['article_cat_id'] . "' " . (multilang_table("AR") ? "and article_cat_language = '" . LANGUAGE . "'" : ""), "when_saving" => "article_cat_name='" . $inputArray['article_cat_name'] . "' " . (multilang_table("AR") ? "AND article_cat_language = '" . LANGUAGE . "'" : ""));
     if (defender::safe()) {
         if (dbcount("(article_cat_id)", DB_ARTICLE_CATS, "article_cat_id='" . $inputArray['article_cat_id'] . "'")) {
             if (!dbcount("(article_cat_id)", DB_ARTICLE_CATS, $categoryNameCheck['when_updating'])) {
                 dbquery_insert(DB_ARTICLE_CATS, $inputArray, "update");
                 addNotice("success", $locale['articles_0151']);
                 redirect(clean_request("cat_view=1", array("section", "aid"), true));
             } else {
                 addNotice("danger", $locale['articles_0352']);
             }
         } else {
             if (!dbcount("(article_cat_id)", DB_ARTICLE_CATS, $categoryNameCheck['when_saving'])) {
                 dbquery_insert(DB_ARTICLE_CATS, $inputArray, "save");
                 addNotice("success", $locale['articles_0150']);
                 redirect(clean_request("cat_view=1", array("section", "aid"), true));
             } else {
                 addNotice("danger", $locale['articles_0352']);
             }
         }
     }
 }
 // UI dual tab
 $articleCatTab['title'][] = $locale['articles_0020'];
 $articleCatTab['id'][] = "b";
 $articleCatTab['title'][] = $locale['articles_0027'];
 $articleCatTab['id'][] = "a";
 $tab_active = tab_active($articleCatTab, isset($_GET['action']) or !defender::safe() ? 1 : 0);
 echo opentab($articleCatTab, $tab_active, "artCTab", FALSE, "m-t-20");
开发者ID:php-fusion,项目名称:PHP-Fusion,代码行数:31,代码来源:article_cat.php


注:本文中的dbquery_insert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。