$lang_upload_php['upload_swf'], // 'html_single' => $lang_upload_php['upload_single'], ); // Filter upload choices to allow plugins to add upload methods $upload_choices = CPGPluginAPI::filter('upload_options', $upload_choices); // Complain if there is no upload method if (!$upload_choices) { cpg_die(ERROR, $lang_upload_php['err_no_method'], __FILE__, __LINE__); } // Default upload method set by the gallery administrator $upload_form = $CONFIG['upload_mechanism']; // Populate Icon array $icon_array = array(); $icon_array['continue'] = cpg_fetch_icon('right', 2); $icon_array['ok'] = cpg_fetch_icon('ok', 0); $icon_array['cancel'] = cpg_fetch_icon('cancel', 2); $icon_array['upload'] = cpg_fetch_icon('upload', 2); $icon_array['info'] = cpg_fetch_icon('info', 2); if ($superCage->get->keyExists('html5')) { $upload_form = 'upload_h5a'; } elseif ($superCage->get->keyExists('single')) { // If we have "single" key in GET then we will force the upload form mechanism to single file upload // This acts as a fallback if js or flash is disabled $upload_form = 'upload_sgl'; } elseif ($CONFIG['allow_user_upload_choice'] && $superCage->get->keyExists('method')) { // pull in upload method from GET parameter 'method' $matches = $superCage->get->getMatched('method','/^[0-9A-Za-z_]+$/'); $upload_form = $matches[0]; $USER['upload_method'] = $upload_form; } elseif ($superCage->post->keyExists('method')) { // pull in upload method from POST parameter 'method' $matches = $superCage->post->getMatched('method','/^[0-9A-Za-z_]+$/'); $upload_form = $matches[0]; } elseif ($CONFIG['allow_user_upload_choice'] && isset($USER['upload_method'])) { $upload_form = $USER['upload_method']; } // Confirm that upload method chosen is one of the available choices if (!in_array($upload_form, array_keys($upload_choices))) { // Try gallery default upload method $upload_form = $CONFIG['upload_mechanism']; if (!in_array($upload_form, array_keys($upload_choices))) { $upload_form = 'upload_h5a'; } unset($USER['upload_method']); } js_include('js/upload.js'); //___________________________________Function Block_______________________________________ // The text box form input function. Takes the text label for the box, the input name, the maximum length for text boxes, // and the number of iterations. function text_box_input($text, $name, $max_length, $iterations, $default='') { global $CONFIG, $LINEBREAK; $ordinal = ''; if (($text == '') and ($iterations == '')) { echo ' ' . $LINEBREAK; return; } // Begin loop for ($counter=0; $counter<$iterations; $counter++) { // Create a numbering system when necessary. if ($text == '') { $cardinal = $counter + 1; $ordinal = "".$cardinal.". "; } // Create a text box. echo << $text $ordinal EOT; } } // The file input function. Takes the label, field name, and number of iterations as arguments. function file_input($text, $name, $iterations) { $ordinal = ''; // Begin loop for ($counter=0; $counter<$iterations; $counter++) { // Create a numbering system when necessary. if ($text == '') { $cardinal = $counter + 1; $ordinal = "".$cardinal.". "; } // Create the file input box. echo << $text $ordinal EOT; } } // The function for text areas on forms. Takes the label, field name, and maximum length as arguments. function text_area_input($text, $name, $max_length,$default='') { // Create the text area. echo << $text EOT; } // The hidden form input function. Takes the hidden input field name and value. function hidden_input($name, $value) { echo << EOT; } // The form label creation function. Takes a non-array element form $data as its argument. function form_label($text) { echo << $text EOT; } // Creates the album list drop down function form_alb_list_box($text, $name) { global $lang_common; $superCage = Inspekt::makeSuperCage(); if ($superCage->get->keyExists('album')) { $sel_album = $superCage->get->getInt('album'); } elseif ($superCage->post->keyExists('album')) { $sel_album = $superCage->post->getInt('album'); } else { $sel_album = 0; } $options = album_selection_options($sel_album); $only_empty_albums = only_empty_albums_button(); echo << {$text} {$only_empty_albums} EOT; } // Creates Javascript verification code and opening form tags // $path --> path to the form action script function open_form($path) { global $upload_form; $on_submit = ''; if ('swfupload' == $upload_form) { $on_submit = 'onsubmit="cpgUploadToggleProgressBar();"'; } echo << function textCounter(field, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); }
EOT; } // The close form function creates the submit button and the closing tags. function close_form($button_value, $progress=0, $icon='ok') { // Pull the language array into the function. global $lang_upload_php, $THEME_DIR, $icon_array; // Create the submit button and close the form. echo <<