本文整理汇总了PHP中generate_smilies函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_smilies函数的具体用法?PHP generate_smilies怎么用?PHP generate_smilies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_smilies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewtopic_modify_data
/**
* Show bbcodes and smilies in the quickreply
* Template data for Ajax submit
*
* @param object $event The event object
* @return null
* @access public
*/
public function viewtopic_modify_data($event)
{
$forum_id = $event['forum_id'];
$topic_data = $event['topic_data'];
$post_list = $event['post_list'];
$topic_id = $topic_data['topic_id'];
$s_quick_reply = false;
if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
// Quick reply enabled forum
$s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
}
if (!$this->user->data['is_registered'] && $s_quick_reply) {
add_form_key('posting');
$s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
$s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
$s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
$s_notify = false;
$qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
// Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
!$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
!$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
!$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
$s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
$s_notify ? $qr_hidden_fields['notify'] = 1 : true;
$topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
$this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
if ($this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}
if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) {
$this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Ajaxify viewtopic data
if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) {
$captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
}
}
// Fix issues if the inserted post is not the first.
if ($this->qr_insert && !$this->qr_first) {
$this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change');
}
$page_title = $event['page_title'];
$this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote']));
$this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
// Output the page
page_header($page_title, false, $forum_id);
page_footer(false, false, false);
$json_response = new \phpbb\json_response();
$json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert));
}
if ($s_quick_reply) {
include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
// HTML, BBCode, Smilies, Images and Flash status
$bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
$img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
$quote_status = true;
// Build custom bbcodes array
if ($bbcode_status) {
display_custom_bbcodes();
}
// Generate smiley listing
if ($smilies_status) {
generate_smilies('inline', $forum_id);
}
// Show attachment box for adding attachments if true
$form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data';
$allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype;
$attachment_data = false;
if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) {
$this->user->add_lang('posting');
}
if ($this->config['qr_attach'] && $allowed) {
$this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype));
include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
$message_parser = new \parse_message();
$message_parser->set_plupload($this->plupload);
$message_parser->set_mimetype_guesser($this->mimetype_guesser);
$message_parser->get_submitted_attachment_data($this->user->data['user_id']);
//.........这里部分代码省略.........
示例2: display_edit_form
/**
* Display the edit form
*
* @param bool $preview
*/
protected function display_edit_form($preview = false)
{
generate_smilies('inline', 0);
display_custom_bbcodes();
add_form_key('article');
$this->template->assign_vars(array('S_PREVIEW' => $preview, 'TITLE' => $this->data['article_title'], 'MESSAGE' => $preview ? $this->data['article_text'] : $this->message_parser->message, 'PREVIEW_MESSAGE' => $this->message_parser->message, 'SOURCES' => $this->data['article_sources'], 'S_BBCODE_ALLOWED' => $this->option['bbcode'], 'S_LINKS_ALLOWED' => $this->option['url'], 'S_BBCODE_IMG' => $this->option['img'], 'S_BBCODE_FLASH' => $this->option['flash'], 'S_BBCODE_QUOTE' => $this->option['quote'], 'BBCODE_STATUS' => $this->option['bbcode'] ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->option['img'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $this->option['flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $this->option['smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->option['bbcode'] && $this->option['url'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'EDIT_REASON' => $this->data['article_edit_reason'], 'TOPIC_ID' => (int) $this->data['article_topic_id'], 'S_AUTH_ACTIVATE' => $this->auth->acl_get('u_wiki_set_active'), 'S_AUTH_EDIT_TOPIC' => $this->auth->acl_get('u_wiki_edit_topic'), 'S_AUTH_REDIRECT' => $this->auth->acl_get('u_wiki_set_redirect'), 'S_AUTH_STICKY' => $this->auth->acl_get('u_wiki_set_sticky'), 'S_ACTIVE' => $preview ? $this->data['article_approved'] : 1, 'S_STICKY' => $this->data['article_sticky'], 'ARTICLE_REDIRECT' => $this->data['article_redirect'], 'ARTICLE_DESCRIPTION' => $this->data['article_description']));
}
示例3: post
/**
* Controller for /post
*
* @throws http_exception
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
*/
public function post()
{
if (!$this->is_available()) {
throw new http_exception(404, 'IDEAS_NOT_AVAILABLE');
}
if ($this->user->data['user_id'] == ANONYMOUS) {
throw new http_exception(404, 'LOGGED_OUT');
}
$this->language->add_lang('posting');
if (!function_exists('submit_post')) {
include $this->root_path . 'includes/functions_posting.' . $this->php_ext;
}
if (!function_exists('display_custom_bbcodes')) {
include $this->root_path . 'includes/functions_display.' . $this->php_ext;
}
$mode = $this->request->variable('mode', '');
$title = $this->request->variable('title', '', true);
$message = $this->request->variable('message', '', true);
if ($mode === 'submit') {
$submit = $this->ideas->submit($title, $message, $this->user->data['user_id']);
if (is_array($submit)) {
$this->template->assign_vars(array('ERROR' => implode('<br />', $submit), 'MESSAGE' => $message));
} else {
return new RedirectResponse($this->helper->route('phpbb_ideas_idea_controller', array('idea_id' => $submit)));
}
}
display_custom_bbcodes();
generate_smilies('inline', 0);
// BBCode, Smilies, Images URL, and Flash statuses
$bbcode_status = (bool) $this->config['allow_bbcode'] && $this->auth->acl_get('f_bbcode', $this->config['ideas_forum_id']);
$smilies_status = (bool) $this->config['allow_smilies'] && $this->auth->acl_get('f_smilies', $this->config['ideas_forum_id']);
$img_status = (bool) $bbcode_status && $this->auth->acl_get('f_img', $this->config['ideas_forum_id']);
$url_status = (bool) $this->config['allow_post_links'];
$flash_status = (bool) $bbcode_status && $this->auth->acl_get('f_flash', $this->config['ideas_forum_id']) && $this->config['allow_post_flash'];
$this->template->assign_vars(array('TITLE' => $title, 'S_POST_ACTION' => $this->helper->route('phpbb_ideas_post_controller', array('mode' => 'submit')), 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => true, 'BBCODE_STATUS' => $this->language->lang($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF', '<a href="' . $this->helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), 'FLASH_STATUS' => $flash_status ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), 'URL_STATUS' => $bbcode_status && $url_status ? $this->language->lang('URL_IS_ON') : $this->language->lang('URL_IS_OFF'), 'SMILIES_STATUS' => $smilies_status ? $this->language->lang('SMILIES_ARE_ON') : $this->language->lang('SMILIES_ARE_OFF')));
// Assign breadcrumb template vars
$this->template->assign_block_vars_array('navlinks', array(array('U_VIEW_FORUM' => $this->helper->route('phpbb_ideas_index_controller'), 'FORUM_NAME' => $this->language->lang('IDEAS')), array('U_VIEW_FORUM' => $this->helper->route('phpbb_ideas_post_controller'), 'FORUM_NAME' => $this->language->lang('NEW_IDEA'))));
return $this->helper->render('idea_new.html', $this->language->lang('NEW_IDEA'));
}
示例4: render_data_for_page
//.........这里部分代码省略.........
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['MCHAT_TITLE'], 'U_VIEW_FORUM' => $this->helper->route('dmzx_mchat_controller')));
}
// Run code...
if ($mchat_view) {
$message_number = $mchat_custom_page ? $this->config_mchat['message_limit'] : $this->config_mchat['message_num'];
$sql_where = $this->user->data['user_mchat_topics'] ? '' : 'WHERE m.forum_id = 0';
// Message row
$sql = 'SELECT m.*, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, u.user_allow_pm
FROM ' . $this->mchat_table . ' m
LEFT JOIN ' . USERS_TABLE . ' u ON m.user_id = u.user_id
' . $sql_where . '
ORDER BY message_id DESC';
$result = $this->db->sql_query_limit($sql, $message_number);
$rows = $this->db->sql_fetchrowset($result);
$this->db->sql_freeresult($result);
if ($this->config['mchat_message_top']) {
$rows = array_reverse($rows, true);
}
foreach ($rows as $row) {
// auth check
if ($row['forum_id'] != 0 && !$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
// edit, delete and permission auths
$mchat_ban = $this->auth->acl_get('a_authusers') && $this->user->data['user_id'] != $row['user_id'] ? true : false;
// edit auths
if ($this->user->data['user_id'] == ANONYMOUS && $this->user->data['user_id'] == $row['user_id']) {
$chat_auths = $this->user->data['session_ip'] == $row['user_ip'] ? true : false;
} else {
$chat_auths = $this->user->data['user_id'] == $row['user_id'] ? true : false;
}
$mchat_edit = $this->auth->acl_get('u_mchat_edit') && ($this->auth->acl_get('m_') || $chat_auths) ? true : false;
$mchat_del = $this->auth->acl_get('u_mchat_delete') && ($this->auth->acl_get('m_') || $chat_auths) ? true : false;
$mchat_avatar = $row['user_avatar'] ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'] > $row['user_avatar_height'] ? 40 : 40 / $row['user_avatar_height'] * $row['user_avatar_width'], $row['user_avatar_height'] > $row['user_avatar_width'] ? 40 : 40 / $row['user_avatar_width'] * $row['user_avatar_height']) : '';
$message_edit = $row['message'];
decode_message($message_edit, $row['bbcode_uid']);
$message_edit = str_replace('"', '"', $message_edit);
// Edit Fix ;)
$message_edit = mb_ereg_replace("'", "’", $message_edit);
if (sizeof($foes_array)) {
if (in_array($row['user_id'], $foes_array)) {
$row['message'] = sprintf($this->user->lang['MCHAT_FOE'], get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']));
}
}
$row['username'] = mb_ereg_replace("'", "’", $row['username']);
$message = str_replace('\'', '’', $row['message']);
$this->template->assign_block_vars('mchatrow', array('MCHAT_ALLOW_BAN' => $mchat_ban, 'MCHAT_ALLOW_EDIT' => $mchat_edit, 'MCHAT_ALLOW_DEL' => $mchat_del, 'MCHAT_USER_AVATAR' => $mchat_avatar, 'U_VIEWPROFILE' => $row['user_id'] != ANONYMOUS ? append_sid("{$this->phpbb_root_path}memberlist.{$this->phpEx}", 'mode=viewprofile&u=' . $row['user_id']) : '', 'U_USER_IDS' => $row['user_id'] != ANONYMOUS && $this->user->data['user_id'] != $row['user_id'] ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'BOT_USER_ID' => $row['user_id'] != '1', 'U_USER_ID' => $row['user_id'] != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && $this->user->data['user_id'] != $row['user_id'] && $row['user_id'] != '1' && ($row['user_allow_pm'] || $this->auth->acl_gets('a_', 'm_') || $this->auth->acl_getf_global('m_')) ? append_sid("{$this->phpbb_root_path}ucp.{$this->phpEx}", 'i=pm&mode=compose&u=' . $row['user_id']) : '', 'MCHAT_MESSAGE_EDIT' => $message_edit, 'MCHAT_MESSAGE_ID' => $row['message_id'], 'MCHAT_USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), 'MCHAT_USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), 'MCHAT_USERNAME_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST']), 'MCHAT_USER_IP' => $row['user_ip'], 'MCHAT_U_WHOIS' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'whois', 'ip' => $row['user_ip'])), 'MCHAT_U_BAN' => append_sid("{$this->phpbb_root_path}adm/index.{$this->phpEx}", 'i=permissions&mode=setting_user_global&user_id[0]=' . $row['user_id'], true, $this->user->session_id), 'MCHAT_MESSAGE' => generate_text_for_display($message, $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']), 'MCHAT_TIME' => $this->user->format_date($row['message_time'], $this->config_mchat['date']), 'MCHAT_CLASS' => $row['message_id'] % 2 ? 1 : 2));
}
// Write no message
if (empty($rows)) {
$mchat_no_message = true;
}
// display custom bbcodes
if ($mchat_allow_bbcode && $this->config['allow_bbcode']) {
$this->functions_mchat->display_mchat_bbcodes();
}
// Smile row
if ($mchat_smilies) {
if (!function_exists('generate_smilies')) {
include $this->phpbb_root_path . 'includes/functions_posting.' . $this->phpEx;
}
generate_smilies('inline', 0);
}
// If the static message is defined in the language file use it, else just use the entry in the database
if (isset($this->user->lang[strtoupper('static_message')]) || !empty($this->config_mchat['static_message'])) {
$this->config_mchat['static_message'] = $this->config_mchat['static_message'];
if (isset($this->user->lang[strtoupper('static_message')])) {
$this->config_mchat['static_message'] = $this->user->lang[strtoupper('static_message')];
}
}
// If the static message is defined in the language file use it, else just use the entry in the database
if (isset($this->user->lang[strtoupper('mchat_rules')]) || !empty($this->config_mchat['rules'])) {
if (isset($this->user->lang[strtoupper('mchat_rules')])) {
$this->config_mchat['rules'] = $this->user->lang[strtoupper('mchat_rules')];
}
}
// a list of users using the chat
if ($mchat_custom_page) {
$mchat_users = $this->functions_mchat->mchat_users($mchat_session_time, true);
} else {
$mchat_users = $this->functions_mchat->mchat_users($mchat_session_time);
}
$this->template->assign_vars(array('MCHAT_USERS_COUNT' => $mchat_users['mchat_users_count'], 'MCHAT_USERS_LIST' => $mchat_users['online_userlist']));
}
break;
}
// show index stats
if (!empty($this->config['mchat_stats_index']) && !empty($this->user->data['user_mchat_stats_index'])) {
// stats display
$mchat_session_time = !empty($this->config_mchat['timeout']) ? $this->config_mchat['timeout'] : $this->config['session_length'];
$mchat_stats = $this->functions_mchat->mchat_users($mchat_session_time);
$this->template->assign_vars(array('MCHAT_INDEX_STATS' => true, 'MCHAT_INDEX_USERS_COUNT' => $mchat_stats['mchat_users_count'], 'MCHAT_INDEX_USERS_LIST' => !empty($mchat_stats['online_userlist']) ? $mchat_stats['online_userlist'] : '', 'L_MCHAT_ONLINE_EXPLAIN' => $mchat_stats['refresh_message']));
}
$copyright = base64_decode('PGEgaHJlZj0iaHR0cDovL3JtY2dpcnI4My5vcmciPlJNY0dpcnI4MzwvYT4gJmNvcHk7IDxhIGhyZWY9Imh0dHA6Ly93d3cuZG16eC13ZWIubmV0IiB0aXRsZT0id3d3LmRtengtd2ViLm5ldCI+ZG16eDwvYT4=');
add_form_key('mchat_posting');
// Template function...
$this->template->assign_vars(array('MCHAT_FILE_NAME' => $this->helper->route('dmzx_mchat_controller'), 'MCHAT_REFRESH_JS' => 1000 * $this->config_mchat['refresh'], 'MCHAT_ADD_MESSAGE' => $mchat_add_mess, 'MCHAT_READ_MODE' => $mchat_read_mode, 'MCHAT_ARCHIVE_MODE' => $mchat_archive_mode, 'MCHAT_INPUT_TYPE' => $this->user->data['user_mchat_input_area'], 'MCHAT_RULES' => $mchat_rules, 'MCHAT_ALLOW_SMILES' => $mchat_smilies, 'MCHAT_ALLOW_IP' => $mchat_ip, 'MCHAT_ALLOW_PM' => $mchat_pm, 'MCHAT_ALLOW_LIKE' => $mchat_like, 'MCHAT_ALLOW_QUOTE' => $mchat_quote, 'MCHAT_NOMESSAGE_MODE' => $mchat_no_message, 'MCHAT_ALLOW_BBCODES' => $mchat_allow_bbcode && $this->config['allow_bbcode'] ? true : false, 'MCHAT_MESSAGE_TOP' => $this->config['mchat_message_top'] ? true : false, 'MCHAT_ENABLE' => $this->config['mchat_enable'], 'MCHAT_ARCHIVE_URL' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'archive')), 'MCHAT_CUSTOM_PAGE' => $mchat_custom_page, 'MCHAT_INDEX_HEIGHT' => $this->config_mchat['index_height'], 'MCHAT_CUSTOM_HEIGHT' => $this->config_mchat['custom_height'], 'MCHAT_READ_ARCHIVE_BUTTON' => $mchat_read_archive, 'MCHAT_FOUNDER' => $mchat_founder, 'MCHAT_CLEAN_URL' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'clean', 'redirect' => $on_page)), 'MCHAT_STATIC_MESS' => !empty($this->config_mchat['static_message']) ? htmlspecialchars_decode($this->config_mchat['static_message']) : '', 'L_MCHAT_COPYRIGHT' => $copyright, 'MCHAT_WHOIS' => $this->config_mchat['whois'], 'MCHAT_MESSAGE_LNGTH' => $this->config_mchat['max_message_lngth'], 'L_MCHAT_MESSAGE_LNGTH_EXPLAIN' => intval($this->config_mchat['max_message_lngth']) ? sprintf($this->user->lang['MCHAT_MESSAGE_LNGTH_EXPLAIN'], intval($this->config_mchat['max_message_lngth'])) : '', 'MCHAT_MESS_LONG' => sprintf($this->user->lang['MCHAT_MESS_LONG'], $this->config_mchat['max_message_lngth']), 'MCHAT_USER_TIMEOUT' => $this->config_mchat['timeout'] ? 1000 * $this->config_mchat['timeout'] : false, 'MCHAT_WHOIS_REFRESH' => 1000 * $this->config_mchat['whois_refresh'], 'MCHAT_PAUSE_ON_INPUT' => $this->config_mchat['pause_on_input'] ? true : false, 'L_MCHAT_ONLINE_EXPLAIN' => $this->functions_mchat->mchat_session_time($mchat_session_time), 'MCHAT_REFRESH_YES' => sprintf($this->user->lang['MCHAT_REFRESH_YES'], $this->config_mchat['refresh']), 'L_MCHAT_WHOIS_REFRESH_EXPLAIN' => sprintf($this->user->lang['WHO_IS_REFRESH_EXPLAIN'], $this->config_mchat['whois_refresh']), 'S_MCHAT_AVATARS' => $mchat_avatars, 'S_MCHAT_LOCATION' => $this->config_mchat['location'], 'S_MCHAT_SOUND_YES' => $this->user->data['user_mchat_sound'], 'S_MCHAT_INDEX_STATS' => $this->user->data['user_mchat_stats_index'], 'U_MORE_SMILIES' => append_sid("{$this->phpbb_root_path}posting.{$this->phpEx}", 'mode=smilies'), 'U_MCHAT_RULES' => $this->helper->route('dmzx_mchat_controller', array('mode' => 'rules')), 'S_MCHAT_ON_INDEX' => $this->config['mchat_on_index'] && !empty($this->user->data['user_mchat_index']) ? true : false));
// Return for: \$this->helper->render(filename, lang_title);
return array('filename' => 'mchat_body.html', 'lang_title' => $this->user->lang['MCHAT_TITLE']);
}
示例5: get_cms_access_auth
$access_allowed = get_cms_access_auth('cms', $cms_admin->mode, $cms_admin->action, $cms_admin->l_id, $cms_admin->b_id);
if (!$access_allowed) {
message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
}
include IP_ROOT_PATH . 'includes/class_db.' . PHP_EXT;
$class_db = new class_db();
include IP_ROOT_PATH . 'includes/class_form.' . PHP_EXT;
$class_form = new class_form();
include_once IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
$page_title = $lang['CMS_TITLE'];
$cms_type = 'cms_standard';
$preview_block = isset($_POST['preview']) ? true : false;
if ($cms_admin->mode == 'smilies') {
generate_smilies('window');
exit;
}
if (isset($_POST['block_reset'])) {
if ($cms_admin->ls_id == false) {
redirect(append_sid($cms_admin->root . '?mode=blocks&l_id=' . $cms_admin->l_id, true));
} else {
redirect(append_sid($cms_admin->root . '?mode=blocks&ls_id=' . $cms_admin->ls_id, true));
}
}
if (isset($_POST['cancel'])) {
redirect(append_sid($cms_admin->root, true));
}
$template->assign_vars(array('S_CMS_AUTH' => true, 'S_EDIT_SETTINGS' => true, 'S_L_ADD' => true, 'S_L_EDIT' => true, 'S_L_DELETE' => true, 'S_B_ADD' => true, 'S_B_EDIT' => true, 'S_B_DELETE' => true));
$cms_admin->s_hidden_fields = '';
$cms_admin->s_append_url = '';
示例6: fix_displayimage
//.........这里部分代码省略.........
if (strpos($match, $v) !== FALSE) {
$matches[3][$key] = " style=\"border:1pix;border-color:grey;\"";
break;
}
}
$film_strip = ereg_replace(preg_quote($match), $matches[1][$key] . $matches[2][$key] . $matches[3][$key] . $matches[4][$key] . $matches[5][$key], $film_strip);
}
$film_strip = ereg_replace("class=\"image\"", "", $film_strip);
}
//removes alt and title from film_strip
$pattern = "#(alt=\")(.*?)(\")#s";
if (preg_match_all($pattern, $film_strip, $matches)) {
foreach ($matches[0] as $key => $match) {
$film_strip = ereg_replace(preg_quote($match), "", $film_strip);
}
}
$pattern = "#(title=\")(.*?)(\")#s";
if (preg_match_all($pattern, $film_strip, $matches)) {
foreach ($matches[0] as $key => $match) {
$film_strip = ereg_replace(preg_quote($match), "", $film_strip);
}
}
//and try to set a border on current vote
$result = cpg_db_query("SELECT rating FROM `{$CONFIG['TABLE_PREFIX']}user_votes` WHERE pid = {$CURRENT_PIC_DATA['pid']} AND user_id = " . USER_ID);
if ($row = mysql_fetch_row($result)) {
$pattern = "#(<img.*?rating{$row[0]}.*?)(border=\"0\")(.*?/>)#s";
if (preg_match($pattern, $votes, $matches)) {
$votes = ereg_replace(preg_quote($matches[0]), $matches[1] . "border=\"2\"" . $matches[3], $votes);
}
}
// find if user can vote (not own image) and if can vote verifies that the voting block is not hidden
if ($CURRENT_PIC_DATA['owner_id'] == USER_ID || !USER_CAN_RATE_PICTURES) {
//<a href="javascript:location.href='./ratepic.php?pic=22&rate=1'" title="Beurk"><img src="themes/alphadxd/images/rating1.gif" border="0" alt="Beurk" /></a>
$pattern = "#(<a href.*?ratepic.*?\\>)(.*?)(</a>)#s";
if (preg_match_all($pattern, $votes, $matches)) {
foreach ($matches[0] as $key => $match) {
$votes = ereg_replace(preg_quote($match), $matches[2][$key], $votes);
}
}
} else {
$votes = ereg_replace(preg_quote("display: none;"), "", $votes);
}
// only display current user's comments in a contest
if ($CURRENT_ALBUM_DATA['comments'] != 'YES') {
return;
}
$comments = '';
$pid = $CURRENT_PIC_DATA['pid'];
if (!$CONFIG['enable_smilies']) {
$tmpl_comment_edit_box = template_extract_block($saved_template_image_comments, 'edit_box_no_smilies', '{EDIT}');
template_extract_block($saved_template_image_comments, 'edit_box_smilies');
template_extract_block($saved_template_add_your_comment, 'input_box_smilies');
} else {
$tmpl_comment_edit_box = template_extract_block($saved_template_image_comments, 'edit_box_smilies', '{EDIT}');
template_extract_block($saved_template_image_comments, 'edit_box_no_smilies');
template_extract_block($saved_template_add_your_comment, 'input_box_no_smilies');
}
$tmpl_comments_buttons = template_extract_block($saved_template_image_comments, 'buttons', '{BUTTONS}');
template_extract_block($saved_template_image_comments, 'ipinfo', '');
//suppressed by PL
template_extract_block($saved_template_image_comments, 'report_comment_button');
// won't report on own comment, would we?
$newpostok = true;
$query = "SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' AND msg_author='" . USER_NAME . "' ORDER BY msg_id DESC LIMIT 1";
$result = cpg_db_query($query);
if ($row = mysql_fetch_array($result)) {
$user_can_edit = true;
$comment_buttons = $tmpl_comments_buttons;
$comment_edit_box = $tmpl_comment_edit_box;
if ($CONFIG['enable_smilies']) {
$comment_body = process_smilies(make_clickable($row['msg_body']));
$smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
} else {
$comment_body = make_clickable($row['msg_body']);
$smilies = '';
}
$params = array('{EDIT}' => &$tmpl_comment_edit_box, '{BUTTONS}' => &$tmpl_comments_buttons);
$template = template_eval($saved_template_image_comments, $params);
$params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']), '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], '%d %B %Y'), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => $smilies, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
$comments .= template_eval($template, $params);
$newpostok = false;
// only 1 comment per author
}
if (USER_ID == $CURRENT_PIC_DATA['owner_id'] || USER_ID == 0) {
$newpostok = false;
}
if ($newpostok) {
$user_name_input = '<tr><td><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
template_extract_block($saved_template_add_your_comment, 'user_name_input', $user_name_input);
$user_name = '';
$params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'], '{NAME}' => $lang_display_comments['name'], '{COMMENT}' => "", '{PIC_ID}' => $pid, '{USER_NAME}' => $user_name, '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'], '{OK}' => $lang_display_comments['OK'], '{SMILIES}' => '', '{WIDTH}' => $CONFIG['picture_table_width']);
if ($CONFIG['enable_smilies']) {
$params['{SMILIES}'] = generate_smilies();
} else {
template_extract_block($saved_template_add_your_comment, 'smilies');
}
$comments .= template_eval($saved_template_add_your_comment, $params);
}
}
}
示例7: rate
public function rate($image_id)
{
$this->user->add_lang_ext('phpbbgallery/core', array('gallery'));
add_form_key('gallery');
$submit = $this->request->variable('submit', false);
$error = $message = '';
// load Image Data
$image_data = $this->image->get_image_data($image_id);
$album_id = (int) $image_data['image_album_id'];
$album_data = $this->loader->get($album_id);
$this->display->generate_navigation($album_data);
$page_title = $image_data['image_name'];
$image_backlink = $this->helper->route('phpbbgallery_image', array('image_id' => $image_id));
$album_backlink = $this->helper->route('phpbbgallery_album', array('album_id' => $album_id));
$image_loginlink = $this->url->append_sid('relative', 'image_page', "album_id={$album_id}&image_id={$image_id}");
$this->gallery_auth->load_user_premissions($this->user->data['user_id']);
$rating = new \phpbbgallery\core\rating($image_id, $image_data, $album_data);
if (!($this->gallery_config->get('allow_rates') && $rating->is_able())) {
// The user is unable to rate.
$this->misc->not_authorised($image_backlink, $image_loginlink);
}
$this->user->add_lang('posting');
include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
$bbcode_status = $this->config['allow_bbcode'] ? true : false;
$smilies_status = $this->config['allow_smilies'] ? true : false;
$img_status = $bbcode_status ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = false;
$quote_status = true;
include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
// Build custom bbcodes array
display_custom_bbcodes();
// Build smilies array
generate_smilies('inline', 0);
/**
* Rating-System: now you can comment and rate in one form
*/
$s_user_rated = false;
if ($this->gallery_config->get('allow_rates')) {
$user_rating = $rating->get_user_rating($this->user->data['user_id']);
// Check: User didn't rate yet, has permissions, it's not the users own image and the user is logged in
if (!$user_rating && $rating->is_allowed()) {
$rating->display_box();
// User just rated the image, so we store it
$rate_point = $this->request->variable('rating', 0);
if ($rating->rating_enabled && $rate_point > 0) {
$rating->submit_rating();
$s_user_rated = true;
$message .= $this->user->lang['RATING_SUCCESSFUL'] . '<br />';
}
$this->template->assign_vars(array('S_ALLOWED_TO_RATE' => $rating->is_allowed()));
}
}
$message .= '<br />' . sprintf($this->user->lang['CLICK_RETURN_IMAGE'], '<a href="' . $image_backlink . '">', '</a>');
$message .= '<br />' . sprintf($this->user->lang['CLICK_RETURN_ALBUM'], '<a href="' . $album_backlink . '">', '</a>');
$this->url->meta_refresh(3, $image_backlink);
trigger_error($message);
return $this->helper->render('gallery/comment_body.html', $page_title);
}
示例8: theme_html_comments
function theme_html_comments($pid)
{
global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $comment_date_fmt, $HTML_SUBST;
global $template_image_comments, $template_add_your_comment, $lang_display_comments, $lang_common, $REFERER;
$html = '';
//report to moderator buttons
if (!($CONFIG['report_post'] == 1 && USER_CAN_SEND_ECARDS)) {
template_extract_block($template_image_comments, 'report_comment_button');
}
if (!$CONFIG['enable_smilies']) {
$tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}');
template_extract_block($template_image_comments, 'edit_box_smilies');
template_extract_block($template_add_your_comment, 'input_box_smilies');
} else {
$tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}');
template_extract_block($template_image_comments, 'edit_box_no_smilies');
template_extract_block($template_add_your_comment, 'input_box_no_smilies');
}
$tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');
$tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}');
if ($CONFIG['comments_sort_descending'] == 1) {
$comment_sort_order = 'DESC';
} else {
$comment_sort_order = 'ASC';
}
$result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid, approval FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='{$pid}' ORDER BY msg_id {$comment_sort_order}");
while ($row = mysql_fetch_array($result)) {
// while-loop start
$user_can_edit = GALLERY_ADMIN_MODE || USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS || !USER_ID && USER_CAN_POST_COMMENTS && $USER['ID'] == $row['author_md5_id'];
if ($user_can_edit != '' && $CONFIG['comment_user_edit'] != 0 || GALLERY_ADMIN_MODE) {
$comment_buttons = $tmpl_comments_buttons;
$comment_edit_box = $tmpl_comment_edit_box;
} else {
$comment_buttons = '';
$comment_edit_box = '';
}
$comment_ipinfo = $row['msg_raw_ip'] && GALLERY_ADMIN_MODE ? $tmpl_comments_ipinfo : '';
$hide_comment = 0;
// comment approval
$pending_approval = '';
if (USER_IS_ADMIN) {
//display the selector approve/disapprove
if ($row['approval'] == 'NO') {
$pending_approval = '<a href="reviewcom.php?pos=-{PID}&msg_id={MSG_ID}&what=approve" title="' . $lang_display_comments['approve'] . '"><img src="images/approve.gif" border="0" alt="" align="middle" /></a>';
} else {
$pending_approval = '<a href="reviewcom.php?pos=-{PID}&msg_id={MSG_ID}&what=disapprove" title="' . $lang_display_comments['disapprove'] . '"><img src="images/disapprove.gif" border="0" alt="" align="middle" /></a>';
}
} else {
// user or guest is logged in - start
if ($row['approval'] == 'NO') {
// the comment is not approved - start
if ($user_can_edit) {
// the comment comes from the current visitor, display it with a warning that it needs admin approval
$pending_approval = '<img src="images/approve.gif" border="0" alt="" title="' . $lang_display_comments['pending_approval'] . '" align="middle" />';
} else {
// the comment comes from someone else - don't display it at all
if ($CONFIG['comment_placeholder'] == 0) {
$hide_comment = 1;
} else {
$row['msg_author'] = $lang_display_comments['unapproved_comment'];
$row['msg_body'] = $lang_display_comments['pending_approval_message'];
$row['author_id'] = 0;
}
}
}
// the comment is not approved - end
}
// user or guest is logged in - end
if ($CONFIG['enable_smilies']) {
$comment_body = process_smilies(make_clickable($row['msg_body']));
$smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
} else {
$comment_body = make_clickable($row['msg_body']);
$smilies = '';
}
// wrap the comment into italics if it isn't approved
if ($row['approval'] == 'NO') {
$comment_body = '<em>' . $comment_body . '</em>';
$row['msg_author'] = $row['msg_author'];
}
$ip = $row['msg_hdr_ip'];
if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
$ip .= ' [' . $row['msg_raw_ip'] . ']';
}
$params = array('{EDIT}' => &$comment_edit_box, '{BUTTONS}' => &$comment_buttons, '{IPINFO}' => &$comment_ipinfo, '{PENDING_APPROVAL}' => &$pending_approval);
$template = template_eval($template_image_comments, $params);
if ($row['author_id'] == 0) {
$profile_lnk = stripslashes($row['msg_author']);
} else {
$profile_lnk = '<a href="profile.php?uid=' . $row['author_id'] . '">' . stripslashes($row['msg_author']) . '</a>';
}
$params = array('{MSG_AUTHOR_LNK}' => $profile_lnk, '{MSG_AUTHOR}' => $row['msg_author'], '{MSG_ID}' => $row['msg_id'], '{PID}' => $row['pid'], '{EDIT_TITLE}' => &$lang_display_comments['edit_title'], '{DELETE_TITLE}' => &$lang_display_comments['delete_title'], '{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'], '{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt), '{MSG_BODY}' => bb_decode($comment_body), '{MSG_BODY_RAW}' => $row['msg_body'], '{OK}' => &$lang_display_comments['OK'], '{SMILIES}' => $smilies, '{IP}' => $ip, '{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'], '{WIDTH}' => $CONFIG['picture_table_width']);
if ($hide_comment != 1) {
$html .= template_eval($template, $params);
}
}
// while-loop end
if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
if (USER_ID) {
$user_name_input = '<tr><td><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
//.........这里部分代码省略.........
示例9: main
//.........这里部分代码省略.........
}
$bbcode_uid = $bbcode_bitfield = $bbcode_flags = '';
$warn_msg = generate_text_for_storage($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags, $enable_bbcode, $enable_urls, $enable_smilies);
if (sizeof($warn_msg)) {
$error += $warn_msg;
}
if (!$submit) {
// Parse it for displaying
$signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags);
} else {
if (!sizeof($error)) {
$user->optionset('sig_bbcode', $enable_bbcode);
$user->optionset('sig_smilies', $enable_smilies);
$user->optionset('sig_links', $enable_urls);
$sql_ary = array('user_sig' => $signature, 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => $bbcode_uid, 'user_sig_bbcode_bitfield' => $bbcode_bitfield);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
// Replace "error" strings with their real, localised form
$error = array_map(array($user, 'lang'), $error);
$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield);
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $decoded_message['text'], 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? ' checked="checked"' : '', 'BBCODE_STATUS' => $user->lang($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF', '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'URL_STATUS' => $config['allow_sig_links'] ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], 'L_SIGNATURE_EXPLAIN' => $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => $config['allow_sig_img'] ? true : false, 'S_BBCODE_FLASH' => $config['allow_sig_flash'] ? true : false, 'S_LINKS_ALLOWED' => $config['allow_sig_links'] ? true : false));
add_form_key('ucp_sig');
// Build custom bbcodes array
display_custom_bbcodes();
// Generate smiley listing
generate_smilies('inline', 0);
break;
case 'avatar':
add_form_key('ucp_avatar');
$avatars_enabled = false;
if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar')) {
/* @var $phpbb_avatar_manager \phpbb\avatar\manager */
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
// This is normalised data, without the user_ prefix
$avatar_data = \phpbb\avatar\manager::clean_row($user->data, 'user');
if ($submit) {
if (check_form_key('ucp_avatar')) {
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) {
$driver = $phpbb_avatar_manager->get_driver($driver_name);
$result = $driver->process_form($request, $template, $user, $avatar_data, $error);
if ($result && empty($error)) {
// Success! Lets save the result in the database
$result = array('user_avatar_type' => $driver_name, 'user_avatar' => $result['avatar'], 'user_avatar_width' => $result['avatar_width'], 'user_avatar_height' => $result['avatar_height']);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $result) . '
WHERE user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
} else {
$error[] = 'FORM_INVALID';
}
}
示例10: _populate_form
/**
* Populate form when an error occurred
*
* @param int $link_id The link ID
* @param string $mode add|edit
* @return null
*/
private function _populate_form($link_id, $mode)
{
if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm'] && $mode != 'edit') {
$this->s_hidden_fields = array_merge($this->s_hidden_fields, $this->captcha->get_hidden_fields());
$this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $this->captcha->get_template()));
}
if (!function_exists('generate_smilies')) {
include $this->root_path . 'includes/functions_posting.' . $this->php_ext;
}
if (!function_exists('display_custom_bbcodes')) {
include $this->root_path . 'includes/functions_display.' . $this->php_ext;
}
generate_smilies('inline', 0);
display_custom_bbcodes();
add_form_key('dir_form_comment');
$this->template->assign_vars(array('S_AUTH_COMM' => $this->auth->acl_get('u_comment_dir'), 'BBCODE_STATUS' => $this->config['dir_allow_bbcode'] ? $this->user->lang('BBCODE_IS_ON', '<a href="' . append_sid($this->root_path . "faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : $this->user->lang('BBCODE_IS_OFF', '<a href="' . append_sid($this->root_path . "faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->config['dir_allow_bbcode'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'SMILIES_STATUS' => $this->config['dir_allow_smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->config['dir_allow_links'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'FLASH_STATUS' => $this->config['dir_allow_bbcode'] && $this->config['dir_allow_flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'L_DIR_REPLY_EXP' => $this->user->lang('DIR_REPLY_EXP', $this->config['dir_length_comments']), 'S_COMMENT' => isset($this->s_comment) ? $this->s_comment : '', 'S_BBCODE_ALLOWED' => (bool) $this->config['dir_allow_bbcode'], 'S_BBCODE_IMG' => (bool) $this->config['dir_allow_bbcode'], 'S_BBCODE_FLASH' => $this->config['dir_allow_bbcode'] && $this->config['dir_allow_flash'] ? true : false, 'S_BBCODE_QUOTE' => true, 'S_LINKS_ALLOWED' => (bool) $this->config['dir_allow_links'], 'S_SMILIES_ALLOWED' => (bool) $this->config['dir_allow_smilies'], 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields), 'S_BUTTON_NAME' => $mode == 'edit' ? 'update_comment' : 'submit_comment', 'S_POST_ACTION' => $mode == 'edit' ? '' : $this->helper->route('ernadoo_phpbbdirectory_comment_new_controller', array('link_id' => (int) $link_id))));
}
示例11: base
//.........这里部分代码省略.........
$next = $prev = false;
if (count($images_array) > $cur + 1) {
$next = array('image_id' => $images_array[$cur + 1]['image_id'], 'image_name' => $images_array[$cur + 1]['image_name']);
}
if ($cur > 0) {
$prev = array('image_id' => $images_array[$cur - 1]['image_id'], 'image_name' => $images_array[$cur - 1]['image_name']);
}
$this->db->sql_freeresult($result);
$this->template->assign_vars(array('UC_NEXT_IMAGE' => $next ? $this->gallery_config->get('disp_nextprev_thumbnail') ? '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id'])) . '"><img style="max-width: 70px; max-height: 70px;" src="' . $this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $next['image_id'])) . '" alt="' . $next['image_name'] . '"></a>' : '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id'])) . '">' . $next['image_name'] . ' »» </a>' : '', 'UC_PREV_IMAGE' => $prev ? $this->gallery_config->get('disp_nextprev_thumbnail') ? '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $prev['image_id'])) . '"><img style="max-width: 70px; max-height: 70px;" src="' . $this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $prev['image_id'])) . '" alt="' . $prev['image_name'] . '"></a>' : '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $prev['image_id'])) . '">«« ' . $prev['image_name'] . '</a>' : '', 'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_album', array('album_id' => $album_id)), 'UC_IMAGE' => $this->helper->route('phpbbgallery_image_file_medium', array('image_id' => $image_id)), 'U_DELETE' => $s_allowed_delete ? $this->helper->route('phpbbgallery_image_delete', array('image_id' => $image_id)) : '', 'U_EDIT' => $s_allowed_edit ? $this->helper->route('phpbbgallery_image_edit', array('image_id' => $image_id)) : '', 'U_REPORT' => $this->gallery_auth->acl_check('i_report', $album_id, $album_data['album_user_id']) && $this->data['image_user_id'] != $this->user->data['user_id'] ? $this->helper->route('phpbbgallery_image_report', array('image_id' => $image_id)) : '', 'U_STATUS' => $s_allowed_status ? $this->helper->route('phpbbgallery_moderate_image', array('image_id' => $image_id)) : '', 'CONTEST_RANK' => $this->data['image_contest_rank'] ? $this->user->lang('CONTEST_RESULT_' . $this->data['image_contest_rank']) : '', 'IMAGE_NAME' => $this->data['image_name'], 'IMAGE_DESC' => $image_desc, 'IMAGE_BBCODE' => $this->config['allow_bbcode'] ? '[image]' . $image_id . '[/image]' : '', 'IMAGE_IMGURL_BBCODE' => $this->config['phpbb_gallery_disp_image_url'] ? '[url=' . $this->url->get_uri($this->helper->route('phpbbgallery_image', array('image_id' => $image_id))) . '][img]' . $this->url->get_uri($this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $image_id))) . '[/img][/url]' : '', 'IMAGE_URL' => $this->config['phpbb_gallery_disp_image_url'] ? $this->url->get_uri($this->helper->route('phpbbgallery_image', array('image_id' => $image_id))) : '', 'IMAGE_TIME' => $this->user->format_date($this->data['image_time']), 'IMAGE_VIEW' => $this->data['image_view_count'], 'POSTER_IP' => $this->auth->acl_get('a_') ? $this->data['image_user_ip'] : '', 'U_POSTER_WHOIS' => $this->auth->acl_get('a_') ? append_sid('mcp', 'mode=whois&ip=' . $this->data['image_user_ip']) : '', 'S_ALBUM_ACTION' => $this->helper->route('phpbbgallery_image', array('image_id' => $image_id)), 'U_RETURN_LINK' => $this->helper->route('phpbbgallery_album', array('album_id' => $album_id)), 'S_RETURN_LINK' => $this->user->lang('RETURN_TO', $album_data['album_name'])));
switch ($this->gallery_config->get('link_imagepage')) {
case 'image':
$this->template->assign_vars(array('UC_IMAGE_ACTION' => $this->helper->route('phpbbgallery_image_file_source', array('image_id' => $image_id))));
break;
case 'next':
if ($next) {
$this->template->assign_vars(array('UC_IMAGE_ACTION' => $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id']))));
}
break;
}
$image_data = $this->data;
/**
* Event view image
*
* @event phpbbgallery.core.viewimage
* @var int image_id id of the image we are viewing
* @var array image_data All the data related to the image
* @var array album_data All the data related to the album image is part of
* @var string page_title Page title
* @since 1.2.0
*/
$vars = array('image_id', 'image_data', 'album_data', 'page_title');
extract($this->dispatcher->trigger_event('phpbbgallery.core.viewimage', compact($vars)));
$this->data = $image_data;
$user_id = $this->data['image_user_id'];
$sql = $this->db->sql_build_query('SELECT', array('SELECT' => 'u.*, gu.personal_album_id, gu.user_images', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array($this->table_users => 'gu'), 'ON' => 'gu.user_id = u.user_id')), 'WHERE' => 'u.user_id = ' . $this->data['image_user_id']));
$result = $this->db->sql_query($sql);
$user_cache = array();
while ($row = $this->db->sql_fetchrow($result)) {
\phpbbgallery\core\user::add_user_to_cache($user_cache, $row);
}
$this->db->sql_freeresult($result);
$user_cache[$user_id]['username'] = $this->data['image_username'] ? $this->data['image_username'] : $this->user->lang['GUEST'];
$this->template->assign_vars(array('POSTER_FULL' => get_username_string('full', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_COLOUR' => get_username_string('colour', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_USERNAME' => get_username_string('username', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'U_POSTER' => get_username_string('profile', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_SIGNATURE' => $user_cache[$user_id]['sig'], 'POSTER_RANK_TITLE' => $user_cache[$user_id]['rank_title'], 'POSTER_RANK_IMG' => $user_cache[$user_id]['rank_image'], 'POSTER_RANK_IMG_SRC' => $user_cache[$user_id]['rank_image_src'], 'POSTER_JOINED' => $user_cache[$user_id]['joined'], 'POSTER_POSTS' => $user_cache[$user_id]['posts'], 'POSTER_AVATAR' => $user_cache[$user_id]['avatar'], 'POSTER_WARNINGS' => $user_cache[$user_id]['warnings'], 'POSTER_AGE' => $user_cache[$user_id]['age'], 'POSTER_ONLINE_IMG' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? '' : ($user_cache[$user_id]['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), 'S_POSTER_ONLINE' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? false : ($user_cache[$user_id]['online'] ? true : false), 'U_POSTER_PROFILE' => $user_cache[$user_id]['profile'], 'U_POSTER_SEARCH' => $user_cache[$user_id]['search'], 'U_POSTER_PM' => $user_id != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($user_cache[$user_id]['allow_pm'] || $this->auth->acl_gets('a_', 'm_')) ? append_sid('./ucp.php', 'i=pm&mode=compose&u=' . $user_id) : '', 'U_POSTER_EMAIL' => $this->auth->acl_gets('a_') || !$this->config['board_hide_emails'] ? $user_cache[$user_id]['email'] : false, 'U_POSTER_JABBER' => $user_cache[$user_id]['jabber'], 'U_POSTER_GALLERY' => $user_cache[$user_id]['gallery_album'], 'POSTER_GALLERY_IMAGES' => $user_cache[$user_id]['gallery_images'], 'U_POSTER_GALLERY_SEARCH' => $user_cache[$user_id]['gallery_search']));
// Add ratings
if ($this->gallery_config->get('allow_rates')) {
$rating = new \phpbbgallery\core\rating($image_id, $image_data, $album_data);
$user_rating = $rating->get_user_rating($this->user->data['user_id']);
// Check: User didn't rate yet, has permissions, it's not the users own image and the user is logged in
if (!$user_rating && $rating->is_allowed()) {
$rating->display_box();
}
$this->template->assign_vars(array('IMAGE_RATING' => $rating->get_image_rating($user_rating), 'S_ALLOWED_TO_RATE' => !$user_rating && $rating->is_allowed(), 'S_VIEW_RATE' => $this->gallery_auth->acl_check('i_rate', $album_id, $album_data['album_user_id']) ? true : false, 'S_RATE_ACTION' => $this->helper->route('phpbbgallery_image_rate', array('image_id' => $image_id))));
unset($rating);
}
/**
* Posting comment
*/
$comments_disabled = !$this->gallery_config->get('allow_comments') || $this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments'];
if (!$comments_disabled && $this->gallery_auth->acl_check('c_post', $album_id, $album_data['album_user_id']) && $album_data['album_status'] != $this->album->get_status_locked() && ($image_data['image_status'] != $this->image->get_status_locked() || $this->gallery_auth->acl_check('m_status', $album_id, $album_data['album_user_id']))) {
add_form_key('gallery');
$this->user->add_lang('posting');
$this->url->_include('functions_posting', 'phpbb');
$bbcode_status = $this->config['allow_bbcode'] ? true : false;
$smilies_status = $this->config['allow_smilies'] ? true : false;
$img_status = $bbcode_status ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$flash_status = false;
$quote_status = true;
include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
// Build custom bbcodes array
display_custom_bbcodes();
// Build smilies array
generate_smilies('inline', 0);
//$s_hide_comment_input = (time() < ($album_data['contest_start'] + $album_data['contest_end'])) ? true : false;
$s_hide_comment_input = false;
$this->template->assign_vars(array('S_ALLOWED_TO_COMMENT' => true, 'S_HIDE_COMMENT_INPUT' => $s_hide_comment_input, 'BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . $this->url->append_sid('phpbb', 'faq', 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . $this->url->append_sid('phpbb', 'faq', 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_SIGNATURE_CHECKED' => $this->user->optionget('attachsig') ? ' checked="checked"' : '', 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_URL' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'L_COMMENT_LENGTH' => sprintf($this->user->lang['COMMENT_LENGTH'], $this->gallery_config->get('comment_length'))));
if ($this->misc->display_captcha('comment')) {
global $phpbb_container;
$captcha = $phpbb_container->get('captcha.factory')->get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
$this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
}
// Different link, when we rate and dont comment
if (!$s_hide_comment_input) {
//$this->template->assign_var('S_COMMENT_ACTION', append_sid($this->url->path('full') . 'comment/' . $image_id . '/add/0'));
$this->template->assign_var('S_COMMENT_ACTION', $this->helper->route('phpbbgallery_comment_add', array('image_id' => $image_id, 'comment_id' => 0)));
}
} else {
if ($this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments']) {
$this->template->assign_var('S_COMMENTS_DISABLED', true);
}
}
/**
* Listing comment
*/
if ($this->gallery_config->get('allow_comments') && $this->gallery_auth->acl_check('c_read', $album_id, $album_data['album_user_id'])) {
$this->display_comments($image_id, $this->data, $album_id, $album_data, ($page - 1) * $this->gallery_config->get('items_per_page'), $this->gallery_config->get('items_per_page'));
}
return $this->helper->render('gallery/viewimage_body.html', $page_title);
}
示例12: main
//.........这里部分代码省略.........
$cp->generate_profile_fields('profile', $user->get_iso_lang_id());
break;
case 'signature':
if (!$auth->acl_get('u_sig')) {
trigger_error('NO_AUTH_SIGNATURE');
}
include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
$enable_bbcode = $config['allow_sig_bbcode'] ? (bool) $user->optionget('sig_bbcode') : false;
$enable_smilies = $config['allow_sig_smilies'] ? (bool) $user->optionget('sig_smilies') : false;
$enable_urls = $config['allow_sig_links'] ? (bool) $user->optionget('sig_links') : false;
$signature = utf8_normalize_nfc(request_var('signature', (string) $user->data['user_sig'], true));
add_form_key('ucp_sig');
if ($submit || $preview) {
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
$enable_bbcode = $config['allow_sig_bbcode'] ? request_var('disable_bbcode', false) ? false : true : false;
$enable_smilies = $config['allow_sig_smilies'] ? request_var('disable_smilies', false) ? false : true : false;
$enable_urls = $config['allow_sig_links'] ? request_var('disable_magic_url', false) ? false : true : false;
if (!sizeof($error)) {
$message_parser = new parse_message($signature);
// Allowing Quote BBCode
$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig');
if (sizeof($message_parser->warn_msg)) {
$error[] = implode('<br />', $message_parser->warn_msg);
}
if (!check_form_key('ucp_sig')) {
$error[] = 'FORM_INVALID';
}
if (!sizeof($error) && $submit) {
$user->optionset('sig_bbcode', $enable_bbcode);
$user->optionset('sig_smilies', $enable_smilies);
$user->optionset('sig_links', $enable_urls);
$sql_ary = array('user_sig' => (string) $message_parser->message, 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 'user_sig_bbcode_bitfield' => $message_parser->bbcode_bitfield);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
$db->sql_query($sql);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
$signature_preview = '';
if ($preview) {
// Now parse it for displaying
$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
unset($message_parser);
}
decode_message($signature, $user->data['user_sig_bbcode_uid']);
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_BBCODE_CHECKED' => !$enable_bbcode ? ' checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? ' checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? ' checked="checked"' : '', 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'URL_STATUS' => $config['allow_sig_links'] ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], 'L_SIGNATURE_EXPLAIN' => sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], 'S_BBCODE_IMG' => $config['allow_sig_img'] ? true : false, 'S_BBCODE_FLASH' => $config['allow_sig_flash'] ? true : false, 'S_LINKS_ALLOWED' => $config['allow_sig_links'] ? true : false));
// Build custom bbcodes array
display_custom_bbcodes();
// Generate smiley listing
generate_smilies('inline', 0);
break;
case 'avatar':
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
$display_gallery = request_var('display_gallery', '0');
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
$can_upload = file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
add_form_key('ucp_avatar');
if ($submit) {
if (check_form_key('ucp_avatar')) {
if (avatar_process_user($error, false, $can_upload)) {
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
} else {
$error[] = 'FORM_INVALID';
}
// Replace "error" strings with their real, localised form
$error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error);
}
if (!$config['allow_avatar'] && $user->data['user_avatar_type']) {
$error[] = $user->lang['AVATAR_NOT_ALLOWED'];
} else {
if ($user->data['user_avatar_type'] == AVATAR_UPLOAD && !$config['allow_avatar_upload'] || $user->data['user_avatar_type'] == AVATAR_REMOTE && !$config['allow_avatar_remote'] || $user->data['user_avatar_type'] == AVATAR_GALLERY && !$config['allow_avatar_local']) {
$error[] = $user->lang['AVATAR_TYPE_NOT_ALLOWED'];
}
}
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'AVATAR' => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height'], 'USER_AVATAR', true), 'AVATAR_SIZE' => $config['avatar_filesize'], 'U_GALLERY' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=profile&mode=avatar&display_gallery=1'), 'S_FORM_ENCTYPE' => $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024)));
if ($config['allow_avatar'] && $display_gallery && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) {
avatar_gallery($category, $avatar_select, 4);
} else {
if ($config['allow_avatar']) {
$avatars_enabled = $can_upload && ($config['allow_avatar_upload'] || $config['allow_avatar_remote_upload']) || $auth->acl_get('u_chgavatar') && ($config['allow_avatar_local'] || $config['allow_avatar_remote']) ? true : false;
$template->assign_vars(array('AVATAR_WIDTH' => request_var('width', $user->data['user_avatar_width']), 'AVATAR_HEIGHT' => request_var('height', $user->data['user_avatar_height']), 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_UPLOAD_AVATAR_FILE' => $can_upload && $config['allow_avatar_upload'] ? true : false, 'S_UPLOAD_AVATAR_URL' => $can_upload && $config['allow_avatar_remote_upload'] ? true : false, 'S_LINK_AVATAR' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote'] ? true : false, 'S_DISPLAY_GALLERY' => $auth->acl_get('u_chgavatar') && $config['allow_avatar_local'] ? true : false));
}
}
break;
}
$template->assign_vars(array('L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action));
// Set desired template
$this->tpl_name = 'ucp_profile_' . $mode;
$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
}
示例13: generate_smilies
} else {
$bbcode_on = $submit || $refresh || $preview ? !empty($HTTP_POST_VARS['disable_bbcode']) ? 0 : TRUE : ($userdata['user_id'] == ANONYMOUS ? $board_config['allow_bbcode'] : $userdata['user_allowbbcode']);
}
if (!$board_config['allow_smilies']) {
$smilies_on = 0;
} else {
$smilies_on = $submit || $refresh || $preview ? !empty($HTTP_POST_VARS['disable_smilies']) ? 0 : TRUE : ($userdata['user_id'] == ANONYMOUS ? $board_config['allow_smilies'] : $userdata['user_allowsmile']);
if ($smilies_on) {
include $phpbb_root_path . 'includes/functions_post.' . $phpEx;
//-- mod : bbcode box reloaded -------------------------------------------------
//-- add
include $phpbb_root_path . 'includes/bbc_box_tags.' . $phpEx;
//-- fin mod : bbcode box reloaded ---------------------------------------------
generate_smilies('inline', PAGE_SHOUTBOX_MAX);
if ($mode == 'smilies') {
generate_smilies('window', PAGE_SHOUTBOX_MAX);
exit;
}
}
}
if ($refresh) {
$message = !empty($HTTP_POST_VARS['message']) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
if (!empty($message)) {
$template->assign_var('MESSAGE', $message);
}
} else {
if ($submit || isset($HTTP_POST_VARS['message'])) {
$current_time = time();
//
// Flood control
//
示例14: generate_smilies
<tr>
<td class="tableb" colspan="3">
<input type="text" class="textinput" name="greetings" value="{$greetings}" style="WIDTH: 100%;"><br />
</td>
</tr>
<tr>
<td class="tableh2" colspan="3"><b>{$lang_ecard_php['message']}</b></td>
</tr>
<tr>
<td class="tableb" colspan="3" valign="top"><br />
<textarea name="message" class="textinput" ROWS="8" COLS="40" WRAP="virtual" onselect="storeCaret_post(this);" onclick="storeCaret_post(this);" onkeyup="storeCaret_post(this);" STYLE="WIDTH: 100%;">{$message}</textarea><br /><br />
</td>
</tr>
<tr>
<td class="tableb" colspan="3" valign="top">
EOT;
echo generate_smilies();
echo <<<EOT
</td>
</tr>
<tr>
<td colspan="3" align="center" class="tablef">
<input type="submit" class="button" value="{$lang_ecard_php['title']}">
</form>
</td>
</tr>
EOT;
endtable();
pagefooter();
ob_end_flush();
示例15: index
public function index()
{
// sets a few variables before the actions
$this->mode = $this->request->variable('mode', 'default');
$this->last_id = $this->request->variable('last_id', 0);
$this->last_time = $this->request->variable('last_time', 0);
$this->post_time = $this->request->variable('last_post', 0);
$this->read_interval = $this->request->variable('read_interval', 5000);
// Grabs the right Action depending on ajax requested mode
if ($this->mode === 'default') {
$this->defaultAction();
} else {
if ($this->mode === 'read') {
$this->readAction();
} else {
if ($this->mode === 'smilies') {
$this->smiliesAction();
} else {
if ($this->mode === 'delete') {
$this->delAction();
}
}
}
}
// Sets a few variables
$bbcode_status = $this->config['allow_bbcode'] && $this->config['auth_bbcode_pm'] && $this->auth->acl_get('u_ajaxchat_bbcode') ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['auth_smilies_pm'] && $this->auth->acl_get('u_pm_smilies') ? true : false;
$img_status = $this->config['auth_img_pm'] && $this->auth->acl_get('u_pm_img') ? true : false;
$flash_status = $this->config['auth_flash_pm'] && $this->auth->acl_get('u_pm_flash') ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$quote_status = true;
$this->mode = strtoupper($this->mode);
$sql = 'SELECT `user_lastpost` FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if ($this->get_status($row['user_lastpost']) === 'online') {
$refresh = $this->config['refresh_online_chat'];
} else {
if ($this->user->data['user_id'] === ANONYMOUS || $this->get_status($row['user_lastpost']) === 'offline') {
$refresh = $this->config['refresh_offline_chat'];
} else {
$refresh = $this->config['refresh_offline_chat'];
}
}
if ($this->user->data['user_id'] === ANONYMOUS || $row['user_lastpost'] === null) {
$last_post = 0;
} else {
$last_post = $row['user_lastpost'];
}
$details = base64_decode('Jm5ic3A7PGEgaHJlZj0iaHR0cDovL3d3dy5saXZlbWVtYmVyc29ubHkuY29tIiBzdHlsZT0iZm9udC13ZWlnaHQ6IGJvbGQ7Ij5BSkFYJm5ic3A7Q2hhdCZuYnNwOyZjb3B5OyZuYnNwOzIwMTU8L2E+Jm5ic3A7PHN0cm9uZz5MaXZlJm5ic3A7TWVtYmVycyZuYnNwO09ubHk8L3N0cm9uZz4=');
//Assign the features template variable
$this->template->assign_vars(['BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_LINKS_ALLOWED' => $url_status, 'S_COMPOSE_PM' => true, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'S_BBCODE_URL' => $url_status, 'L_DETAILS' => $details, 'REFRESH_TIME' => $refresh, 'LAST_ID' => $this->last_id, 'LAST_POST' => $last_post, 'TIME' => time(), 'L_VERSION' => '3.0.9-BETA', 'STYLE_PATH' => generate_board_url() . '/styles/' . $this->user->style['style_path'], 'EXT_STYLE_PATH' => '' . $this->ext_path_web . 'styles/', 'FILENAME' => $this->helper->route('spaceace_ajaxchat_chat'), 'S_ARCHIVE' => !$this->get ? true : false, 'S_GET_CHAT' => $this->get ? true : false, 'S_' . $this->mode => true]);
// Generate smiley listing
\generate_smilies('inline', 0);
// Build custom bbcodes array
\display_custom_bbcodes();
$this->whois_online();
return $this->helper->render('chat_body.html', $this->user->lang['CHAT_ARCHIVE_EXPLAIN']);
}