/**
  * The UI to import in bulk from an archive file.
  *
  * @return tempcode		The UI
  */
 function import()
 {
     $title = get_page_title('IMPORT_EMOTICONS');
     require_code('form_templates');
     $post_url = build_url(array('page' => '_SELF', 'type' => '_import', 'uploading' => 1), '_SELF');
     $fields = new ocp_tempcode();
     $supported = 'tar';
     if (function_exists('zip_open') || get_option('unzip_cmd') != '') {
         $supported .= ', zip';
     }
     $fields->attach(form_input_upload_multi(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_ARCHIVE_IMAGES', escape_html($supported), escape_html(str_replace(',', ', ', get_option('valid_images')))), 'file', true, NULL, NULL, true, str_replace(' ', '', get_option('valid_images') . ',' . $supported)));
     $text = paragraph(do_lang_tempcode('IMPORT_EMOTICONS_WARNING'));
     require_code('images');
     $max = floatval(get_max_image_size()) / floatval(1024 * 1024);
     /*if ($max<1.0)	Ok - this is silly! Emoticons are tiny.
     		{
     			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)),escape_html(is_null($config_url)?'':$config_url))));
     		}*/
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('EMOTICONS')), array('_SELF:_SELF:import', do_lang_tempcode('CHOOSE'))));
     $hidden = build_keep_post_fields();
     $hidden->attach(form_input_hidden('test', '1'));
     handle_max_file_size($hidden);
     return do_template('FORM_SCREEN', array('_GUID' => '1910e01ec183392f6b254671dc7050a3', 'TITLE' => $title, 'FIELDS' => $fields, 'SUBMIT_NAME' => do_lang_tempcode('BATCH_IMPORT_ARCHIVE_CONTENTS'), 'URL' => $post_url, 'TEXT' => $text, 'HIDDEN' => $hidden));
 }
