Example #1
0
 /**
  * Standard modular UI/actualiser to edit an entry.
  *
  * @return tempcode	The UI
  */
 function __ed()
 {
     $id = mixed();
     // Define type as mixed
     $id = $this->non_integer_id ? get_param('id', false, true) : strval(get_param_integer('id'));
     $doing = 'EDIT_' . $this->lang_type;
     if ($this->catalogue && get_param('catalogue_name', '') != '') {
         $catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => get_param('catalogue_name'))));
         if ($this->type_code == 'd') {
             $doing = do_lang('CATALOGUE_GENERIC_EDIT', escape_html($catalogue_title));
         } elseif ($this->type_code == 'c') {
             $doing = do_lang('CATALOGUE_GENERIC_EDIT_CATEGORY', escape_html($catalogue_title));
         }
     }
     $title = get_page_title($doing);
     if ($this->second_stage_preview && get_param_integer('preview', 0) == 1) {
         return $this->preview_intercept($title);
     }
     if (method_exists($this, 'get_submitter')) {
         list($submitter, $date_and_time) = $this->get_submitter($id);
         if (!is_null($date_and_time) && addon_installed('points')) {
             $reverse = post_param_integer('reverse_point_transaction', 0);
             if ($reverse == 1) {
                 $points_test = $GLOBALS['SITE_DB']->query_select('gifts', array('*'), array('date_and_time' => $date_and_time, 'gift_to' => $submitter, 'gift_from' => $GLOBALS['FORUM_DRIVER']->get_guest_id()));
                 if (array_key_exists(0, $points_test)) {
                     $amount = $points_test[0]['amount'];
                     $sender_id = $points_test[0]['gift_from'];
                     $recipient_id = $points_test[0]['gift_to'];
                     $GLOBALS['SITE_DB']->query_delete('gifts', array('id' => $points_test[0]['id']), '', 1);
                     if (!is_guest($sender_id)) {
                         $_sender_gift_points_used = point_info($sender_id);
                         $sender_gift_points_used = array_key_exists('gift_points_used', $_sender_gift_points_used) ? $_sender_gift_points_used['gift_points_used'] : 0;
                         $GLOBALS['FORUM_DRIVER']->set_custom_field($sender_id, 'gift_points_used', strval($sender_gift_points_used - $amount));
                     }
                     require_code('points');
                     $temp_points = point_info($recipient_id);
                     $GLOBALS['FORUM_DRIVER']->set_custom_field($recipient_id, 'points_gained_given', strval((array_key_exists('points_gained_given', $temp_points) ? $temp_points['points_gained_given'] : 0) - $amount));
                 }
             }
         }
     } else {
         $submitter = NULL;
     }
     breadcrumb_set_parents(array_merge($GLOBALS['BREADCRUMB_SET_PARENTS'], array(array('_SELF:_SELF:_e' . $this->type_code . ':' . $id, strpos($doing, ' ') !== false ? protect_from_escaping($doing) : do_lang_tempcode($doing)))));
     $delete = post_param_integer('delete', 0);
     if ($delete == 1 || $delete == 2) {
         if (!is_null($this->permissions_require)) {
             check_delete_permission($this->permissions_require, $submitter, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)), $this->permission_page_name);
         }
         $doing = 'DELETE_' . $this->lang_type;
         if ($this->catalogue && get_param('catalogue_name', '') != '') {
             $catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => get_param('catalogue_name'))));
             if ($this->type_code == 'd') {
                 $doing = do_lang('CATALOGUE_GENERIC_DELETE', escape_html($catalogue_title));
             } elseif ($this->type_code == 'c') {
                 $doing = do_lang('CATALOGUE_GENERIC_DELETE_CATEGORY', escape_html($catalogue_title));
             }
         }
         $title = get_page_title($doing);
         $test = $this->handle_confirmations($title);
         if (!is_null($test)) {
             return $test;
         }
         $this->delete_actualisation($id);
         // Delete custom fields
         if ($this->has_tied_catalogue()) {
             require_code('fields');
             delete_form_custom_fields($this->award_type, $id);
         }
         /*if ((!is_null($this->redirect_type)) || ((!is_null(get_param('redirect',NULL)))))		No - resource is gone now, and redirect would almost certainly try to take us back there
         		{
         			$url=(($this->redirect_type=='!') || (is_null($this->redirect_type)))?get_param('redirect'):build_url(array('page'=>'_SELF','type'=>$this->redirect_type),'_SELF');
         			return redirect_screen($title,$url,do_lang_tempcode('SUCCESS'));
         		}*/
         clear_ocp_autosave();
         $description = is_null($this->do_next_description) ? do_lang_tempcode('SUCCESS') : $this->do_next_description;
         return $this->do_next_manager($title, $description, NULL);
     } else {
         if (!is_null($this->permissions_require)) {
             check_edit_permission($this->permissions_require, $submitter, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)), $this->permission_page_name);
         }
         $test = $this->handle_confirmations($title);
         if (!is_null($test)) {
             return $test;
         }
         if ($this->user_facing && !is_null($this->permissions_require) && array_key_exists('validated', $_POST)) {
             if (!has_specific_permission(get_member(), 'bypass_validation_' . $this->permissions_require . 'range_content', $this->permission_page_name, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? '' : post_param($this->permissions_cat_name), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? '' : post_param($this->permissions_cat_name_b)))) {
                 $_POST['validated'] = '0';
             }
         }
         if (!is_null($this->upload)) {
             require_code('uploads');
         }
         $description = $this->edit_actualisation($id);
         if (!is_null($this->new_id)) {
             $id = $this->new_id;
         }
         // Save custom fields
         if ($this->has_tied_catalogue()) {
             require_code('fields');
             save_form_custom_fields($this->award_type, $id);
         }
         if ($this->output_of_action_is_confirmation && !is_null($description)) {
             return $description;
         }
         if (is_null($description)) {
             $description = do_lang_tempcode('SUCCESS');
         }
         if (addon_installed('awards')) {
             if (!is_null($this->award_type)) {
                 require_code('awards');
                 handle_award_setting($this->award_type, $id);
             }
         }
         if ($this->user_facing) {
             if ($this->check_validation && post_param_integer('validated', 0) == 0) {
                 require_code('submit');
                 if ($this->send_validation_request) {
                     $edit_url = build_url(array('page' => '_SELF', 'type' => '_e' . $this->type_code, 'id' => $id, 'validated' => 1), '_SELF', NULL, false, false, true);
                     if (addon_installed('unvalidated')) {
                         send_validation_request($doing, $this->table, $this->non_integer_id, $id, $edit_url);
                     }
                 }
                 $description->attach(paragraph(do_lang_tempcode('SUBMIT_UNVALIDATED')));
             }
         }
     }
     if (!is_null($this->redirect_type) || !is_null(get_param('redirect', NULL))) {
         $url = $this->redirect_type == '!' || is_null($this->redirect_type) ? make_string_tempcode(get_param('redirect')) : build_url(array('page' => '_SELF', 'type' => $this->redirect_type), '_SELF');
         return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
     }
     clear_ocp_autosave();
     decache('main_awards');
     return $this->do_next_manager($title, $description, $id);
 }
