示例#1
0
function create_form_simple(&$data)
{
    global $CONFIG, $lang_upload_php;
    // Cycle through the elements in the data array.
    foreach ($data as $element) {
        // If the element is another array, parse the definition contained within the array.
        if (is_array($element)) {
            $element[2] = isset($element[2]) ? $element[2] : '';
            $element[3] = isset($element[3]) ? $element[3] : '';
            $element[4] = isset($element[4]) ? $element[4] : '';
            // Based on the type declared in the data array's third position, create a different form input.
            switch ($element[2]) {
                // If the type is a text box input
                case 0:
                    //Call the form input function.
                    text_box_input($element[0], $element[1], $element[3], $element[4], isset($element[5]) ? $element[5] : '');
                    break;
                    // If the type is a file input.
                // If the type is a file input.
                case 1:
                    // Call the file input function.
                    file_input($element[0], $element[1], $element[3]);
                    break;
                    // If the type is an album list dropdown.
                // If the type is an album list dropdown.
                case 2:
                    // Call the album list function.
                    form_alb_list_box($element[0], $element[1]);
                    break;
                    // If the type is a text area
                // If the type is a text area
                case 3:
                    // Call the text area function.
                    text_area_input($element[0], $element[1], $element[3], isset($element[4]) ? $element[4] : '');
                    break;
                    // If the type is a hidden form
                // If the type is a hidden form
                case 4:
                    // Call the hidden input funtion.
                    hidden_input($element[0], $element[1]);
                    break;
                    // If the type is not present, kill the script.
                // If the type is not present, kill the script.
                default:
                    cpg_die(ERROR, $lang_upload_php['reg_instr_1'], __FILE__, __LINE__);
            }
            // switch
        } else {
            // If the element is not an array, it is a label, so call the label function.
            form_label($element);
        }
    }
}
示例#2
0
function createJFrom($inputFieldType)
{
    // Globalize $CONFIG
    global $CONFIG, $lang_upload_php, $lang_common, $lang_bbcode_help_title, $lang_bbcode_help;
    $createJForm = '';
    //print $lang_upload_php['pic_title'];
    /**get the Ablum Drop donw to the varialbe*/
    $createJForm .= upload_form_alb_list($lang_common['album'], 'album_array[]', 1);
    /**get the File input field to the variable*/
    if ($inputFieldType == 1) {
        $createJForm .= file_input('File', 'file_upload_array[]', 1, 1);
    }
    if ($inputFieldType == 2) {
        $createJForm .= text_box_input('URL', 'URI_array[]', 255, 1, '', 'url', '', 1);
    }
    /**get the Title input field as a variable*/
    $createJForm .= text_box_input($lang_upload_php['pic_title'], 'title_array[]', 255, 1, '', 'title', '', 1);
    /**get the Text area field to the variable*/
    $captionLabel = $lang_upload_php['description'];
    if ($CONFIG['show_bbcode_help']) {
        //	$captionLabel .= ' '. cpg_display_help('f=empty.htm&base=64&h='.urlencode(base64_encode(serialize($lang_bbcode_help_title))).'&t='.urlencode(base64_encode(serialize($lang_bbcode_help))),470,245);
    }
    $createJForm .= text_area_input($captionLabel, 'caption_array[]', $CONFIG['max_img_desc_length'], '', 1);
    /**get the Text input field to the variable*/
    $createJForm .= text_box_input($lang_common['keywords_insert1'], 'keywords_array[]', 255, 1, '', 'serachUp', 'onKeyPress="return  disableEnterKey(event)" autocomplete="off"', 1);
    return $createJForm;
}