/** * Get details for an ajax-tree-list of entries for the content covered by this search hook. * * @return array A pair: the hook, and the options */ function ajax_tree() { $catalogue_name = get_param('catalogue_name', ''); if ($catalogue_name == '') { @ob_end_clean(); $tree = nice_get_catalogues(NULL, true); if ($tree->is_empty()) { inform_exit(do_lang_tempcode('NO_ENTRIES')); } require_code('form_templates'); $fields = form_input_list(do_lang_tempcode('NAME'), '', 'catalogue_name', $tree, NULL, true); if (running_script('iframe')) { $post_url = get_self_url_easy(); } else { $post_url = get_self_url(false, false, NULL, false, true); } $submit_name = do_lang_tempcode('PROCEED'); $hidden = build_keep_post_fields(); $title = get_page_title('SEARCH'); $tpl = do_template('FORM_SCREEN', array('_GUID' => 'a2812ac8056903811f444682d45ee448', 'TARGET' => '_self', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => '', 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); $echo = globalise($tpl, NULL, '', true); $echo->evaluate_echo(); exit; } return array('choose_catalogue_category', array('catalogue_name' => $catalogue_name)); }
/** * Get the tempcode for the form to add a banner, with the information passed along to it via the parameters already added in. * * @param boolean Whether to simplify the banner interface (for the point-store buy process) * @param ID_TEXT The name of the banner * @param URLPATH The URL to the banner image * @param URLPATH The URL to the site the banner leads to * @param SHORT_TEXT The caption of the banner * @param LONG_TEXT Any notes associated with the banner * @param integer The banners "importance modulus" * @range 1 max * @param ?integer The number of hits the banner may have (NULL: not applicable for this banner type) * @range 0 max * @param SHORT_INTEGER The type of banner (0=permanent, 1=campaign, 2=default) * @set 0 1 2 * @param ?TIME The banner expiry date (NULL: never expires) * @param ?ID_TEXT The username of the banners submitter (NULL: current member) * @param BINARY Whether the banner has been validated * @param ID_TEXT The banner type (can be anything, where blank means 'normal') * @param SHORT_TEXT The title text for the banner (only used for text banners, and functions as the 'trigger text' if the banner type is shown inline) * @return tempcode The input field tempcode */ function get_banner_form_fields($simplified = false, $name = '', $image_url = '', $site_url = '', $caption = '', $notes = '', $importancemodulus = 3, $campaignremaining = 50, $the_type = 1, $expiry_date = NULL, $submitter = NULL, $validated = 1, $b_type = '', $title_text = '') { require_code('images'); $fields = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_codename(do_lang_tempcode('CODENAME'), do_lang_tempcode('DESCRIPTION_BANNER_NAME'), 'name', $name, true)); $fields->attach(form_input_line(do_lang_tempcode('DESTINATION_URL'), do_lang_tempcode('DESCRIPTION_BANNER_URL'), 'site_url', $site_url, false)); // Blank implies iframe if (!$simplified) { $types = nice_get_banner_types($b_type); if ($types->is_empty()) { warn_exit(do_lang_tempcode('NO_CATEGORIES')); } $fields->attach(form_input_list(do_lang_tempcode('_BANNER_TYPE'), do_lang_tempcode('_DESCRIPTION_BANNER_TYPE'), 'b_type', $types, NULL, false, false)); } else { $fields->attach(form_input_hidden('b_type', $b_type)); } if (has_specific_permission(get_member(), 'full_banner_setup')) { $fields->attach(form_input_username(do_lang_tempcode('OWNER'), do_lang_tempcode('DESCRIPTION_SUBMITTER'), 'submitter', is_null($submitter) ? $GLOBALS['FORUM_DRIVER']->get_username(get_member()) : $submitter, false)); } if (get_value('disable_staff_notes') !== '1') { $fields->attach(form_input_text(do_lang_tempcode('NOTES'), do_lang_tempcode('DESCRIPTION_NOTES'), 'notes', $notes, false)); } if (has_specific_permission(get_member(), 'bypass_validation_midrange_content', 'cms_banners')) { if ($validated == 0) { $validated = get_param_integer('validated', 0); if ($validated == 1) { attach_message(do_lang_tempcode('WILL_BE_VALIDATED_WHEN_SAVING')); } } if (addon_installed('unvalidated')) { $fields->attach(form_input_tick(do_lang_tempcode('VALIDATED'), do_lang_tempcode('DESCRIPTION_VALIDATED'), 'validated', $validated == 1)); } } $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('SOURCE_MEDIA')))); $fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD_BANNER'), 'file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images') . ',swf'))); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('IMAGE_URL')), do_lang_tempcode('DESCRIPTION_URL_BANNER'), 'image_url', $image_url, false)); $fields->attach(form_input_line_comcode(do_lang_tempcode('BANNER_TITLE_TEXT'), do_lang_tempcode('DESCRIPTION_BANNER_TITLE_TEXT'), 'title_text', $title_text, false)); $fields->attach(form_input_line_comcode(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_BANNER_DESCRIPTION'), 'caption', $caption, false)); $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('DEPLOYMENT_DETERMINATION')))); if (has_specific_permission(get_member(), 'full_banner_setup')) { $radios = new ocp_tempcode(); $radios->attach(form_input_radio_entry('the_type', strval(BANNER_PERMANENT), $the_type == BANNER_PERMANENT, do_lang_tempcode('BANNER_PERMANENT'))); $radios->attach(form_input_radio_entry('the_type', strval(BANNER_CAMPAIGN), $the_type == BANNER_CAMPAIGN, do_lang_tempcode('BANNER_CAMPAIGN'))); $radios->attach(form_input_radio_entry('the_type', strval(BANNER_DEFAULT), $the_type == BANNER_DEFAULT, do_lang_tempcode('BANNER_DEFAULT'))); $fields->attach(form_input_radio(do_lang_tempcode('DEPLOYMENT_AGREEMENT'), do_lang_tempcode('DESCRIPTION_BANNER_TYPE'), 'the_type', $radios)); $fields->attach(form_input_integer(do_lang_tempcode('HITS_ALLOCATED'), do_lang_tempcode('DESCRIPTION_HITS_ALLOCATED'), 'campaignremaining', $campaignremaining, false)); $total_importance = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT SUM(importance_modulus) FROM ' . get_table_prefix() . 'banners WHERE ' . db_string_not_equal_to('name', $name)); if (is_null($total_importance)) { $total_importance = 0; } $fields->attach(form_input_integer(do_lang_tempcode('IMPORTANCE_MODULUS'), do_lang_tempcode('DESCRIPTION_IMPORTANCE_MODULUS', strval($total_importance), strval($importancemodulus)), 'importancemodulus', $importancemodulus, true)); } $fields->attach(form_input_date(do_lang_tempcode('EXPIRY_DATE'), do_lang_tempcode('DESCRIPTION_EXPIRY_DATE'), 'expiry_date', true, is_null($expiry_date), true, $expiry_date, 2)); return $fields; }
/** * Function for administrators to pick an identifier (only used by admins, usually the identifier would be picked via some other means in the wider ocPortal codebase). * * @param ID_TEXT Product type code. * @return ?tempcode Input field in standard Tempcode format for fields (NULL: no identifier). */ function get_identifier_manual_field_inputter($type_code) { $list = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query_select('invoices', array('*'), array('i_type_code' => $type_code), 'ORDER BY id DESC'); foreach ($rows as $row) { $username = $GLOBALS['FORUM_DRIVER']->get_username($row['i_member_id']); if (is_null($username)) { $username = do_lang('UNKNOWN'); } $list->attach(form_input_list_entry(strval($row['id']), false, do_lang('INVOICE_OF', strval($row['id']), $username))); } return form_input_list(do_lang_tempcode('INVOICE'), '', 'purchase_id', $list); }
/** * Function for administrators to pick an identifier (only used by admins, usually the identifier would be picked via some other means in the wider ocPortal codebase). * * @param ID_TEXT Product type code. * @return ?tempcode Input field in standard Tempcode format for fields (NULL: no identifier). */ function get_identifier_manual_field_inputter($type_code) { require_code('catalogues'); require_lang('classifieds'); $list = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query_select('catalogue_entries e JOIN ' . get_table_prefix() . 'classifieds_prices c ON c.c_catalogue_name=e.c_name', array('e.*'), NULL, 'GROUP BY e.id ORDER BY ce_add_date DESC'); foreach ($rows as $row) { $data_map = get_catalogue_entry_map($row, NULL, 'CATEGORY', 'DEFAULT', NULL, NULL, array(0)); $ad_title = $data_map['FIELD_0']; $username = $GLOBALS['FORUM_DRIVER']->get_username($row['ce_submitter']); if (is_null($username)) { $username = do_lang('UNKNOWN'); } $list->attach(form_input_list_entry(strval($row['id']), get_param_integer('id', NULL) === $row['id'], do_lang('CLASSIFIED_OF', strval($row['id']), $username, $ad_title))); } return form_input_list(do_lang_tempcode('ENTRY'), '', 'purchase_id', $list); }
/** * Standard import function to get extra fields to ask for when starting the import. * * @return tempcode Extra fields */ function get_extra_fields() { // Give user options // - where to copy files from [actually this field is in admin_import.php] // - theme to save into (advise they should use Theme Wizard to create a theme with similar colour first) // - whether to Comcode-convert // - whether to fix invalid XHTML // - the base URL to use to turn absolute URLs into relative URLs $fields = new ocp_tempcode(); $themes = new ocp_tempcode(); require_code('themes2'); $_themes = find_all_themes(); require_code('form_templates'); foreach ($_themes as $theme => $theme_title) { $themes->attach(form_input_list_entry($theme, $theme == $GLOBALS['FORUM_DRIVER']->get_theme(), $theme_title)); } $fields = form_input_list(do_lang_tempcode('THEME'), do_lang_tempcode('THEME_TO_SAVE_INTO'), 'theme', $themes, NULL, true); $fields->attach(form_input_tick(do_lang_tempcode('WHETHER_CONVERT_COMCODE'), do_lang_tempcode('DESCRIPTION_WHETHER_CONVERT_COMCODE'), 'convert_to_comcode', false)); $fields->attach(form_input_tick(do_lang_tempcode('FIX_INVALID_HTML'), do_lang_tempcode('DESCRIPTION_FIX_INVALID_HTML'), 'fix_html', true)); $fields->attach(form_input_line(do_lang_tempcode('BASE_URL'), do_lang_tempcode('DESCRIPTION_IMPORT_BASE_URL'), 'base_url', get_base_url(), true)); return $fields; }
/** * The UI to select to view a past newsletter. * * @return tempcode The UI */ function archive() { $title = get_page_title('NEWSLETTER_ARCHIVE'); $lang = choose_language($title); if (is_object($lang)) { return $lang; } $newsletters = new ocp_tempcode(); $where = multi_lang() ? array('language' => $lang) : NULL; $rows = $GLOBALS['SITE_DB']->query_select('newsletter_archive', array('id', 'subject', 'date_and_time'), $where, 'ORDER BY date_and_time DESC'); foreach ($rows as $newsletter) { $newsletters->attach(form_input_list_entry(strval($newsletter['id']), false, $newsletter['subject'])); } if ($newsletters->is_empty()) { inform_exit(do_lang_tempcode('NO_ENTRIES')); } require_code('form_templates'); $fields = form_input_list(do_lang_tempcode('NEWSLETTER'), '', 'id', $newsletters, NULL, true); $hidden = form_input_hidden('lang', $lang); $submit_name = do_lang_tempcode('VIEW'); $post_url = build_url(array('page' => '_SELF', 'type' => 'view'), '_SELF', NULL, false, true); return do_template('FORM_SCREEN', array('_GUID' => 'ee295e41dc86c4583c123e6e0e445380', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url)); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('unvalidated'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/unvalidated'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_censor'; $_title = get_page_title('UNVALIDATED_RESOURCES'); $out = new ocp_tempcode(); require_code('form_templates'); $_hooks = find_all_hooks('modules', 'admin_unvalidated'); foreach (array_keys($_hooks) as $hook) { require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook)); $object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true); if (is_null($object)) { continue; } $info = $object->info(); if (is_null($info)) { continue; } $identifier_select = is_array($info['db_identifier']) ? implode(',', $info['db_identifier']) : $info['db_identifier']; $db = array_key_exists('db', $info) ? $info['db'] : $GLOBALS['SITE_DB']; $rows = $db->query('SELECT ' . $identifier_select . (array_key_exists('db_title', $info) ? ',' . $info['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $info['db_table'] . ' WHERE ' . $info['db_validated'] . '=0', 100); $content = new ocp_tempcode(); foreach ($rows as $row) { if (is_array($info['db_identifier'])) { $id = ''; foreach ($info['db_identifier'] as $_id) { if ($id != '') { $id .= ':'; } $id .= $row[$_id]; } } else { $id = $row[$info['db_identifier']]; } if (array_key_exists('db_title', $info)) { $title = $row[$info['db_title']]; if ($info['db_title_dereference']) { $title = get_translated_text($title, $db); } // May actually be comcode (can't be certain), but in which case it will be shown as source } else { $title = '#' . (is_integer($id) ? strval($id) : $id); } if ($title == '') { $title = '#' . strval($id); } $content->attach(form_input_list_entry(is_integer($id) ? strval($id) : $id, false, strip_comcode($title))); } if (array_key_exists('uses_workflow', $info) && $info['uses_workflow']) { // Content that uses a workflow is validated via its view screen $post_url = build_url(array('page' => $info['view_module'], 'type' => $info['view_type'], 'validated' => 1), get_module_zone($info['view_module']), NULL, false, true); } else { // Content which isn't in a workflow is validated via its edit screen $post_url = build_url(array('page' => $info['edit_module'], 'type' => $info['edit_type'], 'validated' => 1), get_module_zone($info['edit_module']), NULL, false, true); } $fields = form_input_list(do_lang_tempcode('EDIT'), do_lang_tempcode('DESCRIPTION_EDIT'), $info['edit_identifier'], $content); if (!$content->is_empty()) { // Could debate whether to include "'TARGET'=>'_blank',". However it does redirect back, so it's a nice linear process like this. If it was new window it could be more efficient, but also would confuse people with a lot of new windows opening and not closing. $content = do_template('FORM', array('_GUID' => '51dcee39273a0fee29569190344f2e41', 'GET' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('EDIT'), 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => '')); } $out->attach(do_template('UNVALIDATED_SECTION', array('_GUID' => '838240008e190b9cbaa0280fbddd6baf', 'TITLE' => $info['title'], 'CONTENT' => $content))); } return do_template('UNVALIDATED_SCREEN', array('_GUID' => '4e971f1c8851b821af030b5c7bbcb3fb', 'TITLE' => $_title, 'SECTIONS' => $out)); }
/** * The UI to edit a configuration page. * * @return tempcode The UI */ function config_category() { require_javascript('javascript_validation'); /*$GLOBALS['HELPER_PANEL_PIC']='pagepics/config'; $GLOBALS['HELPER_PANEL_TUTORIAL']='tut_adv_configuration';*/ $page = get_param('id'); $title = get_page_title(do_lang_tempcode('CONFIG_CATEGORY_' . $page), false); $post_url = build_url(array('page' => '_SELF', 'type' => 'set', 'id' => $page, 'redirect' => get_param('redirect', NULL)), '_SELF'); $category_description = do_lang_tempcode('CONFIG_CATEGORY_DESCRIPTION__' . $page); $rows = $GLOBALS['SITE_DB']->query_select('config', array('*'), array('the_page' => $page)); // Addin special ones if ($page == 'SITE') { $rows[] = array('the_name' => 'timezone', 'human_name' => 'TIME_ZONE', 'config_value' => '', 'the_type' => 'special', 'eval' => '', 'the_page' => 'SITE', 'section' => 'GENERAL', 'explanation' => '', 'shared_hosting_restricted' => 0); } /*global $M_SORT_KEY; This is a lame sort - it doesn't preserve internal order $M_SORT_KEY='section'; usort($rows,'multi_sort');*/ // Better sort $all_known_groups = array(); foreach ($rows as $myrow) { $_group = do_lang($myrow['section'], NULL, NULL, NULL, NULL, false); if (is_null($_group)) { $_group = $myrow['section']; } $_group = strtolower(trim(preg_replace('#(&.*;)|[^\\w\\d\\s]#U', '', $_group))); if (array_key_exists($_group, $all_known_groups) && $all_known_groups[$_group] != $myrow['section']) { $_group = 'std_' . $myrow['section']; } // If cat names translate to same things or are in non-latin characters like Cyrillic $all_known_groups[$_group] = $myrow['section']; } $old_rows = $rows; $rows = array(); ksort($all_known_groups); foreach ($all_known_groups as $group_codename) { foreach ($old_rows as $myrow) { if ($myrow['section'] == $group_codename) { $rows[] = $myrow; } } } // Move advanced group options to the end $rows2 = array(); foreach ($rows as $i => $row) { if ($row['section'] == 'ADVANCED') { $rows2[] = $row; unset($rows[$i]); } } $rows = array_merge($rows, $rows2); // UI hooks $ui_hooks = find_all_hooks('modules', 'admin_config'); $upload_max_filesize = ini_get('upload_max_filesize') == '0' ? do_lang('NA') : clean_file_size(php_return_bytes(ini_get('upload_max_filesize'))); $post_max_size = ini_get('post_max_size') == '0' ? do_lang('NA') : clean_file_size(php_return_bytes(ini_get('post_max_size'))); $groups = new ocp_tempcode(); require_code('form_templates'); $current_group = ''; $out = ''; $_groups = array(); foreach ($rows as $myrow) { if ($myrow['eval'] != '' && $myrow['the_name'] != 'detect_lang_forum') { if (defined('HIPHOP_PHP')) { require_code('hooks/systems/config_default/' . $myrow['the_name']); $hook = object_factory('Hook_config_default_' . $myrow['the_name']); if (is_null($hook->get_default())) { continue; } } else { $GLOBALS['REQUIRE_LANG_LOOP'] = 10; // LEGACY Workaround for corrupt webhost installers if (is_null(@eval($myrow['eval'] . ';'))) { continue; } // @'d in case default is corrupt, don't want it to give errors forever $GLOBALS['REQUIRE_LANG_LOOP'] = 0; // LEGACY } } $_group = do_lang($myrow['section'], NULL, NULL, NULL, NULL, false); $name = do_lang($myrow['human_name'], NULL, NULL, NULL, NULL, false); $_group_tempcode = is_null($_group) ? make_string_tempcode($myrow['section']) : do_lang_tempcode($myrow['section']); $name_tempcode = is_null($name) ? make_string_tempcode($myrow['human_name']) : do_lang_tempcode($myrow['human_name']); if (get_forum_type() == 'ocf' && $myrow['explanation'] == 'CONFIG_OPTION_forum_in_portal') { $exp_string = $myrow['explanation'] . '__ocf'; } else { $exp_string = $myrow['explanation']; } $_explanation = do_lang($exp_string, NULL, NULL, NULL, NULL, false); if (is_null($_explanation)) { $_explanation = do_lang('CONFIG_GROUP_DEFAULT_DESCRIP_' . $myrow['section'], NULL, NULL, NULL, NULL, false); if (is_null($_explanation)) { $explanation = new ocp_tempcode(); } else { $explanation = do_lang_tempcode('CONFIG_GROUP_DEFAULT_DESCRIP_' . $myrow['section']); } } else { $explanation = do_lang_tempcode($exp_string); } if ($myrow['shared_hosting_restricted'] == 1 && !is_null($GLOBALS['CURRENT_SHARE_USER'])) { continue; } if ($myrow['section'] != $current_group && $current_group != '') { $_current_group = do_lang_tempcode($current_group); $_group_description = do_lang('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize), NULL, NULL, false); if (is_null($_group_description)) { $group_description = new ocp_tempcode(); } else { $group_description = do_lang_tempcode('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize)); } $group = do_template('CONFIG_GROUP', array('_GUID' => 'af4c31daa1bc39714ab83b11bd6d3e51', 'GROUP_DESCRIPTION' => $group_description, 'GROUP_NAME' => $current_group, 'GROUP' => $out, 'CURRENT_GROUP' => $_current_group)); $groups->attach($group->evaluate()); $out = ''; } $_groups[$myrow['section']] = $_group_tempcode; switch ($myrow['the_type']) { case 'special': switch ($myrow['the_name']) { case 'timezone': $list = ''; $timezone = get_site_timezone(); foreach (get_timezone_list() as $_timezone => $timezone_nice) { $list .= static_evaluate_tempcode(form_input_list_entry($_timezone, $_timezone == $timezone, $timezone_nice)); } $out .= static_evaluate_tempcode(form_input_list(do_lang_tempcode('TIME_ZONE'), do_lang_tempcode('DESCRIPTION_TIMEZONE_SITE'), 'timezone', make_string_tempcode($list))); break; default: require_code('hooks/modules/admin_config/' . filter_naughty_harsh($myrow['the_name'])); $hook_ob = object_factory('Hook_admin_config_' . filter_naughty_harsh($myrow['the_name'])); $out .= static_evaluate_tempcode($hook_ob->run($myrow)); break; } break; case 'integer': $out .= static_evaluate_tempcode(form_input_integer($name_tempcode, $explanation, $myrow['the_name'], intval(get_option($myrow['the_name'])), false)); break; case 'line': if (strpos($myrow['the_name'], 'colour') !== false && substr(get_option($myrow['the_name']), 0, 1) == '#') { $out .= static_evaluate_tempcode(form_input_colour($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true)); } elseif ($myrow['the_name'] == 'currency') { $list = ''; require_code('currency'); $currencies = array_keys(get_currency_map()); foreach ($currencies as $currency) { $list .= static_evaluate_tempcode(form_input_list_entry($currency, $currency == get_option($myrow['the_name']))); } $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list))); } elseif ($myrow['the_name'] == 'payment_gateway') { $list = ''; $all_via = find_all_hooks('systems', 'ecommerce_via'); foreach (array_keys($all_via) as $via) { $list .= static_evaluate_tempcode(form_input_list_entry($via, $via == get_option($myrow['the_name']))); } $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list))); } else { /*if (strpos($myrow['the_name'],'password')!==false) password fields can't take defaults $out.=static_evaluate_tempcode(form_input_password($name_tempcode,$explanation,$myrow['the_name'],get_option($myrow['the_name']),false)); else */ $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false)); } break; case 'list': $list = ''; $_value = get_option($myrow['the_name']); $values = explode('|', $myrow['c_data']); foreach ($values as $value) { $_option_text = do_lang('CONFIG_OPTION_' . $myrow['the_name'] . '_VALUE_' . $value, NULL, NULL, NULL, NULL, false); if (!is_null($_option_text)) { $option_text = do_lang_tempcode('CONFIG_OPTION_' . $myrow['the_name'] . '_VALUE_' . $value); } else { $option_text = make_string_tempcode($value); } $list .= static_evaluate_tempcode(form_input_list_entry($value, $_value == $value, $option_text)); } $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], make_string_tempcode($list), NULL, false, false)); break; case 'transline': $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false)); break; case 'text': $out .= static_evaluate_tempcode(form_input_text($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true)); break; case 'transtext': $out .= static_evaluate_tempcode(form_input_text($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false, NULL, true)); break; case 'float': $out .= static_evaluate_tempcode(form_input_float($name_tempcode, $explanation, $myrow['the_name'], floatval(get_option($myrow['the_name'])), false)); break; case 'tick': $out .= static_evaluate_tempcode(form_input_tick($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']) == '1')); break; case 'date': $out .= static_evaluate_tempcode(form_input_date($name_tempcode, $explanation, $myrow['the_name'], false, false, false, intval(get_option($myrow['the_name'])), 40, intval(date('Y')) - 20, NULL, false)); break; case 'forum': case '?forum': if (get_forum_type() == 'ocf' && addon_installed('ocf_forum')) { $current_setting = get_option($myrow['the_name']); if (!is_numeric($current_setting)) { $_current_setting = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'id', array('f_name' => $current_setting)); if (is_null($_current_setting)) { if ($myrow['the_type'] == '?forum') { $current_setting = NULL; } else { $current_setting = strval(db_get_first_id()); attach_message(do_lang_tempcode('FORUM_CURRENTLY_UNSET', $name_tempcode), 'notice'); } } else { $current_setting = strval($_current_setting); } } $out .= static_evaluate_tempcode(form_input_tree_list($name_tempcode, $explanation, $myrow['the_name'], NULL, 'choose_forum', array(), false, $current_setting)); } else { $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false)); } break; case 'category': if (get_forum_type() == 'ocf') { $tmp_value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_categories', 'id', array('c_title' => get_option($myrow['the_name']))); require_code('ocf_forums2'); $_list = ocf_nice_get_categories(NULL, $tmp_value); $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], $_list)); } else { $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false)); } break; case 'usergroup': if (get_forum_type() == 'ocf') { $tmp_value = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON t.id=g.g_name', 'g.id', array('text_original' => get_option($myrow['the_name']))); require_code('ocf_groups'); $_list = ocf_nice_get_usergroups($tmp_value); $out .= static_evaluate_tempcode(form_input_list($name_tempcode, $explanation, $myrow['the_name'], $_list)); } else { $out .= static_evaluate_tempcode(form_input_line($name_tempcode, $explanation, $myrow['the_name'], get_option($myrow['the_name']), false)); } break; } $current_group = $myrow['section']; } if ($out != '') { $_group_description = do_lang('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize), NULL, NULL, false); if (is_null($_group_description)) { $group_description = new ocp_tempcode(); } else { $group_description = do_lang_tempcode('CONFIG_GROUP_DESCRIP_' . $current_group, escape_html($post_max_size), escape_html($upload_max_filesize)); } $group = do_template('CONFIG_GROUP', array('_GUID' => '84c0db86002a33a383a7c2e195dd3913', 'GROUP_DESCRIPTION' => $group_description, 'GROUP_NAME' => $current_group, 'GROUP' => $out, 'CURRENT_GROUP' => $_group_tempcode)); $groups->attach($group->evaluate()); } list($warning_details, $ping_url) = handle_conflict_resolution(); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CONFIGURATION')))); breadcrumb_set_self(do_lang_tempcode('CONFIG_CATEGORY_' . $page)); return do_template('CONFIG_CATEGORY_SCREEN', array('_GUID' => 'd01b28b71c38bbb52b6aaf877c7f7b0e', 'CATEGORY_DESCRIPTION' => $category_description, '_GROUPS' => $_groups, 'PING_URL' => $ping_url, 'WARNING_DETAILS' => $warning_details, 'TITLE' => $title, 'URL' => $post_url, 'GROUPS' => $groups, 'SUBMIT_NAME' => do_lang_tempcode('SAVE'))); }
/** * Choose product step. * * @param tempcode The page title. * @return tempcode The result of execution. */ function choose($title) { breadcrumb_set_self(do_lang_tempcode('PURCHASING')); /*if (is_guest()) { $register=$GLOBALS['FORUM_DRIVER']->join_url(); if (is_object($register)) $register=$register->evaluate(); $_redirect=build_url(array('page'=>'_SELF','type'=>'misc'),'_SELF'); $redirect=$_redirect->evaluate(); $_login=build_url(array('page'=>'login','redirect'=>$redirect)); $login=$_login->evaluate(); return $this->wrap(do_template('PURCHASE_WIZARD_STAGE_GUEST',array('_GUID'=>'accf475a1457f73d7280b14d774acc6e','TITLE'=>$title,'TEXT'=>do_lang_tempcode('PURCHASE_NOT_LOGGED_IN_2',escape_html($register),escape_html($login)))),$title,NULL); }*/ $url = build_url(array('page' => '_SELF', 'type' => 'message', 'id' => get_param_integer('id', -1)), '_SELF', NULL, true, true); require_code('form_templates'); $list = new ocp_tempcode(); $filter = get_param('filter', ''); $products = find_all_products(); foreach ($products as $product => $details) { if ($filter != '') { if (!is_string($product) || substr($product, 0, strlen($filter)) != $filter) { continue; } } if (($details[0] == PRODUCT_PURCHASE_WIZARD || $details[0] == PRODUCT_SUBSCRIPTION || $details[0] == PRODUCT_CATALOGUE) && method_exists($details[count($details) - 1], 'is_available') && $details[count($details) - 1]->is_available($product, get_member())) { require_code('currency'); $currency = get_option('currency'); $price = currency_convert(floatval($details[1]), $currency, NULL, true); $description = $details[4]; if (strpos($details[4], strpos($details[4], '.') === false ? preg_replace('#\\.00($|[^\\d])#', '', $price) : $price) === false) { $description .= ' (' . $price . ')'; } $list->attach(form_input_list_entry($product, false, protect_from_escaping($description))); } } if ($list->is_empty()) { inform_exit(do_lang_tempcode('NO_CATEGORIES')); } $fields = form_input_list(do_lang_tempcode('PRODUCT'), '', 'product', $list, NULL, true); return $this->wrap(do_template('PURCHASE_WIZARD_STAGE_CHOOSE', array('_GUID' => '47c22d48313ff50e6323f05a78342eae', 'FIELDS' => $fields, 'TITLE' => $title)), $title, $url, true); }
/** * Standard aed_module edit form filler. * * @param ID_TEXT The entry being edited * @return array A triple: fields, hidden-fields, delete-fields */ function fill_in_edit_form($_id) { $id = intval($_id); $m = $GLOBALS['FORUM_DB']->query_select('f_categories', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $m)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $r = $m[0]; $delete_fields = new ocp_tempcode(); $fields = $this->get_form_fields($r['c_title'], $r['c_description'], $r['c_expanded_by_default']); $list = ocf_nice_get_categories($id); if (!$list->is_empty()) { $delete_fields->attach(form_input_list(do_lang_tempcode('TARGET'), do_lang_tempcode('DESCRIPTION_FORUM_MOVE_TARGET'), 'target_category', $list)); } return array($fields, new ocp_tempcode(), $delete_fields); }
/** * Choose survey to view results of. * * @return tempcode The result of execution. */ function survey_results() { $title = get_page_title('SURVEY_RESULTS'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/survey_results'; require_code('form_templates'); $_m = $GLOBALS['SITE_DB']->query_select('quizzes', array('*'), array('q_type' => 'SURVEY'), 'ORDER BY q_validated DESC,q_add_date DESC', 300); $entries = new ocp_tempcode(); foreach ($_m as $m) { $entries->attach(form_input_list_entry(strval($m['id']), false, get_translated_text($m['q_name']))); } if ($entries->is_empty()) { warn_exit(do_lang_tempcode('NO_ENTRIES')); } $fields = new ocp_tempcode(); $fields->attach(form_input_list(do_lang_tempcode('SURVEY'), '', 'id', $entries, NULL, true)); $post_url = build_url(array('page' => '_SELF', 'type' => '_survey_results'), '_SELF', NULL, false, true); $submit_name = do_lang_tempcode('SURVEY_RESULTS'); breadcrumb_set_self(do_lang_tempcode('CHOOSE')); return do_template('FORM_SCREEN', array('SKIP_VALIDATION' => true, 'HIDDEN' => '', 'GET' => true, 'TITLE' => $title, 'TEXT' => '', 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); }
/** * Choose a test section to edit. * * @return tempcode The result of execution. */ function ed() { $title = get_page_title('EDIT_TEST_SECTION'); check_specific_permission('edit_own_tests'); if (!$GLOBALS['FORUM_DRIVER']->is_staff(get_member())) { access_denied('STAFF_ONLY'); } $list = $this->get_section_list(); if ($list->is_empty()) { inform_exit(do_lang_tempcode('NO_ENTRIES')); } $text = paragraph(do_lang_tempcode('CHOOSE_EDIT_LIST')); $post_url = build_url(array('page' => '_SELF', 'type' => '_ed'), '_SELF', NULL, false, true); require_code('form_templates'); $fields = form_input_list(do_lang_tempcode('NAME'), '', 'id', $list, NULL, true); $submit_name = do_lang_tempcode('PROCEED'); return do_template('FORM_SCREEN', array('_GUID' => '37f70ba9d23204bceda6e84375b52270', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'TITLE' => $title, 'TEXT' => $text, 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); }
/** * The UI to choose filter parameters. * * @return tempcode The UI */ function search() { $title = get_page_title('VIEW_ACTION_LOGS'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/actionlog'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_trace'; require_code('form_templates'); $fields = new ocp_tempcode(); // Possible selections for member filter $_member_choice_list = array(); if (get_forum_type() == 'ocf') { if ($GLOBALS['FORUM_DB']->query_value('f_moderator_logs', 'COUNT(DISTINCT l_by)') < 5000) { $members = list_to_map('l_by', $GLOBALS['FORUM_DB']->query_select('f_moderator_logs', array('l_by', 'COUNT(*) AS cnt'), NULL, 'GROUP BY l_by ORDER BY cnt DESC')); foreach ($members as $member) { $username = $GLOBALS['FORUM_DRIVER']->get_username($member['l_by']); if (is_null($username)) { $username = strval($member['l_by']); } $_member_choice_list[$member['l_by']] = array($username, $member['cnt']); } } } if ($GLOBALS['SITE_DB']->query_value('adminlogs', 'COUNT(DISTINCT the_user)') < 5000) { $_staff = list_to_map('the_user', $GLOBALS['SITE_DB']->query_select('adminlogs', array('the_user', 'COUNT(*) AS cnt'), NULL, 'GROUP BY the_user ORDER BY cnt DESC')); foreach ($_staff as $staff) { $username = $GLOBALS['FORUM_DRIVER']->get_username($staff['the_user']); if (is_null($username)) { $username = strval($staff['the_user']); } if (!array_key_exists($staff['the_user'], $_member_choice_list)) { $_member_choice_list[$staff['the_user']] = array($username, $staff['cnt']); } else { $_member_choice_list[$staff['the_user']][1] += $staff['cnt']; } } } $member_choice_list = new ocp_tempcode(); $member_choice_list->attach(form_input_list_entry('-1', true, do_lang_tempcode('_ALL'))); foreach ($_member_choice_list as $id => $user_actions) { list($username, $action_count) = $user_actions; $member_choice_list->attach(form_input_list_entry(strval($id), false, do_lang($action_count == 1 ? 'ACTIONLOG_USERCOUNT_UNI' : 'ACTIONLOG_USERCOUNT', $username, integer_format($action_count)))); } $fields->attach(form_input_list(do_lang_tempcode('USERNAME'), '', 'id', $member_choice_list, NULL, true)); // Possible selections for action type filter $_action_type_list = array(); $rows1 = get_forum_type() == 'ocf' ? $GLOBALS['FORUM_DB']->query_select('f_moderator_logs', array('DISTINCT l_the_type')) : array(); $rows2 = $GLOBALS['SITE_DB']->query_select('adminlogs', array('DISTINCT the_type')); foreach ($rows1 as $row) { $lang = do_lang($row['l_the_type'], NULL, NULL, NULL, NULL, false); if (!is_null($lang)) { $_action_type_list[$row['l_the_type']] = $lang; } } foreach ($rows2 as $row) { $lang = do_lang($row['the_type'], NULL, NULL, NULL, NULL, false); if (!is_null($lang)) { $_action_type_list[$row['the_type']] = $lang; } } asort($_action_type_list); $action_type_list = new ocp_tempcode(); $action_type_list->attach(form_input_list_entry('', true, do_lang_tempcode('_ALL'))); foreach ($_action_type_list as $lang_id => $lang) { $action_type_list->attach(form_input_list_entry($lang_id, false, $lang)); } $fields->attach(form_input_list(do_lang_tempcode('ACTION'), '', 'to_type', $action_type_list, NULL, false, false)); // Filters $fields->attach(form_input_line(do_lang_tempcode('PARAMETER_A'), '', 'param_a', '', false)); $fields->attach(form_input_line(do_lang_tempcode('PARAMETER_B'), '', 'param_b', '', false)); $post_url = build_url(array('page' => '_SELF', 'type' => 'list'), '_SELF', NULL, false, true); $submit_name = do_lang_tempcode('VIEW_ACTION_LOGS'); breadcrumb_set_self(do_lang_tempcode('VIEW_ACTION_LOGS')); return do_template('FORM_SCREEN', array('_GUID' => 'f2c6eda24e0e973aa7e253054f6683a5', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'TITLE' => $title, 'TEXT' => '', 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); }
/** * The UI to manage bookmarks. * * @return tempcode The UI */ function manage_bookmarks() { $title = get_page_title('MANAGE_BOOKMARKS'); require_code('form_templates'); require_lang('zones'); $fields = new ocp_tempcode(); $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('MOVE')))); $rows = $GLOBALS['SITE_DB']->query_select('bookmarks', array('DISTINCT b_folder'), array('b_owner' => get_member()), 'ORDER BY b_folder'); $list = form_input_list_entry('', false, do_lang_tempcode('NA_EM')); $list->attach(form_input_list_entry('!', false, do_lang_tempcode('ROOT_EM'))); foreach ($rows as $row) { if ($row['b_folder'] != '') { $list->attach(form_input_list_entry($row['b_folder'])); } } $fields->attach(form_input_list(do_lang_tempcode('OLD_BOOKMARK_FOLDER'), do_lang_tempcode('DESCRIPTION_OLD_BOOKMARK_FOLDER'), 'folder', $list, NULL, false, false)); $fields->attach(form_input_line(do_lang_tempcode('NEW_BOOKMARK_FOLDER'), do_lang_tempcode('DESCRIPTION_NEW_BOOKMARK_FOLDER'), 'folder_new', '', false)); $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('ACTIONS')))); $fields->attach(form_input_tick(do_lang_tempcode('DELETE'), do_lang_tempcode('DESCRIPTION_DELETE'), 'delete', false)); $post_url = build_url(array('page' => '_SELF', 'type' => '_manage'), '_SELF'); $form = do_template('FORM', array('HIDDEN' => '', 'FIELDS' => $fields, 'TEXT' => '', 'URL' => $post_url, 'SUBMIT_NAME' => do_lang_tempcode('MOVE_OR_DELETE_BOOKMARKS'), 'JAVASCRIPT' => 'standardAlternateFields(\'folder\',\'folder_new\');')); $bookmarks = array(); $_bookmarks = $GLOBALS['SITE_DB']->query_select('bookmarks', array('*'), array('b_owner' => get_member()), 'ORDER BY b_folder'); foreach ($_bookmarks as $bookmark) { $bookmarks[] = array('ID' => strval($bookmark['id']), 'CAPTION' => $bookmark['b_title'], 'FOLDER' => $bookmark['b_folder'], 'PAGE_LINK' => $bookmark['b_page_link']); } return do_template('BOOKMARKS_SCREEN', array('_GUID' => '685f020d6407543271ce99b5775bb357', 'TITLE' => $title, 'FORM_URL' => $post_url, 'FORM' => $form, 'BOOKMARKS' => $bookmarks)); }
/** * Get tempcode for adding/editing form. * * @param SHORT_TEXT A name for the Welcome E-mail * @param SHORT_TEXT The subject of the Welcome E-mail * @param LONG_TEXT The message body of the Welcome E-mail * @param integer The number of hours before sending the e-mail * @param ?AUTO_LINK What newsletter to send out to instead of members (NULL: none) * @return tempcode The input fields */ function get_form_fields($name = '', $subject = '', $text = '', $send_time = 0, $newsletter = 0) { $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('DESCRIPTION_NAME_REFERENCE'), 'name', $name, true)); $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), do_lang_tempcode('DESCRIPTION_WELCOME_EMAIL_SUBJECT'), 'subject', $subject, true)); $fields->attach(form_input_huge_comcode(do_lang_tempcode('TEXT'), do_lang_tempcode('DESCRIPTION_WELCOME_EMAIL_TEXT'), 'text', $text, true)); $fields->attach(form_input_integer(do_lang_tempcode('SEND_TIME'), do_lang_tempcode('DESCRIPTION_SEND_TIME'), 'send_time', $send_time, true)); if (addon_installed('newsletter')) { require_lang('newsletter'); if (get_value('welcome_nw_choice') === '1') { $newsletters = new ocp_tempcode(); $rows = $GLOBALS['SITE_DB']->query_select('newsletters', array('id', 'title')); if (get_forum_type() == 'ocf') { $newsletters->attach(form_input_list_entry('', is_null($newsletter), do_lang_tempcode('NEWSLETTER_OCF'))); } foreach ($rows as $_newsletter) { $newsletters->attach(form_input_list_entry(strval($_newsletter['id']), $_newsletter['id'] === $newsletter, get_translated_text($_newsletter['title']))); } if (!$newsletters->is_empty()) { $fields->attach(form_input_list(do_lang_tempcode('NEWSLETTER'), '', 'newsletter', $newsletters, NULL, false, false)); } } else { if (get_forum_type() == 'ocf') { require_lang('newsletter'); $fields->attach(form_input_tick(do_lang_tempcode('NEWSLETTER'), do_lang_tempcode('DESCRIPTION_NEWSLETTER_INSTEAD'), 'newsletter', $newsletter == 1)); } } } return $fields; }
/** * The UI to choose an import session. * * @return tempcode The UI */ function choose_session() { $title = get_page_title('IMPORT'); /* Codes to detect redirect hooks for import */ $importer = filter_naughty(get_param('importer')); require_code('hooks/modules/admin_import/' . filter_naughty_harsh($importer)); $object = object_factory('Hook_' . filter_naughty_harsh($importer)); $info = $object->info(); if (array_key_exists('hook_type', $info)) { $redirect_url = build_url(array('page' => $info['import_module'], 'type' => $info['import_method_name']), get_module_zone($info['import_module'])); return redirect_screen($title, $redirect_url, do_lang_tempcode('REDIRECTED_TO_MODULES')); } /* END */ $sessions = new ocp_tempcode(); $_sessions = $GLOBALS['SITE_DB']->query_select('import_session', array('*')); require_code('form_templates'); foreach ($_sessions as $session) { if ($session['imp_session'] == get_session_id()) { $text = do_lang_tempcode('IMPORT_SESSION_CURRENT', escape_html($session['imp_db_name'])); } else { $text = do_lang_tempcode('IMPORT_SESSION_EXISTING_REMAP', escape_html($session['imp_db_name'])); } $sessions->attach(form_input_list_entry(strval($session['imp_session']), false, $text)); } $text = do_lang_tempcode('IMPORT_SESSION_NEW_DELETE'); $sessions->attach(form_input_list_entry(strval(-1), false, $text)); $text = do_lang_tempcode('IMPORT_SESSION_NEW_DELETE_OCF_SATELLITE'); $sessions->attach(form_input_list_entry(strval(-2), false, $text)); $fields = form_input_list(do_lang_tempcode('IMPORT_SESSION'), do_lang_tempcode('DESCRIPTION_IMPORT_SESSION'), 'session', $sessions, NULL, true); $post_url = build_url(array('page' => '_SELF', 'type' => 'session2', 'importer' => get_param('importer')), '_SELF'); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('IMPORT')))); breadcrumb_set_self(do_lang_tempcode('IMPORT_SESSION')); return do_template('FORM_SCREEN', array('_GUID' => 'f474980f7263f2def2ff75e7ee40be33', 'SKIP_VALIDATION' => true, 'HIDDEN' => form_input_hidden('importer', get_param('importer')), 'SUBMIT_NAME' => do_lang_tempcode('CHOOSE'), 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => '')); }
/** * The UI to set privileges. * * @return tempcode The UI */ function interface_specific_permissions() { require_all_lang(); require_code('zones2'); $title = get_page_title('SPECIFIC_PERMISSIONS'); $p_section = get_param('id', NULL); if (is_null($p_section) || $p_section == '') { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/privileges'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_permissions'; $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/privileges'; $fields = new ocp_tempcode(); require_code('form_templates'); $_sections = $this->_get_ordered_sections(); $sections = new ocp_tempcode(); foreach ($_sections as $s) { if (is_null($s)) { $sections->attach(form_input_list_entry('', false, '', false, true)); } else { if (!is_null($s['trans'])) { $sections->attach(form_input_list_entry($s['p_section'], false, $s['trans'])); } } } $fields->attach(form_input_list(do_lang_tempcode('SECTION'), '', 'id', $sections, NULL, true)); $post_url = get_self_url(false, false, NULL, false, true); return do_template('FORM_SCREEN', array('_GUID' => 'e5d457a49a76706afebc92da3d846e74', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('CHOOSE'), 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => '')); } $title = get_page_title('_SPECIFIC_PERMISSIONS', true, array(do_lang_tempcode($p_section))); $url = build_url(array('page' => '_SELF', 'type' => '_specific', 'id' => $p_section), '_SELF'); $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups(); $moderator_groups = $GLOBALS['FORUM_DRIVER']->get_moderator_groups(); $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true); $header_cells = $this->_access_header($admin_groups, $groups); $cols = new ocp_tempcode(); foreach ($groups as $id => $g_name) { if (in_array($id, $admin_groups)) { continue; } $cols->attach(do_template('PERMISSION_COLUMN_SIZER')); } // Find all module permission overrides $all_module_overrides = array(); foreach (find_all_zones() as $zone) { $all_modules = array(); $all_modules += find_all_pages($zone, 'modules_custom', 'php', false); $all_modules += find_all_pages($zone, 'modules', 'php', false); foreach ($all_modules as $module => $module_type) { $functions = extract_module_functions(zone_black_magic_filterer(get_file_base() . '/' . $zone . ($zone == '' ? '' : '/') . 'pages/' . $module_type . '/' . $module . '.php'), array('get_sp_overrides')); if (!is_null($functions[0])) { $overrides = is_array($functions[0]) ? call_user_func_array($functions[0][0], $functions[0][1]) : eval($functions[0]); foreach (array_keys($overrides) as $override) { if (!array_key_exists($override, $all_module_overrides)) { $all_module_overrides[$override] = array(); } $all_module_overrides[$override][] = $module; } } } } $all_page_permission_overridding = $GLOBALS['SITE_DB']->query_select('gsp', array('the_page', 'specific_permission'), array('category_name' => '')); // Rows (pages) $rows = new ocp_tempcode(); $where = array('p_section' => $p_section); // Added in because it was eating up too much memory $_permissions = collapse_2d_complexity('the_name', 'p_section', $GLOBALS['SITE_DB']->query_select('sp_list', array('p_section', 'the_name'), $where, 'ORDER BY p_section,the_name')); $access_rows = $GLOBALS['SITE_DB']->query_select('gsp', array('specific_permission', 'group_id'), array('the_page' => '', 'module_the_name' => '', 'category_name' => '')); $current_section = ''; $sections = new ocp_tempcode(); $_false = do_template('PERMISSION_CELL', array('_GUID' => '61aa7fa739e19caa1efb3695a5e2ab5d', 'CHECKED' => false, 'HUMAN' => '__human__', 'NAME' => '__name__')); $_true = do_template('PERMISSION_CELL', array('_GUID' => '44a888b40d7a34aed6ed2bf8ff47f1de', 'CHECKED' => true, 'HUMAN' => '__human__', 'NAME' => '__name__')); $true = $_true->evaluate(); $false = $_false->evaluate(); // Ad-hoc sorting? $orderings = array('submit_low', 'edit_own_low', 'edit_low', 'delete_own_low', 'delete_low', 'bypass_validation_low', 'submit_mid', 'edit_own_mid', 'edit_mid', 'delete_own_mid', 'delete_mid', 'bypass_validation_mid', 'submit_high', 'edit_own_high', 'edit_high', 'delete_own_high', 'delete_high', 'bypass_validation_high', 'submit_cat_low', 'edit_own_cat_low', 'edit_cat_low', 'delete_own_cat_low', 'delete_cat_low', 'bypass_cat_validation_low', 'submit_cat_mid', 'edit_own_cat_mid', 'edit_cat_mid', 'delete_own_cat_mid', 'delete_cat_mid', 'bypass_cat_validation_mid', 'submit_cat_high', 'edit_own_cat_high', 'edit_cat_high', 'delete_own_cat_high', 'delete_cat_high', 'bypass_cat_validation_high'); $permissions_first = array(); foreach ($orderings as $stub) { foreach ($_permissions as $permission => $section) { if (substr($permission, 0, strlen($stub)) == $stub) { $permissions_first[$permission] = $section; unset($_permissions[$permission]); } } } $_permissions = array_merge($permissions_first, $_permissions); // Display foreach ($_permissions as $permission => $section) { $permission_text = do_lang('PT_' . $permission, NULL, NULL, NULL, NULL, false); if (is_null($permission_text)) { continue; } if ($section != $current_section && $current_section != '') { $sections->attach(do_template('PERMISSION_S_CONFIG_SECTION', array('_GUID' => '36bc9dfbeb7ee3d91f2a18057cd30551', 'HEADER_CELLS' => $header_cells, 'SECTION' => $rows, 'CURRENT_SECTION' => do_lang_tempcode($current_section)))); $rows = new ocp_tempcode(); } $cells = ''; $code = ''; $has = true; foreach ($groups as $id => $g_name) { if (in_array($id, $admin_groups)) { continue; } $has_permission = false; foreach ($access_rows as $access_row) { if ($access_row['specific_permission'] == $permission && $access_row['group_id'] == $id) { $has_permission = true; break; } } if (!$has_permission) { $has = false; } $cells .= str_replace('__human__', escape_html(addslashes(do_lang('PERMISSION_CELL', $permission_text, $g_name))), str_replace('__name__', $permission . '__' . strval($id), $has_permission ? $true : $false)); if (in_array($id, $moderator_groups)) { $code .= 'form.elements[\'' . $permission . '__' . strval($id) . '\'].checked=true;'; } else { $code .= 'form.elements[\'' . $permission . '__' . strval($id) . '\'].checked=this.value==\'+\';'; } } if ($GLOBALS['XSS_DETECT']) { ocp_mark_as_escaped($cells); } $tpl_map = array('_GUID' => '075f8855f0fed36b0d0f9c61108dd3de', 'HAS' => $has, 'ABBR' => $permission, 'PERMISSION' => $permission_text, 'CELLS' => $cells, 'CODE' => $code); // See if any modules can override this if (array_key_exists($permission, $all_module_overrides)) { $m_list = ''; $has_actual_overriding = false; foreach ($all_module_overrides[$permission] as $module) { $this_overrides = false; foreach ($all_page_permission_overridding as $po_row) { if ($po_row['the_page'] == $module && $po_row['specific_permission'] == $permission) { $this_overrides = true; break; } } if ($m_list != '') { $m_list .= escape_html(', '); } if ($this_overrides) { $has_actual_overriding = true; $m_list .= '<s>' . escape_html($module) . '</s>'; } else { $m_list .= '<strong>' . escape_html($module) . '</strong>'; } if ($module == 'topics') { $m_list .= ' (' . strtolower(do_lang(strpos($permission, 'lowrange') !== false ? 'FORUM_POSTS' : 'FORUM_TOPICS')) . ')'; } } if (function_exists('ocp_mark_as_escaped')) { ocp_mark_as_escaped($m_list); } $tpl_map['DESCRIPTION'] = do_lang_tempcode($has_actual_overriding ? 'SP_USED_IN_SLASHED' : 'SP_USED_IN', $m_list); } // Render row $rows->attach(do_template('PERMISSION_ROW', $tpl_map)); $current_section = $section; } $sections->attach(do_template('PERMISSION_S_CONFIG_SECTION', array('_GUID' => 'c75a07373f54c0fa31d18e360fcf26f6', 'COLS' => $cols, 'HEADER_CELLS' => $header_cells, 'SECTION' => $rows, 'CURRENT_SECTION' => do_lang_tempcode($current_section)))); breadcrumb_set_parents(array(array('_SELF:_SELF:specific', do_lang_tempcode('CHOOSE')))); return do_template('PERMISSION_S_PERMISSIONS_SCREEN', array('_GUID' => '11974f0a137266a625991d3611b8e587', 'TITLE' => $title, 'URL' => $url, 'SECTIONS' => $sections)); }
/** * The UI to move a page. * * @return tempcode The UI */ function move() { if (get_file_base() != get_custom_file_base()) { warn_exit(do_lang_tempcode('SHARED_INSTALL_PROHIBIT')); } $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/move'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_structure'; $title = get_page_title('MOVE_PAGES'); $zone = get_param('zone', NULL); if (is_null($zone)) { return $this->choose_zone($title); } require_code('form_templates'); $post_url = build_url(array('page' => '_SELF', 'type' => '_move'), '_SELF'); $submit_name = do_lang_tempcode('MOVE_PAGES'); $fields = new ocp_tempcode(); $pages = find_all_pages_wrap($zone); foreach ($pages as $page => $type) { if (is_integer($page)) { $page = strval($page); } // We can't move admin modules if ($zone == 'adminzone' && substr($page, 0, 6) == 'admin_' && substr($type, 0, 6) == 'module') { continue; } // We can't move modules we've hard-optimised to be in a certain place global $MODULES_ZONES_DEFAULT; if (array_key_exists($page, $MODULES_ZONES_DEFAULT)) { continue; } $fields->attach(form_input_tick($page, do_lang_tempcode('_TYPE', escape_html($type)), 'page__' . $page, false)); } require_code('zones2'); require_code('zones3'); $zones = nice_get_zones(); $fields->attach(form_input_list(do_lang_tempcode('DESTINATION'), do_lang_tempcode('DESCRIPTION_DESTINATION_ZONE'), 'destination_zone', $zones, NULL, true)); $hidden = form_input_hidden('zone', $zone); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('PAGES')))); return do_template('FORM_SCREEN', array('_GUID' => '79869440ede2482fe51839df04b9d880', 'SKIP_VALIDATION' => true, 'FIELDS' => $fields, 'TITLE' => $title, 'SUBMIT_NAME' => $submit_name, 'TEXT' => paragraph(do_lang_tempcode('SELECT_PAGES_MOVE')), 'URL' => $post_url, 'HIDDEN' => $hidden)); }
/** * The UI to choose a ticket type to edit, or to add a ticket. * * @return tempcode The UI */ function ticket_type_interface() { $title = get_page_title('MANAGE_TICKET_TYPES'); require_lang('permissions'); $list = new ocp_tempcode(); require_code('form_templates'); $ticket_types = collapse_1d_complexity('ticket_type', $GLOBALS['SITE_DB']->query_select('ticket_types', array('*'), NULL, 'ORDER BY ticket_type')); foreach ($ticket_types as $ticket_type) { $list->attach(form_input_list_entry(strval($ticket_type), false, get_translated_text($ticket_type))); } if (!$list->is_empty()) { $edit_url = build_url(array('page' => '_SELF', 'type' => 'edit'), '_SELF', NULL, false, true); $submit_name = do_lang_tempcode('CHOOSE'); $fields = form_input_list(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TICKET_TYPE'), 'ticket_type', $list); $tpl = do_template('FORM', array('TABINDEX' => strval(get_form_field_tabindex()), 'GET' => true, 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'URL' => $edit_url, 'SUBMIT_NAME' => $submit_name)); } else { $tpl = new ocp_tempcode(); } // Do a form so people can add $post_url = build_url(array('page' => '_SELF', 'type' => 'add'), '_SELF'); $submit_name = do_lang_tempcode('ADD_TICKET_TYPE'); $fields = form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TICKET_TYPE'), 'ticket_type_2', '', false); $fields->attach(form_input_tick(do_lang_tempcode('TICKET_GUEST_EMAILS_MANDATORY'), do_lang_tempcode('DESCRIPTION_TICKET_GUEST_EMAILS_MANDATORY'), 'guest_emails_mandatory', false)); $fields->attach(form_input_tick(do_lang_tempcode('TICKET_SEARCH_FAQ'), do_lang_tempcode('DESCRIPTION_TICKET_SEARCH_FAQ'), 'search_faq', false)); // Permissions $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups(); $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true); foreach ($groups as $id => $group_name) { if (in_array($id, $admin_groups)) { continue; } $fields->attach(form_input_tick(do_lang_tempcode('ACCESS_FOR', escape_html($group_name)), do_lang_tempcode('DESCRIPTION_ACCESS_FOR', escape_html($group_name)), 'access_' . strval($id), true)); } $add_form = do_template('FORM', array('_GUID' => '382f6fab6c563d81303ecb26495e76ec', 'TABINDEX' => strval(get_form_field_tabindex()), 'SECONDARY_FORM' => true, 'HIDDEN' => '', 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url)); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_TICKET_TYPES')))); return do_template('SUPPORT_TICKET_TYPE_SCREEN', array('_GUID' => '28645dc4a86086fa865ec7e166b84bb6', 'TITLE' => $title, 'TPL' => $tpl, 'ADD_FORM' => $add_form)); }
/** * The UI to choose a language. * * @param tempcode The title to show when choosing a language * @param boolean Whether to also choose a language file * @param boolean Whether the user may add a language * @param mixed Text message to show (Tempcode or string) * @param boolean Whether to provide an N/A choice * @param ID_TEXT The name of the parameter for specifying language * @return tempcode The UI */ function choose_lang($title, $choose_lang_file = false, $add_lang = false, $text = '', $provide_na = true, $param_name = 'lang') { $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/language'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_intl'; require_code('form_templates'); $langs = new ocp_tempcode(); if ($provide_na) { $langs->attach(form_input_list_entry('', false, do_lang_tempcode('NA'))); } $langs->attach(nice_get_langs(NULL, $add_lang)); $fields = form_input_list(do_lang_tempcode('LANGUAGE'), do_lang_tempcode('DESCRIPTION_LANGUAGE'), $param_name, $langs, NULL, false, false); $javascript = ''; if ($add_lang) { $fields->attach(form_input_codename(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('LANGUAGE')), do_lang_tempcode('DESCRIPTION_NEW_LANG'), 'lang_new', '', false)); $javascript .= 'standardAlternateFields(\'lang\',\'lang_new\');'; } if ($choose_lang_file) { $lang_files = new ocp_tempcode(); $lang_files->attach(form_input_list_entry('', false, do_lang_tempcode('NA_EM'))); $lang_files->attach(nice_get_lang_files()); $fields->attach(form_input_list(do_lang_tempcode('LANGUAGE_FILE'), do_lang_tempcode('DESCRIPTION_LANGUAGE_FILE'), 'lang_file', $lang_files, NULL, true)); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang('SEARCH')), '', 'search', '', false)); $javascript .= 'standardAlternateFields(\'lang_file\',\'search\');'; } $post_url = get_self_url(false, false, NULL, false, true); return do_template('FORM_SCREEN', array('_GUID' => 'ee6bdea3661cb4736173cac818a769e5', 'GET' => true, 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'SUBMIT_NAME' => do_lang_tempcode('CHOOSE'), 'TITLE' => $title, 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => $text, 'JAVASCRIPT' => $javascript)); }
/** * Standard modular UI to choose an entry to edit. * * @return tempcode The UI */ function ed() { if (!is_null($this->permissions_require) && is_null($this->permissions_cat_require)) { check_some_edit_permission($this->permissions_require, NULL, $this->permission_page_name); } $doing = 'EDIT_' . $this->lang_type; if ($this->catalogue && get_param('catalogue_name', '') != '') { $catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => get_param('catalogue_name')))); if ($this->type_code == 'd') { $doing = do_lang('CATALOGUE_GENERIC_EDIT', escape_html($catalogue_title)); } elseif ($this->type_code == 'c') { $doing = do_lang('CATALOGUE_GENERIC_EDIT_CATEGORY', escape_html($catalogue_title)); } } $title = get_page_title($doing); $test = $this->choose_catalogue($title); if (!is_null($test)) { return $test; } $text = paragraph(do_lang_tempcode('CHOOSE_EDIT_LIST')); $next_type = '_e' . $this->type_code; if (get_param('type', 'ed') == 'edit_catalogue') { $next_type = '_edit_catalogue'; } $map = array('page' => '_SELF', 'type' => $next_type); if (either_param('catalogue_name', '') != '') { $map['catalogue_name'] = either_param('catalogue_name'); } if (!is_null(get_param('redirect', NULL))) { $map['redirect'] = get_param('redirect'); } if (!is_null(get_param('continue', NULL))) { $map['continue'] = get_param('continue'); } $description = $this->select_name_description != '' ? do_lang_tempcode($this->select_name_description) : new ocp_tempcode(); if (method_exists($this, 'nice_get_radio_entries')) { $entries = $this->nice_get_radio_entries(); if ($entries->is_empty()) { inform_exit(do_lang_tempcode($this->type_code == 'd' ? 'NO_ENTRIES' : 'NO_CATEGORIES')); } $fields = form_input_radio(do_lang_tempcode($this->select_name), $description, 'id', $entries, $this->no_blank_ids, true, ''); } elseif (method_exists($this, 'nice_get_ajax_tree') && ($_fields = $this->nice_get_ajax_tree()) !== NULL) { if (is_array($_fields)) { $text = paragraph(do_lang_tempcode('CHOOSE_EDIT_LIST_EXTRA', escape_html($_fields[1]->evaluate()), escape_html($_fields[2]->evaluate()))); $fields = $_fields[0]; } else { $fields = $_fields; } } elseif (method_exists($this, 'nice_get_choose_table')) { list($test, ) = $this->get_entry_rows(); if (count($test) == 0) { inform_exit(do_lang_tempcode($this->type_code == 'd' ? 'NO_ENTRIES' : 'NO_CATEGORIES')); } $table_result = $this->nice_get_choose_table($map); if (is_null($table_result)) { inform_exit(do_lang_tempcode($this->type_code == 'd' ? 'NO_ENTRIES' : 'NO_CATEGORIES')); } $table = $table_result[0]; $has_ordering = $table_result[1]; if (array_key_exists(2, $table_result) && !is_null($table_result[2])) { $text = paragraph(do_lang_tempcode('CHOOSE_EDIT_TABLE_EXTRA', escape_html($table_result[2]->evaluate()), escape_html($table_result[3]->evaluate()))); } else { $text = paragraph(do_lang_tempcode('CHOOSE_EDIT_TABLE')); } return do_template('TABLE_TABLE_SCREEN', array('TITLE' => $title, 'TEXT' => $text, 'TABLE' => $table, 'SUBMIT_NAME' => $has_ordering ? do_lang_tempcode('ORDER') : NULL, 'POST_URL' => get_self_url())); } else { $_entries = $this->nice_get_entries(); if (is_array($_entries)) { $text = paragraph(do_lang_tempcode('CHOOSE_EDIT_LIST_EXTRA', escape_html($_entries[1]->evaluate()), escape_html($_entries[2]->evaluate()))); $entries = $_entries[0]; } else { $entries = $_entries; } if ($entries->is_empty()) { inform_exit(do_lang_tempcode($this->type_code == 'd' ? 'NO_ENTRIES' : 'NO_CATEGORIES')); } $fields = form_input_list(do_lang_tempcode($this->select_name), $description, 'id', $entries, NULL, true, $this->no_blank_ids); } $post_url = build_url($map, '_SELF', NULL, false, true); //$submit_name=(strpos($doing,' ')!==false)?protect_from_escaping($doing):do_lang($doing); $submit_name = do_lang_tempcode('PROCEED'); $keep = symbol_tempcode('KEEP'); $iframe_url = NULL; if (!$this->special_edit_frontend && has_js()) { $iframe_url = find_script('iframe') . '?zone=' . get_zone_name() . '&wide_high=1&opens_below=1'; foreach ($map as $key => $val) { $iframe_url .= '&' . $key . '=' . urlencode(str_replace('_SELF', get_page_name(), $val)); } $iframe_url .= $keep->evaluate(); } return do_template('FORM_SCREEN', array('_GUID' => '228a05e24253f324ea286ea8ac3d8b02' . get_class($this), 'GET' => true, 'IFRAME_URL' => $iframe_url, 'HIDDEN' => '', 'TITLE' => $title, 'TEXT' => $text, 'URL' => $post_url, 'FIELDS' => $fields->evaluate(), 'SUBMIT_NAME' => $submit_name, 'SKIP_VALIDATION' => true)); }
/** * The UI to add a poll. * * @param ?AUTO_LINK The topic ID to add the poll to (NULL: it is instead gettable from a GET parameter named 'id') * @return tempcode The UI */ function add_poll($topic_id = NULL) { if (is_null($topic_id)) { $topic_id = get_param_integer('id'); } $map = array('page' => '_SELF', 'type' => '_add_poll', 'id' => $topic_id); if (get_param_integer('try_validate', 0) == 1) { $map['try_validate'] = 1; } if (get_param('type', 'misc') == '_add_reply' && post_param_integer('validated', 0) == 1) { $map['re_validate'] = 1; } $post_url = build_url($map, '_SELF'); $fields = new ocp_tempcode(); $fields->attach($this->get_poll_form_fields()); // Find polls we can grab $groups = _get_where_clause_groups(get_member()); if (!is_null($groups)) { $perhaps = $GLOBALS['SITE_DB']->query('SELECT category_name FROM ' . get_table_prefix() . 'group_category_access WHERE ' . db_string_equal_to('module_the_name', 'forums') . ' AND (' . $groups . ')'); $or_list = ''; foreach ($perhaps as $row) { if ($or_list != '') { $or_list .= ' OR '; } $or_list .= 't.t_forum_id=' . strval((int) $row['category_name']); } if ($or_list != '') { $polls = $GLOBALS['FORUM_DB']->query('SELECT p.*,t_cache_first_username FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics t LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_polls p ON p.id=t.t_poll_id WHERE (' . $or_list . ') AND p.id IS NOT NULL ORDER BY id DESC', 30); } else { $polls = array(); } } else { $polls = $GLOBALS['FORUM_DB']->query('SELECT p.*,t_cache_first_username FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics t LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_polls p ON p.id=t.t_poll_id WHERE p.id IS NOT NULL ORDER BY id DESC', 30); } if (count($polls) != 0) { $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => true, 'TITLE' => do_lang_tempcode('ALT_COPY_EXISTING_POLL')))); $list = new ocp_tempcode(); $list->attach(form_input_list_entry('', true, '')); foreach ($polls as $poll) { $list->attach(form_input_list_entry(strval($poll['id']), false, do_lang_tempcode('POLL_IN_LIST', escape_html($poll['po_question']), escape_html($poll['t_cache_first_username'])))); } $fields->attach(form_input_list(do_lang_tempcode('EXISTING'), do_lang_tempcode('COPY_EXISTING_POLL'), 'existing', $list, NULL, false, false)); $javascript = 'var existing=document.getElementById(\'existing\'); var form=existing.form; var ch_func=function() { var disable_all=(existing.selectedIndex!=0); var i; for (i=0;i<form.elements.length;i++) if ((form.elements[i]!=existing) && (form.elements[i].id!=\'perform_keywordcheck\') && ((form.elements[i].getAttribute(\'type\')==\'checkbox\') || (form.elements[i].getAttribute(\'type\')==\'text\'))) { setRequired(form.elements[i].name,(!disable_all) && ((form.elements[i].id==\'question\') || (form.elements[i].id==\'answer_0\'))); setLocked(form.elements[i].name,disable_all); } }; for (i=0;i<form.elements.length;i++) addEventListenerAbstract(form.elements[i],\'change\',ch_func);'; } else { $javascript = ''; } $title = get_page_title('ADD_TOPIC_POLL'); $submit_name = do_lang_tempcode('ADD_TOPIC_POLL'); $topic_info = $GLOBALS['FORUM_DB']->query_select('f_topics', array('*'), array('id' => $topic_id), '', 1); if (!array_key_exists(0, $topic_info)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $this->handle_topic_breadcrumbs($topic_info[0]['t_forum_id'], $topic_id, $topic_info[0]['t_cache_first_title'], do_lang_tempcode('ADD_TOPIC_POLL')); return do_template('FORM_SCREEN', array('_GUID' => 'ce1752a0c5508a061bffbf242a13e5bd', 'HIDDEN' => '', 'TITLE' => $title, 'FIELDS' => $fields, 'TEXT' => '', 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url, 'JAVASCRIPT' => $javascript)); }
/** * Get form inputter. * * @param string The field name * @param string The field description * @param array The field details * @param ?string The actual current value of the field (NULL: none) * @return ?tempcode The Tempcode for the input field (NULL: skip the field - it's not input) */ function get_field_inputter($_cf_name, $_cf_description, $field, $actual_value) { $default = $field['cf_default']; $list = $default == '' ? array() : explode('|', $default); $_list = new ocp_tempcode(); if ($field['cf_required'] == 0 || $actual_value == '' || is_null($actual_value)) { $_list->attach(form_input_list_entry('', true, do_lang_tempcode('NA_EM'))); } foreach ($list as $l) { $_list->attach(form_input_list_entry($l, $l == $actual_value)); } return form_input_list($_cf_name, $_cf_description, 'field_' . strval($field['id']), $_list, NULL, false, $field['cf_required'] == 1); }
/** * UI to add an invoice. * * @return tempcode The interface. */ function ad() { $title = get_page_title('CREATE_INVOICE'); breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('INVOICES')))); require_code('form_templates'); $to = get_param('to', ''); $products = find_all_products(); $list = new ocp_tempcode(); foreach ($products as $product => $details) { if ($details[0] == PRODUCT_INVOICE) { $text = do_lang_tempcode('CUSTOM_PRODUCT_' . $product); if ($details[1] != '?') { $text->attach(escape_html(' (' . $details[1] . ' ' . get_option('currency') . ')')); } $list->attach(form_input_list_entry($product, false, $text)); } } if ($list->is_empty()) { inform_exit(do_lang_tempcode('NOTHING_TO_INVOICE_FOR')); } $fields = new ocp_tempcode(); $fields->attach(form_input_list(do_lang_tempcode('PRODUCT'), '', 'product', $list)); $fields->attach(form_input_username(do_lang_tempcode('USERNAME'), do_lang_tempcode('DESCRIPTION_INVOICE_FOR'), 'to', $to, true)); $fields->attach(form_input_float(do_lang_tempcode('AMOUNT'), do_lang_tempcode('INVOICE_AMOUNT_TEXT', escape_html(get_option('currency'))), 'amount', NULL, false)); $fields->attach(form_input_line(do_lang_tempcode('INVOICE_SPECIAL'), do_lang_tempcode('DESCRIPTION_INVOICE_SPECIAL'), 'special', '', false)); $fields->attach(form_input_text(do_lang_tempcode('INVOICE_NOTE'), do_lang_tempcode('DESCRIPTION_INVOICE_NOTE'), 'note', '', false)); $post_url = build_url(array('page' => '_SELF', 'type' => '_ad'), '_SELF'); $submit_name = do_lang_tempcode('CREATE_INVOICE'); return do_template('FORM_SCREEN', array('HIDDEN' => '', 'TITLE' => $title, 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'TEXT' => do_lang_tempcode('DESCRIPTION_INVOICE_PAGE'))); }
/** * Show value statistics for a custom profile field (choose). * * @return tempcode The UI */ function stats() { $title = get_page_title('CUSTOM_PROFILE_FIELD_STATS'); breadcrumb_set_parents(array()); $fields = new ocp_tempcode(); $rows = $GLOBALS['FORUM_DB']->query_select('f_custom_fields', array('id', 'cf_name', 'cf_type')); require_code('form_templates'); require_code('fields'); $list = new ocp_tempcode(); $_list = array(); foreach ($rows as $row) { $ob = get_fields_hook($row['cf_type']); list(, , $storage_type) = $ob->get_field_value_row_bits(NULL); if (strpos($storage_type, '_trans') === false) { $id = $row['id']; $text = get_translated_text($row['cf_name'], $GLOBALS['FORUM_DB']); $_list[$id] = $text; } } asort($_list); foreach ($_list as $id => $text) { $list->attach(form_input_list_entry(strval($id), false, $text)); } if ($list->is_empty()) { return inform_screen($title, do_lang_tempcode('NO_ENTRIES')); } require_lang('dates'); $fields->attach(form_input_list(do_lang_tempcode('NAME'), '', 'id', $list)); $fields->attach(form_input_date(do_lang_tempcode('FROM'), do_lang_tempcode('DESCRIPTION_MEMBERS_JOINED_FROM'), 'start', true, false, false, time() - 60 * 60 * 24 * 30, 10, intval(date('Y')) - 10)); $fields->attach(form_input_date(do_lang_tempcode('TO'), do_lang_tempcode('DESCRIPTION_MEMBERS_JOINED_TO'), 'end', true, false, false, time(), 10, intval(date('Y')) - 10)); $post_url = build_url(array('page' => '_SELF', 'type' => '_stats'), '_SELF', NULL, false, true); $submit_name = do_lang_tempcode('CUSTOM_PROFILE_FIELD_STATS'); return do_template('FORM_SCREEN', array('_GUID' => '393bac2180c9e135ae9c31565ddf7761', 'GET' => true, 'SKIP_VALIDATION' => true, 'TITLE' => $title, 'HIDDEN' => '', 'FIELDS' => $fields, 'TEXT' => '', 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name)); }
/** * Get tempcode for adding/editing form. * * @param ?AUTO_LINK The ID of the award (NULL: not added yet) * @param SHORT_TEXT The title * @param LONG_TEXT The description * @param integer How many points are given to the awardee * @param ID_TEXT The content type the award type is for * @param BINARY Whether to not show the awardee when displaying this award * @param integer The approximate time in hours between awards (e.g. 168 for a week) * @return tempcode The input fields */ function get_form_fields($id = NULL, $title = '', $description = '', $points = 0, $content_type = 'download', $hide_awardee = 0, $update_time_hours = 168) { $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $title, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', $description, true)); if (addon_installed('points')) { $fields->attach(form_input_integer(do_lang_tempcode('POINTS'), do_lang_tempcode('DESCRIPTION_AWARD_POINTS'), 'points', $points, true)); } $list = new ocp_tempcode(); $_hooks = array(); $hooks = find_all_hooks('systems', 'awards'); foreach (array_keys($hooks) as $hook) { require_code('hooks/systems/awards/' . $hook); $hook_object = object_factory('Hook_awards_' . $hook, true); if (is_null($hook_object)) { continue; } $hook_info = $hook_object->info(); if (!is_null($hook_info)) { $_hooks[$hook] = $hook_info['title']->evaluate(); } } asort($_hooks); foreach ($_hooks as $hook => $hook_title) { $list->attach(form_input_list_entry($hook, $hook == $content_type, protect_from_escaping($hook_title))); } if ($list->is_empty()) { inform_exit(do_lang_tempcode('NO_CATEGORIES')); } $fields->attach(form_input_list(do_lang_tempcode('CONTENT_TYPE'), do_lang_tempcode('DESCRIPTION_CONTENT_TYPE'), 'content_type', $list)); $fields->attach(form_input_tick(do_lang_tempcode('HIDE_AWARDEE'), do_lang_tempcode('DESCRIPTION_HIDE_AWARDEE'), 'hide_awardee', $hide_awardee == 1)); $fields->attach(form_input_integer(do_lang_tempcode('AWARD_UPDATE_TIME_HOURS'), do_lang_tempcode('DESCRIPTION_AWARD_UPDATE_TIME_HOURS'), 'update_time_hours', $update_time_hours, true)); // Permissions $fields->attach($this->get_permission_fields(is_null($id) ? NULL : strval($id), do_lang_tempcode('AWARD_PERMISSION_HELP'), false, do_lang_tempcode('GIVE_AWARD'))); return $fields; }
/** * Get tempcode for a post template adding/editing form. * * @param SHORT_TEXT The emoticon code * @param SHORT_TEXT The theme image code * @param integer The relevance level of the emoticon * @range 0 4 * @param BINARY Whether the emoticon is usable as a topic emoticon * @param BINARY Whether this may only be used by privileged members * @return array A pair: The input fields, Hidden fields */ function get_form_fields($code = ':-]', $theme_img_code = '', $relevance_level = 1, $use_topics = 1, $is_special = 0) { $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('CODE'), do_lang_tempcode('DESCRIPTION_EMOTICON_CODE'), 'code', $code, true)); if (get_base_url() == get_forum_base_url()) { $fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); handle_max_file_size($hidden, 'image'); } require_code('themes2'); $ids = get_all_image_ids_type('ocf_emoticons', false, $GLOBALS['FORUM_DB']); $fields->attach(form_input_picture_choose_specific(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('STOCK')), do_lang_tempcode('DESCRIPTION_ALTERNATE_STOCK'), 'theme_img_code', $ids, NULL, $theme_img_code, NULL, true, $GLOBALS['FORUM_DB'])); $list = new ocp_tempcode(); for ($i = 0; $i <= 4; $i++) { $list->attach(form_input_list_entry(strval($i), $i == $relevance_level, do_lang_tempcode('EMOTICON_RELEVANCE_LEVEL_' . strval($i)))); } $fields->attach(form_input_list(do_lang_tempcode('RELEVANCE_LEVEL'), do_lang_tempcode('DESCRIPTION_RELEVANCE_LEVEL'), 'relevance_level', $list)); $fields->attach(form_input_tick(do_lang_tempcode('USE_TOPICS'), do_lang_tempcode('DESCRIPTION_USE_TOPICS'), 'use_topics', $use_topics == 1)); $fields->attach(form_input_tick(do_lang_tempcode('EMOTICON_IS_SPECIAL'), do_lang_tempcode('DESCRIPTION_EMOTICON_IS_SPECIAL'), 'is_special', $is_special == 1)); return array($fields, $hidden); }
/** * Get tempcode for a news adding/editing form. * * @param ?AUTO_LINK The primary category for the news (NULL: personal) * @param ?array A list of categories the news is in (NULL: not known) * @param SHORT_TEXT The news title * @param LONG_TEXT The news summary * @param SHORT_TEXT The name of the author * @param BINARY Whether the news is validated * @param ?BINARY Whether rating is allowed (NULL: decide statistically, based on existing choices) * @param ?SHORT_INTEGER Whether comments are allowed (0=no, 1=yes, 2=review style) (NULL: decide statistically, based on existing choices) * @param ?BINARY Whether trackbacks are allowed (NULL: decide statistically, based on existing choices) * @param BINARY Whether to show the "send trackback" field * @param LONG_TEXT Notes for the video * @param URLPATH URL to the image for the news entry (blank: use cat image) * @param ?array Scheduled go-live time (NULL: N/A) * @return array A tuple of lots of info (fields, hidden fields, trailing fields) */ function get_form_fields($main_news_category = NULL, $news_category = NULL, $title = '', $news = '', $author = '', $validated = 1, $allow_rating = NULL, $allow_comments = NULL, $allow_trackbacks = NULL, $send_trackbacks = 1, $notes = '', $image = '', $scheduled = NULL) { list($allow_rating, $allow_comments, $allow_trackbacks) = $this->choose_feedback_fields_statistically($allow_rating, $allow_comments, $allow_trackbacks); global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'validated'; if (is_null($main_news_category)) { $NON_CANONICAL_PARAMS[] = 'cat'; $param_cat = get_param('cat', ''); if ($param_cat == '') { $news_category = array(); $main_news_category = NULL; } elseif (strpos($param_cat, ',') === false) { $news_category = array(); $main_news_category = intval($param_cat); } else { require_code('ocfiltering'); $news_category = ocfilter_to_idlist_using_db($param_cat, 'id', 'news_categories', 'news_categories', NULL, 'id', 'id'); $main_news_category = NULL; } $author = $GLOBALS['FORUM_DRIVER']->get_username(get_member()); } $cats1 = nice_get_news_categories($main_news_category, false, true, false, true); $cats2 = nice_get_news_categories(is_null($news_category) || count($news_category) == 0 ? array(get_param_integer('cat', NULL)) : $news_category, false, true, true, false); $fields = new ocp_tempcode(); $fields2 = new ocp_tempcode(); $hidden = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_line_comcode(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $title, true)); if ($validated == 0) { $validated = get_param_integer('validated', 0); if ($validated == 1) { attach_message(do_lang_tempcode('WILL_BE_VALIDATED_WHEN_SAVING')); } } if (has_some_cat_specific_permission(get_member(), 'bypass_validation_' . $this->permissions_require . 'range_content', 'cms_news', $this->permissions_cat_require)) { if (addon_installed('unvalidated')) { $fields2->attach(form_input_tick(do_lang_tempcode('VALIDATED'), do_lang_tempcode('DESCRIPTION_VALIDATED'), 'validated', $validated == 1)); } } if ($cats1->is_empty()) { warn_exit(do_lang_tempcode('NO_CATEGORIES')); } if (addon_installed('authors')) { $hidden->attach(form_input_hidden('author', $author)); } $fields2->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => (is_null($news_category) || count($news_category) == 0) && $image == '' && (is_null($news_category) || $news_category == array()), 'TITLE' => do_lang_tempcode('ADVANCED')))); $fields2->attach(form_input_text_comcode(do_lang_tempcode('BLOG_NEWS_SUMMARY'), do_lang_tempcode('DESCRIPTION_NEWS_SUMMARY'), 'news', $news, false)); if (get_value('disable_secondary_news') !== '1') { $fields2->attach(form_input_list(do_lang_tempcode('MAIN_CATEGORY'), do_lang_tempcode('DESCRIPTION_MAIN_CATEGORY'), 'main_news_category', $cats1)); } else { $fields2->attach(form_input_hidden('main_news_category', is_null($main_news_category) ? 'personal' : strval($main_news_category))); } if (get_value('disable_secondary_news') !== '1') { $fields2->attach(form_input_multi_list(do_lang_tempcode('SECONDARY_CATEGORIES'), do_lang_tempcode('DESCRIPTION_SECONDARY_CATEGORIES'), 'news_category', $cats2)); } $fields2->attach(form_input_upload(do_lang_tempcode('IMAGE'), do_lang_tempcode('DESCRIPTION_NEWS_IMAGE_OVERRIDE'), 'file', false, $image, NULL, true, str_replace(' ', '', get_option('valid_images')))); //handle_max_file_size($hidden,'image'); Attachments will add this if (addon_installed('calendar') && has_specific_permission(get_member(), 'scheduled_publication_times')) { $fields2->attach(form_input_date__scheduler(do_lang_tempcode('PUBLICATION_TIME'), do_lang_tempcode('DESCRIPTION_PUBLICATION_TIME'), 'schedule', true, true, true, $scheduled, intval(date('Y')) - 1970 + 2, 1970)); } require_code('feedback2'); $fields2->attach(feedback_fields($allow_rating == 1, $allow_comments == 1, $allow_trackbacks == 1, $send_trackbacks == 1, $notes, $allow_comments == 2)); $fields2->attach(get_syndication_option_fields()); return array($fields, $hidden, NULL, NULL, NULL, NULL, make_string_tempcode($fields2->evaluate())); }
/** * Function to display export order list filters * * @return tempcode The interface. */ function order_export() { require_code('shopping'); require_code('form_templates'); $title = get_page_title('EXPORT_ORDER_LIST'); breadcrumb_set_parents(array(array('_SEARCH:admin_ecommerce:ecom_usage', do_lang_tempcode('ECOMMERCE')), array('_SELF:_SELF:misc', do_lang_tempcode('ORDERS')), array('_SELF:_SELF:show_orders', do_lang_tempcode('ORDER_LIST')))); $fields = new ocp_tempcode(); $order_status_list = get_order_status_list(); $fields->attach(form_input_list(do_lang_tempcode('ORDER_STATUS'), do_lang_tempcode('ORDER_STATUS_FILTER_DESCRIPTION'), 'order_status', $order_status_list, NULL, false, false)); // Dates $start_year = intval(date('Y')) - 1; $start_month = intval(date('m')); $start_day = intval(date('d')); $start_hour = intval(date('H')); $start_minute = intval(date('i')); $end_year = $start_year + 1; $end_month = $start_month; $end_day = $start_day; $end_hour = $start_hour; $end_minute = $start_minute; $fields->attach(form_input_date(do_lang_tempcode('ST_START_PERIOD'), do_lang_tempcode('ST_START_PERIOD_DESCRIPTION'), 'start_date', false, false, true, array($start_minute, $start_hour, $start_month, $start_day, $start_year))); $fields->attach(form_input_date(do_lang_tempcode('ST_END_PERIOD'), do_lang_tempcode('ST_END_PERIOD_DESCRIPTION'), 'end_date', false, false, true, array($end_minute, $end_hour, $end_month, $end_day, $end_year))); return do_template('FORM_SCREEN', array('SKIP_VALIDATION' => true, 'TITLE' => $title, 'SUBMIT_NAME' => do_lang_tempcode('EXPORT_ORDER_LIST'), 'TEXT' => paragraph(do_lang_tempcode('EXPORT_ORDER_LIST_TEXT')), 'URL' => build_url(array('page' => '_SELF', 'type' => '_order_export'), '_SELF'), 'HIDDEN' => '', 'FIELDS' => $fields)); }
/** * Get tempcode for a zone adding/editing form. * * @param boolean Whether the zone editor will be used * @param SHORT_TEXT The zone title * @param ID_TEXT The zones default page * @param SHORT_TEXT The header text * @param ?ID_TEXT The theme (NULL: no override) * @param BINARY Whether the zone is wide * @param BINARY Whether the zone requires a session for pages to be used * @param BINARY Whether the zone in displayed in the menu coded into some themes * @param ?ID_TEXT Name of the zone (NULL: unknown) * @return array A tuple: The tempcode for the fields, hidden fields, and extra Javascript */ function get_form_fields($in_zone_editor = false, $title = '', $default_page = 'start', $header_text = '', $theme = NULL, $wide = 0, $require_session = 0, $displayed_in_menu = 1, $zone = NULL) { require_lang('permissions'); $javascript = ''; $fields = ''; $hidden = new ocp_tempcode(); require_code('form_templates'); $fields .= static_evaluate_tempcode(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'title', $title, true)); $fields .= static_evaluate_tempcode(form_input_line(do_lang_tempcode('DEFAULT_PAGE'), do_lang_tempcode('DESCRIPTION_DEFAULT_PAGE'), 'default_page', $default_page, true)); $fields .= static_evaluate_tempcode(form_input_line(do_lang_tempcode('HEADER_TEXT'), do_lang_tempcode('DESCRIPTION_HEADER_TEXT'), 'header_text', $header_text, false)); $list = ''; $list .= static_evaluate_tempcode(form_input_list_entry('0', $wide == 0, do_lang_tempcode('NO'))); $list .= static_evaluate_tempcode(form_input_list_entry('1', $wide == 1, do_lang_tempcode('YES'))); $list .= static_evaluate_tempcode(form_input_list_entry('-1', is_null($wide), do_lang_tempcode('RELY_FORUMS'))); $fields .= static_evaluate_tempcode(form_input_list(do_lang_tempcode('WIDE'), do_lang_tempcode('DESCRIPTION_WIDE'), 'wide', make_string_tempcode($list))); $fields .= static_evaluate_tempcode(form_input_tick(do_lang_tempcode('DISPLAYED_IN_MENU'), do_lang_tempcode('DESCRIPTION_DISPLAYED_IN_MENU'), 'displayed_in_menu', $displayed_in_menu == 1)); // Theme require_code('themes2'); $entries = nice_get_themes($theme, false, true); $fields .= static_evaluate_tempcode(form_input_list(do_lang_tempcode('THEME'), do_lang_tempcode(get_forum_type() == 'ocf' ? '_DESCRIPTION_THEME_OCF' : '_DESCRIPTION_THEME', substr(preg_replace('#[^A-Za-z\\d]#', '_', get_site_name()), 0, 80)), 'theme', $entries)); $fields .= static_evaluate_tempcode(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => true, 'TITLE' => do_lang_tempcode('ADVANCED')))); $fields .= static_evaluate_tempcode(form_input_tick(do_lang_tempcode('REQUIRE_SESSION'), do_lang_tempcode('DESCRIPTION_REQUIRE_SESSION'), 'require_session', $require_session == 1)); if (!$in_zone_editor && !is_null($zone) && addon_installed('zone_logos')) { // Logos handle_max_file_size($hidden, 'image'); require_code('themes2'); $themes = find_all_themes(); foreach ($themes as $theme => $theme_name) { $fields .= static_evaluate_tempcode(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => true, 'TITLE' => do_lang_tempcode('THEME_LOGO', escape_html($theme_name))))); $fields .= static_evaluate_tempcode(form_input_upload(do_lang_tempcode('IMAGE'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'logo_upload_' . $theme, false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); require_code('themes2'); $ids = get_all_image_ids_type('logo', false, NULL, $theme); $current_logo = 'logo/' . $zone . '-logo'; if (!in_array($current_logo, $ids)) { $current_logo = 'logo/-logo'; } foreach ($ids as $id) { $test = find_theme_image($id, true, false, $theme); if ($test == '') { $test = find_theme_image($id, false, false, 'default'); } if ($test == '' && $id == $current_logo) { $current_logo = $ids[0]; } } $fields .= static_evaluate_tempcode(form_input_picture_choose_specific(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('STOCK')), do_lang_tempcode('DESCRIPTION_ALTERNATE_STOCK'), 'logo_select_' . $theme, $ids, NULL, $current_logo, NULL, true, NULL, $theme)); $javascript .= 'standardAlternateFields(\'logo_upload_' . $theme . '\',\'logo_select_' . $theme . '*\');'; } } if ($zone !== '') { $fields .= static_evaluate_tempcode(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('PERMISSIONS')))); // Permissions $admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups(); $groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true); foreach ($groups as $id => $name) { if (in_array($id, $admin_groups)) { continue; } $perhaps = is_null($zone) ? true : $GLOBALS['SITE_DB']->query_value_null_ok('group_zone_access', 'zone_name', array('zone_name' => $zone, 'group_id' => $id)); $fields .= static_evaluate_tempcode(form_input_tick(do_lang_tempcode('ACCESS_FOR', escape_html($name)), do_lang_tempcode('DESCRIPTION_ACCESS_FOR', escape_html($name)), 'access_' . strval($id), !is_null($perhaps))); } } return array(make_string_tempcode($fields), $hidden, $javascript); }