Untitled diff
10 removals
519 lines
33 additions
535 lines
<?php
<?php
/**
/**
*
*
* @package phpBB3
* @package phpBB3
* @version $Id$
* @version $Id$
* @copyright (c) 2011 Ariaswari
* @copyright (c) 2011 Ariaswari
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*
*/
*/
/**
/**
* @ignore
* @ignore
*/
*/
if (!defined('IN_PHPBB'))
if (!defined('IN_PHPBB'))
{
{
exit;
exit;
}
}
// include standard classes of form generator
// include standard classes of form generator
require_once $phpbb_root_path . 'includes/form/form.' . $phpEx;
require_once $phpbb_root_path . 'includes/form/form.' . $phpEx;
require_once $phpbb_root_path . 'includes/form/field.' . $phpEx;
require_once $phpbb_root_path . 'includes/form/field.' . $phpEx;
require_once $phpbb_root_path . 'includes/form/form_tpl.' . $phpEx;
require_once $phpbb_root_path . 'includes/form/form_tpl.' . $phpEx;
/**
/**
* regroups general functions concerning forms generator mod
* regroups general functions concerning forms generator mod
* this class can not be instanced, only static methods/properties
* this class can not be instanced, only static methods/properties
*/
*/
abstract class form_generator
abstract class form_generator
{
{
/**
/**
* return all existing forms into an array of form
* return all existing forms into an array of form
*/
*/
public static function get_forms()
public static function get_forms()
{
{
global $db;
global $db;
$sql = 'SELECT *
$sql = 'SELECT *
FROM ' . FORMS_TABLE;
FROM ' . FORMS_TABLE;
$result = $db->sql_query($sql);
$result = $db->sql_query($sql);
$forms = array();
$forms = array();
while ($row = $db->sql_fetchrow($result))
while ($row = $db->sql_fetchrow($result))
{
{
$forms[] = new form($row);
$forms[] = new form($row);
}
}
return $forms;
return $forms;
}
}
/**
/**
* return a specific form
* return a specific form
*/
*/
public static function get_form($form_id, $check_disable = false, $check_reply = false)
public static function get_form($form_id, $check_disable = false, $check_reply = false)
{
{
global $db;
global $db;
if (!$form_id)
if (!$form_id)
{
{
return false;
return false;
}
}
$sql = 'SELECT *
$sql = 'SELECT *
FROM ' . FORMS_TABLE . "
FROM ' . FORMS_TABLE . "
WHERE form_id = $form_id";
WHERE form_id = $form_id";
$sql .= ($check_disable) ? ' AND form_enabled = 1' : '';
$sql .= ($check_disable) ? ' AND form_enabled = 1' : '';
$sql .= ($check_reply) ? ' AND form_reply = 1' : '';
$sql .= ($check_reply) ? ' AND form_reply = 1' : '';
$result = $db->sql_query($sql);
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
if (!$row = $db->sql_fetchrow($result))
{
{
return false;
return false;
}
}
return new form($row);
return new form($row);
}
}
/**
/**
* return a specific field
* return a specific field
*/
*/
public static function get_field($field_id)
public static function get_field($field_id)
{
{
global $db;
global $db;
if (!$field_id)
if (!$field_id)
{
{
return false;
return false;
}
}
$sql = 'SELECT *
$sql = 'SELECT *
FROM ' . FORMS_FIELDS_TABLE . "
FROM ' . FORMS_FIELDS_TABLE . "
WHERE field_id = $field_id";
WHERE field_id = $field_id";
$result = $db->sql_query($sql);
$result = $db->sql_query($sql);
if (!$row = $db->sql_fetchrow($result))
if (!$row = $db->sql_fetchrow($result))
{
{
return false;
return false;
}
}
return self::new_field($row);
return self::new_field($row);
}
}
/**
/**
* created a new field (depending on its type)
* created a new field (depending on its type)
*/
*/
public static function new_field($field_data)
public static function new_field($field_data)
{
{
// if the type and the class exists, create new field
// if the type and the class exists, create new field
if (!empty($field_data['field_type']) && class_exists($field_data['field_type']))
if (!empty($field_data['field_type']) && class_exists($field_data['field_type']))
{
{
return new $field_data['field_type']($field_data);
return new $field_data['field_type']($field_data);
}
}
return false;
return false;
}
}
/**
/**
* generate list of field types
* generate list of field types
*/
*/
public static function select_fields($selected = false, $disabled = false)
public static function select_fields($selected = false, $disabled = false)
{
{
$s_fields = '<select name="field_type" id="field_type"' . (($disabled) ? ' disabled="disabled"' : '') . '>';
$s_fields = '<select name="field_type" id="field_type"' . (($disabled) ? ' disabled="disabled"' : '') . '>';
// generate html
// generate html
foreach (get_declared_classes() as $class)
foreach (get_declared_classes() as $class)
{
{
// create a field of each type
// create a field of each type
if (is_subclass_of($class, 'field'))
if (is_subclass_of($class, 'field'))
{
{
$field = new $class();
$field = new $class();
$select = ($selected && $class == $selected) ? ' selected="selected"' : '';
$select = ($selected && $class == $selected) ? ' selected="selected"' : '';
$s_fields .= '<option value="' . $class . '"' . $select . '>' . $field->get_name() . '</option>';
$s_fields .= '<option value="' . $class . '"' . $select . '>' . $field->get_name() . '</option>';
}
}
}
}
$s_fields .= '</select>';
$s_fields .= '</select>';
return $s_fields;
return $s_fields;
}
}
/**
/**
* generate list of form template
* generate list of form template
*/
*/
public static function select_form_tpl($selected = false)
public static function select_form_tpl($selected = false)
{
{
$s_tpl = '<select name="form_template" id="form_template">';
$s_tpl = '<select name="form_template" id="form_template">';
// generate html
// generate html
foreach (get_declared_classes() as $class)
foreach (get_declared_classes() as $class)
{
{
// create a field of each type
// create a field of each type
if (is_subclass_of($class, 'form_tpl'))
if (is_subclass_of($class, 'form_tpl'))
{
{
$tpl = new $class();
$tpl = new $class();
$select = ($selected && $class == $selected) ? ' selected="selected"' : '';
$select = ($selected && $class == $selected) ? ' selected="selected"' : '';
$s_tpl .= '<option value="' . $class . '"' . $select . '>' . $tpl->get_name() . '</option>';
$s_tpl .= '<option value="' . $class . '"' . $select . '>' . $tpl->get_name() . '</option>';
}
}
}
}
$s_tpl .= '</select>';
$s_tpl .= '</select>';
return $s_tpl;
return $s_tpl;
}
}
/**
/**
* generate list of groups
* generate list of groups
* function copied from includes/functions_admin.php which manages multiple selections
* function copied from includes/functions_admin.php which manages multiple selections
*/
*/
public static function group_select_options($group_id, $exclude_ids = false, $manage_founder = false)
public static function group_select_options($group_id, $exclude_ids = false, $manage_founder = false)
{
{
global $db, $user, $config;
global $db, $user, $config;
$exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : '';
$exclude_sql = ($exclude_ids !== false && sizeof($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : '';
$sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : '';
$sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : '';
$sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : '';
$sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : '';
$sql = 'SELECT group_id, group_name, group_type
$sql = 'SELECT group_id, group_name, group_type
FROM ' . GROUPS_TABLE . "
FROM ' . GROUPS_TABLE . "
$exclude_sql
$exclude_sql
$sql_and
$sql_and
$sql_founder
$sql_founder
ORDER BY group_type DESC, group_name ASC";
ORDER BY group_type DESC, group_name ASC";
$result = $db->sql_query($sql);
$result = $db->sql_query($sql);
$s_group_options = '';
$s_group_options = '';
while ($row = $db->sql_fetchrow($result))
while ($row = $db->sql_fetchrow($result))
{
{
$selected = ((is_array($group_id) && in_array($row['group_id'], $group_id)) || $row['group_id'] == $group_id) ? ' selected="selected"' : '';
$selected = ((is_array($group_id) && in_array($row['group_id'], $group_id)) || $row['group_id'] == $group_id) ? ' selected="selected"' : '';
$s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
$s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . $selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
}
}
$db->sql_freeresult($result);
$db->sql_freeresult($result);
return $s_group_options;
return $s_group_options;
}
}
/**
/**
* return the list of forums which use a form
* return the list of forums which use a form
*/
*/
public static function get_forums_used()
public static function get_forums_used()
{
{
global $db;
global $db;
$sql = 'SELECT forum_id
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
FROM ' . FORUMS_TABLE . '
WHERE form_id <> 0';
WHERE form_id <> 0';
$result = $db->sql_query($sql);
$result = $db->sql_query($sql);
$forums = array();
$forums = array();
while ($row = $db->sql_fetchrow($result))
while ($row = $db->sql_fetchrow($result))
{
{
$forums[] = $row['forum_id'];
$forums[] = $row['forum_id'];
}
}
return $forums;
return $forums;
}
}
/**
/**
* display a form in posting and manages submit/preview
* display a form in posting and manages submit/preview
*/
*/
public static function display_form($data, $mode)
public static function display_form($data, $mode)
{
{
global $config, $user, $template, $auth, $phpbb_root_path, $phpEx;
global $config, $user, $template, $auth, $phpbb_root_path, $phpEx;
//-- mod : quick title edition -------------------------------------------------
//-- mod : quick title edition -------------------------------------------------
//-- add
//-- add
global $qte;
global $qte;
//-- fin mod : quick title edition ---------------------------------------------
//-- fin mod : quick title edition ---------------------------------------------
// setup lang and functions
// setup lang and functions
$user->setup('mods/info_acp_form');
$user->setup('mods/info_acp_form');
require_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_user.' . $phpEx;
// setup data
// setup data
$errors = $fields_submit = array();
$errors = $fields_submit = array();
$submit = (isset($_POST['submit'])) ? true : false;
$submit = (isset($_POST['submit'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;
$subject = utf8_normalize_nfc(request_var('subject', '', true));
$subject = utf8_normalize_nfc(request_var('subject', '', true));
$username = utf8_normalize_nfc(request_var('username', '', true));
$username = utf8_normalize_nfc(request_var('username', '', true));
$message_flag = OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS;
$message_flag = OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS;
// Mod browser, os & screen ---
// Mod browser, os & screen ---
$screen = request_var('screen', '');
$screen = request_var('screen', '');
// End Mod browser, os & screen
// End Mod browser, os & screen
//-- mod : quick title edition -------------------------------------------------
//-- mod : quick title edition -------------------------------------------------
//-- add
//-- add
$data['attr_id'] = request_var('attr_id', 0);
$data['attr_id'] = request_var('attr_id', 0);
if ( !empty($data['topic_attr_id']) )
if ( !empty($data['topic_attr_id']) )
{
{
$data['attr_id'] = $data['topic_attr_id'];
if ( empty($data['attr_id']) || ($data['attr_id'] == -2) )
{
$data['attr_id'] = $data['topic_attr_id'];
}
}
}
//-- fin mod : quick title edition ---------------------------------------------
//-- fin mod : quick title edition ---------------------------------------------
// get form to display
// get form to display
if (!$form = self::get_form($data['form_id'], true, ($mode == 'reply') ? true : false))
if (!$form = self::get_form($data['form_id'], true, ($mode == 'reply') ? true : false))
{
{
return;
return;
}
}
// get fields of the form
// get fields of the form
if (!$fields = $form->get_fields($form->get_id()))
if (!$fields = $form->get_fields($form->get_id()))
{
{
return;
return;
}
}
// check if current user can view the form
// check if current user can view the form
if (!group_memberships(explode(',', $form->get('form_groups')), $user->data['user_id'], true))
if (!group_memberships(explode(',', $form->get('form_groups')), $user->data['user_id'], true))
{
{
return;
return;
}
}
// set default subject in replies
// set default subject in replies
if ($mode == 'reply' && !$subject && !$preview && !$submit)
if ($mode == 'reply' && !$subject && !$preview && !$submit)
{
{
$subject = ((strpos($data['topic_title'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($data['topic_title']);
$subject = ((strpos($data['topic_title'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($data['topic_title']);
}
}
// if anonymous user and visual confirmation needed, setup captcha here
// if anonymous user and visual confirmation needed, setup captcha here
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
{
include_once($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
include_once($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
$captcha->init(CONFIRM_POST);
}
}
// if form submitted/previewed
// if form submitted/previewed
if ($submit || $preview)
if ($submit || $preview)
{
{
// if new topic, subject cannot be empty
// if new topic, subject cannot be empty
if ($mode == 'post' && !$subject)
if ($mode == 'post' && !$subject)
{
{
$errors[] = $user->lang['EMPTY_SUBJECT'];
$errors[] = $user->lang['EMPTY_SUBJECT'];
}
}
//-- mod : quick title edition -------------------------------------------------
//-- mod : quick title edition -------------------------------------------------
//-- add
//-- add
if ( $data['force_attr'] )
if ( $data['force_attr'] )
{
{
if ( !$preview && ($data['attr_id'] == -1) && ($mode == 'post') )
if ( !$preview && !$refresh && ($data['attr_id'] == -1) && ($mode == 'post' || ($mode == 'edit' && $data['topic_first_post_id'] == $post_id)) )
{
{
$user->add_lang('mods/attributes');
$user->add_lang('mods/attributes');
$errors[] = $user->lang['QTE_ATTRIBUTE_UNSELECTED'];
$error[] = $user->lang['QTE_ATTRIBUTE_UNSELECTED'];
// init the value
// init the value
$data['attr_id'] = 0;
$data['attr_id'] = 0;
}
}
}
}
//-- fin mod : quick title edition ---------------------------------------------
//-- fin mod : quick title edition ---------------------------------------------
// if poster is anonymous, check username
// if poster is anonymous, check username
if (!$user->data['is_registered'])
if (!$user->data['is_registered'])
{
{
$user->add_lang('ucp');
$user->add_lang('ucp');
if (($result = validate_username($username)) !== false)
if (($result = validate_username($username)) !== false)
{
{
$error[] = $user->lang[$result . '_USERNAME'];
$error[] = $user->lang[$result . '_USERNAME'];
}
}
if (($result = validate_string($username, false, $config['min_name_chars'], $config['max_name_chars'])) !== false)
if (($result = validate_string($username, false, $config['min_name_chars'], $config['max_name_chars'])) !== false)
{
{
$min_max_amount = ($result == 'TOO_SHORT') ? $config['min_name_chars'] : $config['max_name_chars'];
$min_max_amount = ($result == 'TOO_SHORT') ? $config['min_name_chars'] : $config['max_name_chars'];
$error[] = sprintf($user->lang['FIELD_' . $result], $user->lang['USERNAME'], $min_max_amount);
$error[] = sprintf($user->lang['FIELD_' . $result], $user->lang['USERNAME'], $min_max_amount);
}
}
}
}
// if there is a captcha, check it
// if there is a captcha, check it
if (isset($captcha))
if (isset($captcha))
{
{
$captcha_data = array(
$captcha_data = array(
'message' => '',
'message' => '',
'subject' => $subject,
'subject' => $subject,
'username' => $username,
'username' => $username,
);
);
$vc_response = $captcha->validate($captcha_data);
$vc_response = $captcha->validate($captcha_data);
if ($vc_response)
if ($vc_response)
{
{
$errors[] = $vc_response;
$errors[] = $vc_response;
}
}
}
}
// check each fields
// check each fields
foreach ($fields as $field)
foreach ($fields as $field)
{
{
// get field submitted value
// get field submitted value
$field->set_input(utf8_normalize_nfc(request_var($field->get_html_name(), $field->get_default(), true)));
$field->set_input(utf8_normalize_nfc(request_var($field->get_html_name(), $field->get_default(), true)));
// check if a value is required
// check if a value is required
if ($field->get('field_required') && !$field->get_input())
if ($field->get('field_required') && !$field->get_input())
{
{
$errors[] = sprintf($user->lang['ERROR_REQUIRED'], $field->get('field_name'));
$errors[] = sprintf($user->lang['ERROR_REQUIRED'], $field->get('field_name'));
}
}
}
}
// if no errors, create and save the post
// if no errors, create and save the post
if (!sizeof($errors))
if (!sizeof($errors))
{
{
// create a new object template
// create a new object template
$class_tpl = $form->get('form_template');
$class_tpl = $form->get('form_template');
$form_tpl = new $class_tpl();
$form_tpl = new $class_tpl();
// generate the post based on fields data
// generate the post based on fields data
$message = $form_tpl->generate_message($fields);
$message = $form_tpl->generate_message($fields);
// parse the message for DB storage
// parse the message for DB storage
generate_text_for_storage($message, $bbcode_uid, $bbcode_bitfield, $message_flag, true, true, true);
generate_text_for_storage($message, $bbcode_uid, $bbcode_bitfield, $message_flag, true, true, true);
// preview ?
// preview ?
if ($preview)
if ($preview)
{
{
$template->assign_vars(array(
$template->assign_vars(array(
'PREVIEW_MESSAGE' => generate_text_for_display($message, $bbcode_uid, $bbcode_bitfield, $message_flag),
'PREVIEW_MESSAGE' => generate_text_for_display($message, $bbcode_uid, $bbcode_bitfield, $message_flag),
'PREVIEW_SUBJECT' => $subject,
'PREVIEW_SUBJECT' => $subject,
));
));
//-- mod : quick title edition -------------------------------------------------
//-- mod : quick title edition -------------------------------------------------
//-- add
//-- add
if ( !empty($data['attr_id']) )
if ( !empty($data['attr_id']) && ($data['attr_id'] != -1) )
{
{
$qte->get_users_by_user_id($user->data['user_id']);
$template->assign_vars(array(
$template->assign_vars(array(
'S_TOPIC_ATTR' => true,
'S_TOPIC_ATTR' => true,
'TOPIC_ATTRIBUTE' => $qte->attr_display($data['attr_id'], $user->data['user_id'], time()),
'TOPIC_ATTRIBUTE' => $qte->attr_display($data['attr_id'], $user->data['user_id'], $current_time),
));
));
}
}
//-- fin mod : quick title edition ---------------------------------------------
//-- fin mod : quick title edition ---------------------------------------------
}
}
// submit ? save the post
// submit ? save the post
else
else
{
{
$form_data = array(
$form_data = array(
'forum_id' => $data['forum_id'],
'forum_id' => $data['forum_id'],
'topic_id' => ($mode == 'reply') ? $data['topic_id'] : 0,
'topic_id' => ($mode == 'reply') ? $data['topic_id'] : 0,
'icon_id' => false,
'icon_id' => false,
'enable_bbcode' => true,
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_urls' => true,
'enable_sig' => true,
'enable_sig' => true,
'message' => $message,
'message' => $message,
'message_md5' => md5($message),
'message_md5' => md5($message),
'bbcode_bitfield' => $bbcode_bitfield,
'bbcode_bitfield' => $bbcode_bitfield,
'bbcode_uid' => $bbcode_uid,
'bbcode_uid' => $bbcode_uid,
'post_edit_locked' => 0,
'post_edit_locked' => 0,
'topic_title' => $subject,
'topic_title' => $subject,
'notify_set' => false,
'notify_set' => false,
'notify' => false,
'notify' => false,
'post_time' => 0,
'post_time' => 0,
'forum_name' => $data['forum_name'], // should be defined for email notifications
'forum_name' => $data['forum_name'], // should be defined for email notifications
'enable_indexing' => true,
'enable_indexing' => true,
'screen' => $screen,
'screen' => $screen,
// start mod save full drafts
// start mod save full drafts
'save_as_draft' => false,
'save_as_draft' => false,
'was_draft' => false,
'was_draft' => false,
// end mod save full drafts
// end mod save full drafts
'topic_status' => 0,
'topic_status' => 0,
);
);
//-- mod : quick title edition -------------------------------------------------
//-- mod : quick title edition -------------------------------------------------
//-- add
//-- add
$form_data += array('attr_id' => $data['attr_id']);
$form_data += array('attr_id' => $data['attr_id']);
//-- fin mod : quick title edition ---------------------------------------------
//-- fin mod : quick title edition ---------------------------------------------
$poll_data = array();
$poll_data = array();
$url = submit_post($mode, $subject, $username, POST_NORMAL, $poll_data, $form_data);
$url = submit_post($mode, $subject, $username, POST_NORMAL, $poll_data, $form_data);
if (isset($captcha) && $captcha->is_solved() === true)
if (isset($captcha) && $captcha->is_solved() === true)
{
{
$captcha->reset();
$captcha->reset();
}
}
$message = $user->lang['POST_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $url . '">', '</a>');
$message = $user->lang['POST_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_MESSAGE'], '<a href="' . $url . '">', '</a>');
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $data['forum_id']) . '">', '</a>');
$message .= '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $data['forum_id']) . '">', '</a>');
meta_refresh(5, $url);
meta_refresh(5, $url);
trigger_error($message);
trigger_error($message);
}
}
}
}
}
}
// display each field of the form
// display each field of the form
foreach ($fields as $field)
foreach ($fields as $field)
{
{
$template->assign_block_vars('fields', array(
$template->assign_block_vars('fields', array(
'NAME' => $field->get_html_label(),
'NAME' => $field->get_html_label(),
'DESC' => generate_text_for_display($field->get('field_desc'), $field->get('field_bbcode_uid'), $field->get('field_bbcode_bitfield'), $message_flag),
'DESC' => generate_text_for_display($field->get('field_desc'), $field->get('field_bbcode_uid'), $field->get('field_bbcode_bitfield'), $message_flag),
'HTML' => $field->get_html_code(),
'HTML' => $field->get_html_code(),
));
));
}
}
// display captcha
// display captcha
if (isset($captcha) && $captcha->is_solved() === false)
if (isset($captcha) && $captcha->is_solved() === false)
{
{
$template->assign_vars(array(
$template->assign_vars(array(
'S_CONFIRM_CODE' => true,
'S_CONFIRM_CODE' => true,
'CAPTCHA_TEMPLATE' => $captcha->get_template(),
'CAPTCHA_TEMPLATE' => $captcha->get_template(),
));
));
}
}
// display captcha hidden fields
// display captcha hidden fields
if (isset($captcha) && $captcha->is_solved() !== false)
if (isset($captcha) && $captcha->is_solved() !== false)
{
{
$template->assign_var('S_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
$template->assign_var('S_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// display topic review in replies
// display topic review in replies
if ($mode == 'reply' && topic_review($data['topic_id'], $data['forum_id']))
if ($mode == 'reply' && topic_review($data['topic_id'], $data['forum_id']))
{
{
$template->assign_vars(array(
$template->assign_vars(array(
'S_DISPLAY_REVIEW' => true,
'S_DISPLAY_REVIEW' => true,
'TOPIC_TITLE' => $data['topic_title'],
'TOPIC_TITLE' => $data['topic_title'],
));
));
}
}
// display navigation links and forum rules
// display navigation links and forum rules
generate_forum_nav($data);
generate_forum_nav($data);
generate_forum_rules($data);
generate_forum_rules($data);
// template vars
// template vars
$template->assign_vars(array(
$template->assign_vars(array(
'ERRORS' => ($errors) ? implode('<br />', $errors) : '',
'ERRORS' => ($errors) ? implode('<br />', $errors) : '',
'FORM_NAME' => $form->get('form_name'),
'FORM_NAME' => $form->get('form_name'),
'FORM_DESC' => generate_text_for_display($form->get('form_desc'), $form->get('form_bbcode_uid'), $form->get('form_bbcode_bitfield'), $message_flag),
'FORM_DESC' => generate_text_for_display($form->get('form_desc'), $form->get('form_bbcode_uid'), $form->get('form_bbcode_bitfield'), $message_flag),
'SUBJECT' => $subject,
'SUBJECT' => $subject,
'USERNAME' => $username,
'USERNAME' => $username,
'S_POST_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=$mode&f=" . $data['forum_id']) . (($mode == 'reply') ? '&t=' . $data['topic_id'] : ''),
'S_POST_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=$mode&f=" . $data['forum_id']) . (($mode == 'reply') ? '&t=' . $data['topic_id'] : ''),
'S_DISPLAY_USERNAME' => (!$user->data['is_registered']) ? true : false,
'S_DISPLAY_USERNAME' => (!$user->data['is_registered']) ? true : false,
));
));
//-- mod : quick title edition -------------------------------------------------
//-- mod : quick title edition -------------------------------------------------
//-- add
//-- add
if ( $mode == 'post' )
if ( $mode == 'post' || ($mode == 'edit' && $post_id == $data['topic_first_post_id']) )
{
{
$topic_attribute = 0;
$topic_attribute = 0;
if ( !empty($data['topic_attr_id']) )
if ( !$preview )
{
{
$topic_attribute = $data['topic_attr_id'];
if ( !empty($data['topic_attr_id']) )
{
$topic_attribute = $data['topic_attr_id'];
}
else if ( $data['attr_id'] )
{
$topic_attribute = $data['attr_id'];
}
}
}
else if ( $data['attr_id'] )
else
{
{
$topic_attribute = $data['attr_id'];
$topic_attribute = $data['attr_id'];
}
}
$qte->attr_select($data['forum_id'], $user->data['user_id'], $topic_attribute, $data['hide_attr']);
$template->assign_vars(array(
$data['hide_attr'] = unserialize(trim($data['hide_attr']));
'S_PRIVMSGS' => false,
if ( $data['hide_attr'] === false )
'S_POSTING' => true,
{
));
$data['hide_attr'] = array();
}
$qte->attr_select($data['forum_id'], $user->data['user_id'], (int) $topic_attribute, $data['hide_attr']);
$template->assign_var('S_POSTING', true);
}
}
//-- fin mod : quick title edition ---------------------------------------------
//-- fin mod : quick title edition ---------------------------------------------
// display page
// display page
page_header($form->get('form_name'));
page_header($form->get('form_name'));
$template->set_filenames(array(
$template->set_filenames(array(
'body' => 'form_body.html',
'body' => 'form_body.html',
));
));
page_footer();
page_footer();
// page is loaded
// page is loaded
}
}
}
}
?>
?>