/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('bulkupload'); $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/bulkuploadassistant'; $GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_adv_comcode'; $GLOBALS['HELPER_PANEL_TEXT'] = comcode_lang_string('DOC_BULK_UPLOAD'); $title = get_page_title('BULK_UPLOAD'); $parameter = post_param('parameter', ''); require_code('form_templates'); if ($parameter == '') { $post_url = build_url(array('page' => '_SELF'), '_SELF'); $text = paragraph(do_lang_tempcode('BULK_UPLOAD_HELP')); $submit_name = do_lang_tempcode('BULK_UPLOAD'); $fields = form_input_line(do_lang_tempcode('DIRECTORY'), do_lang_tempcode('DIRECTORY_BULK'), 'parameter', 'uploads/attachments/' . date('Y-m-d', utctime_to_usertime()), true); return do_template('FORM_SCREEN', array('_GUID' => '77a2ca460745145d8a1d18cf24971fea', 'SKIP_VALIDATION' => true, 'HIDDEN' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'TITLE' => $title, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name)); } else { breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('BULK_UPLOAD')))); breadcrumb_set_self(do_lang_tempcode('_RESULTS')); $out = $this->do_dir(get_custom_file_base() . '/' . filter_naughty($parameter, true)); if ($out->is_empty()) { inform_exit(do_lang_tempcode('NO_FILES')); } return do_template('BULK_HELPER_RESULTS_SCREEN', array('_GUID' => '5d373553cf21a58f15006bd4e600a9ee', 'TITLE' => $title, 'RESULTS' => $out)); } }
/** * Get tempcode for a forum category template adding/editing form. * * @param SHORT_TEXT The title (name) of the forum category * @param LONG_TEXT The description for the category * @param BINARY Whether the category is expanded by default when shown in the forum view * @return tempcode The input fields */ function get_form_fields($title = '', $description = '', $expanded_by_default = 1) { $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_line(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', $description, false)); $fields->attach(form_input_tick(do_lang_tempcode('EXPANDED_BY_DEFAULT'), do_lang_tempcode('DESCRIPTION_EXPANDED_BY_DEFAULT'), 'expanded_by_default', $expanded_by_default == 1)); return $fields; }
/** * 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; }
/** * Get fields for adding/editing one of these. * * @param string What to place onto the end of the field name * @param SHORT_TEXT Title * @param LONG_TEXT Description * @param BINARY Whether it is enabled * @param ?integer The cost in points (NULL: not set) * @param BINARY Whether it is restricted to one per member * @return tempcode The fields */ function get_fields($name_suffix = '', $title = '', $description = '', $enabled = 1, $cost = NULL, $one_per_member = 0) { require_lang('points'); $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TITLE'), 'custom_title' . $name_suffix, $title, true)); $fields->attach(form_input_text(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'custom_description' . $name_suffix, $description, true)); $fields->attach(form_input_integer(do_lang_tempcode('COST'), do_lang_tempcode('HOW_MUCH_THIS_COSTS'), 'custom_cost' . $name_suffix, $cost, true)); $fields->attach(form_input_tick(do_lang_tempcode('ONE_PER_MEMBER'), do_lang_tempcode('DESCRIPTION_ONE_PER_MEMBER'), 'custom_one_per_member' . $name_suffix, $one_per_member == 1)); $fields->attach(form_input_tick(do_lang_tempcode('ENABLED'), '', 'custom_enabled' . $name_suffix, $enabled == 1)); return $fields; }
/** * Get template fields to insert into a form page, for manipulation of seo fields. * * @param ID_TEXT The type of resource (e.g. download) * @param ?ID_TEXT The ID of the resource (NULL: adding) * @return tempcode Form page tempcode fragment */ function seo_get_fields($type, $id = NULL) { require_code('form_templates'); if (is_null($id)) { list($keywords, $description) = array('', ''); } else { list($keywords, $description) = seo_meta_get_for($type, $id); } $fields = new ocp_tempcode(); if (get_value('disable_seo') !== '1' && (get_value('disable_seo') !== '2' || !is_null($id))) { $fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => $keywords == '' && $description == '', 'TITLE' => do_lang_tempcode('SEO'), 'HELP' => get_option('show_docs') === '0' ? NULL : protect_from_escaping(symbol_tempcode('URLISE_LANG', array(do_lang('TUTORIAL_ON_THIS'), brand_base_url() . '/docs' . strval(ocp_version()) . '/pg/tut_seo', 'tut_seo', '1')))))); $fields->attach(form_input_line_multi(do_lang_tempcode('KEYWORDS'), do_lang_tempcode('DESCRIPTION_META_KEYWORDS'), 'meta_keywords[]', array_map('trim', explode(',', preg_replace('#,+#', ',', $keywords))), 0)); $fields->attach(form_input_line(do_lang_tempcode('META_DESCRIPTION'), do_lang_tempcode('DESCRIPTION_META_DESCRIPTION'), 'meta_description', $description, false)); } return $fields; }
/** * Get the tempcode for the manipulation of the feedback fields for some content, if they are enabled in the Admin Zone. * * @param boolean Whether rating is currently/by-default allowed for this resource * @param boolean Whether comments are currently/by-default allowed for this resource * @param ?boolean Whether trackbacks are currently/by-default allowed for this resource (NULL: this resource does not support trackbacks regardless) * @param boolean Whether we're allowed to send trackbacks for this resource * @param LONG_TEXT The current/by-default notes for this content * @param ?boolean Whether reviews are currently/by-default allowed for this resource (NULL: no reviews allowed here) * @param boolean Whether the default values for the allow options is actually off (this determines how the tray auto-hides itself) * @return tempcode The feedback editing fields */ function feedback_fields($allow_rating, $allow_comments, $allow_trackbacks, $send_trackbacks, $notes, $allow_reviews = NULL, $default_off = false) { if (get_value('disable_feedback') === '1') { return new ocp_tempcode(); } require_code('feedback'); require_code('form_templates'); $fields = new ocp_tempcode(); if ($send_trackbacks && get_option('is_on_trackbacks') == '1') { require_lang('trackbacks'); $fields->attach(form_input_line(do_lang_tempcode('SEND_TRACKBACKS'), do_lang_tempcode('DESCRIPTION_SEND_TRACKBACKS'), 'send_trackbacks', get_param('trackback', ''), false)); } if (get_option('is_on_rating') == '1') { $fields->attach(form_input_tick(do_lang_tempcode('ALLOW_RATING'), do_lang_tempcode('DESCRIPTION_ALLOW_RATING'), 'allow_rating', $allow_rating)); } if (get_option('is_on_comments') == '1') { if (!is_null($allow_reviews)) { $choices = new ocp_tempcode(); $choices->attach(form_input_list_entry('0', !$allow_comments && !$allow_reviews, do_lang('NO'))); $choices->attach(form_input_list_entry('1', $allow_comments && !$allow_reviews, do_lang('ALLOW_COMMENTS_ONLY'))); $choices->attach(form_input_list_entry('2', $allow_reviews, do_lang('ALLOW_REVIEWS'))); $fields->attach(form_input_list(do_lang_tempcode('ALLOW_COMMENTS'), do_lang_tempcode('DESCRIPTION_ALLOW_COMMENTS'), 'allow_comments', $choices, NULL, false, false)); } else { $fields->attach(form_input_tick(do_lang_tempcode('ALLOW_COMMENTS'), do_lang_tempcode('DESCRIPTION_ALLOW_COMMENTS'), 'allow_comments', $allow_comments)); } } if (get_option('is_on_trackbacks') == '1' && !is_null($allow_trackbacks)) { require_lang('trackbacks'); $fields->attach(form_input_tick(do_lang_tempcode('ALLOW_TRACKBACKS'), do_lang_tempcode('DESCRIPTION_ALLOW_TRACKBACKS'), 'allow_trackbacks', $allow_trackbacks)); } 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 (!$fields->is_empty()) { if ($default_off) { $section_hidden = $notes == '' && !$allow_comments && (is_null($allow_trackbacks) || !$allow_trackbacks) && !$allow_rating; } else { $section_hidden = $notes == '' && $allow_comments && (is_null($allow_trackbacks) || $allow_trackbacks || get_option('is_on_trackbacks') == '0') && $allow_rating; } $_fields = do_template('FORM_SCREEN_FIELD_SPACER', array('SECTION_HIDDEN' => $section_hidden, 'TITLE' => do_lang_tempcode(get_value('disable_staff_notes') !== '1' ? 'FEEDBACK_AND_NOTES' : '_FEEDBACK'))); $_fields->attach($fields); $fields = $_fields; } return $fields; }
/** * Standard modular render function for profile tabs edit hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set) */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { $title = do_lang_tempcode('PHOTO'); $order = 30; // Actualiser if (post_param_integer('submitting_photo_tab', 0) == 1) { require_code('ocf_members_action'); require_code('ocf_members_action2'); ocf_member_choose_photo('photo_url', 'photo_file', $member_id_of); attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform'); } if ($leave_to_ajax_if_possible) { return NULL; } $photo_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_url'); $thumb_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_thumb_url'); // UI fields $fields = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'photo_file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'photo_url', $photo_url, false)); if (get_option('is_on_gd') == '0' || !function_exists('imagetypes')) { $thumb_width = get_option('thumb_width'); $fields->attach(form_input_upload(do_lang_tempcode('THUMBNAIL'), do_lang_tempcode('DESCRIPTION_THUMBNAIL', escape_html($thumb_width)), 'photo_file2', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'photo_thumb_url', $thumb_url, false)); } $hidden = new ocp_tempcode(); handle_max_file_size($hidden, 'image'); $hidden->attach(form_input_hidden('submitting_photo_tab', '1')); $text = new ocp_tempcode(); require_code('images'); $max = floatval(get_max_image_size()) / floatval(1024 * 1024); if ($max < 3.0) { require_code('files2'); $config_url = get_upload_limit_config_url(); $text->attach(paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), is_null($config_url) ? '' : escape_html($config_url)))); } $text = do_template('OCF_EDIT_PHOTO_TAB', array('TEXT' => $text, 'MEMBER_ID' => strval($member_id_of), 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id_of), 'PHOTO' => $GLOBALS['FORUM_DRIVER']->get_member_photo_url($member_id_of))); $javascript = ''; return array($title, $fields, $text, $javascript, $order, $hidden); }
/** * Standard modular render function for profile tabs edit hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set) */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { $title = do_lang_tempcode('MEMBER_TITLE'); $order = 50; // Actualiser $_title = post_param('member_title', NULL); if ($_title !== NULL) { require_code('ocf_members_action'); require_code('ocf_members_action2'); ocf_member_choose_title($_title, $member_id_of); attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform'); } if ($leave_to_ajax_if_possible) { return NULL; } // UI fields $fields = new ocp_tempcode(); $_title = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_title'); require_code('form_templates'); $fields->attach(form_input_line(do_lang_tempcode('MEMBER_TITLE'), '', 'member_title', $_title, false, NULL, intval(get_option('max_member_title_length')))); $text = do_lang_tempcode('DESCRIPTION_MEMBER_TITLE', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member_id_of))); $javascript = ''; return array($title, $fields, $text, $javascript, $order); }
/** * 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)); }
/** * Get tempcode for adding/editing form. * * @param SHORT_TEXT The title * @param LONG_TEXT The description * @return tempcode The input fields */ function get_form_fields($title = '', $description = '') { $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(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', $description, true)); return $fields; }
/** * The main user interface for the file dump. * * @return tempcode The UI. */ function module_do_gui() { $title = get_page_title('FILE_DUMP'); $place = filter_naughty(get_param('place', '/')); if (substr($place, -1, 1) != '/') { $place .= '/'; } $GLOBALS['FEED_URL'] = find_script('backend') . '?mode=filedump&filter=' . $place; // Show tree $dirs = explode('/', substr($place, 0, strlen($place) - 1)); $i = 0; $pre = ''; $file_tree = new ocp_tempcode(); while (array_key_exists($i, $dirs)) { if ($i > 0) { $d = $dirs[$i]; } else { $d = do_lang('FILE_DUMP'); } if (array_key_exists($i + 1, $dirs)) { $tree_url = build_url(array('page' => '_SELF', 'place' => $pre . $dirs[$i] . '/'), '_SELF'); if (!$file_tree->is_empty()) { $file_tree->attach(do_template('BREADCRUMB', array('_GUID' => '7ee62e230d53344a7d9667dc59be21c6'))); } $file_tree->attach(hyperlink($tree_url, $d)); } $pre .= $dirs[$i] . '/'; $i++; } if (!$file_tree->is_empty()) { breadcrumb_add_segment($file_tree, $d); } else { breadcrumb_set_self($i == 1 ? do_lang_tempcode('FILE_DUMP') : make_string_tempcode(escape_html($d))); } // Check directory exists $fullpath = get_custom_file_base() . '/uploads/filedump' . $place; if (!file_exists(get_custom_file_base() . '/uploads/filedump' . $place)) { if (has_specific_permission(get_member(), 'upload_filedump')) { @mkdir($fullpath, 0777) or warn_exit(do_lang_tempcode('WRITE_ERROR_DIRECTORY', escape_html($fullpath), escape_html(dirname($fullpath)))); fix_permissions($fullpath, 0777); sync_file($fullpath); } } // Find all files in the incoming directory $handle = opendir(get_custom_file_base() . '/uploads/filedump' . $place); $i = 0; $filename = array(); $description = array(); $filesize = array(); $filetime = array(); $directory = array(); $deletable = array(); while (false !== ($file = readdir($handle))) { if (!should_ignore_file('uploads/filedump' . $place . $file, IGNORE_ACCESS_CONTROLLERS | IGNORE_HIDDEN_FILES)) { $directory[$i] = !is_file(get_custom_file_base() . '/uploads/filedump' . $place . $file); $filename[$i] = $directory[$i] ? $file . '/' : $file; if ($directory[$i]) { $filesize[$i] = do_lang_tempcode('NA_EM'); } $dbrows = $GLOBALS['SITE_DB']->query_select('filedump', array('description', 'the_member'), array('name' => $file, 'path' => $place)); if (!array_key_exists(0, $dbrows)) { $description[$i] = $directory[$i] ? do_lang_tempcode('NA_EM') : do_lang_tempcode('NONE_EM'); } else { $description[$i] = make_string_tempcode(escape_html(get_translated_text($dbrows[0]['description']))); } if ($description[$i]->is_empty()) { $description[$i] = do_lang_tempcode('NONE_EM'); } $deletable[$i] = array_key_exists(0, $dbrows) && $dbrows[0]['the_member'] == get_member() || has_specific_permission(get_member(), 'delete_anything_filedump'); if ($directory[$i]) { $size = get_directory_size(get_custom_file_base() . '/uploads/filedump' . $place . $file); $timestamp = NULL; } else { $size = filesize(get_custom_file_base() . '/uploads/filedump' . $place . $file); $timestamp = filemtime(get_custom_file_base() . '/uploads/filedump' . $place . $file); } $filesize[$i] = clean_file_size($size); $filetime[$i] = is_null($timestamp) ? NULL : get_timezoned_date($timestamp); $i++; } } closedir($handle); if ($i != 0) { require_code('templates_table_table'); $header_row = table_table_header_row(array(do_lang_tempcode('FILENAME'), do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('SIZE'), do_lang_tempcode('DATE_TIME'), do_lang_tempcode('ACTIONS'))); $rows = new ocp_tempcode(); for ($a = 0; $a < $i; $a++) { if ($directory[$a]) { $link = build_url(array('page' => '_SELF', 'place' => $place . $filename[$a]), '_SELF'); } else { $link = make_string_tempcode(get_custom_base_url() . '/uploads/filedump' . str_replace('%2F', '/', rawurlencode($place . $filename[$a]))); } if (!$directory[$a]) { if ($deletable[$a]) { $delete_url = build_url(array('page' => '_SELF', 'type' => 'ed', 'file' => $filename[$a], 'place' => $place), '_SELF'); $actions = do_template('TABLE_TABLE_ACTION_DELETE_ENTRY', array('_GUID' => '9b91e485d80417b1664145f9bca5a2f5', 'NAME' => $filename[$a], 'URL' => $delete_url)); } else { $actions = new ocp_tempcode(); } } else { $delete_url = build_url(array('page' => '_SELF', 'type' => 'ec', 'file' => $filename[$a], 'place' => $place), '_SELF'); $actions = do_template('TABLE_TABLE_ACTION_DELETE_CATEGORY', array('_GUID' => '0fa7d4090c6195328191399a14799169', 'NAME' => $filename[$a], 'URL' => $delete_url)); } $rows->attach(table_table_row(array(hyperlink($link, escape_html($filename[$a]), !$directory[$a]), escape_html($description[$a]), escape_html($filesize[$a]), is_null($filetime[$a]) ? do_lang_tempcode('NA') : make_string_tempcode(escape_html($filetime[$a])), $actions))); } $files = do_template('TABLE_TABLE', array('_GUID' => '1c0a91d47c5fc8a7c2b35c7d9b36132f', 'HEADER_ROW' => $header_row, 'ROWS' => $rows)); } else { $files = new ocp_tempcode(); } // Do a form so people can upload their own stuff if (has_specific_permission(get_member(), 'upload_filedump')) { $post_url = build_url(array('page' => '_SELF', 'type' => 'ad', 'uploading' => 1), '_SELF'); $submit_name = do_lang_tempcode('FILEDUMP_UPLOAD'); $max = floatval(get_max_file_size()); $text = new ocp_tempcode(); if ($max < 30.0) { $config_url = get_upload_limit_config_url(); $text->attach(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max / 1024.0 / 1024.0)), escape_html(is_null($config_url) ? '' : $config_url))); } require_code('form_templates'); $fields = form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('_DESCRIPTION_UPLOAD'), 'file', true); $fields->attach(form_input_line(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', '', false)); $hidden = new ocp_tempcode(); $hidden->attach(form_input_hidden('place', $place)); handle_max_file_size($hidden); $upload_form = do_template('FORM', array('TABINDEX' => strval(get_form_field_tabindex()), 'SKIP_REQUIRED' => true, 'HIDDEN' => $hidden, 'TEXT' => $text, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url)); } else { $upload_form = new ocp_tempcode(); } // Do a form so people can make folders if (get_option('is_on_folder_create') == '1') { $post_url = build_url(array('page' => '_SELF', 'type' => 'ac'), '_SELF'); require_code('form_templates'); $fields = form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('DESCRIPTION_NAME'), 'name', '', true); $hidden = form_input_hidden('place', $place); $submit_name = do_lang_tempcode('FILEDUMP_CREATE_FOLDER'); $create_folder_form = do_template('FORM', array('_GUID' => '043f9b595d3699b7d8cd7f2284cdaf98', 'TABINDEX' => strval(get_form_field_tabindex()), 'SKIP_REQUIRED' => true, 'SECONDARY_FORM' => true, 'HIDDEN' => $hidden, 'TEXT' => '', 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url)); } else { $create_folder_form = new ocp_tempcode(); } return do_template('FILE_DUMP_SCREEN', array('_GUID' => '3f49a8277a11f543eff6488622949c84', 'TITLE' => $title, 'PLACE' => $place, 'FILES' => $files, 'UPLOAD_FORM' => $upload_form, 'CREATE_FOLDER_FORM' => $create_folder_form)); }
function get_form_fields($id = NULL, $name = '', $category = '', $image = '', $price = 10, $enabled = 1) { $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_line(do_lang_tempcode('GIFT'), do_lang_tempcode('DESCRIPTION_GIFT'), 'name', $name, true)); $fields->attach(form_input_line(do_lang_tempcode('CATEGORY'), do_lang_tempcode('DESCRIPTION_GIFT_CATEGORY'), 'category', $category, true)); $fields->attach(form_input_upload(do_lang_tempcode('IMAGE'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'image', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'url', $image, false)); handle_max_file_size($hidden, 'image'); $fields->attach(form_input_line(do_lang_tempcode('PRICE'), '', 'price', strval($price), true)); $fields->attach(form_input_tick(do_lang_tempcode('GIFT_ENABLED'), do_lang_tempcode('DESCRIPTION_GIFT_ENABLED'), 'enabled', $enabled == 1)); return array($fields, $hidden); }
/** * 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 actualiser to decline a members joining of a usergroup. * * @return tempcode The UI */ function decline() { $title = get_page_title('DECLINE_FROM_GROUP'); $id = post_param_integer('id', NULL); if (is_null($id)) { $id = get_param_integer('id'); require_code('form_templates'); $text = paragraph(do_lang_tempcode('OPTIONAL_REASON')); $submit_name = do_lang_tempcode('DECLINE_FROM_GROUP'); $post_url = build_url(array('page' => '_SELF', 'type' => get_param('type')), '_SELF', NULL, true); $fields = new ocp_tempcode(); $hidden = form_input_hidden('id', strval($id)); $fields->attach(form_input_line(do_lang_tempcode('REASON'), '', 'reason', '', false)); return do_template('FORM_SCREEN', array('SKIP_VALIDATION' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); } if (!ocf_may_control_group($id, get_member())) { access_denied('I_ERROR'); } $member_id = get_param_integer('member_id'); ocf_member_validate_into_group($id, $member_id, true, post_param('reason')); $url = build_url(array('page' => '_SELF', 'type' => 'view', 'id' => $id), '_SELF'); return redirect_screen($title, $url, do_lang_tempcode('SUCCESS')); }
/** * The UI for managing super debranding. * * @return tempcode The UI */ function misc() { $title = get_page_title('SUPER_DEBRAND'); require_code('form_templates'); $rebrand_name = get_value('rebrand_name'); if (is_null($rebrand_name)) { $rebrand_name = 'ocPortal'; } $rebrand_base_url = get_value('rebrand_base_url'); if (is_null($rebrand_base_url)) { $rebrand_base_url = 'http://ocportal.com'; } $company_name = get_value('company_name'); if (is_null($company_name)) { $company_name = 'ocProducts'; } $keyboard_map = file_exists(get_file_base() . '/pages/comcode/' . get_site_default_lang() . '/keymap.txt') ? file_get_contents(get_file_base() . '/pages/comcode/' . get_site_default_lang() . '/keymap.txt') : file_get_contents(get_file_base() . '/pages/comcode/' . fallback_lang() . '/keymap.txt'); if (file_exists(get_file_base() . '/pages/comcode_custom/' . get_site_default_lang() . '/keymap.txt')) { $keyboard_map = file_get_contents(get_file_base() . '/pages/comcode_custom/' . get_site_default_lang() . '/keymap.txt'); } if (file_exists(get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/website.txt')) { $adminguide = file_get_contents(get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/website.txt'); } else { $adminguide = do_lang('ADMINGUIDE_DEFAULT_TRAINING'); } if (file_exists(get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/start.txt')) { $start_page = file_get_contents(get_file_base() . '/adminzone/pages/comcode_custom/' . get_site_default_lang() . '/start.txt'); } elseif (file_exists(get_file_base() . '/adminzone/pages/comcode/' . get_site_default_lang() . '/start.txt')) { $start_page = file_exists(get_file_base() . '/adminzone/pages/comcode/' . get_site_default_lang() . '/start.txt') ? file_get_contents(get_file_base() . '/adminzone/pages/comcode/' . get_site_default_lang() . '/start.txt') : file_get_contents(get_file_base() . '/adminzone/pages/comcode/' . fallback_lang() . '/start.txt'); } else { $start_page = do_lang('REBRAND_FRONT_PAGE'); } $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('REBRAND_NAME'), do_lang_tempcode('DESCRIPTION_REBRAND_NAME'), 'rebrand_name', $rebrand_name, true)); $fields->attach(form_input_line(do_lang_tempcode('REBRAND_BASE_URL'), do_lang_tempcode('DESCRIPTION_BRAND_BASE_URL', escape_html('docs' . strval(ocp_version()))), 'rebrand_base_url', $rebrand_base_url, true)); $fields->attach(form_input_line(do_lang_tempcode('COMPANY_NAME'), '', 'company_name', $company_name, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('ADMINGUIDE'), do_lang_tempcode('DESCRIPTION_ADMINGUIDE'), 'adminguide', $adminguide, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('ADMINSTART_PAGE'), do_lang_tempcode('DESCRIPTION_ADMINSTART_PAGE'), 'start_page', $start_page, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('KEYBOARD_MAP'), '', 'keyboard_map', $keyboard_map, true)); $fields->attach(form_input_tick(do_lang_tempcode('DELETE_UN_PC'), do_lang_tempcode('DESCRIPTION_DELETE_UN_PC'), 'churchy', false)); $fields->attach(form_input_tick(do_lang_tempcode('SHOW_DOCS'), do_lang_tempcode('DESCRIPTION_SHOW_DOCS'), 'show_docs', get_option('show_docs') == '1')); $fields->attach(form_input_upload(do_lang_tempcode('FAVICON'), do_lang_tempcode('DESCRIPTION_FAVICON'), 'favicon', false, find_theme_image('favicon'), NULL, true, str_replace(' ', '', get_option('valid_images')))); $fields->attach(form_input_upload(do_lang_tempcode('APPLEICON'), do_lang_tempcode('DESCRIPTION_APPLEICON'), 'appleicon', false, find_theme_image('appleicon'), NULL, true, str_replace(' ', '', get_option('valid_images')))); if (addon_installed('ocf_avatars')) { $fields->attach(form_input_upload(do_lang_tempcode('SYSTEM_AVATAR'), do_lang_tempcode('DESCRIPTION_SYSTEM_AVATAR'), 'system_avatar', false, find_theme_image('ocf_default_avatars/default_set/ocp_fanatic'), NULL, true, str_replace(' ', '', get_option('valid_images')))); } $post_url = build_url(array('page' => '_SELF', 'type' => 'actual'), '_SELF'); $submit_name = do_lang_tempcode('SUPER_DEBRAND'); return do_template('FORM_SCREEN', array('HIDDEN' => '', 'TITLE' => $title, 'URL' => $post_url, 'FIELDS' => $fields, 'TEXT' => do_lang_tempcode('WARNING_SUPER_DEBRAND_MAJOR_CHANGES'), '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; }
/** * The UI to contact a member. * * @return tempcode The UI */ function gui() { $member_id = get_param_integer('id'); $username = $GLOBALS['FORUM_DRIVER']->get_username($member_id); if (is_null($username)) { warn_exit(do_lang_tempcode('USER_NO_EXIST')); } $title = get_page_title('EMAIL_MEMBER', true, array(escape_html($username))); global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML $text = do_lang_tempcode('EMAIL_MEMBER_TEXT'); $fields = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), '', 'subject', get_param('subject', '', true), true)); $default_email = is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_email_address'); $default_name = is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_member_row_field(get_member(), 'm_username'); $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('_DESCRIPTION_NAME'), 'name', $default_name, true)); $fields->attach(form_input_email(do_lang_tempcode('EMAIL_ADDRESS'), do_lang_tempcode('YOUR_ADDRESS'), 'email_address', $default_email, true)); $fields->attach(form_input_text(do_lang_tempcode('MESSAGE'), '', 'message', get_param('message', '', true), true)); if (addon_installed('captcha')) { require_code('captcha'); if (use_captcha()) { $fields->attach(form_input_captcha()); $text->attach(' '); $text->attach(do_lang_tempcode('FORM_TIME_SECURITY')); } } $size = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id, 'm_max_email_attach_size_mb'); $hidden = new ocp_tempcode(); if ($size != 0) { handle_max_file_size($hidden); $fields->attach(form_input_upload_multi(do_lang_tempcode('_ATTACHMENT'), do_lang_tempcode('EMAIL_ATTACHMENTS', integer_format($size)), 'attachment', false)); } $submit_name = do_lang_tempcode('SEND'); $redirect = get_param('redirect', ''); if ($redirect == '') { $redirect = $GLOBALS['FORUM_DRIVER']->member_profile_url($member_id, false, true); if (is_object($redirect)) { $redirect = $redirect->evaluate(); } } $post_url = build_url(array('page' => '_SELF', 'type' => 'actual', 'id' => $member_id, 'redirect' => $redirect), '_SELF'); return do_template('FORM_SCREEN', array('_GUID' => 'e06557e6eceacf1f46ee930c99ac5bb5', 'TITLE' => $title, 'HIDDEN' => $hidden, 'JAVASCRIPT' => function_exists('captcha_ajax_check') ? captcha_ajax_check() : '', 'FIELDS' => $fields, 'TEXT' => $text, 'SUBMIT_NAME' => $submit_name, 'URL' => $post_url)); }
/** * Get tempcode for a custom comcode tag adding/editing form. * * @param SHORT_TEXT The title (name) of the custom comcode tag * @param LONG_TEXT The description of the tag * @param BINARY Whether the tag is enabled * @param ID_TEXT The actual tag code * @param LONG_TEXT What to replace the tag with * @param LONG_TEXT Example usage * @param SHORT_TEXT Comma-separated list of accepted parameters * @param BINARY Whether it is a dangerous tag * @param BINARY Whether it is a block tag * @param BINARY Whether it is a textual tag * @return tempcode The input fields */ function get_form_fields($title = '', $description = '', $enabled = 1, $tag = 'this', $replace = '<span class="example" style="color: {color}">{content}</span>', $example = '[this color="red"]blah[/this]', $parameters = 'color=black', $dangerous_tag = 0, $block_tag = 0, $textual_tag = 1) { $fields = new ocp_tempcode(); require_code('comcode_text'); $fields->attach(form_input_codename(do_lang_tempcode('COMCODE_TAG'), do_lang_tempcode('DESCRIPTION_COMCODE_TAG'), 'tag', $tag, true, NULL, MAX_COMCODE_TAG_LOOK_AHEAD_LENGTH)); $fields->attach(form_input_line(do_lang_tempcode('TITLE'), do_lang_tempcode('DESCRIPTION_TAG_TITLE'), 'title', $title, true)); $fields->attach(form_input_line(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', $description, true)); $fields->attach(form_input_text(do_lang_tempcode('COMCODE_REPLACE'), do_lang_tempcode('DESCRIPTION_COMCODE_REPLACE'), 'replace', $replace, true)); $fields->attach(form_input_line(do_lang_tempcode('PARAMETERS'), do_lang_tempcode('DESCRIPTION_COMCODE_PARAMETERS'), 'parameters', $parameters, false)); $fields->attach(form_input_tick(do_lang_tempcode('DANGEROUS_TAG'), do_lang_tempcode('DESCRIPTION_DANGEROUS_TAG'), 'dangerous_tag', $dangerous_tag == 1)); $fields->attach(form_input_tick(do_lang_tempcode('BLOCK_TAG'), do_lang_tempcode('DESCRIPTION_BLOCK_TAG'), 'block_tag', $block_tag == 1)); $fields->attach(form_input_tick(do_lang_tempcode('TEXTUAL_TAG'), do_lang_tempcode('DESCRIPTION_TEXTUAL_TAG'), 'textual_tag', $textual_tag == 1)); $fields->attach(form_input_line(do_lang_tempcode('EXAMPLE'), do_lang_tempcode('DESCRIPTION_COMCODE_EXAMPLE'), 'example', $example, true)); $fields->attach(form_input_tick(do_lang_tempcode('ENABLED'), '', 'enabled', $enabled == 1)); return $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); }
/** * Get tempcode for a post template adding/editing form. * * @param ID_TEXT The ID of the banner type * @param BINARY Whether this is a textual banner * @param integer The image width (ignored for textual banners) * @param integer The image height (ignored for textual banners) * @param integer The maximum file size for the banners (this is a string length for textual banners) * @param BINARY Whether the banner will be automatically shown via Comcode hot-text (this can only happen if banners of the title are given title-text) * @return array A pair: the tempcode for the visible fields, and the tempcode for the hidden fields */ function get_form_fields($id = '', $is_textual = 0, $image_width = 160, $image_height = 600, $max_file_size = 70, $comcode_inline = 0) { $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('CODENAME'), do_lang_tempcode('DESCRIPTION_BANNER_TYPE_2'), 'new_id', $id, false)); if ($id != '') { $hidden->attach(form_input_hidden('is_textual', strval($is_textual))); } else { $fields->attach(form_input_tick(do_lang_tempcode('BANNER_IS_TEXTUAL'), do_lang_tempcode('DESCRIPTION_BANNER_IS_TEXTUAL'), 'is_textual', $is_textual == 1)); } $fields->attach(form_input_integer(do_lang_tempcode('WIDTH'), do_lang_tempcode('DESCRIPTION_BANNER_WIDTH'), 'image_width', $image_width, true)); $fields->attach(form_input_integer(do_lang_tempcode('HEIGHT'), do_lang_tempcode('DESCRIPTION_BANNER_HEIGHT'), 'image_height', $image_height, true)); $fields->attach(form_input_integer(do_lang_tempcode('_FILE_SIZE'), do_lang_tempcode('DESCRIPTION_BANNER_FILE_SIZE'), 'max_file_size', $max_file_size, true)); $fields->attach(form_input_tick(do_lang_tempcode('COMCODE_INLINE'), do_lang_tempcode('DESCRIPTION_COMCODE_INLINE'), 'comcode_inline', $comcode_inline == 1)); return array($fields, $hidden); }
/** * 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 test section adding/editing form. * * @param SHORT_TEXT The name of the section * @param LONG_TEXT Notes for the section * @param ?MEMBER The member the tests are assigned to (NULL: not a normal section, one that gets inherited into tests) * @param BINARY Whether this test section is intended to be inherited, not used by itself * @return tempcode The tempcode for the visible fields */ function get_test_section_form_fields($section = '', $notes = '', $assigned_to = NULL, $inheritable = 0) { require_code('form_templates'); $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('DESCRIPTION_NAME'), 'section', $section, true)); $fields->attach(form_input_text(do_lang_tempcode('NOTES'), do_lang_tempcode('DESCRIPTION_NOTES'), 'notes', $notes, false)); $list = $this->get_tester_list($assigned_to); $fields->attach(form_input_list(do_lang_tempcode('TESTER'), do_lang_tempcode('DESCRIPTION_TESTER_1'), 'assigned_to', $list)); $fields->attach(form_input_tick(do_lang_tempcode('INHERITABLE'), do_lang_tempcode('DESCRIPTION_INHERITABLE'), 'inheritable', $inheritable == 1)); return $fields; }
/** * Get tempcode for adding/editing form. * * @param SHORT_TEXT The name of the custom profile field * @param LONG_TEXT The description of the field * @param LONG_TEXT The default value of the field * @param BINARY Whether the field is publicly viewable * @param BINARY Whether the field may be viewed by the owner * @param BINARY Whether the owner may set the value of the field * @param BINARY Whether the field is encrypted * @param ID_TEXT The type of the field * @set short_text long_text short_trans long_trans integer upload picture url list tick * @param BINARY Whether the field is required to be filled in * @param BINARY Whether the field is to be shown on the join form * @param BINARY Whether the field is shown in posts * @param BINARY Whether the field is shown in post previews * @param ?integer The order the field is given relative to the order of the other custom profile fields (NULL: last) * @param LONG_TEXT The usergroups that this field is confined to (comma-separated list). * @param BINARY Whether the field is locked * @return array A pair: the tempcode for the visible fields, and the tempcode for the hidden fields */ function get_form_fields($name = '', $description = '', $default = '', $public_view = 1, $owner_view = 1, $owner_set = 1, $encrypted = 0, $type = 'long_text', $required = 0, $show_on_join_form = 0, $show_in_posts = 0, $show_in_post_previews = 0, $order = NULL, $only_group = '', $locked = 0) { $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); require_code('form_templates'); require_code('encryption'); require_lang('fields'); if ($locked == 0) { $fields->attach(form_input_line(do_lang_tempcode('NAME'), do_lang_tempcode('DESCRIPTION_NAME'), 'name', $name, true)); } else { $hidden->attach(form_input_hidden('name', $name)); } $fields->attach(form_input_line_comcode(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_DESCRIPTION'), 'description', $description, false)); $fields->attach(form_input_line(do_lang_tempcode('DEFAULT_VALUE'), do_lang_tempcode('DESCRIPTION_DEFAULT_VALUE_CPF'), 'default', $default, false, NULL, 10000)); $fields->attach(form_input_tick(do_lang_tempcode('OWNER_VIEW'), do_lang_tempcode('DESCRIPTION_OWNER_VIEW'), 'owner_view', $owner_view == 1)); $fields->attach(form_input_tick(do_lang_tempcode('OWNER_SET'), do_lang_tempcode('DESCRIPTION_OWNER_SET'), 'owner_set', $owner_set == 1)); $fields->attach(form_input_tick(do_lang_tempcode('PUBLIC_VIEW'), do_lang_tempcode('DESCRIPTION_PUBLIC_VIEW'), 'public_view', $public_view == 1)); if (is_encryption_enabled() && $name == '') { $fields->attach(form_input_tick(do_lang_tempcode('ENCRYPTED'), do_lang_tempcode('DESCRIPTION_ENCRYPTED'), 'encrypted', $encrypted == 1)); } require_code('fields'); $type_list = nice_get_field_type($type, $name != ''); $fields->attach(form_input_list(do_lang_tempcode('TYPE'), do_lang_tempcode('DESCRIPTION_FIELD_TYPE'), 'type', $type_list)); $fields->attach(form_input_tick(do_lang_tempcode('REQUIRED'), do_lang_tempcode('DESCRIPTION_REQUIRED'), 'required', $required == 1)); $fields->attach(form_input_tick(do_lang_tempcode('SHOW_ON_JOIN_FORM'), do_lang_tempcode('DESCRIPTION_SHOW_ON_JOIN_FORM'), 'show_on_join_form', $show_on_join_form == 1)); $orderlist = new ocp_tempcode(); $num_cpfs = $GLOBALS['FORUM_DB']->query_value('f_custom_fields', 'COUNT(*)'); if ($name == '') { $num_cpfs++; } $selected_one = false; for ($i = 0; $i < (is_null($order) ? $num_cpfs : max($num_cpfs, $order)); $i++) { $selected = $i === $order || $name == '' && $i == $num_cpfs - 1; if ($selected) { $selected_one = true; } $orderlist->attach(form_input_list_entry(strval($i), $selected, integer_format($i + 1))); } if (!$selected_one) { $orderlist->attach(form_input_list_entry(strval($order), true, integer_format($order + 1))); } $fields->attach(form_input_list(do_lang_tempcode('ORDER'), do_lang_tempcode('DESCRIPTION_FIELD_ORDER'), 'order', $orderlist)); $fields->attach(form_input_tick(do_lang_tempcode('SHOW_IN_POSTS'), do_lang_tempcode('DESCRIPTION_SHOW_IN_POSTS'), 'show_in_posts', $show_in_posts == 1)); $fields->attach(form_input_tick(do_lang_tempcode('SHOW_IN_POST_PREVIEWS'), do_lang_tempcode('DESCRIPTION_SHOW_IN_POST_PREVIEWS'), 'show_in_post_previews', $show_in_post_previews == 1)); $rows = $GLOBALS['FORUM_DB']->query_select('f_groups', array('id', 'g_name', 'g_is_super_admin'), array('g_is_private_club' => 0)); if ($locked == 0) { $groups = new ocp_tempcode(); //$groups=form_input_list_entry('-1',false,do_lang_tempcode('_ALL')); foreach ($rows as $group) { if ($group['id'] != db_get_first_id()) { $groups->attach(form_input_list_entry(strval($group['id']), count(array_intersect(array($group['id']), explode(',', $only_group))) != 0, get_translated_text($group['g_name'], $GLOBALS['FORUM_DB']))); } } $fields->attach(form_input_multi_list(do_lang_tempcode('GROUP'), do_lang_tempcode('DESCRIPTION_FIELD_ONLY_GROUP'), 'only_group', $groups)); } else { $hidden->attach(form_input_hidden('only_group', '')); } return array($fields, $hidden); }
/** * The UI for editing a message. * * @return tempcode The UI. */ function chat_edit_message() { $title = get_page_title('EDIT_MESSAGE'); $id = get_param_integer('id'); $rows = $GLOBALS['SITE_DB']->query_select('chat_messages', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { return warn_screen($title, do_lang_tempcode('MISSING_RESOURCE')); } $myrow = $rows[0]; $room_id = $myrow['room_id']; check_chatroom_access($room_id); $room_details = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $room_id), '', 1); if (!array_key_exists(0, $room_details)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $row = $room_details[0]; $has_mod_access = has_specific_permission(get_member(), 'edit_lowrange_content', 'cms_chat', array('chat', $room_id)) || $row['room_owner'] == get_member() && has_specific_permission(get_member(), 'moderate_my_private_rooms'); if (!$has_mod_access) { access_denied('SPECIFIC_PERMISSION', 'edit_lowrange_content'); } //$post_url=build_url(array('page'=>'_SELF','type'=>'delete','id'=>$myrow['id'],'room_id'=>get_param_integer('room_id',db_get_first_id())),'_SELF'); //$edit_form=do_template('FORM',array('_GUID'=>'da2ac49bc6af253b36e2855763ad8ae3','HIDDEN'=>'','TEXT'=>paragraph(do_lang_tempcode('DESCRIPTION_DELETE_MESSAGE')),'FIELDS'=>'','SUBMIT_NAME'=>do_lang_tempcode('DELETE_MESSAGE'),'URL'=>$post_url)); $post_url = build_url(array('page' => '_SELF', 'type' => '_ed', 'id' => $myrow['id'], 'room_id' => $room_id), '_SELF'); $message = get_translated_tempcode($myrow['the_message']); require_code('form_templates'); $text_colour = $myrow['text_colour'] == '' ? get_option('chat_default_post_colour') : $myrow['text_colour']; $font_name = $myrow['font_name'] == '' ? get_option('chat_default_post_font') : $myrow['font_name']; $fields = form_input_text_comcode(do_lang_tempcode('MESSAGE'), do_lang_tempcode('DESCRIPTION_MESSAGE'), 'message', $message->evaluate(), true); $fields->attach(form_input_line(do_lang_tempcode('CHAT_OPTIONS_COLOUR_NAME'), do_lang_tempcode('CHAT_OPTIONS_COLOUR_DESCRIPTION'), 'textcolour', $text_colour, false)); //$fields->attach(do_template('EDIT_CSS_ENTRY',array('_GUID'=>'d65449d25908252cc7f34c19ee5e8747','COLOR'=>'#'.$myrow['text_colour'],'NAME'=>do_lan g_tempcode('TEXTCOLOUR'),'CONTEXT'=>do_l ang_tempcode('DESCRIPTION_TEXTCOLOUR')))); $fields->attach(form_input_line(do_lang_tempcode('CHAT_OPTIONS_TEXT_NAME'), do_lang_tempcode('CHAT_OPTIONS_TEXT_DESCRIPTION'), 'fontname', $font_name, 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_MESSAGE'), 'delete', false)); // $fields->attach(do_template('COLOUR_CHOOSER',array('_GUID'=>'817dbcdb419982774f86b8e5a0c5c1fe','NAME'=>$myrow['id'],'CONTEXT'=>do_l ang_tempcode('DESCRIPTION_TEXTCOLOUR'),'COLOR'=>$myrow['text_colour']))); //$edit_form->attach(do_template('FORM',array('_GUID'=>'43651e089d7ec45e1468ae57e3bf315e','HIDDEN'=>'','TEXT'=>'','FIELDS'=>$fields,'SUBMIT_NAME'=>do_lang_tempcode('EDIT_MESSAGE'),'URL'=>$post_url))); //return do_template('CHAT_PANEL',array('_GUID'=>'6278e2571f20ad1b9becd12e007caac2','TITLE'=>$title,'INTRODUCTION'=>'','CONTENT'=>$edit_form)); breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('CHOOSE')), array('_SELF:_SELF:room:id=' . strval($room_id), do_lang_tempcode('CHAT_MOD_PANEL')))); return do_template('FORM_SCREEN', array('_GUID' => 'bf92ecd4d5f923f78bbed4faca6c0cb6', 'HIDDEN' => '', 'TITLE' => $title, 'TEXT' => '', 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => do_lang_tempcode('SAVE'))); }
/** * 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'))); }
function get_form_fields($id = NULL, $name = '', $image = '', $cure = '', $cure_price = 10, $immunization = '', $immunization_price = 5, $spread_rate = 12, $points_per_spread = 10, $enabled = 0) { $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); require_code('form_templates'); $fields->attach(form_input_line(do_lang_tempcode('DISEASE'), do_lang_tempcode('DESCRIPTION_DISEASE'), 'name', $name, true)); $fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'image', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'url', $image, false)); handle_max_file_size($hidden, 'image'); $fields->attach(form_input_line(do_lang_tempcode('CURE'), do_lang_tempcode('DESCRIPTION_CURE'), 'cure', $cure, true)); $fields->attach(form_input_line(do_lang_tempcode('CURE_PRICE'), '', 'cure_price', strval($cure_price), true)); $fields->attach(form_input_line(do_lang_tempcode('IMMUNIZATION'), do_lang_tempcode('DESCRIPTION_IMMUNIZATION'), 'immunization', $immunization, true)); $fields->attach(form_input_line(do_lang_tempcode('IMMUNIZATION_PRICE'), '', 'immunization_price', strval($immunization_price), true)); $fields->attach(form_input_line(do_lang_tempcode('SPREAD_RATE'), do_lang_tempcode('DESCRIPTION_SPREAD_RATE'), 'spread_rate', strval($spread_rate), true)); $fields->attach(form_input_line(do_lang_tempcode('POINTS_PER_SPREAD'), do_lang_tempcode('DESCRIPTION_POINTS_PER_SPREAD'), 'points_per_spread', strval($points_per_spread), true)); $fields->attach(form_input_tick(do_lang_tempcode('DISEASE_ENABLED'), do_lang_tempcode('DESCRIPTION_DISEASE_ENABLED'), 'enabled', $enabled == 1)); return array($fields, $hidden); }
/** * Standard modular render function for profile tabs edit hooks. * * @param MEMBER The ID of the member who is being viewed * @param MEMBER The ID of the member who is doing the viewing * @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later * @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set) */ function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false) { $title = do_lang_tempcode('AVATAR'); $order = 20; // Actualiser if (post_param_integer('submitting_avatar_tab', 0) == 1) { require_code('uploads'); if (has_specific_permission($member_id_viewing, 'own_avatars')) { if (!(is_swf_upload(true) && array_key_exists('avatar_file', $_FILES) || array_key_exists('avatar_file', $_FILES) && is_uploaded_file($_FILES['avatar_file']['tmp_name']))) { $urls = array(); $stock = post_param('avatar_alt_url', ''); if ($stock == '') { $stock = post_param('avatar_stock', NULL); if (!is_null($stock)) { $urls[0] = $stock == '' ? '' : find_theme_image($stock, false, true); } else { $urls[0] = ''; } // None } else { if (url_is_local($stock) && !$GLOBALS['FORUM_DRIVER']->is_super_admin($member_id_viewing)) { $old = $GLOBALS['FORUM_DB']->query_value('f_members', 'm_avatar_url', array('id' => $member_id_of)); if ($old != $stock) { access_denied('ASSOCIATE_EXISTING_FILE'); } } $urls[0] = $stock; // URL } } else { // We have chosen an upload. Note that we will not be looking at alt_url at this point, even though it is specified below for canonical reasons $urls = get_url('avatar_alt_url', 'avatar_file', file_exists(get_custom_file_base() . '/uploads/avatars') ? 'uploads/avatars' : 'uploads/ocf_avatars', 0, OCP_UPLOAD_IMAGE, false, '', '', false, true); if ((get_base_url() != get_forum_base_url() || array_key_exists('on_msn', $GLOBALS['SITE_INFO']) && $GLOBALS['SITE_INFO']['on_msn'] == '1') && $urls[0] != '' && url_is_local($urls[0])) { $urls[0] = get_custom_base_url() . '/' . $urls[0]; } } $avatar_url = $urls[0]; } else { $stock = post_param('avatar_stock'); $avatar_url = $stock == '' ? '' : find_theme_image($stock, false, true); } require_code('ocf_members_action'); require_code('ocf_members_action2'); ocf_member_choose_avatar($avatar_url, $member_id_of); attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform'); } if ($leave_to_ajax_if_possible) { return NULL; } // UI fields $avatar_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_avatar_url'); require_javascript('javascript_multi'); $fields = new ocp_tempcode(); require_code('form_templates'); require_code('themes2'); $ids = get_all_image_ids_type('ocf_default_avatars', true); $found_it = false; foreach ($ids as $id) { $pos = strpos($avatar_url, '/' . $id); $selected = $pos !== false; if ($selected) { $found_it = true; } } $hidden = new ocp_tempcode(); if (has_specific_permission($member_id_viewing, 'own_avatars')) { $javascript = 'standardAlternateFields(\'avatar_file\',\'avatar_alt_url\',\'avatar_stock*\',true);'; $fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'avatar_file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images')))); handle_max_file_size($hidden, 'image'); $fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'avatar_alt_url', $found_it ? '' : $avatar_url, false)); $fields->attach(form_input_picture_choose_specific(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('STOCK')), do_lang_tempcode('DESCRIPTION_ALTERNATE_STOCK'), 'avatar_stock', $ids, $avatar_url, NULL, NULL, true)); } else { $javascript = ''; $fields->attach(form_input_picture_choose_specific(do_lang_tempcode('STOCK'), '', 'avatar_stock', $ids, $avatar_url, NULL, NULL, true)); } if ($avatar_url != '') { if (url_is_local($avatar_url)) { $avatar_url = get_complex_base_url($avatar_url) . '/' . $avatar_url; } $avatar = do_template('OCF_TOPIC_POST_AVATAR', array('_GUID' => '50a5902f3ab7e384d9cf99577b222cc8', 'AVATAR' => $avatar_url)); } else { $avatar = do_lang_tempcode('NONE_EM'); } $width = ocf_get_member_best_group_property($member_id_of, 'max_avatar_width'); $height = ocf_get_member_best_group_property($member_id_of, 'max_avatar_height'); $text = do_template('OCF_EDIT_AVATAR_TAB', array('_GUID' => 'dbdac6ca3bc752b54d2a24a4c6e69c7c', 'MEMBER_ID' => strval($member_id_of), 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id_of), 'AVATAR' => $avatar, 'WIDTH' => integer_format($width), 'HEIGHT' => integer_format($height))); $hidden = new ocp_tempcode(); $hidden->attach(form_input_hidden('submitting_avatar_tab', '1')); return array($title, $fields, $text, $javascript, $order, $hidden); }
/** * The UI for recommending the site. * * @return tempcode The UI. */ function gui() { require_code('form_templates'); global $EXTRA_HEAD; $EXTRA_HEAD->attach('<meta name="robots" content="noindex" />'); // XHTMLXHTML global $NON_CANONICAL_PARAMS; $NON_CANONICAL_PARAMS[] = 'page_title'; $NON_CANONICAL_PARAMS[] = 'subject'; $NON_CANONICAL_PARAMS[] = 's_message'; $NON_CANONICAL_PARAMS[] = 'from'; $NON_CANONICAL_PARAMS[] = 'title'; $NON_CANONICAL_PARAMS[] = 'ocp'; $page_title = get_param('page_title', NULL, true); $submit_name = !is_null($page_title) ? make_string_tempcode($page_title) : do_lang_tempcode('SEND'); $post_url = build_url(array('page' => '_SELF', 'type' => 'actual'), '_SELF', NULL, true); $hidden = new ocp_tempcode(); $name = post_param('name', is_guest() ? '' : $GLOBALS['FORUM_DRIVER']->get_username(get_member())); $recommender_email_address = post_param('recommender_email_address', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member())); $fields = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('YOUR_NAME'), '', 'name', $name, true)); $fields->attach(form_input_email(do_lang_tempcode('YOUR_EMAIL_ADDRESS'), '', 'recommender_email_address', $recommender_email_address, true)); $already = array(); foreach ($_POST as $key => $email_address) { if (substr($key, 0, 14) != 'email_address_') { continue; } if (get_magic_quotes_gpc()) { $email_address = stripslashes($email_address); } $already[] = $email_address; } if (is_guest()) { $fields->attach(form_input_email(do_lang_tempcode('FRIEND_EMAIL_ADDRESS'), '', 'email_address_0', array_key_exists(0, $already) ? $already[0] : '', true)); } else { $fields->attach(form_input_line_multi(do_lang_tempcode('FRIEND_EMAIL_ADDRESS'), do_lang_tempcode('THEIR_ADDRESS'), 'email_address_', $already, 1, NULL, 'email')); } if (may_use_invites() && get_forum_type() == 'ocf' && !is_guest()) { $invites = get_num_invites(get_member()); if ($invites > 0) { require_lang('ocf'); $invite = count($_POST) == 0 ? true : post_param_integer('invite', 0) == 1; $fields->attach(form_input_tick(do_lang_tempcode('USE_INVITE'), do_lang_tempcode('USE_INVITE_DESCRIPTION', $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member()) ? do_lang('NA_EM') : integer_format($invites)), 'invite', $invite)); } } $message = post_param('message', NULL); $subject = get_param('subject', do_lang('RECOMMEND_MEMBER_SUBJECT', get_site_name()), true); if (is_null($message)) { $message = get_param('s_message', '', true); if ($message == '') { $from = get_param('from', NULL, true); if (!is_null($from)) { $resource_title = get_param('title', '', true); if ($resource_title == '') { $downloaded_at_link = http_download_file($from, 3000, false); if (is_string($downloaded_at_link)) { $matches = array(); if (preg_match('#\\s*<title[^>]*\\s*>\\s*(.*)\\s*\\s*<\\s*/title\\s*>#mi', $downloaded_at_link, $matches) != 0) { $resource_title = trim(str_replace('–', '-', str_replace('—', '-', @html_entity_decode($matches[1], ENT_QUOTES, get_charset())))); $resource_title = preg_replace('#^' . str_replace('#', '\\#', preg_quote(get_site_name())) . ' - #', '', $resource_title); $resource_title = preg_replace('#\\s+[^\\d\\s][^\\d\\s]?[^\\d\\s]?\\s+' . str_replace('#', '\\#', preg_quote(get_site_name())) . '$#i', '', $resource_title); } } } if ($resource_title == '') { $resource_title = do_lang('THIS'); // Could not find at all, so say 'this' } else { $subject = get_param('subject', do_lang('RECOMMEND_MEMBER_SUBJECT_SPECIFIC', get_site_name(), $resource_title), true); } $message = do_lang('FOUND_THIS_ON', get_site_name(), comcode_escape($from), comcode_escape($resource_title)); } } if (get_param_integer('ocp', 0) == 1) { $message = do_lang('RECOMMEND_OCPORTAL'); } } $text = is_null($page_title) ? do_lang_tempcode('RECOMMEND_SITE_TEXT') : new ocp_tempcode(); if (!is_null(get_param('from', NULL, true))) { if (is_null($page_title)) { $title = get_page_title('RECOMMEND_LINK'); } else { $title = get_page_title($page_title, false); } $submit_name = do_lang_tempcode('SEND'); $text = do_lang_tempcode('RECOMMEND_AUTO_TEXT', get_site_name()); $need_message = true; } else { if (is_null($page_title)) { $title = get_page_title('_RECOMMEND_SITE', true, array(escape_html(get_site_name()))); } else { $title = get_page_title($page_title, false); } $hidden->attach(form_input_hidden('wrap_message', '1')); $need_message = false; } //add an upload CSV contacts file field $_help_url = build_url(array('page' => 'recommend_help'), get_page_zone('recommend_help')); $help_url = $_help_url->evaluate(); if (get_value('disable_csv_recommend') !== '1' && !is_guest()) { $fields->attach(form_input_upload(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('UPLOAD')), do_lang_tempcode('DESCRIPTION_UPLOAD_CSV_FILE', escape_html($help_url)), 'upload', false, NULL, NULL, false)); } handle_max_file_size($hidden); $fields->attach(form_input_line(do_lang_tempcode('SUBJECT'), '', 'subject', $subject, true)); $fields->attach(form_input_text_comcode(do_lang_tempcode('MESSAGE'), do_lang_tempcode('RECOMMEND_SUP_MESSAGE'), 'message', $message, $need_message)); if (addon_installed('captcha')) { require_code('captcha'); if (use_captcha()) { $fields->attach(form_input_captcha()); $text->attach(' '); $text->attach(do_lang_tempcode('FORM_TIME_SECURITY')); } } $hidden->attach(form_input_hidden('comcode__message', '1')); if (get_value('disable_csv_recommend') !== '1' && !is_guest()) { $javascript = 'standardAlternateFields(\'upload\',\'email_address_0\');'; } else { $javascript = ''; } $javascript .= function_exists('captcha_ajax_check') ? captcha_ajax_check() : ''; return do_template('FORM_SCREEN', array('_GUID' => '08a538ca8d78597b0417f464758a59fd', 'JAVASCRIPT' => $javascript, 'SKIP_VALIDATION' => true, 'TITLE' => $title, 'HIDDEN' => $hidden, 'FIELDS' => $fields, 'URL' => $post_url, 'SUBMIT_NAME' => $submit_name, 'TEXT' => $text)); }
/** * 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'))); }
/** * The UI to run a multi-moderation. * * @return tempcode The UI */ function multimod() { $mm_id = intval(substr(get_param('type', 'misc'), 3)); $topic_id = get_param_integer('id'); $this->check_has_mod_access($topic_id); $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')); } $topic_title = $topic_info[0]['t_cache_first_title']; $this->handle_topic_breadcrumbs($topic_info[0]['t_forum_id'], $topic_id, $topic_info[0]['t_cache_first_title'], do_lang_tempcode('_PERFORM_MULTI_MODERATION', escape_html($topic_title))); $title = get_page_title('_PERFORM_MULTI_MODERATION', true, array(escape_html($topic_title))); $mm = $GLOBALS['FORUM_DB']->query_select('f_multi_moderations', array('*'), array('id' => $mm_id), '', 1); if (!array_key_exists(0, $mm)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $_mm = $mm[0]; $post_text = $_mm['mm_post_text']; $submit_name = do_lang_tempcode('PERFORM_MULTI_MODERATION'); $post_url = build_url(array('page' => '_SELF', 'type' => '_multimod', 'id' => $topic_id, 'mm_id' => $mm_id), '_SELF', NULL, true); $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); $hidden->attach(build_keep_post_fields()); $hidden->attach(build_keep_form_fields()); $fields->attach(form_input_text(do_lang_tempcode('MM_POST_TEXT'), do_lang_tempcode('DESCRIPTION_MM_POST_TEXT'), 'post_text', $post_text, false)); $options = array(); if (get_value('disable_skip_sig') !== '1') { if (addon_installed('ocf_signatures')) { $options[] = array(do_lang_tempcode('SKIP_SIGNATURE'), 'skip_sig', false, do_lang_tempcode('DESCRIPTION_SKIP_SIGNATURE')); } } if (get_value('disable_post_emphasis') !== '1') { $options[] = array(do_lang_tempcode('EMPHASISED'), 'is_emphasised', true, do_lang_tempcode('DESCRIPTION_EMPHASISED')); } $fields->attach(form_input_various_ticks($options, '')); $fields->attach(form_input_line(do_lang_tempcode('REASON'), do_lang_tempcode('OPTIONAL_REASON'), 'reason', '', false)); $mm_title = get_translated_text($_mm['mm_name'], $GLOBALS['FORUM_DB']); $action_list = new ocp_tempcode(); if ($_mm['mm_open_state'] == 1) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_OPEN')); } if ($_mm['mm_open_state'] == 0) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_CLOSE')); } if ($_mm['mm_pin_state'] == 1) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_PIN')); } if ($_mm['mm_pin_state'] == 0) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_UNPIN')); } if ($_mm['mm_sink_state'] == 1) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_SINK')); } if ($_mm['mm_sink_state'] == 0) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_UNSINK')); } if ($_mm['mm_title_suffix'] != '') { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_TITLE_SUFFIX', escape_html($_mm['mm_title_suffix']))); } if (!is_null($_mm['mm_move_to'])) { $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_MOVE', ocf_forum_breadcrumbs($_mm['mm_move_to']))); } $action_list->attach(do_lang_tempcode('MULTI_MODERATION_WILL_POST')); $text = do_lang_tempcode('MULTI_MODERATION_WILL', make_string_tempcode($mm_title), $action_list); return do_template('FORM_SCREEN', array('_GUID' => '2eef0c445d207bb10ff3fd28ea32ef8c', 'STAFF_HELP_URL' => brand_base_url() . '/docs' . strval(ocp_version()) . '/pg/tut_forum_helpdesk', 'PREVIEW' => true, 'HIDDEN' => $hidden, 'TITLE' => $title, 'TEXT' => $text, 'URL' => $post_url, 'FIELDS' => $fields, 'SUBMIT_NAME' => $submit_name)); }