Example #2
0
 /**
  * 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));
 }
Example #3
0
 /**
  * The UI to import into a gallery.
  *
  * @return tempcode		The UI
  */
 function _gimp()
 {
     $cat = get_param('name', 'root');
     check_specific_permission('mass_import');
     if (substr($cat, 0, 7) != 'member_') {
         $test = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'name', array('name' => $cat));
         if (is_null($test)) {
             warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
         }
     }
     $title = get_page_title('GALLERY_IMPORT');
     require_code('form_templates');
     require_lang('trackbacks');
     // To choose to batch import from an attached tar or zip file (zip file only supported if zip module running on php install)
     $post_url = build_url(array('page' => '_SELF', 'type' => '__gimp', 'cat' => $cat, 'uploading' => 1, 'redirect' => get_param('redirect', NULL)), '_SELF');
     $fields = new ocp_tempcode();
     $supported = 'tar';
     if (function_exists('zip_open') || get_option('unzip_cmd') != '') {
         $supported .= ', zip';
     }
     $fields->attach(form_input_upload_multi(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_ARCHIVE_MEDIA', escape_html($supported), escape_html(str_replace(',', ', ', get_option('valid_images') . ',' . get_allowed_video_file_types()))), 'file', true, NULL, NULL, true, str_replace(' ', '', get_option('valid_images') . ',' . $supported)));
     $hidden = new ocp_tempcode();
     handle_max_file_size($hidden);
     if (get_option('is_on_gd') == '1') {
         if ($this->has_at_least_one_watermark($cat)) {
             $fields->attach(form_input_tick(do_lang_tempcode('WATERMARK'), do_lang_tempcode('DESCRIPTION_WATERMARK'), 'watermark', true));
         }
     }
     // Feedback
     require_code('feedback2');
     $fields->attach(feedback_fields(true, true, true, false, ''));
     // Max upload limit
     require_code('files2');
     $max = floatval(get_max_file_size()) / floatval(1024 * 1024);
     if ($max < 30.0) {
         $config_url = get_upload_limit_config_url();
         $text = 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)), escape_html(is_null($config_url) ? '' : $config_url)));
     } else {
         $text = new ocp_tempcode();
     }
     // Show form
     $hidden->attach(form_input_hidden('test', '1'));
     $form = do_template('FORM', array('_GUID' => '05de2bc134ed0b1ab703ac8bfbfabce4', 'TABINDEX' => strval(get_form_field_tabindex()), 'FIELDS' => $fields, 'SUBMIT_NAME' => do_lang_tempcode('BATCH_IMPORT_ARCHIVE_CONTENTS'), 'URL' => $post_url, 'TEXT' => $text, 'HIDDEN' => $hidden));
     // Orphaned upload form
     // To choose to batch import what already exists in gallery directory, but is orphaned
     $orphaned_content = new ocp_tempcode();
     if ($GLOBALS['FORUM_DRIVER']->is_staff(get_member()) && $GLOBALS['SITE_DB']->query_value('images', 'COUNT(*)') + $GLOBALS['SITE_DB']->query_value('videos', 'COUNT(*)') < 4000) {
         require_code('images');
         $there = array();
         $_dir = opendir(get_custom_file_base() . '/uploads/galleries/');
         while (false !== ($file = readdir($_dir))) {
             if ($file != 'index.html' && !is_dir(get_custom_file_base() . '/uploads/galleries/' . $file) && (is_image($file) || is_video($file))) {
                 $there[$file] = filemtime(get_custom_file_base() . '/uploads/galleries/' . $file);
             }
         }
         closedir($_dir);
         $_dir = @opendir(get_custom_file_base() . '/uploads/galleries/' . filter_naughty($cat));
         if ($_dir !== false) {
             while (false !== ($file = readdir($_dir))) {
                 if ($file != 'index.html' && !is_dir(get_custom_file_base() . '/uploads/galleries/' . $cat . '/' . $file) && (is_image($file) || is_video($file))) {
                     $there[$cat . '/' . $file] = filemtime(get_custom_file_base() . '/uploads/galleries/' . $cat . '/' . $file);
                 }
             }
             closedir($_dir);
         }
         if (count($there) != 0) {
             asort($there);
             $test1 = collapse_1d_complexity('url', $GLOBALS['SITE_DB']->query_select('images', array('url')));
             $test2 = collapse_1d_complexity('url', $GLOBALS['SITE_DB']->query_select('videos', array('url')));
             arsort($there);
             $temp_keys = array_keys($there);
             $last_time = $there[$temp_keys[0]];
             foreach ($there as $file => $time) {
                 if (!in_array('uploads/galleries/' . str_replace('%2F', '/', rawurlencode($file)), $test1) && !in_array('uploads/galleries/' . str_replace('%2F', '/', rawurlencode($file)), $test2)) {
                     $orphaned_content->attach(form_input_list_entry($file, $time >= $last_time - 60 * 60 * 3 || strpos($file, '/') !== false, $file));
                 }
             }
         }
         $add_url = build_url(array('page' => '_SELF', 'type' => 'ss'), '_SELF');
         if (!$orphaned_content->is_empty()) {
             $fields_2 = new ocp_tempcode();
             $hidden_2 = new ocp_tempcode();
             if (get_param_integer('keep_de_orphan', 0) == 1) {
                 $cats = nice_get_gallery_tree($cat, NULL, false, false, false, false, NULL, true);
                 $fields_2->attach(form_input_list(do_lang_tempcode('GALLERY'), '', 'cat', $cats));
             } else {
                 $hidden_2->attach(form_input_hidden('cat', $cat));
             }
             $fields_2->attach(form_input_multi_list(do_lang_tempcode('ENTRIES'), '', 'files', $orphaned_content));
             if ($this->has_at_least_one_watermark($cat)) {
                 $fields_2->attach(form_input_various_ticks(array(array(do_lang_tempcode('WATERMARK'), 'watermark', true, ''), array(do_lang_tempcode('ALLOW_RATING'), 'allow_rating', true, ''), array(do_lang_tempcode('ALLOW_COMMENTS'), 'allow_comments', true, ''), array(do_lang_tempcode('ALLOW_REVIEWS'), 'allow_reviews', false, ''), array(do_lang_tempcode('ALLOW_TRACKBACKS'), 'allow_trackbacks', true, '')), '', NULL, do_lang_tempcode('OPTIONS')));
             }
             $radios = new ocp_tempcode();
             $radios->attach(form_input_radio_entry('type', 'sa', true, do_lang_tempcode('ADD_GALLERY_SELECTION')));
             $radios->attach(form_input_radio_entry('type', 'sd', false, do_lang_tempcode('DELETE_GALLERY_SELECTION')));
             $fields_2->attach(form_input_radio(do_lang_tempcode('ACTION'), '', 'type', $radios, true));
             // Feedback
             require_code('feedback2');
             $fields_2->attach(feedback_fields(true, true, true, false, ''));
             $form2 = do_template('FORM', array('SECONDARY_FORM' => true, 'TABINDEX' => strval(get_form_field_tabindex()), 'FIELDS' => $fields_2, 'SUBMIT_NAME' => do_lang_tempcode('PROCEED'), 'URL' => $add_url, 'TEXT' => '', 'HIDDEN' => $hidden_2));
         } else {
             $form2 = new ocp_tempcode();
         }
     } else {
         $form2 = new ocp_tempcode();
     }
     breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('MANAGE_GALLERIES')), array('_SELF:_SELF:gimp', do_lang_tempcode('GALLERY'))));
     breadcrumb_set_self(do_lang_tempcode('UPLOAD'));
     return do_template('GALLERY_IMPORT_SCREEN', array('_GUID' => '607c819ff751268294e5e590a0d41533', 'TITLE' => $title, 'FORM2' => $form2, 'FORM' => $form));
 }