Example #2
0
 /**
  * The actualiser to edit a post.
  *
  * @return tempcode		The UI
  */
 function _edit_post()
 {
     require_code('attachments2');
     if (post_param_integer('delete', 0) == 1) {
         return $this->_delete_post();
     }
     $post_id = post_param_integer('post_id');
     $post_details = $GLOBALS['FORUM_DB']->query_select('f_posts', array('*'), array('id' => $post_id), '', 1);
     if (!array_key_exists(0, $post_details)) {
         warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $forum_id = $post_details[0]['p_cache_forum_id'];
     $intended_solely_for = post_param_integer('intended_solely_for', -1);
     if ($intended_solely_for == -1) {
         $intended_solely_for = NULL;
     }
     $validated = post_param_integer('validated', 0);
     if (!is_null($forum_id) && !has_specific_permission(get_member(), 'bypass_validation_lowrange_content', 'topics', array('forums', $forum_id))) {
         $validated = 0;
     }
     $old_validated = $post_details[0]['p_validated'];
     require_code('ocf_posts_action');
     require_code('ocf_posts_action2');
     require_code('ocf_posts_action3');
     $topic_id = ocf_edit_post($post_id, $validated, post_param('title', ''), post_param('post'), post_param_integer('skip_sig', 0), post_param_integer('is_emphasised', 0), $intended_solely_for, post_param_integer('show_as_edited', 0) == 1, post_param_integer('mark_as_unread', 0) == 1, post_param('reason'));
     require_code('fields');
     if (has_tied_catalogue('post')) {
         save_form_custom_fields('post', strval($post_id));
     }
     if ($old_validated != $validated) {
         if ($validated == 1) {
             ocf_validate_post($post_id);
         }
     }
     if (addon_installed('awards')) {
         require_code('awards');
         handle_award_setting('post', strval($post_id));
     }
     require_code('autosave');
     clear_ocp_autosave();
     // Show it worked / Refresh
     $url = get_param('redirect', NULL);
     if (!is_null($url)) {
         return redirect_screen(get_page_title('EDIT_POST'), $url, do_lang_tempcode('SUCCESS'));
     }
     return $this->redirect_to('EDIT_POST', $topic_id, NULL, $post_id);
 }
Example #3
0
 /**
  * The actualiser for editing a CEDI page.
  *
  * @return tempcode	The UI.
  */
 function _edit_page()
 {
     $_id = get_param_cedi_chain('id');
     $id = intval($_id[0]);
     if (!has_category_access(get_member(), 'seedy_page', strval($id))) {
         access_denied('CATEGORY_ACCESS');
     }
     if (post_param_integer('delete', 0) == 1) {
         $title = get_page_title('CEDI_DELETE_PAGE');
         check_delete_permission('cat_low', NULL, array('seedy_page', $id));
         cedi_delete_page($id);
         require_code('fields');
         if (has_tied_catalogue('seedy_page')) {
             delete_form_custom_fields('seedy_page', strval($id));
         }
         require_code('autosave');
         clear_ocp_autosave();
         $_url = build_url(array('page' => '_SELF', 'type' => 'misc'), '_SELF');
         $url = $_url->evaluate();
     } else {
         $title = get_page_title('CEDI_EDIT_PAGE');
         check_edit_permission('cat_low', NULL, array('seedy_page', $id));
         require_code('permissions2');
         set_category_permissions_from_environment('seedy_page', strval($id), 'cms_cedi');
         cedi_edit_page($id, post_param('title'), post_param('post'), post_param('notes', ''), post_param_integer('hide_posts', 0), post_param('meta_keywords', ''), post_param('meta_description', ''));
         require_code('fields');
         if (has_tied_catalogue('seedy_page')) {
             save_form_custom_fields('seedy_page', strval($id));
         }
         require_code('autosave');
         clear_ocp_autosave();
         if (addon_installed('awards')) {
             require_code('awards');
             handle_award_setting('seedy_page', strval($id));
         }
         $url = get_param('redirect');
     }
     // Show it worked / Refresh
     return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
 }
Example #4
0
 /**
  * The actualiser to edit a comcode page.
  *
  * @return tempcode		The UI
  */
 function __ed()
 {
     $simple_add = get_param_integer('simple_add', 0) == 1;
     $title = get_page_title($simple_add ? 'COMCODE_PAGE_ADD' : 'COMCODE_PAGE_EDIT');
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/comcode_page_edit';
     $file = filter_naughty(post_param('file'));
     $lang = filter_naughty(post_param('lang'));
     $zone = filter_naughty(post_param('zone'));
     if (addon_installed('page_management')) {
         $new_file = filter_naughty(has_actual_page_access(get_member(), 'admin_sitetree') ? post_param('title', $file) : $file);
     } else {
         $new_file = filter_naughty($file);
     }
     if ($file == '') {
         $file = $new_file;
     }
     require_code('type_validation');
     if (!is_alphanumeric($file, true)) {
         warn_exit(do_lang_tempcode('BAD_CODENAME'));
     }
     $fullpath = zone_black_magic_filterer(get_custom_file_base() . '/' . $zone . '/pages/comcode_custom/' . $lang . '/' . $file . '.txt');
     $renaming_page = $new_file != $file;
     if ($renaming_page) {
         if (!is_alphanumeric($new_file, true)) {
             warn_exit(do_lang_tempcode('BAD_CODENAME'));
         }
         $langs = find_all_langs(true);
         $rename_map = array();
         $afm_needed = false;
         // Actually will stay false as we don't allow renaming original-pages at the moment
         foreach (array_keys($langs) as $lang) {
             $path = zone_black_magic_filterer(filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/comcode_custom/' . $lang . '/' . $file . '.txt', true);
             if (is_file(get_file_base() . '/' . $path)) {
                 $new_path = zone_black_magic_filterer(filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/comcode_custom/' . $lang . '/' . $new_file . '.txt', true);
                 if (is_file($new_path)) {
                     warn_exit(do_lang_tempcode('ALREADY_EXISTS', escape_html($zone . ':' . $new_file)));
                 }
                 $rename_map[$path] = $new_path;
             }
             if (is_file(get_file_base() . '/' . str_replace('/comcode_custom/', '/comcode/', $path))) {
                 $completion_text = do_lang_tempcode('ORIGINAL_PAGE_NO_RENAME');
             }
         }
         if ($afm_needed) {
             require_code('abstract_file_manager');
             force_have_afm_details();
         }
     }
     $validated = post_param_integer('validated', 0);
     if (!has_specific_permission(get_member(), 'bypass_validation_highrange_content')) {
         $validated = 0;
     }
     $parent_page = post_param('parent_page', '');
     $show_as_edit = post_param_integer('show_as_edit', 0);
     $resource_owner = $GLOBALS['SITE_DB']->query_value_null_ok('comcode_pages', 'p_submitter', array('the_zone' => $zone, 'the_page' => $file));
     check_edit_permission('high', $resource_owner);
     if ($GLOBALS['FORUM_DRIVER']->is_super_admin(get_member())) {
         $_owner = post_param('owner', $GLOBALS['FORUM_DRIVER']->get_username(get_member()));
         $owner = $GLOBALS['FORUM_DRIVER']->get_member_from_username($_owner);
         if (is_null($owner)) {
             $owner = get_member();
         }
     } else {
         $owner = get_member();
     }
     if (is_null($resource_owner)) {
         check_submit_permission('high');
         require_code('submit');
         give_submit_points('COMCODE_PAGE_ADD');
         if (!addon_installed('unvalidated')) {
             $validated = 1;
         }
         $GLOBALS['SITE_DB']->query_insert('comcode_pages', array('the_zone' => $zone, 'the_page' => $file, 'p_parent_page' => $parent_page, 'p_validated' => $validated, 'p_edit_date' => NULL, 'p_add_date' => time(), 'p_submitter' => $owner, 'p_show_as_edit' => 0));
     } else {
         if (!has_actual_page_access(get_member(), $file, $zone)) {
             access_denied('PAGE_ACCESS');
         }
         require_code('submit');
         $just_validated = !content_validated('comcode_page', $zone . ':' . $file) && $validated == 1;
         if ($just_validated) {
             send_content_validated_notification('comcode_page', $zone . ':' . $file);
         }
         if (!addon_installed('unvalidated')) {
             $validated = 1;
         }
         $GLOBALS['SITE_DB']->query_update('comcode_pages', array('p_parent_page' => $parent_page, 'p_validated' => $validated, 'p_edit_date' => time(), 'p_submitter' => $owner, 'p_show_as_edit' => $show_as_edit), array('the_zone' => $zone, 'the_page' => $file), '', 1);
     }
     if ($validated == 0) {
         require_code('submit');
         $edit_url = build_url(array('page' => '_SELF', 'type' => '_ed', 'page_link' => $zone . ':' . $new_file), '_SELF', NULL, false, false, true);
         if (addon_installed('unvalidated')) {
             send_validation_request('COMCODE_PAGE_EDIT', 'comcode_pages', true, $zone . ':' . $new_file, $edit_url);
         }
     }
     $new = post_param('post');
     require_code('attachments2');
     $_new = do_comcode_attachments($new, 'comcode_page', $zone . ':' . $file);
     $new = $_new['comcode'];
     if (!file_exists($fullpath) || $new != file_get_contents($fullpath, FILE_TEXT)) {
         $myfile = @fopen($fullpath, 'wt');
         if ($myfile === false) {
             intelligent_write_error($fullpath);
         }
         final_attachments_from_preview($zone . ':' . $file);
         if (fwrite($myfile, $new) < strlen($new)) {
             warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
         }
         fclose($myfile);
         sync_file($fullpath);
         $file_changed = true;
     } else {
         $file_changed = false;
     }
     require_code('seo2');
     $new_keywords = post_param('meta_keywords', '');
     $new_description = post_param('meta_description', '');
     if ($new_keywords == '' && $new_description == '') {
         seo_meta_set_for_implicit('comcode_page', $zone . ':' . $file, array($new), $new);
     } else {
         seo_meta_set_for_explicit('comcode_page', $zone . ':' . $file, $new_keywords, $new_description);
     }
     $completion_text = $validated == 0 ? do_lang_tempcode('SUBMIT_UNVALIDATED') : do_lang_tempcode('SUCCESS');
     // Update cache  NO WE CAN'T - THEY'RE MULTI-THEME NOW
     /*	$string_index=$GLOBALS['SITE_DB']->query_value_null_ok('cached_comcode_pages','string_index',array('the_zone'=>$zone,'the_page'=>$file));
     		if (!is_null($string_index))
     		{
     			lang_remap_comcode($string_index,$new);
     		} else
     		{
     			$string_index=insert_lang_comcode($new,1,NULL,false,NULL,NULL,false,NULL,NULL,60,true,true);
     			$GLOBALS['SITE_DB']->query_insert('cached_comcode_pages',array('the_zone'=>$zone,'the_page'=>$file,'string_index'=>$string_index));
     		}*/
     require_code('permissions2');
     set_page_permissions_from_environment($zone, $file);
     $caches = $GLOBALS['SITE_DB']->query_select('cached_comcode_pages', array('string_index'), array('the_zone' => $zone, 'the_page' => $file));
     $GLOBALS['SITE_DB']->query_delete('cached_comcode_pages', array('the_zone' => $zone, 'the_page' => $file));
     foreach ($caches as $cache) {
         delete_lang($cache['string_index']);
     }
     persistant_cache_empty();
     persistant_cache_delete(array('PAGE_INFO'));
     decache('main_comcode_page_children');
     fix_permissions($fullpath);
     if (is_file($fullpath) && get_option('store_revisions') == '1' && $file_changed) {
         $time = time();
         @copy($fullpath, $fullpath . '.' . strval($time)) or intelligent_write_error($fullpath . '.' . strval($time));
         fix_permissions($fullpath . '.' . strval($time));
         sync_file($fullpath . '.' . strval($time));
     }
     log_it('COMCODE_PAGE_EDIT', $file, $zone);
     require_code('autosave');
     clear_ocp_autosave();
     if ($renaming_page) {
         $GLOBALS['SITE_DB']->query_delete('comcode_pages', array('the_zone' => $zone, 'the_page' => $new_file), '', 1);
         $GLOBALS['SITE_DB']->query_update('comcode_pages', array('the_page' => $new_file), array('the_zone' => $zone, 'the_page' => $file), '', 1);
         $GLOBALS['SITE_DB']->query_update('comcode_pages', array('p_parent_page' => $new_file), array('the_zone' => $zone, 'p_parent_page' => $file));
         foreach ($rename_map as $path => $new_path) {
             if ($afm_needed) {
                 afm_move($path, $new_path);
             } else {
                 rename(get_custom_file_base() . '/' . $path, get_custom_file_base() . '/' . $new_path);
             }
         }
         if (addon_installed('awards')) {
             $types = $GLOBALS['SITE_DB']->query_select('award_types', array('id'), array('a_content_type' => 'comcode_page'));
             foreach ($types as $type) {
                 $GLOBALS['SITE_DB']->query_update('award_archive', array('content_id' => $new_file), array('content_id' => $file, 'a_type_id' => $type['id']));
             }
         }
         $file = $new_file;
     }
     if (post_param_integer('delete', 0) == 1) {
         unlink(get_custom_file_base() . '/' . $path);
     }
     if (addon_installed('awards')) {
         require_code('awards');
         handle_award_setting('comcode_page', $zone . ':' . $file);
     }
     decache('main_sitemap');
     breadcrumb_set_self(do_lang_tempcode('DONE'));
     // Look for bad title semantics
     $_new['html'] = $_new['tempcode']->evaluate();
     if (substr($file, 0, 1) != '_' && substr($file, 0, 6) != 'panel_' && trim($_new['html']) != '') {
         if (strpos($_new['html'], '<h1') === false && strpos($_new['comcode'], '[title]') === false && strpos($_new['comcode'], '[title="1"]') === false) {
             attach_message(do_lang_tempcode('NO_LEVEL_1_HEADERS'), 'notice');
         }
         $matches = array();
         if (strpos($_new['html'], '<h2') === false && preg_match_all('#\\n\\[(b|font|size)\\][^\\.]+\\[/(b|font|size)\\]\\n#', $_new['comcode'], $matches) >= 2) {
             attach_message(do_lang_tempcode('NO_LEVEL_2_HEADERS'), 'inform');
         }
     }
     // Show it worked / Refresh
     $url = post_param('redirect', '');
     if ($url != '') {
         return redirect_screen($title, $url, $completion_text);
     }
     return $this->do_next_manager($title, $file, $zone, $completion_text);
 }
Example #5
0
 /**
  * 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('SIGNATURE');
     $order = 40;
     // Actualiser
     $new_signature = post_param('signature', NULL);
     if ($new_signature !== NULL) {
         require_code('ocf_members_action');
         require_code('ocf_members_action2');
         ocf_member_choose_signature($new_signature, $member_id_of);
         require_code('autosave');
         clear_ocp_autosave();
         attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform');
     }
     if ($leave_to_ajax_if_possible) {
         return NULL;
     }
     // UI
     $_signature = get_translated_tempcode($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_signature'), $GLOBALS['FORUM_DB']);
     $signature = $_signature->is_empty() ? do_lang_tempcode('NONE_EM') : $_signature;
     $_signature_original = get_translated_text($GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_signature'), $GLOBALS['FORUM_DB']);
     $size = ocf_get_member_best_group_property($member_id_of, 'max_sig_length_comcode');
     $javascript = "\n\t\t\tvar form=document.getElementById('signature').form;\n\t\t\tform.old_submit=form.onsubmit;\n\t\t\tform.onsubmit=function()\n\t\t\t\t{\n\t\t\t\t\tvar post=form.elements['signature'];\n\t\t\t\t\tif ((!post.value) && (post[1])) post=post[1];\n\t\t\t\t\tif (post.value.length>" . strval($size) . ")\n\t\t\t\t\t{\n\t\t\t\t\t\twindow.fauxmodal_alert('" . php_addslashes(do_lang('SIGNATURE_TOO_BIG')) . "');\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof form.old_submit!='undefined' && form.old_submit) return form.old_submit();\n\t\t\t\t\treturn true;\n\t\t\t\t};\n\t\t";
     require_code('form_templates');
     $required = false;
     $has_preview = true;
     require_lang('javascript');
     require_javascript('javascript_posting');
     require_javascript('javascript_editing');
     require_javascript('javascript_ajax');
     require_javascript('javascript_swfupload');
     require_css('swfupload');
     require_lang('comcode');
     $tabindex = get_form_field_tabindex();
     $post_comment = do_lang_tempcode('SIGNATURE');
     list($attachments, $attach_size_field) = get_attachments('signature');
     $hidden_fields = new ocp_tempcode();
     $hidden_fields->attach($attach_size_field);
     $continue_url = get_self_url();
     $comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
     $emoticon_chooser = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
     $comcode_editor = get_comcode_editor();
     $comcode_editor_small = get_comcode_editor('signature', true);
     $w = has_js() && (browser_matches('wysiwyg') && strpos($_signature_original, '{$,page hint: no_wysiwyg}') === false);
     $class = '';
     global $JAVASCRIPT, $WYSIWYG_ATTACHED;
     if (!$WYSIWYG_ATTACHED) {
         $JAVASCRIPT->attach(do_template('HTML_EDIT'));
     }
     $WYSIWYG_ATTACHED = true;
     @header('Content-type: text/html; charset=' . get_charset());
     if ($w) {
         $class .= ' wysiwyg';
     }
     global $LAX_COMCODE;
     $temp = $LAX_COMCODE;
     $LAX_COMCODE = true;
     $GLOBALS['COMCODE_PARSE_URLS_CHECKED'] = 100;
     // Little hack to stop it checking any URLs
     /*if (is_null($default_parsed)) */
     $default_parsed = comcode_to_tempcode($_signature_original, NULL, false, 60, NULL, NULL, true);
     $LAX_COMCODE = $temp;
     $fields = new ocp_tempcode();
     $fields->attach(do_template('POSTING_FIELD', array('PRETTY_NAME' => do_lang_tempcode('SIGNATURE'), 'DESCRIPTION' => '', 'HIDDEN_FIELDS' => $hidden_fields, 'NAME' => 'signature', 'REQUIRED' => $required, 'TABINDEX_PF' => strval($tabindex), 'COMCODE_EDITOR' => $comcode_editor, 'COMCODE_EDITOR_SMALL' => $comcode_editor_small, 'CLASS' => $class, 'COMCODE_URL' => build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false)), 'EXTRA' => '', 'POST_COMMENT' => $post_comment, 'EMOTICON_CHOOSER' => $emoticon_chooser, 'COMCODE_HELP' => $comcode_help, 'POST' => $_signature_original, 'DEFAULT_PARSED' => $default_parsed, 'CONTINUE_URL' => $continue_url, 'ATTACHMENTS' => $attachments)));
     $text = do_template('OCF_EDIT_SIGNATURE_TAB', array('_GUID' => 'f5f2eb2552c34840c9cf46886422401e', 'SIZE' => integer_format($size), 'SIGNATURE' => $signature, 'TITLE' => $title));
     return array($title, $fields, $text, $javascript, $order);
 }