Esempio n. 1
0
  * main process
  *
  * main usergroups page where the user can select a group.
  */
 // grab usergroups data
 include $get->url('includes/class_rcs_set');
 $set = new rcs_set();
 $items = $set->get_usergroups_list();
 unset($set);
 // let's go
 if (!empty($items)) {
     // header
     $page_title = $lang['Group_Control_Panel'];
     include $get->url('includes/page_header');
     // hidden fields
     _hide_build(array('sid' => $userdata['session_id']));
     _hide_send();
     // build groups list
     $groups_list = array('name' => POST_GROUPS_URL, 'items' => $items);
     $rcs->constructor($groups_list);
     unset($items);
     // display
     $template->set_filenames(array('user' => 'groupcp_select_body.tpl'));
     // constants
     $template->assign_vars(array('L_USERGROUPS' => $lang['usergroups_list'], 'L_SELECT_USERGROUP' => $lang['select_usergroup'], 'L_SELECT_USERGROUP_DETAILS' => $lang['select_usergroup_details'], 'L_VIEW_INFORMATION' => $lang['View_Information'], 'I_SUBMIT' => $images['cmd_submit'], 'S_USERGROUP_ACTION' => $get->url('groupcp', '', true)));
     // navigation
     $navigation = new navigation();
     $navigation->add('usergroups_list', 'select_usergroup', 'groupcp');
     $navigation->display();
     unset($navigation);
     // send the display
Esempio n. 2
0
    function action()
    {
        global $db, $template, $lang, $images;
        global $common, $rcs, $get;
        if ($this->mode == 'edit' || $this->mode == 'add') {
            if ($this->mode == 'edit') {
                if (!isset($this->data[$this->rcs_id]['id'])) {
                    // send achievement message
                    $this->_achievement('rcs_not_exists');
                }
                // get this rank data
                $rank = $this->data[$this->rcs_id];
                // hidden fields
                _hide_build(array('id' => $this->rcs_id, 'rcs_tmp_name' => $rank['name'], 'rcs_tmp_color' => $rank['color'], 'rcs_tmp_order' => $rank['order'], 'rcs_tmp_single' => $rank['single'], 'rcs_tmp_display' => $rank['display']));
                $style = $rcs->get_style($rank['name'], $rank['color']);
                $template->assign_block_vars('edit', array('L_RCS_EDIT_TITLE' => sprintf($lang['rcs_edit_title'], $style, lang_item($rank['name'])), 'L_RCS_EDIT_TITLE_DESC' => $lang['rcs_edit_title_desc']));
            } else {
                // get the last rank
                $last_idx = count($this->data);
                $keys = array_values($this->data);
                $last_rank = $keys[intval($last_idx - 1)];
                // set last rank data
                $rank['name'] = $rank['color'] = '';
                $rank['single'] = $rank['display'] = 0;
                // hidden fields
                _hide_build(array('rcs_tmp_order' => $last_rank['order']));
                $template->assign_block_vars('add', array('L_RCS_ADD_TITLE' => $lang['rcs_add_title'], 'L_RCS_ADD_TITLE_DESC' => $lang['rcs_add_title_desc']));
            }
            $rcs_is_single = $rank['single'] ? ' checked="checked"' : '';
            $rcs_is_not_single = !$rank['single'] ? ' checked="checked"' : '';
            $rcs_is_display = $rank['display'] ? ' checked="checked"' : '';
            $rcs_is_not_display = !$rank['display'] ? ' checked="checked"' : '';
            // build list order
            $after = 0;
            $items = array();
            $list_move_after = array(0 => 'Top');
            if (!empty($this->data)) {
                $keys = array_keys($this->data);
                $tkeys = array_flip($keys);
                $after = intval($keys[$tkeys[$this->rcs_id] - 1]);
                unset($tkeys);
                foreach ($this->data as $rank_id => $rank_data) {
                    if ($rank_id != $this->rcs_id) {
                        $list_move_after[$rank_id] = $rank_data['name'];
                    }
                }
            }
            if (!empty($list_move_after)) {
                foreach ($list_move_after as $val => $desc) {
                    $items[] = array('name' => lang_item($desc), 'value' => $this->data[$val]['order'], 'style' => !empty($val) ? $rcs->get_style($desc, $this->data[$val]['color']) : '', 'selected' => $val == $after);
                }
                $rcs_list_order = array('name' => 'rcs_order', 'items' => $items);
                $rcs->constructor($rcs_list_order, 'LIST_ORDER');
                unset($items);
            }
            // hidden fields
            _hide_send();
            // display
            $template->assign_vars(array('RCS_NAME' => $rank['name'], 'RCS_COLOR' => $rank['color'], 'RCS_SINGLE' => $rcs_is_single, 'RCS_NOT_SINGLE' => $rcs_is_not_single, 'RCS_DISPLAY' => $rcs_is_display, 'RCS_NOT_DISPLAY' => $rcs_is_not_display, 'L_RCS_NAME' => $lang['rcs_name'], 'L_RCS_NAME_DESC' => $lang['rcs_name_desc'], 'L_RCS_COLOR' => $lang['rcs_color'], 'L_RCS_COLOR_DESC' => $lang['rcs_color_desc'], 'L_RCS_SINGLE' => $lang['rcs_single'], 'L_RCS_SINGLE_DESC' => $lang['rcs_single_desc'], 'L_RCS_DISPLAY' => $lang['rcs_display'], 'L_RCS_DISPLAY_DESC' => $lang['rcs_display_desc'], 'L_RCS_MOVE_AFTER' => $lang['rcs_move_after'], 'L_PICK_COLOR' => $lang['rcs_pick_color'], 'L_SUBMIT' => $lang['Submit'], 'L_CANCEL' => $lang['Cancel'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'I_SUBMIT' => $this->root . $images['cmd_submit'], 'I_CANCEL' => $this->root . $images['cmd_cancel'], 'S_RCS_ACTION' => $get->url($this->requester, '', true)));
            // send to template
            $template->set_filenames(array('body' => 'admin/rcs_edit_body.tpl'));
        } else {
            if ($this->mode == 'save') {
                $rcs_name = request_var('rcs_name', TYPE_NO_HTML);
                $rcs_color = request_var('rcs_color', TYPE_NO_HTML);
                $rcs_single = request_var('rcs_single', TYPE_INT);
                $rcs_display = request_var('rcs_display', TYPE_INT);
                $rcs_tmp_name = request_var('rcs_tmp_name', TYPE_NO_HTML);
                $rcs_tmp_color = request_var('rcs_tmp_color', TYPE_NO_HTML);
                $rcs_tmp_single = request_var('rcs_tmp_single', TYPE_INT);
                $rcs_tmp_display = request_var('rcs_tmp_display', TYPE_INT);
                $rcs_tmp_order = request_var('rcs_tmp_order', TYPE_INT);
                $rcs_order = request_var('rcs_order', TYPE_INT);
                $rcs_order = $rcs_order + 10 == $rcs_tmp_order ? $rcs_tmp_order : $rcs_order + 5;
                if ($rcs_name == '' || !preg_match('/^[a-z0-9_-]*$/i', $rcs_name) && empty($rcs_color)) {
                    // send achievement message
                    $this->_achievement('rcs_must_fill');
                }
                // prepare data
                $rcs_name = $common->sql_type_cast($rcs_name, true);
                $rcs_color = !preg_match('/^[0-9a-f]{6}$/i', $rcs_color) ? '' : $rcs_color;
                $rcs_single = $common->sql_type_cast($rcs_single);
                $rcs_display = $common->sql_type_cast($rcs_display);
                $rcs_order = $common->sql_type_cast($rcs_order);
                if (!empty($this->rcs_id)) {
                    $sql = 'UPDATE ' . RCS_TABLE . '
					SET rcs_name = ' . $rcs_name . ', rcs_color = \'' . $rcs_color . '\', rcs_single = ' . $rcs_single . ', rcs_display = ' . $rcs_display . ', rcs_order = ' . $rcs_order . '
					WHERE rcs_id = ' . $this->rcs_id;
                    $l_key = 'rcs_updated';
                } else {
                    $rcs_new_order = $rcs_order - 5;
                    $rcs_order = $rcs_tmp_order == $rcs_new_order ? $rcs_order + 5 : $rcs_order;
                    $sql = 'INSERT INTO ' . RCS_TABLE . ' (rcs_name, rcs_color, rcs_single, rcs_display, rcs_order)
					VALUES (' . $rcs_name . ', \'' . $rcs_color . '\', ' . $rcs_single . ', ' . $rcs_display . ', ' . $rcs_order . ')';
                    $rcs_order = $rcs_tmp_order == $rcs_new_order ? $rcs_tmp_order : $rcs_order;
                    $l_key = 'rcs_added';
                }
                if (!$db->sql_query($sql)) {
                    message_die(GENERAL_ERROR, 'Could not update/insert into rank color system table', '', __LINE__, __FILE__, $sql);
                }
                // renum order
                if ($rcs_order != $rcs_tmp_order) {
                    $this->_renum_order();
                }
                // update colors if individual value has changed
                if ($rcs_single != $rcs_tmp_single && !empty($this->rcs_id)) {
                    // users/groups to update
                    $list_ids = array();
                    $sql = 'SELECT group_id
					FROM ' . GROUPS_TABLE . '
					WHERE group_color = ' . $this->rcs_id;
                    if (!empty($rcs_tmp_single)) {
                        $patterns = array('group_id', GROUPS_TABLE, 'group_color');
                        $replacements = array('user_id', USERS_TABLE, 'user_color');
                        $sql = str_replace($patterns, $replacements, $sql);
                    }
                    if (!($result = $db->sql_query($sql))) {
                        message_die(GENERAL_ERROR, 'Error getting group/user information', '', __LINE__, __FILE__, $sql);
                    }
                    while ($row = $db->sql_fetchrow($result)) {
                        $row_id = !empty($rcs_tmp_single) ? $row['user_id'] : $row['group_id'];
                        if (!empty($row_id)) {
                            $list_ids[intval($row_id)] = true;
                        }
                    }
                    $db->sql_freeresult($result);
                    // delete users/groups color
                    if (!empty($list_ids)) {
                        $result_ids = implode(', ', array_keys($list_ids));
                        $rcs->update_colors($result_ids, $rcs_tmp_single, 0);
                    }
                }
                // re-cache ranks color variables, if necessary
                $has_modified = $rcs_tmp_name != $rcs_name || $rcs_tmp_color != $rcs_color || $rcs_tmp_single != $rcs_single || $rcs_tmp_display != $rcs_display;
                if ($has_modified) {
                    $rcs->obtain_ids_colors(true);
                }
                // send achievement message
                $this->_achievement($l_key);
            } else {
                if ($this->mode == 'delete') {
                    if (!isset($this->data[$this->rcs_id]['id'])) {
                        // send achievement message
                        $this->_achievement('rcs_not_exists');
                    }
                    $confirm = request_var('confirm', TYPE_NO_HTML);
                    if (!empty($confirm)) {
                        $sql = 'DELETE FROM ' . RCS_TABLE . '
					WHERE rcs_id = ' . $this->rcs_id;
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not delete rank color', '', __LINE__, __FILE__, $sql);
                        }
                        // renum order
                        $this->_renum_order();
                        // users/groups to update
                        $list_ids = array();
                        $rcs_tmp_single = $this->data[$this->rcs_id]['single'];
                        $sql = 'SELECT group_id
					FROM ' . GROUPS_TABLE . '
					WHERE group_color = ' . $this->rcs_id;
                        if (!empty($rcs_tmp_single)) {
                            $patterns = array('group_id', GROUPS_TABLE, 'group_color');
                            $replacements = array('user_id', USERS_TABLE, 'user_color');
                            $sql = str_replace($patterns, $replacements, $sql);
                        }
                        if (!($result = $db->sql_query($sql))) {
                            message_die(GENERAL_ERROR, 'Error getting group/user information', '', __LINE__, __FILE__, $sql);
                        }
                        while ($row = $db->sql_fetchrow($result)) {
                            $row_id = !empty($rcs_tmp_single) ? $row['user_id'] : $row['group_id'];
                            if (!empty($row_id)) {
                                $list_ids[intval($row_id)] = true;
                            }
                        }
                        $db->sql_freeresult($result);
                        // delete users/groups color
                        if (!empty($list_ids)) {
                            $result_ids = implode(', ', array_keys($list_ids));
                            $rcs->update_colors($result_ids, $rcs_tmp_single, false, true);
                        }
                        // re-cache ranks color variables
                        $rcs->obtain_ids_colors(true);
                        // send achievement message
                        $this->_achievement('rcs_removed');
                    } else {
                        // hidden fields
                        _hide_build(array('mode' => 'delete', 'id' => $this->rcs_id));
                        _hide_send();
                        $template->assign_vars(array('MESSAGE_TITLE' => $lang['Confirm'], 'MESSAGE_TEXT' => $lang['rcs_confirm_delete'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'S_CONFIRM_ACTION' => $get->url($this->requester, '', true)));
                        // send to template
                        $template->set_filenames(array('body' => 'admin/confirm_body.tpl'));
                    }
                }
            }
        }
    }
Esempio n. 3
0
        $selected = $i == 0 ? ' selected="selected"' : '';
        $select_font_color .= '<option style="color:' . $font_types[$i] . '" value="' . $font_types[$i] . '"' . $selected . '>' . $font_types_text[$i] . '</option>';
    }
    $select_font_color .= '</select>';
    // generate smilies box
    if (!empty($qp_smilies)) {
        generate_smilies_box();
    }
    // build hidden fields
    $s_hidden_fields = array('sid' => $userdata['session_id'], 'mode' => 'reply', POST_TOPIC_URL => intval($topic_id));
    // check attach sig
    if (($qp_lite || !$qp_lite && !$qp_more) && $attach_sig) {
        $s_hidden_fields = array_merge($s_hidden_fields, array('attach_sig' => $userdata['user_attachsig']));
    }
    // send hidden fields
    _hide_build($s_hidden_fields);
    _hide_send();
    // sent to template
    $template->assign_vars(array('HTML_STATUS' => $html_status, 'BBCODE_STATUS' => sprintf($bbcode_status, '<a href="' . append_sid('faq.' . $phpEx . '?mode=bbcode') . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => $smilies_status, 'QP_ROWSPAN' => $qp_more && $qp_logged ? ' rowspan="2"' : '', 'QP_DISPLAY' => $qp_show ? 'block' : 'none', 'QP_WIDTH' => $qp_lite ? '40' : '100', 'L_OPTIONS' => $lang['Options'], 'L_DISABLE_HTML' => $lang['Disable_HTML_post'], 'L_DISABLE_BBCODE' => $lang['Disable_BBCode_post'], 'L_DISABLE_SMILIES' => $lang['Disable_Smilies_post'], 'U_MORE_SMILIES' => append_sid('posting.' . $phpEx . '?mode=smilies'), 'L_MORE_SMILIES' => $lang['More_emoticons'], 'L_ATTACH_SIGNATURE' => $lang['Attach_signature'], 'L_NOTIFY_ON_REPLY' => $lang['Notify'], 'L_QUOTE_SELECTED' => $lang['qp_quote_selected'], 'L_NO_TEXT_SELECTED' => $lang['qp_quote_empty'], 'L_BBCODE_B_HELP' => $lang['bbcode_b_help'], 'L_BBCODE_I_HELP' => $lang['bbcode_i_help'], 'L_BBCODE_U_HELP' => $lang['bbcode_u_help'], 'L_BBCODE_Q_HELP' => $lang['bbcode_q_help'], 'L_BBCODE_C_HELP' => $lang['bbcode_c_help'], 'L_BBCODE_L_HELP' => $lang['bbcode_l_help'], 'L_BBCODE_O_HELP' => $lang['bbcode_o_help'], 'L_BBCODE_P_HELP' => $lang['bbcode_p_help'], 'L_BBCODE_W_HELP' => $lang['bbcode_w_help'], 'L_BBCODE_A_HELP' => $lang['bbcode_a_help'], 'L_BBCODE_E_HELP' => $lang['bbcode_e_help'], 'L_BBCODE_S_HELP' => $lang['bbcode_s_help'], 'L_BBCODE_F_HELP' => $lang['bbcode_f_help'], 'L_FONT_COLOR' => $lang['Font_color'], 'L_FONT_SIZE' => $lang['Font_size'], 'L_BBCODE_CLOSE_TAGS' => $lang['Close_Tags'], 'L_STYLES_TIP' => $lang['Styles_tip'], 'I_PREVIEW' => $images['cmd_preview'], 'I_SELECT' => $images['cmd_select'], 'I_SUBMIT' => $images['cmd_submit'], 'S_FONT_SIZE_TYPES' => $select_font_size, 'S_FONT_COLOR_TYPES' => $select_font_color, 'S_HTML_CHECKED' => !$html_on ? ' checked="checked"' : '', 'S_BBCODE_CHECKED' => !$bbcode_on ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => !$smilies_on ? ' checked="checked"' : ''));
}
// generate the page
$template->assign_vars(array('L_EMPTY_MESSAGE' => $lang['Empty_message'], 'L_QP_TITLE' => $lang['qp_quick_post'], 'L_QP_OPTIONS' => $lang['qp_options'], 'L_USERNAME' => $lang['Username'], 'L_SUBJECT' => $lang['Subject'], 'L_MESSAGE_BODY' => $lang['Message_body'], 'L_PREVIEW' => $lang['Preview'], 'L_SUBMIT' => $lang['Submit'], 'S_POST_ACTION' => append_sid('posting.' . $phpEx)));
// send the display
if (!empty($qp_form)) {
    $qp_block_name = !empty($qp_lite) ? 'qpl' : 'qpm';
    $template->assign_block_vars($qp_block_name, array());
    $template->set_filenames(array('qp_box' => 'qpes_box.tpl'));
    $template->assign_var_from_handle('QP_BOX', 'qp_box');
}
// function generate_smilies_box()
function generate_smilies_box()
Esempio n. 4
0
         while ($row = $db->sql_fetchrow($result)) {
             $inc += 10;
             $sql = 'UPDATE ' . ATTRIBUTES_TABLE . ' SET attribute_order = ' . $inc . ' WHERE attribute_id = ' . intval($row['attribute_id']);
             if (!$db->sql_query($sql)) {
                 message_die(GENERAL_ERROR, $lang['Attr_Error_Message_05'], '', __LINE__, __FILE__, $sql);
             }
         }
         $db->sql_freeresult($result);
         $message = $lang['Attribute_Removed'] . '<br /><br />' . sprintf($lang['Click_Return_Attributes_Management'], '<a href="' . $get->url($requester, '', true) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . $get->url('admin/index', array('pane' => 'right'), true) . '">', '</a>');
         message_die(GENERAL_MESSAGE, $message);
     } elseif ($attribute_id && !$confirm) {
         /**
          * Present the confirmation screen to the user
          */
         $template->set_filenames(array('body' => 'admin/confirm_body.tpl'));
         _hide_build(array('mode' => 'delete', 'id' => $attribute_id));
         _hide_send();
         $template->assign_vars(array('MESSAGE_TITLE' => $lang['Confirm'], 'MESSAGE_TEXT' => $lang['Attribute_Confirm_Delete'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'S_CONFIRM_ACTION' => $get->url($requester, '', true)));
     } else {
         message_die(GENERAL_MESSAGE, $lang['Must_Select_Attribute']);
     }
 } else {
     if ($mode == 'moveup' || $mode == 'movedw') {
         $inc = $mode == 'movedw' ? +15 : -15;
         $attribute_id = request_var('id', TYPE_INT);
         if (empty($attribute_id)) {
             $message = $lang['Must_Select_Attribute'] . '<br /><br />' . sprintf($lang['Click_Return_Attributes_Management'], '<a href="' . $get->url($requester, '', true) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . $get->url('admin/index', array('pane' => 'right'), true) . '">', '</a>');
             message_die(GENERAL_MESSAGE, $message);
         }
         $sql = 'UPDATE ' . ATTRIBUTES_TABLE . ' SET attribute_order = attribute_order + ' . $inc . ' WHERE attribute_id = ' . intval($attribute_id);
         if (!$db->sql_query($sql)) {