function print_move_prune_rows($permcheck = '') { global $vbphrase; print_description_row($vbphrase['date_options'], 0, 2, 'thead', 'center'); print_input_row($vbphrase['original_post_date_is_at_least_xx_days_ago'], 'thread[originaldaysolder]', 0, 1, 5); print_input_row($vbphrase['original_post_date_is_at_most_xx_days_ago'] . '<dfn>' . construct_phrase($vbphrase['note_leave_x_specify_no_limit'], '0') . '</dfn>', 'thread[originaldaysnewer]', 0, 1, 5); print_input_row($vbphrase['last_post_date_is_at_least_xx_days_ago'], 'thread[lastdaysolder]', 0, 1, 5); print_input_row($vbphrase['last_post_date_is_at_most_xx_days_ago'] . '<dfn>' . construct_phrase($vbphrase['note_leave_x_specify_no_limit'], '0') . '</dfn>', 'thread[lastdaysnewer]', 0, 1, 5); print_description_row($vbphrase['view_options'], 0, 2, 'thead', 'center'); print_input_row($vbphrase['thread_has_at_least_xx_replies'], 'thread[repliesleast]', 0, 1, 5); print_input_row($vbphrase['thread_has_at_most_xx_replies'] . '<dfn>' . construct_phrase($vbphrase['note_leave_x_specify_no_limit'], '-1') . '</dfn>', 'thread[repliesmost]', -1, 1, 5); print_input_row($vbphrase['thread_has_at_least_xx_views'], 'thread[viewsleast]', 0, 1, 5); print_input_row($vbphrase['thread_has_at_most_xx_views'] . '<dfn>' . construct_phrase($vbphrase['note_leave_x_specify_no_limit'], '-1') . '</dfn>', 'thread[viewsmost]', -1, 1, 5); print_description_row($vbphrase['status_options'], 0, 2, 'thead', 'center'); print_yes_no_other_row($vbphrase['thread_is_sticky'], 'thread[issticky]', $vbphrase['either'], 0); $state = array('visible' => $vbphrase['visible'], 'moderation' => $vbphrase['awaiting_moderation'], 'deleted' => $vbphrase['deleted'], 'any' => $vbphrase['any']); print_radio_row($vbphrase['thread_state'], 'thread[state]', $state, 'any'); $status = array('open' => $vbphrase['open'], 'closed' => $vbphrase['closed'], 'redirect' => $vbphrase['redirect'], 'not_redirect' => $vbphrase['not_redirect'], 'any' => $vbphrase['any']); print_radio_row($vbphrase['thread_status'], 'thread[status]', $status, 'not_redirect'); print_description_row($vbphrase['other_options'], 0, 2, 'thead', 'center'); print_input_row($vbphrase['username'], 'thread[posteduser]'); print_input_row($vbphrase['title'], 'thread[titlecontains]'); print_moderator_forum_chooser('thread[forumid]', -1, $vbphrase['all_forums'], $vbphrase['forum'], true, false, true, $permcheck); print_yes_no_row($vbphrase['include_child_forums'], 'thread[subforums]'); if ($prefix_options = construct_prefix_options(0, '', true, true)) { print_label_row($vbphrase['prefix'], '<select name="thread[prefixid]" class="bginput">' . $prefix_options . '</select>', '', 'top', 'prefixid'); } }
if ($db->num_rows($product_dependencies)) { print_table_header($vbphrase['existing_product_dependencies'], 4); print_cells_row(array($vbphrase['dependency_type'], $vbphrase['compatibility_starts'], $vbphrase['incompatible_with'], $vbphrase['delete']), 1); while ($product_dependency = $db->fetch_array($product_dependencies)) { if ($product_dependency['dependencytype'] != 'product') { $dep_type = $dependency_types["{$product_dependency['dependencytype']}"]; } else { $dep_type = $vbphrase['product'] . ' - ' . htmlspecialchars_uni($product_dependency['parentproductid']); } $depid = $product_dependency['productdependencyid']; print_cells_row(array($dep_type, "<input type=\"text\" name=\"productdependency[{$depid}][minversion]\" value=\"" . htmlspecialchars_uni($product_dependency['minversion']) . "\" size=\"25\" maxlength=\"50\" tabindex=\"1\" />", "<input type=\"text\" name=\"productdependency[{$depid}][maxversion]\" value=\"" . htmlspecialchars_uni($product_dependency['maxversion']) . "\" size=\"25\" maxlength=\"50\" tabindex=\"1\" />", "<input type=\"checkbox\" name=\"productdependency[{$depid}][delete]\" value=\"1\" />")); } print_table_break(); } print_table_header($vbphrase['add_new_product_dependency']); print_radio_row($vbphrase['dependency_type'], 'dependencytype', $dependency_types); print_input_row($vbphrase['compatibility_starts_with_version'], 'minversion', '', true, 25, 50); print_input_row($vbphrase['incompatible_with_version_and_newer'], 'maxversion', '', true, 25, 50); print_submit_row(); // ############################################# echo '<hr />'; print_form_header('plugin', 'productcode'); construct_hidden_code('productid', $vbulletin->GPC['productid']); $productcodes = $db->query_read("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . TABLE_PREFIX . "productcode\r\n\t\t\tWHERE productid = '" . $db->escape_string($vbulletin->GPC['productid']) . "'\r\n\t\t\tORDER BY version\r\n\t\t"); if ($db->num_rows($productcodes)) { print_table_header($vbphrase['existing_install_uninstall_code'], 4); print_cells_row(array($vbphrase['version'], $vbphrase['install_code'], $vbphrase['uninstall_code'], $vbphrase['delete']), 1); $productcodes_grouped = array(); $productcodes_versions = array(); while ($productcode = $db->fetch_array($productcodes)) { // have to be careful here, as version numbers are not necessarily unique
// ###################### Swap from database to file system and vice versa ########## if ($_REQUEST['do'] == 'storage') { if ($vbulletin->options['usefileavatar']) { print_form_header('avatar', 'switchtype'); print_table_header("{$vbphrase['storage_type']}: <span class=\"normal\">{$vbphrase['user_pictures']}</span>"); print_description_row(construct_phrase($vbphrase['avatars_are_currently_being_served_from_the_filesystem_at_x'], '<b>' . $vbulletin->options['avatarpath'] . '</b>')); print_description_row(construct_phrase($vbphrase['profilepics_are_currently_being_served_from_the_filesystem_at_x'], '<b>' . $vbulletin->options['profilepicpath'] . '</b>')); print_description_row(construct_phrase($vbphrase['sigpics_are_currently_being_served_from_the_filesystem_at_x'], '<b>' . $vbulletin->options['sigpicpath'] . '</b>')); print_table_break(); print_table_header(' '); print_radio_row($vbphrase['move_items_from_filesystem_into_database'], 'dowhat', array('FS_to_DB' => ''), 'FS_to_DB'); print_table_break(); print_table_header(' '); print_radio_row($vbphrase['move_avatars_to_a_different_directory'], 'dowhat', array('FS_to_FS1' => '')); print_radio_row($vbphrase['move_profilepics_to_a_different_directory'], 'dowhat', array('FS_to_FS2' => '')); print_radio_row($vbphrase['move_sigpics_to_a_different_directory'], 'dowhat', array('FS_to_FS3' => '')); print_submit_row($vbphrase['go'], 0); } else { $vbulletin->GPC['dowhat'] = 'DB_to_FS'; $_REQUEST['do'] = 'switchtype'; } } // ###################### Swap from database to file system and vice versa ########## if ($_REQUEST['do'] == 'switchtype') { if ($vbulletin->GPC['dowhat'] == 'FS_to_DB') { // redirect straight through to image mover $vbulletin->GPC['avatarpath'] = $vbulletin->options['avatarpath']; $vbulletin->GPC['avatarurl'] = $vbulletin->options['avatarurl']; $vbulletin->GPC['profilepicpath'] = $vbulletin->options['profilepicpath']; $vbulletin->GPC['profilepicurl'] = $vbulletin->options['profilepicurl']; $vbulletin->GPC['sigpicpath'] = $vbulletin->options['sigpicpath'];
print_yes_no_row($vbphrase['invisible_mode'], 'options[invisible]', $user['invisible']); print_yes_no_row($vbphrase['allow_vcard_download'], 'options[showvcard]', $user['showvcard']); print_yes_no_row($vbphrase['receive_private_messages'], 'options[receivepm]', $user['receivepm']); print_yes_no_row($vbphrase['pm_from_contacts_only'], 'options[receivepmbuddies]', $user['receivepmbuddies']); print_yes_no_row($vbphrase['send_notification_email_when_a_private_message_is_received'], 'options[emailonpm]', $user['emailonpm']); print_yes_no_row($vbphrase['pop_up_notification_box_when_a_private_message_is_received'], 'user[pmpopup]', $user['pmpopup']); print_yes_no_row($vbphrase['enable_visitor_messaging'], 'options[vm_enable]', $user['vm_enable']); print_yes_no_row($vbphrase['limit_vm_to_contacts_only'], 'options[vm_contactonly]', $user['vm_contactonly']); print_yes_no_row($vbphrase['display_signatures'], 'options[showsignatures]', $user['showsignatures']); print_yes_no_row($vbphrase['display_avatars'], 'options[showavatars]', $user['showavatars']); print_yes_no_row($vbphrase['display_images'], 'options[showimages]', $user['showimages']); print_yes_no_row($vbphrase['show_others_custom_profile_styles'], 'options[showusercss]', $user['showusercss']); print_yes_no_row($vbphrase['receieve_friend_request_notification'], 'options[receivefriendemailrequest]', $user['receivefriendemailrequest']); print_radio_row($vbphrase['auto_subscription_mode'], 'user[autosubscribe]', array(-1 => $vbphrase['subscribe_choice_none'], 0 => $vbphrase['subscribe_choice_0'], 1 => $vbphrase['subscribe_choice_1'], 2 => $vbphrase['subscribe_choice_2'], 3 => $vbphrase['subscribe_choice_3']), $user['autosubscribe'], 'smallfont'); print_radio_row($vbphrase['thread_display_mode'], 'user[threadedmode]', array(0 => "{$vbphrase['linear']} - {$vbphrase['oldest_first']}", 3 => "{$vbphrase['linear']} - {$vbphrase['newest_first']}", 2 => $vbphrase['hybrid'], 1 => $vbphrase['threaded']), $threaddisplaymode, 'smallfont'); print_radio_row($vbphrase['message_editor_interface'], 'user[showvbcode]', array(0 => $vbphrase['do_not_show_editor_toolbar'], 1 => $vbphrase['show_standard_editor_toolbar'], 2 => $vbphrase['show_enhanced_editor_toolbar']), $user['showvbcode'], 'smallfont'); construct_style_chooser($vbphrase['style'], 'user[styleid]', $user['styleid']); print_table_break('', $INNERTABLEWIDTH); // ADMIN OVERRIDE OPTIONS SECTION print_table_header($vbphrase['admin_override_options']); foreach ($vbulletin->bf_misc_adminoptions as $field => $value) { print_yes_no_row($vbphrase['keep_' . $field], 'adminoptions[' . $field . ']', $user["{$field}"]); } print_table_break('', $INNERTABLEWIDTH); // TIME FIELDS SECTION print_table_header($vbphrase['time_options']); print_select_row($vbphrase['timezone'], 'user[timezoneoffset]', fetch_timezones_array(), $user['timezoneoffset']); print_yes_no_row($vbphrase['automatically_detect_dst_settings'], 'options[dstauto]', $user['dstauto']); print_yes_no_row($vbphrase['dst_currently_in_effect'], 'options[dstonoff]', $user['dstonoff']); print_select_row($vbphrase['default_view_age'], 'user[daysprune]', $pruneoptions, $user['daysprune']); print_time_row($vbphrase['join_date'], 'user[joindate]', $user['joindate']);
if ($_REQUEST['do'] == 'apiedit' or $_REQUEST['do'] == 'apiadd') { $vbulletin->input->clean_array_gpc('r', array('paymentapiid' => TYPE_INT)); print_form_header('subscriptions', 'apiupdate'); if ($_REQUEST['do'] == 'apiadd') { print_table_header($vbphrase['add_new_paymentapi']); } else { $api = $db->query_first("\n\t\t\tSELECT * FROM " . TABLE_PREFIX . "paymentapi\n\t\t\tWHERE paymentapiid = " . $vbulletin->GPC['paymentapiid'] . "\n\t\t"); print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['paymentapi'], $api['title'], $api['paymentapiid'])); construct_hidden_code('paymentapiid', $api['paymentapiid']); } print_input_row($vbphrase['title'], 'api[title]', $api['title']); print_radio_row($vbphrase['active'], 'api[active]', array(0 => $vbphrase['no'], 1 => $vbphrase['yes']), $api['active'], 'smallfont'); if ($vbulletin->debug) { print_input_row($vbphrase['classname'], 'api[classname]', $api['classname']); print_input_row($vbphrase['supported_currency'], 'api[currency]', $api['currency']); print_radio_row($vbphrase['supports_recurring'], 'api[recurring]', array(0 => $vbphrase['no'], 1 => $vbphrase['yes']), $api['recurring'], 'smallfont'); } else { print_label_row($vbphrase['classname'], $api['classname']); print_label_row($vbphrase['supported_currency'], $api['currency']); print_label_row($vbphrase['supports_recurring'], $api['recurring'] ? $vbphrase['yes'] : $vbphrase['no']); } if ($_REQUEST['do'] == 'apiedit') { $settings = unserialize($api['settings']); if (is_array($settings)) { // $info is an array foreach ($settings as $key => $info) { print_description_row('<div>' . $vbphrase["setting_{$api[classname]}_{$key}_title"] . "</div>", 0, 2, "optiontitle\""); $name = "settings[{$key}]"; $description = "<div class=\"smallfont\">" . $vbphrase["setting_{$api[classname]}_{$key}_desc"] . '</div>'; switch ($info['type']) { case 'yesno':
/** * Prints a setting row for use in options.php?do=options * * @param array Settings array * @param array Phrases */ function print_setting_row($setting, $settingphrase) { global $vbulletin, $vbphrase, $bgcounter, $settingphrase, $stylevar; $settingid = $setting['varname']; echo '<tbody>'; print_description_row(iif($vbulletin->debug, '<div class="smallfont" style="float:' . $stylevar['right'] . '">' . construct_link_code($vbphrase['edit'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=editsetting&varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=removesetting&varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vbulletin->debug ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : '')); echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n"; // make sure all rows use the alt1 class $bgcounter--; $description = "<div class=\"smallfont\"" . ($vbulletin->debug ? "title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>'; $name = "setting[{$setting['varname']}]"; $right = "<span class=\"smallfont\">{$vbphrase['error']}</span>"; $width = 40; $rows = 8; if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) { $width = $matches[1]; $setting['optioncode'] = ''; } else { if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) { $rows = $matches[1]; if ($matches[2]) { $width = $matches[3]; } $setting['optioncode'] = 'textarea'; } else { if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'bitfield'; $setting['bitfield'] =& fetch_bitfield_definitions($matches[1]); } else { if (preg_match('#^(select|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = "{$matches['1']}:{$matches['2']}"; $setting['optiondata'] = trim($matches[4]); } else { if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) { $size = intval($matches[1]); $setting['optioncode'] = 'usergroup'; } else { if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'usergroupextra'; $setting['optiondata'] = trim($matches[3]); } } } } } } switch ($setting['optioncode']) { // input type="text" case '': print_input_row($description, $name, $setting['value'], 1, $width); break; // input type="radio" // input type="radio" case 'yesno': print_yes_no_row($description, $name, $setting['value']); break; // textarea // textarea case 'textarea': print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%"); break; // bitfield // bitfield case 'bitfield': $setting['value'] = intval($setting['value']); $setting['html'] = ''; if ($setting['bitfield'] === NULL) { print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40); } else { #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>"; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($setting['bitfield'] as $key => $value) { $value = intval($value); $setting['html'] .= "<table style=\"width:175px; float:{$stylevar['left']}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n"; } $setting['html'] .= "</div>\r\n"; #$setting['html'] .= "</fieldset>"; print_label_row($description, $setting['html'], '', 'top', $name, 40); } break; // select:piped // select:piped case 'select:piped': print_select_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value']); break; // radio:piped // radio:piped case 'radio:piped': print_radio_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value'], 'smallfont'); break; // select:eval // select:eval case 'select:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_select_row($description, $name, $options, $setting['value']); } else { print_input_row($description, $name, $setting['value']); } break; // radio:eval // radio:eval case 'radio:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_radio_row($description, $name, $options, $setting['value'], 'smallfont'); } else { print_input_row($description, $name, $setting['value']); } break; case 'username': if (intval($setting['value']) and $userinfo = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($setting['value']))) { print_input_row($description, $name, $userinfo['username'], false); } else { print_input_row($description, $name); } break; case 'usergroup': $usergrouplist = array(); foreach ($vbulletin->usergroupcache as $usergroup) { $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title']; } if ($size > 1) { print_select_row($description, $name . '[]', array(0 => '') + $usergrouplist, unserialize($setting['value']), false, $size, true); } else { print_select_row($description, $name, $usergrouplist, $setting['value']); } break; case 'usergroupextra': $usergrouplist = fetch_piped_options($setting['optiondata']); foreach ($vbulletin->usergroupcache as $usergroup) { $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title']; } print_select_row($description, $name, $usergrouplist, $setting['value']); break; // arbitrary number of <input type="text" /> // arbitrary number of <input type="text" /> case 'multiinput': $setting['html'] = "<div id=\"ctrl_{$setting['varname']}\"><fieldset id=\"multi_input_fieldset_{$setting['varname']}\" style=\"padding:4px\">"; $setting['values'] = unserialize($setting['value']); $setting['values'] = is_array($setting['values']) ? $setting['values'] : array(); $setting['values'][] = ''; foreach ($setting['values'] as $key => $value) { $setting['html'] .= "<div id=\"multi_input_container_{$setting['varname']}_{$key}\">" . ($key + 1) . " <input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$key}]\" id=\"multi_input_{$setting['varname']}_{$key}\" size=\"40\" value=\"" . htmlspecialchars_uni($value) . "\" tabindex=\"1\" /></div>"; } $i = sizeof($setting['values']); if ($i == 0) { $setting['html'] .= "<div><input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$i}]\" size=\"40\" tabindex=\"1\" /></div>"; } $setting['html'] .= "\n\t\t\t\t</fieldset>\n\t\t\t\t<div class=\"smallfont\"><a href=\"#\" onclick=\"return multi_input['{$setting['varname']}'].add()\">Add Another Option</a></div>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t<!--\n\t\t\t\tmulti_input['{$setting['varname']}'] = new vB_Multi_Input('{$setting['varname']}', {$i}, '" . $vbulletin->options['cpstylefolder'] . "');\n\t\t\t\t//-->\n\t\t\t\t</script>\n\t\t\t"; print_label_row($description, $setting['html']); break; // default registration options // default registration options case 'defaultregoptions': $setting['value'] = intval($setting['value']); $checkbox_options = array('receiveemail' => 'display_email', 'adminemail' => 'receive_admin_emails', 'invisiblemode' => 'invisible_mode', 'vcard' => 'allow_vcard_download', 'signature' => 'display_signatures', 'avatar' => 'display_avatars', 'image' => 'display_images', 'showreputation' => 'display_reputation', 'enablepm' => 'receive_private_messages', 'emailonpm' => 'send_notification_email_when_a_private_message_is_received', 'pmpopup' => 'pop_up_notification_box_when_a_private_message_is_received'); $setting['value'] = intval($setting['value']); $setting['html'] = ''; #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>"; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($checkbox_options as $key => $phrase) { $value = $vbulletin->bf_misc_regoptions["{$key}"]; $setting['html'] .= "<table style=\"width:175px; float:{$stylevar['left']}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($phrase) . "</label></td>\r\n</tr></table>\r\n"; } #$setting['html'] .= "</fieldset>"; print_label_row($description, $setting['html'], '', 'top', $name, 40); break; // cp folder options // cp folder options case 'cpstylefolder': if ($folders = fetch_cpcss_options() and !empty($folders)) { print_select_row($description, $name, $folders, $setting['value'], 1, 6); } else { print_input_row($description, $name, $setting['value'], 1, 40); } break; // cookiepath / cookiedomain options // cookiepath / cookiedomain options case 'cookiepath': case 'cookiedomain': $func = 'fetch_valid_' . $setting['optioncode'] . 's'; $cookiesettings = $func($setting['optioncode'] == 'cookiepath' ? $vbulletin->script : $_SERVER['HTTP_HOST'], $vbphrase['blank']); $setting['found'] = in_array($setting['value'], array_keys($cookiesettings)); $setting['html'] = "\n\t\t\t<div id=\"ctrl_{$setting['varname']}\">\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['suggested_settings']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<select name=\"setting[{$setting['varname']}]\" tabindex=\"1\" class=\"bginput\">" . construct_select_options($cookiesettings, $setting['value']) . "\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<br />\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['custom_setting']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<label for=\"{$settingid}o\"><input type=\"checkbox\" id=\"{$settingid}o\" name=\"setting[{$settingid}_other]\" tabindex=\"1\" value=\"1\"" . ($setting['found'] ? '' : ' checked="checked"') . " />{$vbphrase['use_custom_setting']}\n\t\t\t\t\t</label><br />\n\t\t\t\t\t<input type=\"text\" class=\"bginput\" size=\"25\" name=\"setting[{$settingid}_value]\" value=\"" . ($setting['found'] ? '' : $setting['value']) . "\" />\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t</div>"; print_label_row($description, $setting['html'], '', 'top', $name, 50); break; // just a label // just a label default: $handled = false; ($hook = vBulletinHook::fetch_hook('admin_options_print')) ? eval($hook) : false; if (!$handled) { eval("\$right = \"<div id=\\\"ctrl_setting[{$setting['varname']}]\\\">{$setting['optioncode']}</div>\";"); print_label_row($description, $right, '', 'top', $name, 50); } break; } echo "</tbody>\r\n"; $valid = exec_setting_validation_code($setting['varname'], $setting['value'], $setting['validationcode']); echo "<tbody id=\"tbody_error_{$settingid}\" style=\"display:" . (($valid === 1 or $valid === true) ? 'none' : '') . "\"><tr><td class=\"alt1 smallfont\" colspan=\"2\"><div style=\"padding:4px; border:solid 1px red; background-color:white; color:black\"><strong>{$vbphrase['error']}</strong>:<div id=\"span_error_{$settingid}\">{$valid}</div></div></td></tr></tbody>"; }
} if ($profilefield['description']) { print_textarea_row($vbphrase['description'] . $extra . '<dfn>' . construct_link_code($vbphrase['translations'], "phrase.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&fieldname=cprofilefield&varname={$profilefield['descvarname']}&t=1", 1) . '</dfn>', 'description', $profilefield['description']); } else { print_textarea_row($vbphrase['description'] . $extra, 'description'); } $pfcs = array(0 => '(' . $vbphrase['uncategorized'] . ')'); $pfcs_result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "profilefieldcategory ORDER BY displayorder"); while ($pfc = $db->fetch_array($pfcs_result)) { $pfcs["{$pfc['profilefieldcategoryid']}"] = $vbphrase['category' . $pfc['profilefieldcategoryid'] . '_title']; } $db->free_result($pfcs_result); if (!$pfcs[$profilefield['profilefieldcategoryid']]) { $profilefield['profilefieldcategoryid'] = 0; } print_radio_row($vbphrase['profile_field_category'], 'profilefield[profilefieldcategoryid]', $pfcs, $profilefield['profilefieldcategoryid']); if ($vbulletin->GPC['type'] == 'input') { print_input_row($vbphrase['default_value_you_may_specify_a_default_registration_value'], 'profilefield[data]', $profilefield['data'], 0); } if ($vbulletin->GPC['type'] == 'textarea') { print_textarea_row($vbphrase['default_value_you_may_specify_a_default_registration_value'], 'profilefield[data]', $profilefield['data'], 10, 40, 0); } if ($vbulletin->GPC['type'] == 'textarea' or $vbulletin->GPC['type'] == 'input') { print_input_row($vbphrase['max_length_of_allowed_user_input'], 'profilefield[maxlength]', $profilefield['maxlength']); print_input_row($vbphrase['field_length'], 'profilefield[size]', $profilefield['size']); } if ($vbulletin->GPC['type'] == 'textarea') { print_input_row($vbphrase['text_area_height'], 'profilefield[height]', $profilefield['height']); } if ($vbulletin->GPC['type'] == 'select') { print_textarea_row(construct_phrase($vbphrase['x_enter_the_options_that_the_user_can_choose_from'], $vbphrase['options']), 'profilefield[data]', $profilefield['data'], 10, 40, 0);
print_stop_message('test_file_write_failed', $imagepath); } } $vbulletin->input->clean_array_gpc('r', array('groupiconpath' => TYPE_STR, 'groupiconurl' => TYPE_STR, 'dowhat' => TYPE_STR)); // ###################### Swap from database to file system and vice versa ########## if ($_REQUEST['do'] == 'storage') { if ($vbulletin->options['usefilegroupicon']) { print_form_header('socialgroup_icon', 'switchtype'); print_table_header("{$vbphrase['storage_type']}: <span class=\"normal\">{$vbphrase['social_group_icons']}</span>"); print_description_row(construct_phrase($vbphrase['group_icons_are_currently_being_served_from_the_filesystem_at_x'], '<b>' . $vbulletin->options['groupiconpath'] . '</b>')); print_table_break(); print_table_header(' '); print_radio_row($vbphrase['move_group_icons_from_filesystem_into_database'], 'dowhat', array('FS_to_DB' => ''), 'FS_to_DB'); print_table_break(); print_table_header(' '); print_radio_row($vbphrase['move_group_icons_to_a_different_directory'], 'dowhat', array('FS_to_FS' => '')); print_submit_row($vbphrase['go'], 0); } else { $vbulletin->GPC['dowhat'] = 'DB_to_FS'; $_REQUEST['do'] = 'switchtype'; } } // ###################### Swap from database to file system and vice versa ########## if ($_REQUEST['do'] == 'switchtype') { if ($vbulletin->GPC['dowhat'] == 'FS_to_DB') { // redirect straight through to image mover $vbulletin->GPC['groupiconpath'] = $vbulletin->options['groupiconpath']; $vbulletin->GPC['groupiconurl'] = $vbulletin->options['groupiconurl']; $_POST['do'] = 'doswitchtype'; } else { // show a form to allow user to specify file path
print_yes_no_row($vbphrase['allow_comments_to_be_posted'], 'blog[options][allowcomments]', $blog['allowcomments']); print_yes_no_row($vbphrase['moderate_comments_before_displaying'], 'blog[options][moderatecomments]', $blog['moderatecomments']); print_yes_no_row($vbphrase['allow_trackback_pingback'], 'blog[options][allowpingback]', $blog['allowpingback']); print_yes_no_row($vbphrase['show_others_custom_blog_style'], 'user[showblogcss]', $user['showblogcss']); print_input_row($vbphrase['wordpress_api_key'], 'blog[akismet_key]', $blog['akismet_key']); print_radio_row("$vbphrase[default_subscription_mode] $vbphrase[blog_entries]", 'blog[subscribeown]', array( 'none' => $vbphrase['subscribe_choice_none'], 'usercp' => $vbphrase['subscribe_choice_0'], 'email' => $vbphrase['subscribe_choice_1'], ), $blog['subscribeown'], 'smallfont'); print_radio_row("$vbphrase[default_subscription_mode] $vbphrase[blog_comments]", 'blog[subscribeothers]', array( 'none' => $vbphrase['subscribe_choice_none'], 'usercp' => $vbphrase['subscribe_choice_0'], 'email' => $vbphrase['subscribe_choice_1'], ), $blog['subscribeothers'], 'smallfont'); print_label_row($vbphrase['members_on_buddy_list_may'], "<span class=\"smallfont\"> <label><input type=\"checkbox\" name=\"blog[options_buddy][canviewmyblog]\" $checked[buddy_canviewmyblog] value=\"1\" />$vbphrase[view_blog]</label><br /> <label><input type=\"checkbox\" name=\"blog[options_buddy][cancommentmyblog]\" $checked[buddy_cancommentmyblog] value=\"1\" />$vbphrase[leave_comments_on_blog_entries]</label></span>" ); print_label_row($vbphrase['members_on_ignore_list_may'], "<span class=\"smallfont\"> <label><input type=\"checkbox\" name=\"blog[options_ignore][canviewmyblog]\" $checked[ignore_canviewmyblog] value=\"1\" />$vbphrase[view_blog]</label><br /> <label><input type=\"checkbox\" name=\"blog[options_ignore][cancommentmyblog]\" $checked[ignore_cancommentmyblog] value=\"1\" />$vbphrase[leave_comments_on_blog_entries]</label><br /></span>" );
/** * Prints a setting row for use in options.php?do=options * * @param array Settings array * @param array Phrases */ function print_setting_row($setting, $settingphrase, $option_config = true, $userContext = false) { global $vbulletin, $bgcounter, $vbphrase; $settingid = $setting['varname']; if (empty($userContext)) { $userContext = vB::getUserContext(); } echo '<tbody>'; $vb5_config = vB::getConfig(); print_description_row(iif($vb5_config['Misc']['debug'] and $option_config and $userContext->hasAdminPermission('canadminsettingsall'), '<div class="smallfont" style="float:' . vB_Template_Runtime::fetchStyleVar('right') . '">' . construct_link_code($vbphrase['edit'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=editsetting&varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=removesetting&varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vb5_config['Misc']['debug'] ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : '')); echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n"; // make sure all rows use the alt1 class $bgcounter--; $description = "<div class=\"smallfont\"" . ($vb5_config['Misc']['debug'] ? " title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>'; $name = "setting[{$setting['varname']}]"; $right = "<span class=\"smallfont\">{$vbphrase['error']}</span>"; $width = 40; $rows = 8; if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) { $width = $matches[1]; $setting['optioncode'] = ''; } else { if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) { $rows = $matches[1]; if ($matches[2]) { $width = $matches[3]; } $setting['optioncode'] = 'textarea'; } else { if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'bitfield'; $setting['bitfield'] =& fetch_bitfield_definitions($matches[1]); } else { if (preg_match('#^(select|selectmulti|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = "{$matches['1']}:{$matches['2']}"; $setting['optiondata'] = trim($matches[4]); } else { if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) { $size = intval($matches[1]); $setting['optioncode'] = 'usergroup'; } else { if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'usergroupextra'; $setting['optiondata'] = trim($matches[3]); } else { if (preg_match('#^profilefield:?([a-z0-9,;=]*)(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'profilefield'; $setting['optiondata'] = array('constraints' => trim($matches[1]), 'extraoptions' => trim($matches[2])); } } } } } } } // Make setting's value the default value if it's null if ($setting['value'] === NULL) { $setting['value'] = $setting['defaultvalue']; } switch ($setting['optioncode']) { // input type="text" case '': print_input_row($description, $name, $setting['value'], 1, $width); break; // input type="radio" // input type="radio" case 'yesno': print_yes_no_row($description, $name, $setting['value']); break; // textarea // textarea case 'textarea': print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%"); break; // bitfield // bitfield case 'bitfield': $setting['value'] = intval($setting['value']); $setting['html'] = ''; if ($setting['bitfield'] === NULL) { print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40); } else { #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>"; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($setting['bitfield'] as $key => $value) { $value = intval($value); $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n"; } $setting['html'] .= "</div>\r\n"; #$setting['html'] .= "</fieldset>"; print_label_row($description, $setting['html'], '', 'top', $name, 40); } break; // select:piped // select:piped case 'select:piped': print_select_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value']); break; // radio:piped // radio:piped case 'radio:piped': print_radio_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value'], 'smallfont'); break; // select:eval // select:eval case 'select:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_select_row($description, $name, $options, $setting['value'], true); } else { print_input_row($description, $name, $setting['value']); } break; // select:eval // select:eval case 'selectmulti:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_select_row($description, $name . '[]', $options, $setting['value'], false, 5, true); } else { print_input_row($description, $name, $setting['value']); } break; // radio:eval // radio:eval case 'radio:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_radio_row($description, $name, $options, $setting['value'], 'smallfont'); } else { print_input_row($description, $name, $setting['value']); } break; case 'username': $userinfo = vB::getDbAssertor()->assertQuery('user', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'userid' => $setting['value'])); if (intval($setting['value']) and $userinfo and $userinfo->valid()) { $userInfo = $userinfo->current(); print_input_row($description, $name, $userInfo['username'], false); } else { print_input_row($description, $name); } break; case 'usergroup': $usergrouplist = array(); $usergroupcache = vB::getDatastore()->get_value('usergroupcache'); foreach ($usergroupcache as $usergroup) { $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title']; } if ($size > 1) { print_select_row($description, $name . '[]', array(0 => '') + $usergrouplist, unserialize($setting['value']), false, $size, true); } else { print_select_row($description, $name, $usergrouplist, $setting['value']); } break; case 'usergroupextra': $usergrouplist = fetch_piped_options($setting['optiondata']); $usergroupcache = vB::getDatastore()->get_value('usergroupcache'); foreach ($usergroupcache as $usergroup) { $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title']; } print_select_row($description, $name, $usergrouplist, $setting['value']); break; case 'profilefield': static $profilefieldlistcache = array(); $profilefieldlisthash = md5(serialize($setting['optiondata'])); if (!isset($profilefieldlistcache[$profilefieldlisthash])) { $profilefieldlist = fetch_piped_options($setting['optiondata']['extraoptions']); $constraints = preg_split('#;#', $setting['optiondata']['constraints'], -1, PREG_SPLIT_NO_EMPTY); //$where = array(); $conditions = array(); foreach ($constraints as $constraint) { $constraint = explode('=', $constraint); switch ($constraint[0]) { case 'editablegt': //$where[] = 'editable > ' . intval($constraint[1]); $conditions[] = array('field' => 'editable', 'value' => intval($constraint[1]), 'operator' => vB_dB_Query::OPERATOR_GT); break; case 'types': $constraint[1] = preg_split('#,#', $constraint[1], -1, PREG_SPLIT_NO_EMPTY); if (!empty($constraint[1])) { $conditions[] = array('field' => 'type', 'value' => $constraint[1], 'operator' => vB_dB_Query::OPERATOR_EQ); } break; } } $profilefields = vB::getDbAssertor()->assertQuery('vBForum:profilefield', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => $conditions), array('field' => 'displayorder', 'direction' => vB_dB_Query::SORT_ASC)); foreach ($profilefields as $profilefield) { $fieldname = "field{$profilefield['profilefieldid']}"; $profilefieldlist[$fieldname] = construct_phrase($vbphrase['profilefield_x_fieldid_y'], fetch_phrase_from_key("{$fieldname}_title"), $fieldname); } $profilefieldlistcache[$profilefieldlisthash] = $profilefieldlist; unset($profilefieldlist, $constraints, $constraint, $where, $profilefields, $profilefield, $fieldname); } print_select_row($description, $name, $profilefieldlistcache[$profilefieldlisthash], $setting['value']); break; // arbitrary number of <input type="text" /> // arbitrary number of <input type="text" /> case 'multiinput': $setting['html'] = "<div id=\"ctrl_{$setting['varname']}\"><fieldset id=\"multi_input_fieldset_{$setting['varname']}\" style=\"padding:4px\">"; $setting['values'] = unserialize($setting['value']); $setting['values'] = is_array($setting['values']) ? $setting['values'] : array(); $setting['values'][] = ''; foreach ($setting['values'] as $key => $value) { $setting['html'] .= "<div id=\"multi_input_container_{$setting['varname']}_{$key}\">" . ($key + 1) . " <input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$key}]\" id=\"multi_input_{$setting['varname']}_{$key}\" size=\"40\" value=\"" . htmlspecialchars_uni($value) . "\" tabindex=\"1\" /></div>"; } $i = sizeof($setting['values']); if ($i == 0) { $setting['html'] .= "<div><input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$i}]\" size=\"40\" tabindex=\"1\" /></div>"; } $setting['html'] .= "\n\t\t\t\t</fieldset>\n\t\t\t\t<div class=\"smallfont\"><a href=\"#\" onclick=\"return multi_input['{$setting['varname']}'].add()\">Add Another Option</a></div>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t<!--\n\t\t\t\tmulti_input['{$setting['varname']}'] = new vB_Multi_Input('{$setting['varname']}', {$i}, '" . vB::getDatastore()->getOption('cpstylefolder') . "');\n\t\t\t\t//-->\n\t\t\t\t</script>\n\t\t\t"; print_label_row($description, $setting['html']); break; // default registration options // default registration options case 'defaultregoptions': $setting['value'] = intval($setting['value']); $checkbox_options = array('receiveemail' => 'display_email_gcpuser', 'adminemail' => 'receive_admin_emails_guser', 'invisiblemode' => 'invisible_mode_guser', 'vcard' => 'allow_vcard_download_guser', 'signature' => 'display_signatures_gcpuser', 'avatar' => 'display_avatars_gcpuser', 'image' => 'display_images_gcpuser', 'showreputation' => 'display_reputation_gcpuser', 'enablepm' => 'receive_private_messages_guser', 'emailonpm' => 'send_notification_email_when_a_private_message_is_received_guser', 'pmpopup' => 'pop_up_notification_box_when_a_private_message_is_received'); $setting['value'] = intval($setting['value']); $setting['html'] = ''; #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>"; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($checkbox_options as $key => $phrase) { $bf_misc_regoptions = vB::getDatastore()->getValue('bf_misc_regoptions'); $value = $bf_misc_regoptions["{$key}"]; $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($phrase) . "</label></td>\r\n</tr></table>\r\n"; } #$setting['html'] .= "</fieldset>"; print_label_row($description, $setting['html'], '', 'top', $name, 40); break; // cp folder options // cp folder options case 'cpstylefolder': if ($folders = fetch_cpcss_options() and !empty($folders)) { print_select_row($description, $name, $folders, $setting['value'], 1, 6); } else { print_input_row($description, $name, $setting['value'], 1, 40); } break; // cookiepath / cookiedomain options // cookiepath / cookiedomain options case 'cookiepath': case 'cookiedomain': $func = 'fetch_valid_' . $setting['optioncode'] . 's'; $cookiesettings = $func($setting['optioncode'] == 'cookiepath' ? $vbulletin->script : $_SERVER['HTTP_HOST'], $vbphrase['blank']); $setting['found'] = in_array($setting['value'], array_keys($cookiesettings)); $setting['html'] = "\n\t\t\t<div id=\"ctrl_{$setting['varname']}\">\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['suggested_settings']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<select name=\"setting[{$setting['varname']}]\" tabindex=\"1\" class=\"bginput\">" . construct_select_options($cookiesettings, $setting['value']) . "\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<br />\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['custom_setting']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<label for=\"{$settingid}o\"><input type=\"checkbox\" id=\"{$settingid}o\" name=\"setting[{$settingid}_other]\" tabindex=\"1\" value=\"1\"" . ($setting['found'] ? '' : ' checked="checked"') . " />{$vbphrase['use_custom_setting']}\n\t\t\t\t\t</label><br />\n\t\t\t\t\t<input type=\"text\" class=\"bginput\" size=\"25\" name=\"setting[{$settingid}_value]\" value=\"" . ($setting['found'] ? '' : $setting['value']) . "\" />\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t</div>"; print_label_row($description, $setting['html'], '', 'top', $name, 50); break; case 'forums:all': $array = construct_forum_chooser_options(-1, $vbphrase['all']); $size = sizeof($array); $vbphrase['forum_is_closed_for_posting'] = $vbphrase['closed']; print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true); break; case 'forums:none': $array = construct_forum_chooser_options(0, $vbphrase['none']); $size = sizeof($array); $vbphrase['forum_is_closed_for_posting'] = $vbphrase['closed']; print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true); break; // just a label // just a label default: $handled = false; // Legacy Hook 'admin_options_print' Removed // if (!$handled) { eval("\$right = \"<div id=\\\"ctrl_setting[{$setting['varname']}]\\\">{$setting['optioncode']}</div>\";"); print_label_row($description, $right, '', 'top', $name, 50); } break; } echo "</tbody>\r\n"; $valid = exec_setting_validation_code($setting['varname'], $setting['value'], $setting['validationcode']); echo "<tbody id=\"tbody_error_{$settingid}\" style=\"display:" . (($valid === 1 or $valid === true) ? 'none' : '') . "\"><tr><td class=\"alt1 smallfont\" colspan=\"2\"><div style=\"padding:4px; border:solid 1px red; background-color:white; color:black\"><strong>{$vbphrase['error']}</strong>:<div id=\"span_error_{$settingid}\">{$valid}</div></div></td></tr></tbody>"; }
/** * Prints a setting row for use in options.php?do=options * * @param array Settings array * @param array Phrases */ function print_setting_row($setting, $settingphrase, $option_config = true) { global $vbulletin, $vbphrase, $bgcounter, $settingphrase; $settingid = $setting['varname']; echo '<tbody>'; print_description_row(iif($vbulletin->debug and $option_config, '<div class="smallfont" style="float:' . vB_Template_Runtime::fetchStyleVar('right') . '">' . construct_link_code($vbphrase['edit'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=editsetting&varname={$setting['varname']}") . construct_link_code($vbphrase['delete'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=removesetting&varname={$setting['varname']}") . '</div>') . '<div>' . $settingphrase["setting_{$setting['varname']}_title"] . "<a name=\"{$setting['varname']}\"></a></div>", 0, 2, 'optiontitle' . ($vbulletin->debug ? "\" title=\"\$vbulletin->options['" . $setting['varname'] . "']" : '')); echo "</tbody><tbody id=\"tbody_{$settingid}\">\r\n"; // make sure all rows use the alt1 class $bgcounter--; $description = "<div class=\"smallfont\"" . ($vbulletin->debug ? "title=\"\$vbulletin->options['{$setting['varname']}']\"" : '') . ">" . $settingphrase["setting_{$setting['varname']}_desc"] . '</div>'; $name = "setting[{$setting['varname']}]"; $right = "<span class=\"smallfont\">{$vbphrase['error']}</span>"; $width = 40; $rows = 8; if (preg_match('#^input:?(\\d+)$#s', $setting['optioncode'], $matches)) { $width = $matches[1]; $setting['optioncode'] = ''; } else { if (preg_match('#^textarea:?(\\d+)(,(\\d+))?$#s', $setting['optioncode'], $matches)) { $rows = $matches[1]; if ($matches[2]) { $width = $matches[3]; } $setting['optioncode'] = 'textarea'; } else { if (preg_match('#^bitfield:(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'bitfield'; $setting['bitfield'] =& fetch_bitfield_definitions($matches[1]); } else { if (preg_match('#^(select|selectmulti|radio):(piped|eval)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = "{$matches['1']}:{$matches['2']}"; $setting['optiondata'] = trim($matches[4]); } else { if (preg_match('#^usergroup:?(\\d+)$#s', $setting['optioncode'], $matches)) { $size = intval($matches[1]); $setting['optioncode'] = 'usergroup'; } else { if (preg_match('#^(usergroupextra)(\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'usergroupextra'; $setting['optiondata'] = trim($matches[3]); } else { if (preg_match('#^profilefield:?([a-z0-9,;=]*)(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'profilefield'; $setting['optiondata'] = array('constraints' => trim($matches[1]), 'extraoptions' => trim($matches[2])); } else { if (preg_match('#^apipostidmanage(?:\\r\\n|\\n|\\r)(.*)$#siU', $setting['optioncode'], $matches)) { $setting['optioncode'] = 'apipostidmanage'; $setting['optiondata'] = preg_split("#(\r\n|\n|\r)#s", $matches[1], -1, PREG_SPLIT_NO_EMPTY); } } } } } } } } switch ($setting['optioncode']) { // input type="text" case '': print_input_row($description, $name, $setting['value'], 1, $width); break; // input type="radio" // input type="radio" case 'yesno': print_yes_no_row($description, $name, $setting['value']); break; // textarea // textarea case 'textarea': print_textarea_row($description, $name, $setting['value'], $rows, "{$width}\" style=\"width:90%"); break; // bitfield // bitfield case 'bitfield': $setting['value'] = intval($setting['value']); $setting['html'] = ''; if ($setting['bitfield'] === NULL) { print_label_row($description, construct_phrase("<strong>{$vbphrase['settings_bitfield_error']}</strong>", implode(',', vB_Bitfield_Builder::fetch_errors())), '', 'top', $name, 40); } else { #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>"; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($setting['bitfield'] as $key => $value) { $value = intval($value); $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n"; } $setting['html'] .= "</div>\r\n"; #$setting['html'] .= "</fieldset>"; print_label_row($description, $setting['html'], '', 'top', $name, 40); } break; // select:piped // select:piped case 'select:piped': print_select_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value']); break; // radio:piped // radio:piped case 'radio:piped': print_radio_row($description, $name, fetch_piped_options($setting['optiondata']), $setting['value'], 'smallfont'); break; // select:eval // select:eval case 'select:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_select_row($description, $name, $options, $setting['value']); } else { print_input_row($description, $name, $setting['value']); } break; // select:eval // select:eval case 'selectmulti:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_select_row($description, $name . '[]', $options, $setting['value'], false, 5, true); } else { print_input_row($description, $name, $setting['value']); } break; // radio:eval // radio:eval case 'radio:eval': $options = null; eval($setting['optiondata']); if (is_array($options) and !empty($options)) { print_radio_row($description, $name, $options, $setting['value'], 'smallfont'); } else { print_input_row($description, $name, $setting['value']); } break; case 'username': if (intval($setting['value']) and $userinfo = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = " . intval($setting['value']))) { print_input_row($description, $name, $userinfo['username'], false); } else { print_input_row($description, $name); } break; case 'usergroup': $usergrouplist = array(); foreach ($vbulletin->usergroupcache as $usergroup) { $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title']; } if ($size > 1) { print_select_row($description, $name . '[]', array(0 => '') + $usergrouplist, unserialize($setting['value']), false, $size, true); } else { print_select_row($description, $name, $usergrouplist, $setting['value']); } break; case 'usergroupextra': $usergrouplist = fetch_piped_options($setting['optiondata']); foreach ($vbulletin->usergroupcache as $usergroup) { $usergrouplist["{$usergroup['usergroupid']}"] = $usergroup['title']; } print_select_row($description, $name, $usergrouplist, $setting['value']); break; case 'profilefield': static $profilefieldlistcache = array(); $profilefieldlisthash = md5(serialize($setting['optiondata'])); if (!isset($profilefieldlistcache[$profilefieldlisthash])) { $profilefieldlist = fetch_piped_options($setting['optiondata']['extraoptions']); $constraints = preg_split('#;#', $setting['optiondata']['constraints'], -1, PREG_SPLIT_NO_EMPTY); $where = array(); foreach ($constraints as $constraint) { $constraint = explode('=', $constraint); switch ($constraint[0]) { case 'editablegt': $where[] = 'editable > ' . intval($constraint[1]); break; case 'types': $constraint[1] = preg_split('#,#', $constraint[1], -1, PREG_SPLIT_NO_EMPTY); if (!empty($constraint[1])) { $where[] = "type IN('" . implode("', '", array_map(array($vbulletin->db, 'escape_string'), $constraint[1])) . "')"; } break; } } $profilefields = $vbulletin->db->query_read_slave("\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM " . TABLE_PREFIX . "profilefield\n\t\t\t\t\t" . (!empty($where) ? 'WHERE ' . implode(' AND ', $where) : '') . "\n\t\t\t\t\tORDER BY displayorder\n\t\t\t\t"); while ($profilefield = $vbulletin->db->fetch_array($profilefields)) { $fieldname = "field{$profilefield['profilefieldid']}"; $profilefieldlist[$fieldname] = construct_phrase($vbphrase['profilefield_x_fieldid_y'], fetch_phrase_from_key("{$fieldname}_title"), $fieldname); } $profilefieldlistcache[$profilefieldlisthash] = $profilefieldlist; unset($profilefieldlist, $constraints, $constraint, $where, $profilefields, $profilefield, $fieldname); } print_select_row($description, $name, $profilefieldlistcache[$profilefieldlisthash], $setting['value']); break; // arbitrary number of <input type="text" /> // arbitrary number of <input type="text" /> case 'multiinput': $setting['html'] = "<div id=\"ctrl_{$setting['varname']}\"><fieldset id=\"multi_input_fieldset_{$setting['varname']}\" style=\"padding:4px\">"; $setting['values'] = unserialize($setting['value']); $setting['values'] = is_array($setting['values']) ? $setting['values'] : array(); $setting['values'][] = ''; foreach ($setting['values'] as $key => $value) { $setting['html'] .= "<div id=\"multi_input_container_{$setting['varname']}_{$key}\">" . ($key + 1) . " <input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$key}]\" id=\"multi_input_{$setting['varname']}_{$key}\" size=\"40\" value=\"" . htmlspecialchars_uni($value) . "\" tabindex=\"1\" /></div>"; } $i = sizeof($setting['values']); if ($i == 0) { $setting['html'] .= "<div><input type=\"text\" class=\"bginput\" name=\"setting[{$setting['varname']}][{$i}]\" size=\"40\" tabindex=\"1\" /></div>"; } $setting['html'] .= "\n\t\t\t\t</fieldset>\n\t\t\t\t<div class=\"smallfont\"><a href=\"#\" onclick=\"return multi_input['{$setting['varname']}'].add()\">Add Another Option</a></div>\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t<!--\n\t\t\t\tmulti_input['{$setting['varname']}'] = new vB_Multi_Input('{$setting['varname']}', {$i}, '" . $vbulletin->options['cpstylefolder'] . "');\n\t\t\t\t//-->\n\t\t\t\t</script>\n\t\t\t"; print_label_row($description, $setting['html']); break; // activity stream options // activity stream options case 'activitystream': $options = array(); $activities = $vbulletin->db->query_read("\n\t\t\t\tSELECT\n\t\t\t\t\ttypeid, section, type, enabled\n\t\t\t\tFROM " . TABLE_PREFIX . "activitystreamtype AS a\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "package AS p ON (p.packageid = a.packageid)\n\t\t\t\tORDER BY section, type\n\t\t\t"); while ($activity = $vbulletin->db->fetch_array($activities)) { $options["{$activity['section']}_{$activity['type']}"] = $activity; } $setting['html'] = ''; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($options as $key => $activity) { $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$activity['typeid']}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"1\"" . ($activity['enabled'] ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($key) . "</label></td>\r\n</tr></table>\r\n"; } print_label_row($description, $setting['html'], '', 'top', $name, 40); break; // default registration options // default registration options case 'defaultregoptions': $setting['value'] = intval($setting['value']); $checkbox_options = array('receiveemail' => 'display_email', 'adminemail' => 'receive_admin_emails', 'invisiblemode' => 'invisible_mode', 'vcard' => 'allow_vcard_download', 'signature' => 'display_signatures', 'avatar' => 'display_avatars', 'image' => 'display_images', 'showreputation' => 'display_reputation', 'enablepm' => 'receive_private_messages', 'emailonpm' => 'send_notification_email_when_a_private_message_is_received', 'pmpopup' => 'pop_up_notification_box_when_a_private_message_is_received'); $setting['value'] = intval($setting['value']); $setting['html'] = ''; #$setting['html'] .= "<fieldset><legend>$vbphrase[yes] / $vbphrase[no]</legend>"; $setting['html'] .= "<div id=\"ctrl_setting[{$setting['varname']}]\" class=\"smallfont\">\r\n"; $setting['html'] .= "<input type=\"hidden\" name=\"setting[{$setting['varname']}][0]\" value=\"0\" />\r\n"; foreach ($checkbox_options as $key => $phrase) { $value = $vbulletin->bf_misc_regoptions["{$key}"]; $setting['html'] .= "<table style=\"width:175px; float:" . vB_Template_Runtime::fetchStyleVar('left') . "\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr valign=\"top\">\n\t\t\t\t<td><input type=\"checkbox\" name=\"setting[{$setting['varname']}][{$value}]\" id=\"setting[{$setting['varname']}]_{$key}\" value=\"{$value}\"" . ($setting['value'] & $value ? ' checked="checked"' : '') . " /></td>\n\t\t\t\t<td width=\"100%\" style=\"padding-top:4px\"><label for=\"setting[{$setting['varname']}]_{$key}\" class=\"smallfont\">" . fetch_phrase_from_key($phrase) . "</label></td>\r\n</tr></table>\r\n"; } #$setting['html'] .= "</fieldset>"; print_label_row($description, $setting['html'], '', 'top', $name, 40); break; // cp folder options // cp folder options case 'cpstylefolder': if ($folders = fetch_cpcss_options() and !empty($folders)) { print_select_row($description, $name, $folders, $setting['value'], 1, 6); } else { print_input_row($description, $name, $setting['value'], 1, 40); } break; case 'apipostidmanage': $setting['html'] = "<div id=\"ctrl_apipostidmanage\"><fieldset id=\"multi_input_fieldset_apipostidmanage}\" style=\"padding:4px\">"; $setting['values'] = unserialize($setting['value']); $setting['values'] = is_array($setting['values']) ? $setting['values'] : array(); $setting['html'] .= "\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<span style=\"display:block\">{$vbphrase['apipostidmanage_enable']}</span>\n\t\t\t\t\t<label for=\"multi_input_apipostidmanage_enable1\" />\n\t\t\t\t\t\t<input type=\"radio\"" . ($setting['values']['enable'] ? ' checked="checked" ' : '') . "class=\"bginput\" name=\"setting[apipostidmanage][enable]\" id=\"multi_input_apipostidmanage_enable1\" value=\"1\" tabindex=\"1\" />\n\t\t\t\t\t\t{$vbphrase['yes']}\n\t\t\t\t\t</label>\n\t\t\t\t\t<label for=\"multi_input_{$setting['varname']}_enable2\" />\n\t\t\t\t\t\t<input type=\"radio\"" . (!$setting['values']['enable'] ? ' checked="checked" ' : '') . "class=\"bginput\" name=\"setting[apipostidmanage][enable]\" id=\"multi_input_apipostidmanage_enable2\" value=\"0\" tabindex=\"1\" />\n\t\t\t\t\t\t{$vbphrase['no']}\n\t\t\t\t\t</label>\n\t\t\t\t</div>"; foreach ($setting['optiondata'] as $device) { if (!$vbphrase['apipostidmanage_' . $device]) { continue; } $setting['html'] .= "<div style=\"padding:4px\">\n\t\t\t\t\t<span style=\"display:block\">" . $vbphrase['apipostidmanage_' . $device] . "</span>\n\t\t\t\t\t<input type=\"text\" class=\"bginput\" name=\"setting[apipostidmanage][{$device}]\" id=\"multi_input_apipostidmanage_{$device}\" size=\"50\" value=\"" . htmlspecialchars_uni($setting['values'][$device]) . "\" tabindex=\"1\" />\n\t\t\t\t</div>"; } $setting['html'] .= "</fieldset></div>"; print_label_row($description, $setting['html'], '', 'top', 'apipostidmanage'); break; break; // cookiepath / cookiedomain options // cookiepath / cookiedomain options case 'cookiepath': case 'cookiedomain': $func = 'fetch_valid_' . $setting['optioncode'] . 's'; $cookiesettings = $func($setting['optioncode'] == 'cookiepath' ? $vbulletin->script : $_SERVER['HTTP_HOST'], $vbphrase['blank']); $setting['found'] = in_array($setting['value'], array_keys($cookiesettings)); $setting['html'] = "\n\t\t\t<div id=\"ctrl_{$setting['varname']}\">\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['suggested_settings']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<select name=\"setting[{$setting['varname']}]\" tabindex=\"1\" class=\"bginput\">" . construct_select_options($cookiesettings, $setting['value']) . "\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t<br />\n\t\t\t<fieldset>\n\t\t\t\t<legend>{$vbphrase['custom_setting']}</legend>\n\t\t\t\t<div style=\"padding:4px\">\n\t\t\t\t\t<label for=\"{$settingid}o\"><input type=\"checkbox\" id=\"{$settingid}o\" name=\"setting[{$settingid}_other]\" tabindex=\"1\" value=\"1\"" . ($setting['found'] ? '' : ' checked="checked"') . " />{$vbphrase['use_custom_setting']}\n\t\t\t\t\t</label><br />\n\t\t\t\t\t<input type=\"text\" class=\"bginput\" size=\"25\" name=\"setting[{$settingid}_value]\" value=\"" . ($setting['found'] ? '' : $setting['value']) . "\" />\n\t\t\t\t</div>\n\t\t\t</fieldset>\n\t\t\t</div>"; print_label_row($description, $setting['html'], '', 'top', $name, 50); break; case 'facebooksslcheck': require_once DIR . '/includes/class_vurl.php'; $vurl = new vB_vURL($vbulletin); $result = $vurl->test_ssl(); print_label_row($description, $result ? $vbphrase['supported'] : $vbphrase['not_supported']); break; case 'usergroups:none': $array = build_usergroup_list($vbphrase['none'], 0); $size = sizeof($array); print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true); break; case 'usergroups:all': $array = build_usergroup_list($vbphrase['all'], -1); $size = sizeof($array); print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true); break; case 'forums:all': $array = construct_forum_chooser_options(-1, $vbphrase['all']); $size = sizeof($array); $vbphrase[forum_is_closed_for_posting] = $vbphrase[closed]; print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true); break; case 'forums:none': $array = construct_forum_chooser_options(0, $vbphrase['none']); $size = sizeof($array); $vbphrase[forum_is_closed_for_posting] = $vbphrase[closed]; print_select_row($description, $name . '[]', $array, unserialize($setting['value']), false, $size > 10 ? 10 : $size, true); break; // just a label // just a label default: $handled = false; ($hook = vBulletinHook::fetch_hook('admin_options_print')) ? eval($hook) : false; if (!$handled) { eval("\$right = \"<div id=\\\"ctrl_setting[{$setting['varname']}]\\\">{$setting['optioncode']}</div>\";"); print_label_row($description, $right, '', 'top', $name, 50); } break; } echo "</tbody>\r\n"; $valid = exec_setting_validation_code($setting['varname'], $setting['value'], $setting['validationcode']); echo "<tbody id=\"tbody_error_{$settingid}\" style=\"display:" . (($valid === 1 or $valid === true) ? 'none' : '') . "\"><tr><td class=\"alt1 smallfont\" colspan=\"2\"><div style=\"padding:4px; border:solid 1px red; background-color:white; color:black\"><strong>{$vbphrase['error']}</strong>:<div id=\"span_error_{$settingid}\">{$valid}</div></div></td></tr></tbody>"; }
construct_hidden_code('item[userid]', 0); construct_hidden_code('auction', 1); construct_hidden_code('quantity', 1); print_time_row("Auction Expire Time", 'auction_exp', $item['expire_time']); } else { print_input_row("<strong style=\"color: red\">Owner UserID</strong>", 'item[userid]', $item['userid']); print_input_row("<strong style=\"color: red\">Quantity</strong><dfn>Enter 0 for unlimited</dfn>", 'quantity', 1); } if ($durations) { print_label_row($vbphrase['kbank_exp_base_duration']); print_select_row($vbphrase['kbank_item_duration'], 'duration', $durations); } else { print_radio_row('Item NEVER expires', 'forever', array(1 => 'Yes', 0 => 'No'), 0); print_time_row('Expire Date<dfn>Only work if select NO in "Item NEVER expires"</dfn>', 'exp', $item['expire_time'], false); } print_radio_row('Add Another Item', 'addmore', array(2 => 'Yes, with the same options (ItemType/Auction)', 1 => 'Yes', 0 => 'No'), 2); print_submit_row($vbphrase['add'], 0); } print_cp_footer(); } if ($_GET['do'] == "do_item_update") { $vbulletin->input->clean_array_gpc('p', array('auction' => TYPE_UINT, 'auction_exp' => TYPE_ARRAY, 'itemid' => TYPE_UINT, 'item' => TYPE_ARRAY, 'quantity' => TYPE_UINT, 'forever' => TYPE_UINT, 'exp' => TYPE_ARRAY, 'duration' => TYPE_INT, 'delete' => TYPE_UINT, 'addmore' => TYPE_UINT)); $item = $vbulletin->GPC['item']; $item['options'] = array(); $itemtype_obj = newItemType($item['type']); $itemtype = $itemtype_obj->data; if ($vbulletin->GPC['itemid']) { $edit = true; $item_obj =& newItem($vbulletin->GPC['itemid']); if (!$item_obj) { print_stop_message('kbank_no_permission');
if (!in_array($vbulletin->userinfo['userid'], preg_split('#\\s*,\\s*#s', $vbulletin->config['SpecialUsers']['superadministrators'], -1, PREG_SPLIT_NO_EMPTY))) { rpm_print_stop_back("You don't have permission to access this page."); } print_cp_header(); /////////////////////// front page if (empty($_REQUEST['do'])) { print_form_header($this_script, 'list', 0, 1, 'listForm'); print_table_header('Read PMs'); print_input_row('User ID or Username', 'userid'); print_submit_row('Read PMs', 0); print_form_header($this_script, 'havepms', 0, 1, 'resetForm'); print_submit_row('List Users with PMs', 0); print_form_header($this_script, 'search', 0, 1, 'searchForm'); print_table_header('Search for PMs'); print_textarea_row('Search for', 'search'); print_radio_row('Match', 'match', array('exact' => 'exact text', 'all' => 'all words', 'atleastone' => 'at least one of the words'), 'exact'); //print_input_row('User ID<br /><div class="smallfont"><em>optional</em></div>', 'userid'); print_submit_row('Search for PMs', 0); print_form_header($this_script, 'latest', 0, 1, 'latestForm'); print_table_header('Latest PMs'); print_input_row('Number of PMs to show', 'showlatest', '100'); print_submit_row('Latest PMs', 0); } /////////////////////// search if ($_REQUEST['do'] == 'search') { if (empty($_REQUEST['search'])) { rpm_print_stop_back('You must write what you are searching for.'); } $match = $_REQUEST['match']; $search_for = $db->escape_string($_REQUEST['search']); $pms = rpm_search_pms($search_for, $match);
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']); }
if ($_REQUEST['do'] == 'counts') { $vbulletin->input->clean_array_gpc('r', array('perpage' => TYPE_UINT, 'start' => TYPE_UINT, 'phase' => TYPE_UINT)); $photoplog_start = intval($vbulletin->GPC['start']); $photoplog_perpage = intval($vbulletin->GPC['perpage']); $photoplog_phase = intval($vbulletin->GPC['phase']); if (!$photoplog_perpage) { $photoplog_perpage = 50; } photoplog_maintain_counts($photoplog_start, $photoplog_perpage, $photoplog_phase, $photoplog_header, 'photoplog_massmove.php'); // print_cp_redirect("photoplog_massmove.php?".$vbulletin->session->vars['sessionurl']."do=view", 1); } if ($_REQUEST['do'] == 'view') { print_form_header('photoplog_massmove', 'preview'); construct_hidden_code('s', $vbulletin->session->vars['sessionhash']); print_table_header($photoplog_header, 3); print_radio_row($vbphrase['photoplog_md'], 'photoplog_md', array("1" => $vbphrase['photoplog_move'], "2" => $vbphrase['photoplog_delete']), "1"); print_table_header($vbphrase['photoplog_source'] . " " . $vbphrase['photoplog_blank_ignored'], 3); $photoplog_source_list_categories = array(); $photoplog_not_available_nonempty = photoplog_count_category_files(0); photoplog_list_categories($photoplog_source_list_categories, -1, $vbphrase['photoplog_all_categories'], $photoplog_not_available_nonempty); print_select_row($vbphrase['photoplog_category'], 'photoplog_source_category', $photoplog_source_list_categories, "-1", true, 0, false); print_yes_no_row($vbphrase['photoplog_include_subcategories'], 'photoplog_include_subcategories', "0"); print_input_row($vbphrase['photoplog_posted_by_ids'], 'photoplog_posted_by'); print_input_row($vbphrase['photoplog_title_contains'], 'photoplog_title'); print_input_row($vbphrase['photoplog_description_contains'], 'photoplog_description'); print_time_row($vbphrase['photoplog_posted_after'], 'photoplog_posted_after'); print_time_row($vbphrase['photoplog_posted_before'], 'photoplog_posted_before'); print_input_row($vbphrase['photoplog_filesize_at_least'], 'photoplog_filesize_at_least'); print_input_row($vbphrase['photoplog_filesize_at_most'], 'photoplog_filesize_at_most'); print_input_row($vbphrase['photoplog_width_at_least'], 'photoplog_width_at_least'); print_input_row($vbphrase['photoplog_width_at_most'], 'photoplog_width_at_most');
print_submit_row("Submit!"); } // ####################################################################### // ######################## START EDIT FIELD ############################ // ####################################################################### if ($_REQUEST['do'] == 'edit') { print_form_header('threadfields_admin', 'update'); $fieldid = $_REQUEST['fieldid']; $threadfield = $db->query_first("\r\n\t\tSELECT *\r\n\t\tFROM " . TABLE_PREFIX . "thread_fields_admin\r\n\t\tWHERE fieldid = {$fieldid}\r\n\t\tLIMIT 1\r\n\t"); echo "<input type=\"hidden\" name=\"update_fieldid\" value=\"{$threadfield['fieldid']}\">"; echo "<input type=\"hidden\" name=\"update_what\" value=\"edit\">"; print_table_header("Edit: {$threadfield['title']}"); print_input_row("Field Name<dfn>This is the name of the field you'd like to have.</dfn>", 'update_title', $threadfield['title']); print_radio_row('Field Required<dfn>Force users to have to fill out this field.</dfn>', 'update_required', array('yes' => 'yes', 'no' => 'no'), $threadfield[required]); print_radio_row('Field Searchable<dfn>Field Searchable<dfn>Would you like this field to be searchable when a user is browsing through the forum (forumdisplay.php) where this field is applied? Selecting yes, will apply this field to the "Search this forum" section of the applied forums.</dfn>', 'update_search', array('1' => 'yes', '0' => 'no'), $threadfield[search]); print_radio_row('Field Only Editable By Staff<dfn>Normal users will not be able to edit this field.</dfn>', 'update_staffedit', array('1' => 'yes', '0' => 'no'), $threadfield[staffedit]); print_textarea_row("Field Description<dfn>This is the description for the field.</dfn>", 'update_desc', $threadfield['description']); print_select_row('Field Type', 'update_type', array('text' => 'Text', 'radio' => 'Radio', 'select' => 'Drop Down Select', 'checkbox' => 'Checkbox List'), $threadfield[type]); print_input_row("Field Size<dfn>This only applies for text fields.</dfn>", 'update_size', $threadfield['size']); print_textarea_row("Field Options<dfn>This is only if you picked a radio, drop down select, or checkbox field type. <br><br><b>Note:</b> Separate each option with a new-line (carriage return).</dfn>", 'update_options', $threadfield['options']); print_input_row("Forums To Include This In<dfn>Please enter the ID's of the forums in which you'd like to have these options included in, seperated by a comma. Leave this blank for it to be in all forums. <br /><cite><b>Ex:</b> 1,2,3</cite></dfn>", 'update_forums', $threadfield['forums']); print_input_row("Display Number<dfn>This is the display number for your field. Fields are arranged by order of display number.</dfn>", 'update_display', $threadfield['display']); print_submit_row("Save!"); } if ($_REQUEST['do'] == 'update') { // ####################################################################### // ###################### START UPDATE EDITED ############################ // ####################################################################### if ($_POST['update_what'] == 'edit') { $fieldid = $_POST['update_fieldid']; $title = addslashes($_POST['update_title']);