function print_statistic_result($date, $bar, $value, $width) { global $vbulletin; $bgclass = fetch_row_bgclass(); $style = 'width:' . $width . '%; ' . 'height:' . vB_Template_Runtime::fetchStyleVar('pollbar_height') . '; ' . 'border:' . vB_Template_Runtime::fetchStyleVar('pollbar_border') . '; ' . 'background:' . vB_Template_Runtime::fetchStyleVar('pollbar' . $bar . '_background') . '; '; echo '<tr><td width="0" class="' . $bgclass . '">' . $date . "</td>\n"; echo '<td width="100%" class="' . $bgclass . '" nowrap="nowrap"><div style="' . $style . '"> </div></td>' . "\n"; echo '<td width="0%" class="' . $bgclass . '" nowrap="nowrap">' . $value . "</td></tr>\n"; }
function print_statistic_result($date, $bar, $value, $width) { global $vbulletin; $bgclass = fetch_row_bgclass(); $style = 'width:' . $width . '%; ' . 'height: 23px; ' . 'border:' . vB_Template_Runtime::fetchStyleVar('poll_result_border') . '; ' . 'background:' . vB_Template_Runtime::fetchStyleVar('poll_result_color_' . str_pad(strval(intval($bar)), 2, '0', STR_PAD_LEFT)) . '; '; echo '<tr><td width="0" class="' . $bgclass . '">' . $date . "</td>\n"; echo '<td width="100%" class="' . $bgclass . '" nowrap="nowrap"><div style="' . $style . '"> </div></td>' . "\n"; echo '<td width="0%" class="' . $bgclass . '" nowrap="nowrap">' . $value . "</td></tr>\n"; }
function downloads_categories_admin($id = 0, $categories = array(), $spacer = '') { global $db, $dl, $vbphrase; $catexclude = $dl->exclude_cat(); $result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "dl2_categories WHERE {$catexclude} `parent` = {$id} ORDER BY `weight`"); while ($category = $db->fetch_array($result)) { $class = fetch_row_bgclass(); echo '<tr> <td class="' . $class . '" width="100%"> ' . $spacer . htmlspecialchars_uni($category['name']) . '</td> <td class="' . $class . '" align="center"><input type="text" class="bginput" name="displayorder[' . $category['id'] . ']" value="' . $category['weight'] . '" tabindex="1" size="2" title="' . $vbphrase['display_order'] . '" /></td> <td class="' . $class . '"><a href="downloads2.php?' . $vbulletin->session->vars['sessionurl'] . 'do=editcat&id=' . $category['id'] . '">' . $vbphrase['edit'] . '</a></td> <td class="' . $class . '"><a href="downloads2.php?' . $vbulletin->session->vars['sessionurl'] . 'do=delcat&id=' . $category['id'] . '">' . $vbphrase['delete'] . '</a></td> </tr>'; if ($category['subs'] > 0) { $categories += downloads_categories_admin($category['id'], $categories, $spacer . '- - '); } } $db->free_result($result); return $categories; }
function print_statistic_result($date, $bar, $value, $width) { global $stylevars, $vbulletin; $bgclass = fetch_row_bgclass(); if (preg_match('#^(https?://|/)#i', $stylevars['imgdir_poll'])) { $imgpath = $stylevars['imgdir_poll']; } else { $imgpath = '../' . $stylevars['imgdir_poll']; } if ($vbulletin->userinfo['lang_options'] & $vbulletin->bf_misc_languageoptions['direction']) { // ltr $l_img = 'l'; $r_img = 'r'; } else { // rtl $l_img = 'r'; $r_img = 'l'; } echo '<tr><td width="0" class="' . $bgclass . '">' . $date . "</td>\n"; echo '<td width="100%" class="' . $bgclass . '" nowrap="nowrap"><img src="' . $imgpath . '/bar' . "{$bar}-{$l_img}" . '.gif" height="10" /><img src="' . $imgpath . '/bar' . $bar . '.gif" width="' . $width . '%" height="10" /><img src="' . $imgpath . "/bar{$bar}-{$r_img}.gif\" height=\"10\" /></td>\n"; echo '<td width="0%" class="' . $bgclass . '" nowrap="nowrap">' . $value . "</td></tr>\n"; }
$vbulletin->input->clean_array_gpc('r', array('bbcodeid' => TYPE_UINT)); if ($bbcode = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bbcode WHERE bbcodeid = " . $vbulletin->GPC['bbcodeid'])) { $parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $parsed_code = $parser->do_parse($bbcode['bbcodeexample'], false, false, true, false, true); echo $parsed_code; } } // ####################################### MODIFY ##################################### if ($_REQUEST['do'] == 'modify') { $parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $bbcodes = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "bbcode"); print_form_header('bbcode', 'add'); print_table_header($vbphrase['bb_code_manager'], 6); print_cells_row(array($vbphrase['title'], $vbphrase['bb_code'], $vbphrase['html'], $vbphrase['replacement'], $vbphrase['button_image'], $vbphrase['controls']), 1, '', -5); while ($bbcode = $db->fetch_array($bbcodes)) { $class = fetch_row_bgclass(); $altclass = iif($class == 'alt1', 'alt2', 'alt1'); $parsed_code = $parser->do_parse($bbcode['bbcodeexample'], false, false, true, false, true); $cell = array("<b>{$bbcode['title']}</b>", "<div class=\"{$altclass}\" style=\"padding:2px; border:solid 1px; width:200px; height:75px; overflow:auto\"><span class=\"smallfont\">" . htmlspecialchars_uni($bbcode['bbcodeexample']) . '</span></div>', "<div class=\"{$altclass}\" style=\"padding:2px; border:solid 1px; width:200px; height:75px; overflow:auto\"><span class=\"smallfont\">" . htmlspecialchars_uni($parsed_code) . '</span></div>', '<iframe src="bbcode.php?do=previewbbcode&bbcodeid=' . $bbcode['bbcodeid'] . '" style="width:200px; height:75px;"></iframe>'); if ($bbcode['buttonimage']) { $src = $bbcode['buttonimage']; if (!preg_match('#^[a-z]+://#i', $src) and $src[0] != '/') { $src = "../{$src}"; } $cell[] = "<img style=\"background:buttonface; border:solid 1px highlight\" src=\"{$src}\" alt=\"\" />"; } else { $cell[] = $vbphrase['n_a']; } $cell[] = construct_link_code($vbphrase['edit'], "bbcode.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&bbcodeid={$bbcode['bbcodeid']}") . construct_link_code($vbphrase['delete'], "bbcode.php?" . $vbulletin->session->vars['sessionurl'] . "do=remove&bbcodeid={$bbcode['bbcodeid']}"); print_cells_row($cell, 0, $class, -4); }
if ($totalavatars > 0) { print_form_header('usertools', 'avatar'); construct_hidden_code('userid', $vbulletin->GPC['userid']); print_table_header($vbphrase['avatars_to_show_per_page_gcpuser'] . ': <input type="text" name="perpage" value="' . $vbulletin->GPC['perpage'] . '" size="5" tabindex="1" /> <input type="submit" class="button" value="' . $vbphrase['go'] . '" tabindex="1" /> '); print_table_footer(); } print_form_header('usertools', 'updateavatar', 1); print_table_header($vbphrase['avatars_gcpglobal']); $output = "<table border=\"0\" cellpadding=\"6\" cellspacing=\"1\" class=\"tborder\" align=\"center\" width=\"100%\">"; foreach ($avatars as $avatar) { $avatarid = $avatar['avatarid']; $avatar['avatarpath'] = resolve_cp_image_url($avatar['avatarpath']); if ($avatarcount == 0) { $output .= '<tr class="' . fetch_row_bgclass() . '">'; } $output .= "<td valign=\"bottom\" align=\"center\" width=\"20%\"><label for=\"av{$avatar['avatarid']}\"><input type=\"radio\" name=\"avatarid\" id=\"av{$avatar['avatarid']}\" value=\"{$avatar['avatarid']}\" tabindex=\"1\" {$avatarchecked[$avatarid]} />"; $output .= "<img src=\"{$avatar['avatarpath']}\" alt=\"\" /><br />{$avatar['title']}</label></td>"; $avatarcount++; if ($avatarcount == 5) { echo '</tr>'; $avatarcount = 0; } } if ($avatarcount != 0) { while ($avatarcount != 5) { $output .= '<td> </td>'; $avatarcount++; } echo '</tr>';
if (empty($_REQUEST['do'])) { $_REQUEST['do'] = 'list'; } // ###################### Start list ####################### if ($_REQUEST['do'] == 'list') { $getusergroups = $db->query_read("\r\n\t\tSELECT usergroupid, title, ei_forumid\r\n\t\tFROM " . TABLE_PREFIX . "usergroup\r\n\t\tWHERE ei_auto = 1\r\n\t\tORDER BY `usergroupid`\r\n\t"); print_table_start('admin_ei'); print_table_header($vbphrase['ei_header_auto'], 2); print_description_row($vbphrase['ei_auto_how_to'], 0, 2); while ($getusergroup = $db->fetch_array($getusergroups)) { print_table_header($getusergroup['title'], 2); $forumlist = explode(",", $getusergroup['ei_forumid']); foreach ($forumlist as $key => $forumupdateid) { $getforuminfo = $db->query_read("SELECT title FROM " . TABLE_PREFIX . "forum WHERE forumid = {$forumupdateid}"); while ($foruminfo = $db->fetch_array($getforuminfo)) { $bg = fetch_row_bgclass(); echo "<tr><td class=\"" . $bg . "\">" . $foruminfo['title'] . "</td><td class=\"" . $bg . "\"><a href=\"admin_ei.php?" . $vbulletin->session->vars['sessionurl'] . "do=autosub&f=" . $forumupdateid . "&ug=" . $getusergroup['usergroupid'] . "\">" . $vbphrase['ei_update_sub'] . "</a></td></tr>"; } } } print_table_footer(2, '', '', 0); } // ###################### Start list ####################### if ($_REQUEST['do'] == 'autosub') { $vbulletin->input->clean_array_gpc('r', array('f' => TYPE_UINT, 'ug' => TYPE_UINT)); $users = $db->query_read("\r\n\t\tSELECT userid, username\r\n\t\tFROM " . TABLE_PREFIX . "user\r\n\t\tWHERE usergroupid = '" . $vbulletin->GPC['ug'] . "' OR membergroupids REGEXP '^" . $vbulletin->GPC['ug'] . "\$|^" . $vbulletin->GPC['ug'] . ",|," . $vbulletin->GPC['ug'] . ",|," . $vbulletin->GPC['ug'] . "\$'\r\n\t\tORDER BY `userid`\r\n\t"); while ($user = $db->fetch_array($users)) { $db->query_write("\r\n\t\t\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "subscribeforum (userid, emailupdate, forumid)\r\n\t\t\t\t\t\t\t\tVALUES ('" . $user['userid'] . "', 1, '" . $vbulletin->GPC['f'] . "')\r\n\t\t\t\t\t\t\t"); echo $vbphrase['ei_auto_updated'] . $user['username'] . "<br>"; } }
$readonly = 1; $template = $db->query_first("\n\t\tSELECT title, template\n\t\tFROM " . TABLE_PREFIX . "template\n\t\tWHERE title = '" . $db->escape_string($vbulletin->GPC['item']) . "'\n\t\t\tAND styleid = -1\n\t\t\tAND templatetype = 'stylevar'\n\t"); $css["{$template['title']}"] = unserialize($template['template']); $css["{$template['title']}"]['styleid'] = -1; print_form_header('', ''); print_css_row($title . ' (default)', $vbulletin->GPC['item'], $dolinks, 0); print_table_footer(2, '<input type="button" class="button" value="' . $vbphrase['close'] . '" onclick="self.close();" tabindex="1" />'); } // ###################### Start List StyleVar Colors ####################### if ($_REQUEST['do'] == 'stylevar-colors') { // use 'dostyleid'from GPC if ($vbulletin->GPC['dostyleid'] != 0 and $style = $db->query_first("\n\t\tSELECT * FROM " . TABLE_PREFIX . "style\n\t\tWHERE styleid = " . $vbulletin->GPC['dostyleid'])) { print_form_header('', ''); foreach (unserialize($style['csscolors']) as $colorname => $colorvalue) { if (preg_match('#^[a-z0-9_]+_hex$#siU', $colorname)) { echo "<tr><td class=\"" . fetch_row_bgclass() . "\">{$colorname}</td><td style=\"background-color:#{$colorvalue}\" title=\"#{$colorvalue}\">#{$colorvalue}</td></tr>"; } } print_table_footer(); } else { // fail. $_REQUEST['do'] = 'modify'; } } // ###################### Start List styles ####################### if ($_REQUEST['do'] == 'modify') { print_form_header('css', 'edit'); print_table_header($vbphrase['edit_styles']); if ($vbulletin->debug) { print_label_row('<b>' . $vbphrase['master_style'] . '</b>', construct_link_code($vbphrase['edit'], "css.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&dostyleid=-1") . construct_link_code($vbphrase['templates'], "template.php?" . $vbulletin->session->vars['sessionurl'] . "expandset={$style['styleid']}")); $depthmark = '--';
function makeTable($section, $recordset) { require_once DIR . '/includes/adminfunctions.php'; global $vbphrase; $result = "\n\t<input type=\"hidden\" name=\"sectionid\" id=\"sectionid\" value=\"" . $section['nodeid'] . "\" />\n\t<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"100%\" class=\"tborder\" style=\"border-collapse: separate;\">\n\t<tr class=\"thead\">\n\t<td colspan=\"6\"> " . $section['title'] . "\n\t<!-- <tbody> -->\n\t</td>\n\t</tr>\n\t<tr class=\"tcat\">\n\t<td class=\"feature_management_header\" style=\"padding:5px;\"> " . (intval($vbulletin->GPC['sectionid']) == intval($section['permissionsfrom']) ? construct_phrase($vbphrase['permissions_assigned_section_x'], $section['title']) : construct_phrase($vbphrase['permissions_not_assigned_section_x'], $section['title'])) . "\n\t\t<input type=\"button\" id=\"button_change_section\" onclick=\"showNodeWindow('filter_section')\" value=\"" . $vbphrase['navigate_to_section'] . "\" />\n\t\t</td>\n\t\t</tr>\n\t\t<tr><td><table class=\"tborder\" cellpadding=\"4\" border=\"0\" width=\"100%\" >\n\t\t<tr class=\"thead\">\n\t\t\t<td width=\"40%\">\n\t\t\t\t" . $vbphrase['user_group'] . "\n\t\t\t</td>"; $table_columns = array('can_read' => array('groupid' => 1, 'permid' => VBCMS_PERM_READ), 'can_download' => array('groupid' => 2, 'permid' => VBCMS_PERM_DOWNLOAD), 'create_content' => array('groupid' => 3, 'permid' => VBCMS_PERM_CREATE), 'edit_others_content' => array('groupid' => 4, 'permid' => VBCMS_PERM_EDITOTHERS), 'can_publish' => array('groupid' => 5, 'permid' => VBCMS_PERM_PUBLISH), 'can_use_html' => array('groupid' => 6, 'permid' => VBCMS_PERM_HTML)); foreach ($table_columns as $table_column_phrase => $table_column_info) { $table_column_groupid = $table_column_info['groupid']; $table_column_permid = $table_column_info['permid']; $result .= "<td width=\"12%\" align=\"center\" valign=\"top\">\n\t\t\t" . $vbphrase[$table_column_phrase] . "\n\t\t\t<select id=\"change_selection_permid_" . $table_column_permid . "\" onchange=\"javascript: toggleCheckBox('cb', '" . $table_column_groupid . "', document.getElementById('count').value, this.value);\">\n\t\t\t\t<option></option>\n\t\t\t\t<option value=\"1\">" . $vbphrase['select_all'] . "</option>\n\t\t\t\t<option value=\"0\">" . $vbphrase['deselect_all'] . "</option>\n\t\t\t\t<option value=\"-1\">" . $vbphrase['invert_selection'] . "</option>\n\t\t\t</select>\n\t\t</td>\n\t\t"; } $result .= "</tr>"; $count = 0; while ($row = vB::$db->fetch_array($recordset)) { $count++; $bgclass = fetch_row_bgclass(); $result .= "\n\t<tr id=\"usergroupid_{$row['usergroupid']}\" class=\"{$bgclass}\" >\n\t\t<td>" . $row['title'] . "<input type=\"hidden\" name=\"groupid_{$count}\" value=\"" . $row['usergroupid'] . "\" />\n\t\t\t<input type=\"hidden\" name=\"permid_{$count}\" value=\"" . $row['permissionid'] . "\" />\n\t\t</td>\n\t\t<td id=\"usergroupid_{$row['usergroupid']}_permissionid_" . VBCMS_PERM_READ . "\" align=\"center\"><input type=\"checkbox\" name=\"cb_1_{$count}\" id=\"cb_1_{$count}\" " . ($row['permissions'] & VBCMS_PERM_READ ? 'checked="checked"' : '') . " /></td>\n\t\t<td id=\"usergroupid_{$row['usergroupid']}_permissionid_" . VBCMS_PERM_DOWNLOAD . "\" align=\"center\"><input type=\"checkbox\" name=\"cb_2_{$count}\" id=\"cb_2_{$count}\" " . ($row['permissions'] & VBCMS_PERM_DOWNLOAD ? 'checked="checked"' : '') . " /></td>\n\t\t<td id=\"usergroupid_{$row['usergroupid']}_permissionid_" . VBCMS_PERM_CREATE . "\" align=\"center\"><input type=\"checkbox\" name=\"cb_3_{$count}\" id=\"cb_3_{$count}\" " . ($row['permissions'] & VBCMS_PERM_CREATE ? 'checked="checked"' : '') . " /></td>\n\t\t<td id=\"usergroupid_{$row['usergroupid']}_permissionid_" . VBCMS_PERM_EDITOTHERS . "\" align=\"center\"><input type=\"checkbox\" name=\"cb_4_{$count}\" id=\"cb_4_{$count}\" " . ($row['permissions'] & VBCMS_PERM_EDITOTHERS ? 'checked="checked"' : '') . " /></td>\n\t\t<td id=\"usergroupid_{$row['usergroupid']}_permissionid_" . VBCMS_PERM_PUBLISH . "\" align=\"center\"><input type=\"checkbox\" name=\"cb_5_{$count}\" id=\"cb_5_{$count}\" " . ($row['permissions'] & VBCMS_PERM_PUBLISH ? 'checked="checked"' : '') . " /></td>\n\t\t<td id=\"usergroupid_{$row['usergroupid']}_permissionid_" . VBCMS_PERM_HTML . "\" align=\"center\"><input type=\"checkbox\" name=\"cb_6_{$count}\" id=\"cb_6_{$count}\" " . ($row['permissions'] & VBCMS_PERM_HTML ? 'checked="checked"' : '') . " /></td>\n\t</tr>\n\t\t"; } $result .= "</table>\n\t\t</td>\n\t\t</tr>\n\t<!-- </tbody> -->\n</table>"; $result .= "<input type=\"hidden\" name=\"count\" id=\"count\" value=\"{$count}\" />\n"; return $result; }
<br /> </td></tr> <?php if (!$vbulletin->options['skimlinks_enabled'] && !empty($skimlinks_pub_id)) { print_description_row($vbphrase['skimlinks_global_status'], false, 2, 'thead skimdisabledalert'); print_description_row($vbphrase['skimlinks_gloabal_is_off'], false, 2, 'alt1 skimLinksInfo skimdisabledalert'); } print_description_row($vbphrase['skimlinks_global_options'], false, 2, 'thead'); print_description_row($vbphrase['skimlinks_global_enable'], false, 2, fetch_row_bgclass() . ' skimLinksInfo'); print_yes_no_row($vbphrase['skimlinks_enabled'], 'skimlinks_enabled', $vbulletin->options['skimlinks_enabled'], 'skimEnableSubmit();'); print_description_row($vbphrase['skimlinks_to_enable_products'], false, 2, fetch_row_bgclass() . ' skimLinksInfo'); print_label_row($vbphrase['skimlinks_pub_id'], "<div id=\"ctrl_skimlinks_pub_id\" style=\"float: left;\"><input type=\"text\" class=\"bginput\" name=\"skimlinks_pub_id\" id=\"skimlinks_pub_id\" value=\"" . htmlspecialchars_uni($skimlinks_pub_id) . "\" readonly=\"readonly\" size=\"25\" style=\"background-color: #f6f6f6; border-color: #f6f6f6;\" /></div>" . (!empty($skimlinks_pub_id) ? '<div style="float: right; margin-right: 8px;"><a href="javascript:void(0);" onclick="skimDissociate();" id="skim_dissociate_link"><small>' . $vbphrase['skimlinks_dissociate_account'] . '</small></a></div><div style="clear: both; heigh: 0; line-height: 0;"></div>' : ''), '', 'top', skimlinks_pub_id); print_description_row($vbphrase['skimlinks_global_settings_description'], false, 2, 'alt1 skimLinksInfo'); print_description_row($vbphrase['skimlinks_product_level_options'], false, 2, 'thead'); print_description_row('<div style="font-size: 11px; margin: 4px 0;">' . $vbphrase['skimlinks_product_level_options_description'] . '</div>', false, 2, fetch_row_bgclass() . ' skimLinksInfo'); print print_submit_row(); ?> <script type="text/javascript"> document.getElementById('cpform').addEventListener("submit", function (e) { promptchange = false; },false); $(function() { $('input[type=submit], input[type=reset]').attr('disabled', 'disabled'); }); </script> <?php } function getCheckbox($name, $value = 1, $checked = true, array $attributes = null) { $attributeString = ''; if (is_array($attributes)) { foreach ($attributes as $attribute => $value) {
$row[] = $currow[0]; if ($currow[0] != TABLE_PREFIX . 'word' and $currow[0] != TABLE_PREFIX . 'postindex') { print_yes_no_row($currow[0], "table[{$currow['0']}]", 1); } } print_yes_no_row(TABLE_PREFIX . 'word', "table[" . TABLE_PREFIX . "word]", 1); print_yes_no_row(TABLE_PREFIX . 'postindex', "table[" . TABLE_PREFIX . "postindex]", 1); print_submit_row($vbphrase['go']); print_form_header('backup', 'sqlfile'); print_table_header($vbphrase['backup_database_to_a_file_on_the_server']); print_description_row($vbphrase['backup_file_warning']); print_input_row($vbphrase['path_and_file_to_save_backup_to'], 'filename', './forumbackup-' . vbdate(str_replace(array('\\', '/', ' '), '', $vbulletin->options['dateformat']), TIMENOW) . '-' . substr(md5(TIMENOW), 0, 5) . '.sql', 0, 60); print_submit_row($vbphrase['save']); print_form_header('backup', 'csvtable'); print_table_header($vbphrase['csv_backup_of_single_database_table']); echo "<tr class='" . fetch_row_bgclass() . "'>\n<td><p>" . $vbphrase['table_name'] . "</p></td>\n<td><p>"; echo "<select name=\"table\" size=\"1\" tabindex=\"1\" class=\"bginput\">\n"; foreach ($row as $table) { echo '<option value="' . htmlspecialchars_uni($table) . '">' . htmlspecialchars_uni($table) . "</option>\n"; } echo "</select></p></td></tr>\n\n"; print_input_row($vbphrase['separator_character'], 'separator', ','); print_input_row($vbphrase['quote_character'], 'quotes', "'"); print_yes_no_row($vbphrase['add_column_names'], 'showhead', 1); print_submit_row($vbphrase['go']); } // ###################### Dumping to SQL File #################### if ($_POST['do'] == 'sqlfile') { $vbulletin->input->clean_array_gpc('p', array('filename' => TYPE_STR)); if (is_demo_mode()) { print_cp_message('This function is disabled within demo mode');
function makeTable($section, $recordset) { require_once(DIR . '/includes/adminfunctions.php'); global $vbphrase; $result = " <input type=\"hidden\" name=\"sectionid\" id=\"sectionid\" value=\"" . $section['nodeid'] . "\" /> <table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"100%\" class=\"tborder\" style=\"border-collapse: separate;\"> <tr class=\"thead\"> <td colspan=\"6\"> " . $section['title'] . " <!-- <tbody> --> </td> </tr> <tr class=\"tcat\"> <td class=\"feature_management_header\" style=\"padding:5px;\"> " . ( intval($vbulletin->GPC['sectionid']) == intval($section['permissionsfrom']) ? construct_phrase($vbphrase['permissions_assigned_section_x'], $section['title']) : construct_phrase($vbphrase['permissions_not_assigned_section_x'], $section['title']) ) . " <input type=\"button\" onclick=\"showNodeWindow('filter_section')\" value=\"" . $vbphrase['navigate_to_section'] ."\" /> </td> </tr> <tr><td><table class=\"tborder\" cellpadding=\"4\" border=\"0\" width=\"100%\" > <tr class=\"thead\"> <td width=\"40%\"> " . $vbphrase['user_group'] . " </td>"; $table_columns = array( 'can_read' => 1, 'can_download' => 2, 'create_content' => 3, 'edit_others_content' => 4, 'can_publish' => 5, 'can_use_html' => 6, ); foreach ($table_columns AS $table_column_phrase => $table_column_groupid) { $result .= "<td width=\"12%\" align=\"center\" valign=\"top\"> " . $vbphrase[$table_column_phrase] . " <select onchange=\"javascript: toggleCheckBox('cb', '" . $table_column_groupid . "', document.getElementById('count').value, this.value);\"> <option></option> <option value=\"1\">" . $vbphrase['select_all'] . "</option> <option value=\"0\">" . $vbphrase['deselect_all'] . "</option> <option value=\"-1\">" . $vbphrase['invert_selection'] . "</option> </select> </td> "; } $result .= "</tr>"; $count = 0; while($row = vB::$db->fetch_array($recordset)) { $count++; $bgclass = fetch_row_bgclass(); $result .= " <tr class=\"$bgclass\" > <td>" . $row['title'] ."<input type=\"hidden\" name=\"groupid_$count\" value=\"" . $row['usergroupid'] . "\" /> <input type=\"hidden\" name=\"permid_$count\" value=\"" . $row['permissionid'] . "\" /> </td> <td align=\"center\"><input type=\"checkbox\" name=\"cb_1_$count\" id=\"cb_1_$count\" " . ( ($row['permissions'] & 1) ? 'checked="checked"' : '') ." /></td> <td align=\"center\"><input type=\"checkbox\" name=\"cb_2_$count\" id=\"cb_2_$count\" " . ( ($row['permissions'] & 32) ? 'checked="checked"' : '') ." /></td> <td align=\"center\"><input type=\"checkbox\" name=\"cb_3_$count\" id=\"cb_3_$count\" " . ( ($row['permissions'] & 2) ? 'checked="checked"' : '') ." /></td> <td align=\"center\"><input type=\"checkbox\" name=\"cb_4_$count\" id=\"cb_4_$count\" " . ( ($row['permissions'] & 4) ? 'checked="checked"' : '') ." /></td> <td align=\"center\"><input type=\"checkbox\" name=\"cb_5_$count\" id=\"cb_5_$count\" " . ( ($row['permissions'] & 8) ? 'checked="checked"' : '') ." /></td> <td align=\"center\"><input type=\"checkbox\" name=\"cb_6_$count\" id=\"cb_6_$count\" " . ( ($row['permissions'] & 16) ? 'checked="checked"' : '') ." /></td> </tr> "; } $result .= "</table> </td> </tr> <!-- </tbody> --> </table>"; $result .= "<input type=\"hidden\" name=\"count\" id=\"count\" value=\"$count\" />\n"; return $result; }
function photoplog_make_field_form($fielddata_inputs, $catid, $fieldtype, $fieldid, $donext) { global $vbulletin, $vbphrase, $photoplog_fieldtypes; $doadd = $donext == 'doadd'; $fielddata = array('name' => '', 'groupid' => '0', 'title' => '', 'description' => '', 'maxlength' => '100', 'default' => '1', 'size' => '40', 'height' => '8', 'options' => '', 'limit' => '0', 'perline' => '2', 'active' => '1', 'hidden' => '0', 'required' => '0', 'inherited' => '1'); if ($fieldtype <= 1) { $fielddata['default'] = ''; } if ($fieldtype == 1) { $fielddata['maxlength'] = '1000'; } foreach ($fielddata_inputs as $fielddata_name => $fielddata_value) { $fielddata[$fielddata_name] = $fielddata_value; } $catname = intval($catid) == -1 ? $vbphrase['photoplog_all_categories'] : photoplog_get_category_title($catid); print_form_header('photoplog_field', $donext); construct_hidden_code('s', $vbulletin->session->vars['sessionhash']); construct_hidden_code('catid', $catid); if ($doadd) { construct_hidden_code('fieldtype', $fieldtype); print_table_header($vbphrase['photoplog_add_new_field'], 2); } else { construct_hidden_code('fieldid', $fieldid); print_table_header($vbphrase['photoplog_edit_field'], 2); } // NOTE THAT htmlspecialchars_uni is automatically done by the below functions unless turned off! EXCEPT label_row! print_label_row($vbphrase['photoplog_category'], htmlspecialchars_uni($catname)); print_label_row($vbphrase['photoplog_field_type'], htmlspecialchars_uni($photoplog_fieldtypes[$fieldtype])); if ($doadd) { $photoplog_available_groups = photoplog_make_available_groups($catid); if (empty($photoplog_available_groups)) { print_input_row(photoplog_row_info('photoplog_field_name', 'photoplog_field_name_description', 50), 'fielddata[name]', $fielddata['name']); } else { $photoplog_available_groups['0'] = $vbphrase['photoplog_select_name_or_enter_below']; ksort($photoplog_available_groups); print_radio_row(photoplog_row_info('photoplog_field_name', 'photoplog_field_name_select_description', 50), 'fielddata[groupid]', $photoplog_available_groups, '0', 'smallfont'); $bgclass = fetch_row_bgclass(); print_input_row(photoplog_row_info('', 'photoplog_field_name_description'), 'fielddata[name]', $fielddata['name']); } } else { print_label_row($vbphrase['photoplog_field_name'], htmlspecialchars_uni($fielddata['name'])); } print_input_row(photoplog_row_info('photoplog_field_title', 'photoplog_field_title_description', 50), 'fielddata[title]', $fielddata['title']); print_input_row(photoplog_row_info('photoplog_field_description', 'photoplog_field_description_description', 250), 'fielddata[description]', $fielddata['description']); if ($fieldtype <= 1) { print_input_row(photoplog_row_info('photoplog_field_maxlength', 'photoplog_field_maxlength_description'), 'fielddata[maxlength]', $fielddata['maxlength']); print_input_row(photoplog_row_info('photoplog_field_default', 'photoplog_field_default_description_text'), 'fielddata[default]', $fielddata['default']); print_input_row(photoplog_row_info('photoplog_field_size', 'photoplog_field_size_description'), 'fielddata[size]', $fielddata['size']); } if ($fieldtype == 1) { print_input_row(photoplog_row_info('photoplog_field_height', 'photoplog_field_height_description_text'), 'fielddata[height]', $fielddata['height']); } if ($fieldtype >= 2 && $fieldtype <= 5) { print_textarea_row(photoplog_row_info('photoplog_field_options', 'photoplog_field_options_description'), 'fielddata[options]', $fielddata['options'], 8, 40); print_yes_no_row(photoplog_row_info('photoplog_field_default', 'photoplog_field_default_description_select'), 'fielddata[default]', $fielddata['default']); } if ($fieldtype == 4 || $fieldtype == 2) { print_input_row(photoplog_row_info('photoplog_field_height', 'photoplog_field_height_description_select'), 'fielddata[height]', $fielddata['height']); } if ($fieldtype >= 4) { print_input_row(photoplog_row_info('photoplog_field_limit', 'photoplog_field_limit_description'), 'fielddata[limit]', $fielddata['limit']); } if ($fieldtype == 3) { print_input_row(photoplog_row_info('photoplog_field_perline_radio', 'photoplog_field_perline_radio_description'), 'fielddata[perline]', $fielddata['perline']); } if ($fieldtype == 5) { print_input_row(photoplog_row_info('photoplog_field_perline_checkbox', 'photoplog_field_perline_checkbox_description'), 'fielddata[perline]', $fielddata['perline']); } print_yes_no_row(photoplog_row_info('photoplog_field_active', 'photoplog_field_active_description'), 'fielddata[active]', $fielddata['active']); print_yes_no_row(photoplog_row_info('photoplog_field_hidden', 'photoplog_field_hidden_description'), 'fielddata[hidden]', $fielddata['hidden']); print_yes_no_row(photoplog_row_info('photoplog_field_required', 'photoplog_field_required_description'), 'fielddata[required]', $fielddata['required']); print_yes_no_row(photoplog_row_info('photoplog_field_inherited', 'photoplog_field_inherited_description'), 'fielddata[inherited]', $fielddata['inherited']); print_submit_row($vbphrase['photoplog_save'], '_default_', 2, $vbphrase['go_back']); }
public static function listSections($page, $per_page = 10) { global $vbphrase; global $vbulletin; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('cpcms'); $sectionid = ( ($vbulletin->GPC_exists['sectionid'] AND intval($vbulletin->GPC['sectionid']))? $vbulletin->GPC['sectionid'] : false); $sections = self::getSection($sectionid); if ($record_count = count($sections)) { $sections = array_slice($sections, ($page-1) * $per_page, $per_page, true); $parent = $vbulletin->db->query_first($sql = "SELECT info.title FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid WHERE " . ( $sectionid ? " node.nodeid = " . $sectionid : " node.nodeid IS NULL" )); $i = 1; $result = print_form_header('cms_content_admin', '', false, true, 'cms_data', '100%', '_self', true, 'post', 0, false); $result .= "<input type=\"hidden\" id=\"sectionid\" value=\"" . ( $sectionid ? $sectionid :'') . "\" name=\"sectionid\"/> <input type=\"hidden\" name=\"sentfrom\" id=\"section\" value=\"section\"/> <input type=\"hidden\" name=\"id\" id=\"id\" value=\"0\"/>"; $result .= self::getSectionHeaders($sectionid) . "<br />\n"; $result .= "<tr class=\"tcat\"> <td class=\"feature_management_header\" style=\"padding:5px;float:" . vB_Template_Runtime::fetchStyleVar('left') . ";\"><div style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . "\"> " . $vbphrase['you_are_managing'] . " " . $vbphrase['section'] . ": <span class=\"section_name\">" . $parent['title'] . ($vbulletin->GPC_exists['sectionid'] ? '' : '(' . $vbphrase['all_sections'] .')') . "</span> <input type=\"button\" onclick=\"showNodeWindow('filter_section')\" value=\"" . $vbphrase['navigate_to_section'] ."\"> " . " </div> </td> </tr>"; $result.= "<tr><td>\n"; $result .= "<div style=\"overflow:auto;margin: auto;\"> <table class=\"tborder\" cellpadding=\"4\" border=\"0\" width=\"100%\" align=\"center\">\n"; $bgclass = fetch_row_bgclass(); $result .= "<tr align=\"center\" class=\"thead\">\n"; $result .= "<td class=\"thead\" width=\"20\">#</td> <td class=\"thead\" align=\"" . vB_Template_Runtime::fetchStyleVar('left') . "\" width=\"400\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=config4.value\" target=\"_self\">" . $vbphrase['title'] . "</a></td> <td class=\"thead\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=setpublish\">" . $vbphrase['published'] . "</a></td> <td class=\"thead\">" . $vbphrase['content_layout'] . "</td> <td class=\"thead\"><a href=\"cms_content_admin.php?do=sort&sentfrom=section&sortby=auto_displayorder\" target=\"_self\">" . $vbphrase['display_order'] . "</a></td> <td class=\"thead\" width=\"50\">" . $vbphrase['records_per_page'] . "</td> <td class=\"thead\">" . $vbphrase['subsections'] . "</td> <td class=\"thead\">" . $vbphrase['content'] . "</td> <td class=\"thead\">" . $vbphrase['viewcount'] . "</td>". /* <td class=\"thead\">" . $vbphrase['layout'] . "</td> <td class=\"thead\">" . $vbphrase['style'] . "</td> */ " </tr>"; $sequence = 0; foreach($sections as $key => $section) { $sequence++; $first_selected_parent_row_class = ""; $change_display_order_buttons = ""; $section_name_prefix = ((vB_Template_Runtime::fetchStyleVar('textdirection') == 'ltr') ? '>' : '>'); if ($sequence == 1 AND $page == 1) { $first_selected_parent_row_class = " class=\"selected_parent_row\""; $section_name_prefix = ""; } // for sub-sections, display up or down arrows to change the display order else { $change_display_order_buttons = "<div style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . "; width:32px;\">"; // dont display up arrow if its already first section in list if ($sequence > 2 AND isset($sections[$key-1])) { $change_display_order_buttons .= "<a style=\"float:" . vB_Template_Runtime::fetchStyleVar('left') . ";\" href=\"javascript:swapSections(".$section['nodeid'].", ".$sections[$key-1]['nodeid'].")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/arrow_up.png\" style=\"border-style:none\" /></a>"; } // dont display down arrow is its already last section in list if ($sequence < count($sections) AND isset($sections[$key+1])) { $change_display_order_buttons .= "<a style=\"float:right;\" href=\"javascript:swapSections(".$section['nodeid'].", ".$sections[$key+1]['nodeid'].")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/arrow_down.png\" style=\"border-style:none\" /></a>"; } $change_display_order_buttons .= "</div>"; } $bgclass = fetch_row_bgclass(); $result .= "<tr" . $first_selected_parent_row_class . " align=\"center\">\n <input type=\"hidden\" name=\"ids[]\" value=\"" . $section['nodeid'] . "\" />\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">$sequence</td>\n"; $result .= " <td align=\"" . vB_Template_Runtime::fetchStyleVar('left') . "\" class=\"$bgclass\" style=\"font-size:80%;width:400px;\"><div class=\"sectionTitleWrapper\" style=\"width:400px;\"> " . $change_display_order_buttons . $section_name_prefix . "<a href=\"./cms_content_admin.php?do=filter§ionid=" . $section['nodeid'] . "&contenttypeid=" . vb_Types::instance()->getContentTypeID("vBCms_Section") . "\" target=\"_self\" >" . htmlspecialchars_uni($section['title']) . "</a> <div style=\"float:" . vB_Template_Runtime::fetchStyleVar('right') . "\"> <a href=\"javascript:showSectionEdit('new_section'," . (intval($section['parentnode']) ? $section['parentnode'] : '0') . ", " . $section['nodeid'] . ",'')\"><img src=\"" . self::getImagePath('imgdir_cms') . "/add_small.png\" style=\"border-style:none\"></a> <a href=\"javascript:showSectionEdit('save_section',". (intval($section['parentnode']) ? $section['parentnode'] : '0') . ', ' . $section['nodeid'] . ", '" . vB_Template_Runtime::escapeJS(htmlspecialchars_uni($section['title'])) . "')\")\"><img src=\"" . self::getImagePath('imgdir_cms') . "/edit_small.png\" style=\"border-style:none\"></a>" . ((intval($section['nodeid']) != 1 AND intval($section['section_count']) == 0 AND intval($section['item_count']) == 0) ? "<a href=\"javascript:confirmSectionDelete(" . $section['nodeid'] . ', \'' . vB_Template_Runtime::escapeJS($vbphrase['confirm_deletion']). "');\"> <img src=\"" . self::getImagePath('imgdir_cms') . "/delete_small.png\" style=\"border-style:none\"></a>" : '') . " </div> </div></td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select name=\"state_" . $section['nodeid']. "\" id=\"state_" . $section['nodeid']. "\" onchange=\"setFormValue('do', 'saveonesectionstate'); setFormValue('nodeid', " . $section['nodeid']. ");document.getElementById('cms_data').submit();\">" . self::getPublishedSelect( intval($section['setpublish']), $section['publishdate']) . "</select></td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select id=\"cl_" . $section['nodeid'] . "\" name=\"cl_" . $section['nodeid'] . "\" onchange=\"setFormValue('do','saveonecl'); setFormValue('nodeid'," . $section['nodeid'] . "); document.getElementById('cms_data').submit();\">" . self::getContentLayoutSelect($section['content_layoutid']) ; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\"><select name=\"sect_pr_" . $section['nodeid'] . "\" onchange=\"setFormValue('nodeid', " . $section['nodeid']. "); setFormValue('do', 'sectionpriority');document.getElementById('cms_data').submit();\">\n" . self::getSectionPrioritySelect($section['priority'], $section['nodeid']) . "</select></td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . self::getSectionPPEdit($section['per_page'], $section['nodeid']) . "</td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['section_count'] . "</td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['item_count'] . "</td>\n"; $result .= " <td class=\"$bgclass\" style=\"font-size:80%;\">" . $section['viewcount'] . "</td>\n"; $result .= "</tr>\n"; } print_hidden_fields(); $result .= "</table>"; $result .= "</div></td></tr>"; $result .= "</table>\n"; $result .= self::getNav($per_page, $record_count, $page, 'section', 100, 'page', true, ('cms_content_admin.php' . ($sectionid ? "?sectionid=$sectionid" : ''))); global $echoform; $echoform = false; $result .= "</form>"; $result .= self::getSectionEditPanel(); return $result; } }
/** * Prints a row containing a number of <input type="checkbox" /> fields representing a user's membergroups * * @param string Title for row * @param string Base name for checkboxes - $name[] * @param integer Number of columns to split checkboxes into * @param mixed Either NULL or a user info array */ function print_membergroup_row($title, $name = 'membergroup', $columns = 0, $userarray = NULL) { global $vbulletin, $iusergroupcache; $uniqueid = fetch_uniqueid_counter(); if (!is_array($iusergroupcache)) { $iusergroupcache = array(); $usergroups = $vbulletin->db->query_read("SELECT usergroupid,title FROM " . TABLE_PREFIX . "usergroup ORDER BY title"); while ($usergroup = $vbulletin->db->fetch_array($usergroups)) { $iusergroupcache["{$usergroup['usergroupid']}"] = $usergroup['title']; } unset($usergroup); $vbulletin->db->free_result($usergroups); } // create a blank user array if one is not set if (!is_array($userarray)) { $userarray = array('usergroupid' => 0, 'membergroupids' => ''); } $options = array(); foreach ($iusergroupcache as $usergroupid => $grouptitle) { // don't show the user's primary group (if set) if ($usergroupid != $userarray['usergroupid']) { $options[] = "\t\t<div><label for=\"{$name}{$usergroupid}_{$uniqueid}\" title=\"usergroupid: {$usergroupid}\"><input type=\"checkbox\" tabindex=\"1\" name=\"{$name}" . "[]\" id=\"{$name}{$usergroupid}_{$uniqueid}\" value=\"{$usergroupid}\"" . iif(strpos(",{$userarray['membergroupids']},", ",{$usergroupid},") !== false, ' checked="checked"') . iif($vbulletin->debug, " title=\"name="{$name}"\"") . " />{$grouptitle}</label></div>\n"; } } $class = fetch_row_bgclass(); if ($columns > 1) { $html = "\n\t<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n"; $counter = 0; $totaloptions = sizeof($options); $percolumn = ceil($totaloptions / $columns); for ($i = 0; $i < $columns; $i++) { $html .= "\t<td class=\"{$class}\"><span class=\"smallfont\">\n"; for ($j = 0; $j < $percolumn; $j++) { $html .= $options[$counter++]; } $html .= "\t</span></td>\n"; } $html .= "</tr></table>\n\t"; } else { $html = "<div id=\"ctrl_{$name}\" class=\"smallfont\">\n" . implode('', $options) . "\t</div>"; } print_label_row($title, $html, $class, 'top', $name); }
if ($_REQUEST['do'] == 'stylevar-colors') { // use 'dostyleid'from GPC if ($vbulletin->GPC['dostyleid'] != 0 AND $style = $db->query_first(" SELECT * FROM " . TABLE_PREFIX . "style WHERE styleid = " . $vbulletin->GPC['dostyleid'] )) { print_form_header('', ''); foreach (unserialize($style['csscolors']) AS $colorname => $colorvalue) { if (preg_match('#^[a-z0-9_]+_hex$#siU', $colorname)) { echo "<tr><td class=\"" . fetch_row_bgclass() . "\">$colorname</td><td style=\"background-color:#$colorvalue\" title=\"#$colorvalue\">#$colorvalue</td></tr>"; } } print_table_footer(); } else { // fail. $_REQUEST['do'] = 'modify'; } } // ###################### Start List styles ####################### if ($_REQUEST['do'] == 'modify') {
} print_form_header('', ''); print_table_header($vbphrase['last_online'] . ' - ' . $vbphrase['color_key']); print_description_row(' <div class="darkbg" style="border: 2px inset"><ul class="darkbg"> <li class="modtoday">' . $vbphrase['today'] . '</li> <li class="modyesterday">' . $vbphrase['yesterday'] . '</li> <li class="modlasttendays">' . construct_phrase($vbphrase['within_the_last_x_days'], '10') . '</li> <li class="modsincetendays">' . construct_phrase($vbphrase['more_than_x_days_ago'], '10') . '</li> <li class="modsincethirtydays"> ' . construct_phrase($vbphrase['more_than_x_days_ago'], '30') . '</li> </ul></div> '); print_table_footer(); print_form_header('', ''); print_table_header($vbphrase['moderators']); echo "<tr valign=\"top\">\n\t<td class=\"" . fetch_row_bgclass() . "\" colspan=\"2\">"; echo "<div class=\"darkbg\" style=\"padding: 4px; border: 2px inset; text-align: {$stylevar['left']}\">"; // get the timestamp for the beginning of today, according to bbuserinfo's timezone require_once DIR . '/includes/functions_misc.php'; $unixtoday = vbmktime(0, 0, 0, vbdate('m', TIMENOW, false, false), vbdate('d', TIMENOW, false, false), vbdate('Y', TIMENOW, false, false)); $list = array(); $curforum = -1; if ($db->num_rows($forums)) { while ($forum = $db->fetch_array($forums)) { $modlist["{$forum['userid']}"]++; if ($curforum != $forum['forumid']) { $curforum = $forum['forumid']; if ($countforums++ != 0) { echo "\t\t</ul>\n\t\t</ul>\n\t</li>\n\t</ul>\n"; } echo "\n\t<ul>\n\t<li><b><a href=\"../forumdisplay.php?" . $vbulletin->session->vars['sessionurl'] . "f={$forum['forumid']}\">{$forum['title']}</a></b>\n";
/** * Prints out a style editor block, as seen in template.php?do=modify * * @param integer Style ID * @param array Style info array */ function print_style($styleid, $style = '') { global $vbulletin, $masterset; global $only; global $SHOWTEMPLATE; $vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('add_child_style', 'add_new_template', 'all_template_groups', 'allow_user_selection', 'collapse_all_template_groups', 'collapse_template_group', 'collapse_templates', 'collapse_x', 'common_templates', 'controls', 'custom_templates', 'customize_gstyle', 'delete_style', 'display_order', 'download', 'edit', 'edit_fonts_colors_etc', 'edit_settings_gstyle', 'edit_style_options', 'edit_templates', 'expand_all_template_groups', 'expand_template_group', 'expand_templates', 'expand_x', 'go', 'master_style', 'replacement_variables', 'revert_all_stylevars', 'revert_all_templates', 'revert_gcpglobal', 'stylevareditor', 'template_is_customized_in_this_style', 'template_is_inherited_from_a_parent_style', 'template_is_unchanged_from_the_default_style', 'template_options', 'view_original', 'view_your_forum_using_this_style', 'x_templates')); $titlesonly =& $vbulletin->GPC['titlesonly']; $expandset =& $vbulletin->GPC['expandset']; $group =& $vbulletin->GPC['group']; $searchstring =& $vbulletin->GPC['searchstring']; $vb5_config =& vB::getConfig(); $styleIsReadonly = (!$vb5_config['Misc']['debug'] and !empty($style['guid'])); if ($styleid == -1) { $THISstyleid = 0; $style['title'] = $vbphrase['master_style']; $style['templatelist'] = $masterset; } else { $THISstyleid = $styleid; } if ($expandset == 'all' or $expandset == $styleid) { $showstyle = 1; } else { $showstyle = 0; } $forumhome_url = vB5_Route::buildUrl('home|fullurl', array(), array('styleid' => $styleid)); //vB5_Route::buildUrl('page|fullurl', array(), array('styleid' => $styleid)); // show the header row $printstyleid = iif($styleid == -1, 'm', $styleid); $onclickoptions = array('do' => 'modify', 'group' => $group); if (empty($showstyle)) { $onclickoptions['expandset'] = $styleid; } $onclicklink = vB5_Route::buildUrl('admincp|fullurl', array('file' => 'template'), $onclickoptions); $userContext = vB::getUserContext(); $altRowClass = fetch_row_bgclass(); echo "\n\t<!-- start header row for style '{$style['styleid']}' -->\n\t<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"stylerow {$altRowClass}\">\n\t<tr>\n\t\t<td><label for=\"userselect_{$styleid}\" title=\"{$vbphrase['allow_user_selection']}\"> " . construct_depth_mark($style['depth'], '- - ', iif($vb5_config['Misc']['debug'] and $styleid != -1, '- - ')) . iif($styleid != -1, "<input type=\"checkbox\" name=\"userselect[{$styleid}]\" value=\"1\" tabindex=\"1\"" . iif($style['userselect'], ' checked="checked"') . " id=\"userselect_{$styleid}\" onclick=\"check_children({$styleid}, this.checked)\" />") . "</label><a href=\"{$forumhome_url}\" target=\"_blank\" title=\"{$vbphrase['view_your_forum_using_this_style']}\">{$style['title']}</a></td>\n\t\t<td align=\"" . vB_Template_Runtime::fetchStyleVar('right') . "\" nowrap=\"nowrap\">\n\t\t\t" . iif($styleid != -1, "<input type=\"text\" class=\"bginput\" name=\"displayorder[{$styleid}]\" value=\"{$style['displayorder']}\" tabindex=\"1\" size=\"2\" title=\"{$vbphrase['display_order']}\" />") . "\n\t\t\t \n\t\t\t<select name=\"styleEdit_{$printstyleid}\" id=\"menu_{$styleid}\" onchange=\"Sdo(this.options[this.selectedIndex].value, {$styleid});\" class=\"bginput\">"; if ($userContext->hasAdminPermission('canadmintemplates') and !$styleIsReadonly) { echo "\n\t\t\t\t<optgroup label=\"" . $vbphrase['template_options'] . "\">\n\t\t\t\t\t<option value=\"template_templates\">" . $vbphrase['edit_templates'] . "</option>\n\t\t\t\t\t<option value=\"template_addtemplate\">" . $vbphrase['add_new_template'] . "</option>\n\t\t\t\t\t" . iif($styleid != -1, "<option value=\"template_revertall\">" . $vbphrase['revert_all_templates'] . "</option>") . "\n\t\t\t\t</optgroup> "; } if ($userContext->hasAdminPermission('canadminstyles') and !$styleIsReadonly) { echo "<optgroup label=\"" . $vbphrase['edit_fonts_colors_etc'] . "\"> "; } if ($userContext->hasAdminPermission('canadmintemplates') and !$styleIsReadonly) { echo "<option value=\"css_templates\">" . $vbphrase['common_templates'] . "</option> \n"; } if ($userContext->hasAdminPermission('canadminstyles')) { if (!$styleIsReadonly) { echo "\t<option value=\"stylevar\" selected=\"selected\">{$vbphrase['stylevareditor']}</option>\n\t\t\t\t\t\t" . iif($styleid != -1, "<option value=\"stylevar_revertall\">" . $vbphrase['revert_all_stylevars'] . "</option>") . "\n\t\t\t\t\t\t<option value=\"css_replacements\">{$vbphrase['replacement_variables']}</option>\n\t\t\t\t\t</optgroup>"; } echo "\t\t\t<optgroup label=\"" . $vbphrase['edit_style_options'] . "\">\n\t\t" . iif($styleid != -1, '<option value="template_editstyle">' . $vbphrase['edit_settings_gstyle'] . '</option>') . "\n\t\t<option value=\"template_addstyle\">" . $vbphrase['add_child_style'] . "</option> \n "; } if ($userContext->hasAdminPermission('canadmintemplates')) { echo "<option value=\"template_download\">" . $vbphrase['download'] . "</option>\n"; } if ($userContext->hasAdminPermission('canadminstyles')) { echo '<option value="template_delete" class="col-c">' . $vbphrase['delete_style'] . "</option>\n"; } echo "</optgroup>\n\t\t\t</select><input type=\"button\" class=\"button\" value=\"{$vbphrase['go']}\" onclick=\"Sdo(this.form.styleEdit_{$printstyleid}.options[this.form.styleEdit_{$printstyleid}.selectedIndex].value, {$styleid});\" />\n\t\t\t \n\t\t\t<input type=\"button\" class=\"button\" tabindex=\"1\"\n\t\t\tvalue=\"" . iif($showstyle, COLLAPSECODE, EXPANDCODE) . "\" title=\"" . iif($showstyle, $vbphrase['collapse_templates'], $vbphrase['expand_templates']) . "\"\n\t\t\tonclick=\"window.location='" . $onclicklink . "';\" />\n\t\t\t \n\t\t</td>\n\t</tr>\n\t</table>\n\t<!-- end header row for style '.{$style['styleid']}' -->\n\t"; if ($showstyle) { if (empty($searchstring)) { $searchconds = ''; } elseif ($titlesonly) { $searchconds = "AND t1.title LIKE('%" . $vbulletin->db->escape_string_like($searchstring) . "%')"; } else { $searchconds = "AND ( t1.title LIKE('%" . $vbulletin->db->escape_string_like($searchstring) . "%') OR template_un LIKE('%" . $vbulletin->db->escape_string_like($searchstring) . "%') ) "; } //master style doesn't really exist and therefore can't be loaded. if (empty($style['templatelist'])) { $style = vB_Library::instance('Style')->fetchStyleById($styleid); } /* If $style was passed into this function, templatelist might still be a serialized string. Note, I only ever ran into this once, and it never happened again, so it might've been some old cached data somewhere (cached before the removal of templatelist from the stylecache, maybe?) */ if (is_string($style['templatelist'])) { $style['templatelist'] = unserialize($style['templatelist']); } // not sure if this if is necesary any more. The template list should always be set // at this point and if it isn't things don't work properly. However I need to stop // fixing things at some point and wrap this up. if (!empty($style['templatelist']) and is_array($style['templatelist'])) { $templateids = implode(',', $style['templatelist']); if (!empty($templateids)) { $searchconds .= "\n\t\t\t\t\t\tAND\n\t\t\t\t\ttemplateid IN({$templateids})\n\t\t\t\t"; } } $specials = vB_Api::instanceInternal('template')->fetchSpecialTemplates(); $templates = $vbulletin->db->query_read("\n\t\t\tSELECT templateid, IF(((t1.title LIKE '%.css') AND (t1.title NOT like 'css_%')),\n\t\t\t\tCONCAT('csslegacy_', t1.title), title) AS title, styleid, templatetype, dateline, username\n\t\t\tFROM " . TABLE_PREFIX . "template AS t1\n\t\t\tWHERE\n\t\t\t\ttemplatetype IN('template', 'replacement') {$searchconds}\n\t\t\tAND title NOT IN('" . implode("', '", $specials) . "')\n\t\t\tORDER BY title\n\t\t"); // just exit if no templates found $numtemplates = $vbulletin->db->num_rows($templates); if ($numtemplates == 0) { return; } echo "\n<!-- start template list for style '{$style['styleid']}' -->\n"; echo "<table cellpadding=\"0\" cellspacing=\"10\" border=\"0\" align=\"center\"><tr valign=\"top\">\n"; echo "<td>\n<select name=\"tl{$THISstyleid}\" id=\"templatelist{$THISstyleid}\" class=\"darkbg\" size=\"" . TEMPLATE_EDITOR_ROWS . "\" style=\"width:450px\"\n\t"; echo "onchange=\"Tprep(this.options[this.selectedIndex], {$THISstyleid}, 1);"; echo "\"\n\t"; echo "ondblclick=\"Tdo(Tprep(this.options[this.selectedIndex], {$THISstyleid}, 0), '');\">\n"; echo "\t<option class=\"templategroup\" value=\"\">- - " . construct_phrase($vbphrase['x_templates'], $style['title']) . " - -</option>\n"; while ($template = $vbulletin->db->fetch_array($templates)) { if ($template['templatetype'] == 'replacement') { $replacements["{$template['templateid']}"] = $template; } else { // don't show special templates if (in_array($template['title'], vB_Api::instanceInternal('template')->fetchSpecialTemplates())) { continue; } else { $m = substr(strtolower($template['title']), 0, iif($n = strpos($template['title'], '_'), $n, strlen($template['title']))); if ($template['styleid'] != -1 and !isset($masterset["{$template['title']}"]) and !isset($only["{$m}"])) { $customtemplates["{$template['templateid']}"] = $template; } else { $maintemplates["{$template['templateid']}"] = $template; } } } } // custom templates if (!empty($customtemplates)) { echo "<optgroup label=\"\">\n"; echo "\t<option class=\"templategroup\" value=\"\">" . $vbphrase['custom_templates'] . "</option>\n"; foreach ($customtemplates as $template) { echo $SHOWTEMPLATE($template, $styleid, 1); vbflush(); } echo "</optgroup><!--<optgroup label=\"\"></optgroup>-->"; } // main templates if (!empty($maintemplates)) { $lastgroup = ''; $echo_ul = 0; foreach ($maintemplates as $template) { $showtemplate = 1; if (!empty($lastgroup) and isTemplateInGroup($template['title'], $lastgroup)) { if ($group == 'all' or $group == $lastgroup) { echo $SHOWTEMPLATE($template, $styleid, $echo_ul); vbflush(); } } else { foreach ($only as $thisgroup => $display) { if ($lastgroup != $thisgroup and $echo_ul == 1) { echo "</optgroup><!--<optgroup label=\"\"></optgroup>-->\n"; $echo_ul = 0; } if (isTemplateInGroup($template['title'], $thisgroup)) { $lastgroup = $thisgroup; if ($group == 'all' or $group == $lastgroup) { echo "<optgroup label=\"\">\n"; echo "\t<option class=\"templategroup\" value=\"[]\"" . (($group == $thisgroup and empty($vbulletin->GPC['templateid'])) ? ' selected="selected"' : '') . ">" . construct_phrase($vbphrase['x_templates'], $display) . " «</option>\n"; $echo_ul = 1; } else { echo "\t<option class=\"templategroup\" value=\"[{$thisgroup}]\">" . construct_phrase($vbphrase['x_templates'], $display) . " »</option>\n"; $showtemplate = 0; } break; } } // end foreach($only) if ($showtemplate) { echo $SHOWTEMPLATE($template, $styleid, $echo_ul); vbflush(); } } // end if template string same AS last } // end foreach ($maintemplates) } echo "</select>\n"; echo "</td>\n<td width=\"100%\" align=\"center\" valign=\"top\">"; echo "\n\t\t<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"tborder\" width=\"300\">\n\t\t<tr align=\"center\">\n\t\t\t<td class=\"tcat\"><b>{$vbphrase['controls']}</b></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"alt2\" align=\"center\" style=\"font: 11px tahoma, verdana, arial, helvetica, sans-serif\">\n\t\t\t\t<input type=\"button\" class=\"button\" style=\"font-weight: normal\" value=\"{$vbphrase['customize_gstyle']}\" id=\"cust{$THISstyleid}\" onclick=\"buttonclick(this, {$THISstyleid},'');\" />\n\t\t\t\t<input type=\"button\" class=\"button\" style=\"font-weight: normal\" value=\"" . trim(construct_phrase($vbphrase['expand_x'], '')) . '/' . trim(construct_phrase($vbphrase['collapse_x'], '')) . "\" id=\"expa{$THISstyleid}\" onclick=\"buttonclick(this, {$THISstyleid}, '');\" /><br />\n\t\t\t\t<input type=\"button\" class=\"button\" style=\"font-weight: normal\" value=\" {$vbphrase['edit']} \" id=\"edit{$THISstyleid}\" onclick=\"buttonclick(this,{$THISstyleid}, '');\" />\n\t\t\t\t<input type=\"button\" class=\"button\" style=\"font-weight: normal\" value=\"{$vbphrase['view_original']}\" id=\"orig{$THISstyleid}\" onclick=\"buttonclick(this, {$THISstyleid}, 'vieworiginal');\" />\n\t\t\t\t<input type=\"button\" class=\"button\" style=\"font-weight: normal\" value=\"{$vbphrase['revert_gcpglobal']}\" id=\"kill{$THISstyleid}\" onclick=\"buttonclick(this, {$THISstyleid}, 'killtemplate');\" />\n\t\t\t\t<div class=\"darkbg\" style=\"margin: 4px; padding: 4px; border: 2px inset; text-align: " . vB_Template_Runtime::fetchStyleVar('left') . "\" id=\"helparea{$THISstyleid}\">\n\t\t\t\t\t" . construct_phrase($vbphrase['x_templates'], '<b>' . $style['title'] . '</b>') . "\n\t\t\t\t</div>\n\t\t\t\t<input type=\"button\" class=\"button\" value=\"" . EXPANDCODE . "\" title=\"" . $vbphrase['expand_all_template_groups'] . "\" onclick=\"Texpand('all', '{$expandset}');\" />\n\t\t\t\t<b>" . $vbphrase['all_template_groups'] . "</b>\n\t\t\t\t<input type=\"button\" class=\"button\" value=\"" . COLLAPSECODE . "\" title=\"" . $vbphrase['collapse_all_template_groups'] . "\" onclick=\"Texpand('', '{$expandset}');\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t<br />\n\t\t<table cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"tborder\" width=\"300\">\n\t\t<tr align=\"center\">\n\t\t\t<td class=\"tcat\"><b>{$vbphrase['color_key']}</b></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"alt2\">\n\t\t\t<div class=\"darkbg\" style=\"margin: 4px; padding: 4px; border: 2px inset; text-align: " . vB_Template_Runtime::fetchStyleVar('left') . "\">\n\t\t\t<span class=\"col-g\">" . $vbphrase['template_is_unchanged_from_the_default_style'] . "</span><br />\n\t\t\t<span class=\"col-i\">" . $vbphrase['template_is_inherited_from_a_parent_style'] . "</span><br />\n\t\t\t<span class=\"col-c\">" . $vbphrase['template_is_customized_in_this_style'] . "</span>\n\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t"; /* // might come back to this at some point... if (!empty($replacements)) { $numreplacements = sizeof($replacements); echo "<br />\n<b>Replacement Variables:</b><br />\n<select name=\"rep$THISstyleid\" size=\"" . iif($numreplacements > ADMIN_MAXREPLACEMENTS, ADMIN_MAXREPLACEMENTS, $numreplacements) . "\" class=\"bginput\" style=\"width:350px\">\n"; foreach($replacements AS $replacement) { echo $SHOWTEMPLATE($replacement, $styleid, 0, 1); vbflush(); } echo "</select>\n"; } */ echo "\n</td>\n</tr>\n</table>\n\n\t\t<script type=\"text/javascript\">\n\t\t<!--\n\t\tif (document.forms.tform.tl{$THISstyleid}.selectedIndex > 0)\n\t\t{\n\t\t\tTprep(document.forms.tform.tl{$THISstyleid}.options[document.forms.tform.tl{$THISstyleid}.selectedIndex], {$THISstyleid}, 1);\n\t\t}\n\t\t//-->\n\t\t</script>"; echo "<!-- end template list for style '{$style['styleid']}' -->\n\n"; } // end if($showstyle) }