Pagina 1 di 1

Codice del post nel titolo della discussione su viewforum

Inviato: 30/10/2012, 13:20
da digreo
Inserendo delle faccine all'interno del post, nel titolo in viewforum.php viene riportata parte di codice:


Il problema potrebbe risiedere che nel viewforum.php ho inserito una query per leggere il primo posts di ogni discussione (riporto tutte le vars assegnate allo stesso template perchè magari è proprio lì l'errore.. MAH?):

Codice: Seleziona tutto

$sql = "SELECT post_text FROM ".POSTS_TABLE." WHERE topic_id = $topic_id ORDER BY post_time ASC LIMIT 0,1";
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

		$template->assign_block_vars('topicrow', array(
			'POST_TEXT'                 => $rows['post_text'],
			'FORUM_ID'					=> $topic_forum_id,
			'TOPIC_ID'					=> $topic_id,
			'TOPIC_AUTHOR'				=> get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'TOPIC_AUTHOR_COLOUR'		=> get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'TOPIC_AUTHOR_FULL'			=> get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'FIRST_POST_TIME'			=> $user->format_date($row['topic_time']),
			'LAST_POST_SUBJECT'			=> censor_text($row['topic_last_post_subject']),
			'LAST_POST_TIME'			=> $user->format_date($row['topic_last_post_time']),
			'LAST_VIEW_TIME'			=> $user->format_date($row['topic_last_view_time']),
			'LAST_POST_AUTHOR'			=> get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),

			'PAGINATION'		=> topic_generate_pagination($replies, $view_topic_url),
			'REPLIES'			=> $replies,
			'VIEWS'				=> $row['topic_views'],
			'TOPIC_TITLE'		=> censor_text($row['topic_title']),
			'TOPIC_TYPE'		=> $topic_type,

			'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
			'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
			'TOPIC_FOLDER_IMG_ALT'	=> $user->lang[$folder_alt],
			'TOPIC_FOLDER_IMG_WIDTH'=> $user->img($folder_img, '', false, '', 'width'),
			'TOPIC_FOLDER_IMG_HEIGHT'	=> $user->img($folder_img, '', false, '', 'height'),

			'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
			'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
			'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
			'ATTACH_ICON_IMG'		=> ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
			'UNAPPROVED_IMG'		=> ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',

			'S_TOPIC_TYPE'			=> $row['topic_type'],
			'S_USER_POSTED'			=> (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
			'S_UNREAD_TOPIC'		=> $unread_topic,
			'S_TOPIC_REPORTED'		=> (!empty($row['topic_reported']) && $auth->acl_get('m_report', $topic_forum_id)) ? true : false,
			'S_TOPIC_UNAPPROVED'	=> $topic_unapproved,
			'S_POSTS_UNAPPROVED'	=> $posts_unapproved,
			'S_HAS_POLL'			=> ($row['poll_start']) ? true : false,
			'S_POST_ANNOUNCE'		=> ($row['topic_type'] == POST_ANNOUNCE) ? true : false,
			'S_POST_GLOBAL'			=> ($row['topic_type'] == POST_GLOBAL) ? true : false,
			'S_POST_STICKY'			=> ($row['topic_type'] == POST_STICKY) ? true : false,
			'S_TOPIC_LOCKED'		=> ($row['topic_status'] == ITEM_LOCKED) ? true : false,
			'S_TOPIC_MOVED'			=> ($row['topic_status'] == ITEM_MOVED) ? true : false,

			'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread',
			'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
			'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
			'U_VIEW_TOPIC'			=> $view_topic_url,
			'U_MCP_REPORT'			=> append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $topic_forum_id . '&t=' . $topic_id, true, $user->session_id),
			'U_MCP_QUEUE'			=> $u_mcp_queue,

			'S_TOPIC_TYPE_SWITCH'	=> ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test)
		);
e in viewforum_body.html (template) in prossimità del title ho inserito la chiamata alla query:

Codice: Seleziona tutto

<dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.POST_TEXT}"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
IN CONCLUSIONE:
Se vado a leggere punto il mouse sopra il titolo in viewforum.php mi compare il primo post della discussione e se c'è una faccina all'interno del post, nel titolo compare tutto il codice del post dal punto in cui ho inserito la faccina e subito dopo l'apertura degli apostrofi del tag <img src=
E' possibile vederlo appunto posizionandosi sopra il titolo in viewforum.php




P.S.:
Il problema è complesso:

Codice: Seleziona tutto

$sql = "SELECT post_text FROM ".POSTS_TABLE." WHERE topic_id = $topic_id ORDER BY post_time ASC LIMIT 0,1";
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Questa query è stata posizionata subito sopra $template->assign_block_vars('topicrow', array

In quanto è l'unico posto che mi consente di farlo funzionare, cambiando $row in $rows (altrimenti succede un'altro casino!), resta il fatto che il casino resta ugualmente!!

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 30/10/2012, 19:46
da digreo
Il problema si genera subito prima di {SMILIES_PATH}!

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 01/11/2012, 14:50
da digreo
Qualcuno ha qualche idea?

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 01/11/2012, 16:39
da Angolo
Verifica col subsilver2. Se con quello è regolare, hai pasticciato con lo stile.

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 01/11/2012, 17:28
da digreo
Non ho subsilver2! Non permetto di cambiare stile e non intendo cambiarlo, anche perchè devo implementare uno stile personale.

Il problema non risiede nello stile, perchè se cancello la query, tutto torna alla normalità.. mentre, se:
punto il mouse sopra il titolo in viewforum.php mi compare il primo post della discussione, ma se c'è una faccina all'interno del post, nel titolo compare tutto il codice del post dal punto in cui ho inserito la faccina e subito dopo l'apertura degli apostrofi del tag <img src= subito prima di {SMILES_PATH}.
Questo è l'attuale codice::

Codice: Seleziona tutto

$sql = "SELECT post_text FROM ".POSTS_TABLE." WHERE topic_id = $topic_id ORDER BY post_time ASC LIMIT 0,1";
$result = $db->sql_query($sql);
$roww = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
Questa query è stata posizionata subito sopra:

Codice: Seleziona tutto

$template->assign_block_vars('topicrow', array(
			'PST_TEXT'					=> $roww['post_text'],
In quanto è l'unico posto che lo fa funzionare, cambiando $row in $roww (o qualsiasi altro termine, altrimenti succede un'altro casino!).

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 01/11/2012, 17:32
da Angolo
Nessuno ti ha detto di cambiare stile. Ti è stato detto di provare con un altro stile. Che è cosa diversa. E il subsilver2 si deve avere, perché è uno stile predefinito.

A maggior ragione se hai pasticciato con il php, non è questa la sezione in cui chiedere queste cose. Sposto.

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 02/11/2012, 18:32
da digreo
Allego il file viewforum.php, da notare la query POST_TEXT!
Ribadisco tutto quello che è stato scritto sopra, nulla è cambiato: lo script, per visualizzare il primo post sul titolo della discussione, funziona soltanto in quella posizione e cambiando la var row; ma se nel post ci sono delle faccine, tutto il POST_TEXT lo ritrovo nel titolo della discussione dalla posizione della faccina, in poi!


SEGUE ALLEGATO

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 07/11/2012, 22:16
da digreo
UP! Non ho alcuna idea per risolvere!
L'unica soluzione che mi viene in mente è non permettere le Emoticon (e non mi piace molto l'idea).

Re: Codice del post nel titolo della discussione su viewforu

Inviato: 08/11/2012, 16:46
da digreo
Questa è la linea in /includes/message_parser.php che scrive gli smiles sui post:

Codice: Seleziona tutto

$replace[] = '<!-- s' . $row['code'] . ' --><img src="{SMILIES_PATH}/' . $row['smiley_url'] . '" alt="' . $row['code'] . '" title="' . $row['emotion'] . '" /><!-- s' . $row['code'] . ' -->';
L'errore, si genera in prossimità di src="
Quindi ho pensato che il problema potrebbero essere le virgolette, visto che sul template la funzione è richiamata in questa maniera: title="{topicrow.PST_TEXT}"