/** * Prints a setting group for use in options.php?do=options * * @param string Settings group ID * @param boolean Show advanced settings? */ function print_setting_group($dogroup, $advanced = 0) { global $settingscache, $grouptitlecache, $bgcounter, $settingphrase; if (!is_array($settingscache["{$dogroup}"])) { return; } $userContext = vB::getUserContext(); if (!empty($settingscache[$dogroup]['groupperm']) and !$userContext->hasAdminPermission($settingscache[$dogroup]['groupperm'])) { return; } $vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('group_requires_admin_perm', 'edit', 'delete', 'add_setting', 'rebuild', 'rebuild_all_attachments')); print_column_style_code(array('width:45%', 'width:55%')); echo "<thead>\r\n"; $vb5_config = vB::getConfig(); $title = $settingphrase["settinggroup_{$grouptitlecache[$dogroup]}"]; if ($vb5_config['Misc']['debug'] and $userContext->hasAdminPermission('canadminsettingsall')) { $title .= '<span class="normal">' . construct_link_code($vbphrase['edit'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=editgroup&grouptitle={$dogroup}") . construct_link_code($vbphrase['delete'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=removegroup&grouptitle={$dogroup}") . construct_link_code($vbphrase['add_setting'], "options.php?" . vB::getCurrentSession()->get('sessionurl') . "do=addsetting&grouptitle={$dogroup}") . '</span>'; } print_table_header($title); echo "</thead>\r\n"; $bgcounter = 1; foreach ($settingscache["{$dogroup}"] as $settingid => $setting) { if (!empty($setting['adminperm']) and !$userContext->hasAdminPermission($setting['adminperm'])) { continue; } if (($advanced or !$setting['advanced']) and !empty($setting['varname'])) { print_setting_row($setting, $settingphrase, true, $userContext); } } }
/** * Prints a setting group for use in options.php?do=options * * @param string Settings group ID * @param boolean Show advanced settings? */ function print_setting_group($dogroup, $advanced = 0) { global $settingscache, $grouptitlecache, $vbulletin, $vbphrase, $bgcounter, $settingphrase, $stylevar; if (!is_array($settingscache["{$dogroup}"])) { return; } print_column_style_code(array('width:45%', 'width:55%')); echo "<thead>\r\n"; print_table_header($settingphrase["settinggroup_{$grouptitlecache[$dogroup]}"] . iif($vbulletin->debug, '<span class="normal">' . construct_link_code($vbphrase['edit'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=editgroup&grouptitle={$dogroup}") . construct_link_code($vbphrase['delete'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=removegroup&grouptitle={$dogroup}") . construct_link_code($vbphrase['add_setting'], "options.php?" . $vbulletin->session->vars['sessionurl'] . "do=addsetting&grouptitle={$dogroup}") . '</span>')); echo "</thead>\r\n"; $bgcounter = 1; foreach ($settingscache["{$dogroup}"] as $settingid => $setting) { if (($advanced or !$setting['advanced']) and !empty($setting['varname'])) { print_setting_row($setting, $settingphrase); } } }
if ($db->num_rows($questions)) { print_cells_row(array($vbphrase['question'], $vbphrase['answers'], $vbphrase['regex'], $vbphrase['date'], $vbphrase['controls']), 1); } else { print_description_row($vbphrase['not_specified_questions_no_validation'], false, 5); } while ($question = $db->fetch_array($questions)) { print_cells_row(array($question['text'], $question['answerid'] ? $question['answers'] : 0, $question['regex'] ? $vbphrase['yes'] : $vbphrase['no'], vbdate($vbulletin->options['logdateformat'], $question['dateline']), "<span style=\"white-space:nowrap\"><select name=\"q{$question['questionid']}\" onchange=\"js_jump({$question['questionid']}, this);\" class=\"bginput\">" . construct_select_options($options) . "</select><input type=\"button\" value=\"" . $vbphrase['go'] . "\" onclick=\"js_jump({$question['questionid']}, this.form.q{$question['questionid']});\" class=\"button\" /></span>")); } print_submit_row($vbphrase['add_new_question'], 0, 5); break; case 'Recaptcha': print_form_header('verify', 'updateoptions'); print_table_header($vbphrase['recaptcha_verification_options']); foreach ($cache as $setting) { if (preg_match('#^hv_recaptcha_#si', $setting['varname'])) { print_setting_row($setting, $settingphrase); } } print_submit_row($vbphrase['save']); break; default: ($hook = vBulletinHook::fetch_hook('admin_humanverify_intro_output')) ? eval($hook) : false; } } // ###################### Edit/Add Question ####################### if ($_REQUEST['do'] == 'modifyquestion') { print_form_header('verify', 'updatequestion'); if (empty($vbulletin->GPC['questionid'])) { print_table_header($vbphrase['add_new_question']); } else { $question = $db->query_first_slave("\r\n\t\t\tSELECT question.questionid, question.regex, question.dateline, phrase.text\r\n\t\t\tFROM " . TABLE_PREFIX . "hvquestion AS question\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "phrase AS phrase ON (phrase.varname = CONCAT('question', question.questionid) AND phrase.fieldname = 'hvquestion' and languageid = 0)\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "hvanswer AS answer ON (question.questionid = answer.questionid)\r\n\t\t\tWHERE question.questionid = " . $vbulletin->GPC['questionid'] . "\r\n\t\t");
/** * Returns the config view for the block. * * @param vB_Registry * @param setting values * * @return boolean */ public function getConfigHTML($settingvalues = array()) { if ($this->settings) { // query settings phrases global $settingphrase; $settingphrase = array(); $phrases = $this->registry->db->query_read(" SELECT varname, text FROM " . TABLE_PREFIX . "phrase WHERE fieldname = 'vbblocksettings' AND languageid IN(-1, 0, " . LANGUAGEID . ") ORDER BY languageid ASC "); while($phrase = $this->registry->db->fetch_array($phrases)) { $settingphrase["$phrase[varname]"] = $phrase['text']; } require_once(DIR . '/includes/adminfunctions_options.php'); foreach ($this->settings AS $settingid => $setting) { if (isset($settingvalues[$settingid])) { $setting['value'] = $settingvalues[$settingid]; } elseif (isset($setting['defaultvalue'])) { $setting['value'] = $setting['defaultvalue']; } $setting['varname'] = $settingid; if (!$setting['advanced']) { print_setting_row($setting, $settingphrase, false); } } return true; } else { return false; } }