[MOD-RC2] Topic Descriptions

Started by Kirby, October 24, 2004, 10:24:49 PM

Previous topic - Next topic

[Unknown]

If you replace ALL of the text you quoted, my suggestion should work just fine.

-[Unknown]

edi67

so i replaced all data u told me in the place of mine and the result is the same

this is pics:

Making new Topic:


if i want see preview:


as u can see in pic the field Description is empy and i must rewrite it.


but also i have this little bug too.

if i write description in topic and i save it i see in messageindex not my description but 2 time the tile of topic

look pic


u have some solution ??
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

Thanks for reporting that, I accidentally set it to 'subject' instead of 'description' :P
Anyway, I fixed the file link, the bug that was reported above, and I made it use language files now.

edi67

#23
ok well thx again this problem is solved now:

Quotebut also i have this little bug too.

if i write description in topic and i save it i see in messageindex not my description but 2 time the tile of topic



but problem of preview is the same again look the pic making preview

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

You have to add $txt['tdesc'] somewhere in your Post.<insertlanguage>.php and define it.
Example:
$txt['tdesc'] = 'Description';

While your at it, open up ModSettings.<insertlanguage>.php, and add the following line
$txt['descr_allow'] = 'Enable topic descriptions';

remember to add them somewhere before the ?> and the language files are in your themes directory :P

[darksteel]

In

Quote
<edit file>
Themes/default/languages/ModSettings.english.php
</edit file>

<search for>
?>
</search for>

Is

Quote
<edit file>
Themes/default/languages/ModSettings.english.php
</edit file>

<search for>
<?php
</search for>
:) darksteel-



Luis "[darksteel]" Alvarado.
Spanish Support
¿Qué es el repair_settings?
No doy soporte por PM, publica tu duda en el foro y tendras respuestas mas rapidas.
My forum:
www.caamboard.com

edi67

Quote from: Kirby on November 02, 2004, 11:22:36 AM
You have to add $txt['tdesc'] somewhere in your Post.<insertlanguage>.php and define it.
Example:
$txt['tdesc'] = 'Description';

While your at it, open up ModSettings.<insertlanguage>.php, and add the following line
$txt['descr_allow'] = 'Enable topic descriptions';

remember to add them somewhere before the ?> and the language files are in your themes directory :P

sorry but u not understood me the problem is not the word "Descroption" that i see correctly but problem is that if u write one new thread and insert all data field descrption too, and after u want see the PREVIEW of this new thread , the field DESCRIPTION will begin DELETED and u must rewrite it again. i hope u understood me
by the way is great mod
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

Oh, thanks. I'm going to look into the problem and post/edit once I fix it.

readme.txt

Hagamos el mundo al reves.

Kirby


FaSan

#30
Quote from: edi67 on October 30, 2004, 02:33:48 PM
again thx for this great mod but i want u tell about one little little bug

making one new thread u insert all data, title, description, and all if u want see the preview before post it u will see all correct but the field description will be deleted and u must rewrite the description

i want ask if is normal that description go out if u see the preview or may be there is one way to fix it

thx anyway


Change that :


Post.php :



<search>
// Set up the inputs for the form.
$form_subject = htmlspecialchars(stripslashes($_REQUEST['subject']));
$form_message = htmlspecialchars(stripslashes($_REQUEST['message']), ENT_QUOTES);

// Cheating ;).
$form_subject = preg_replace('~&amp;#(\d{4,5}|[3-9]\d{2,4}|2[6-9]\d);~', '&#$1;', $form_subject);
</search>

<replace>
// Set up the inputs for the form.
$form_subject = htmlspecialchars(stripslashes($_REQUEST['subject']));
$form_description = htmlspecialchars(stripslashes($_REQUEST['description']));
$form_message = htmlspecialchars(stripslashes($_REQUEST['message']), ENT_QUOTES);

// Cheating ;).
$form_subject = preg_replace('~&amp;#(\d{4,5}|[3-9]\d{2,4}|2[6-9]\d);~', '&#$1;', $form_subject);
$form_description = preg_replace('~&amp;#(\d{4,5}|[3-9]\d{2,4}|2[6-9]\d);~', '&#$1;', $form_description);</replace>


<search>
$context['subject'] = addcslashes($form_subject, '"');
</search>

<add after>
$context['description'] = addcslashes($form_description, '"');
</add after>

<search>
// Get the stuff ready for the form.
$form_subject = $row['subject'];
$form_message = preg_replace('|<br(?: /)?>|', "\n", $row['body']);
censorText($form_message);
censorText($form_subject);
</search>

<replace>
// Get the stuff ready for the form.
$form_subject = $row['subject'];
$form_description = $row['description'];
$form_message = preg_replace('|<br(?: /)?>|', "\n", $row['body']);
censorText($form_message);
censorText($form_subject);
censorText($form_description);
</replace>


<delete>
// Set the description.
$context['description'] = $row['description'];
</delete>



Post.template.php



<search>
if ($context['is_new_topic'] && $modSettings['descr_allow'] == '1')
        {
echo '
<tr>
<td align="right">
<b>', $txt['tdesc'], ':</b>
</td>
<td>
<input type="text" name="description" size="80" maxlength="80" tabindex="1" />
</td>
</tr>';
}
        elseif ($context['is_first_post'] && $modSettings['descr_allow'] == '1' && isset($_REQUEST['msg']))
        {
echo '
<tr>
<td align="right">
<b>', $txt['tdesc'], ':</b>
</td>
<td>
<input type="text" name="description" value="' . $context['description'] . '" size="80" maxlength="80" tabindex="1" />
</td>
</tr>';
}
echo '
<tr>
<td align="right">
<b>', $txt[71], ':</b>
</td>
<td>
<select name="icon" id="icon" onchange="showimage()">';
</search>

<replace>
if (($context['is_new_topic'] || $context['is_first_post']) && !empty($modSettings['descr_allow']))
    {
echo '
<tr>
<td align="right">
<b>', $txt['tdesc'], ':</b>
</td>
<td>
<input type="text" name="description"', $context['description'] == '' ? '' : ' value="' . $context['description'] . '"', ' size="80" maxlength="80" tabindex="1" />
</td>
</tr>';
}
echo '
<tr>
<td align="right">
<b>', $txt[71], ':</b>
</td>
<td>
<select name="icon" id="icon" onchange="showimage()">';
</replace>




;)



FaSan

readme.txt

#31
Hi FaSan or Kirby

i have three  problems:

8: Undefined variable: form_description
Archivo: /home/####/public_html/forum/Sources/Post.php
Line: 740

Line 739     $context['subject'] = addcslashes($form_subject, '"');
Line 740     $context['description'] = addcslashes($form_description, '"');






8: Undefined index: ID_MEMBER_POSTER
Archivo: /home/####/public_html/forum/Sources/Post.php
Line: 1505


Line 1503 // Log an act of moderation - modifying.
Line 1504 if (!empty($moderationAction))
Line 1505 logAction('modify', array('topic' => $topic, 'message' => $_REQUEST['msg'], 'member' => $row['ID_MEMBER_POSTER']));






8: Undefined index: description
Archivo: /home/####/public_html/forum/Sources/Post.php
Line: 1018


Line 1016 // Hack to make it so &#324324... can't happen.
Line 1017 $_POST['subject'] = preg_replace('~&#\d+$~', '', $_POST['subject']);
Line 1018 $_POST['description'] = preg_replace('~&#\d+$~', '', $_POST['description']);



Help me :)
Hagamos el mundo al reves.

FaSan

#32
Change this:


Quote
<search>
$form_description = htmlspecialchars(stripslashes($_REQUEST['description']));
</search>

<replace>
$form_description = isset($_REQUEST['description']) ? htmlspecialchars(stripslashes($_REQUEST['description'])) : '';
</replace>


<search>
$context['description'] = addcslashes($form_description, '"');
</search>

<replace>
$context['description'] = isset($form_description) ? addcslashes($form_description, '"') : '';
</replace>


<search>
$context['description'] = $row['description'];
</search>

<replace>
$form_description = isset ($row['description']) ? $row['description'] : '';
</replace>


<search>
$_POST['description'] = preg_replace('~&#\d+$~', '', $_POST['description']);
</search>

<replace>
$_POST['description'] = isset($_POST['description']) ? preg_replace('~&#\d+$~', '', $_POST['description']) : '';
</replace>



FaSan

readme.txt

Hagamos el mundo al reves.

edi67

#34
and for this error some solution ?^

8: Undefined index: ID_LAST_MSG
File: /home/forumzo7/public_html/Sources/MessageIndex.php
Linea: 464


Line 462          'preview' => $row['lastBody'],
Line 463                       'icon' => $row['lastIcon'],
Line 464                 'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . '#msg' . $row['ID_LAST_MSG'],
Line 465                   'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . ($row['numReplies'] == 0 ? '.0' : '.msg' . $row['ID_LAST_MSG']) . '#msg' . $row['ID_LAST_MSG'] . '">' . $row['lastSubject'] . '</a>'
Line 466                 ),





8: Undefined index: ID_LAST_MSG
File: /home/forumzo7/public_html/Sources/MessageIndex.php
Linea: 392


Line 391                 // Don't censor them twice!
Line 392                 if ($row['ID_FIRST_MSG'] == $row['ID_LAST_MSG'])
Line 393                   {
Line 394                 $row['lastSubject'] = $row['firstSubject'];
Line 395                   $row['lastBody'] = $row['firstBody'];
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

FaSan

It's not "Topic Descriptions" errors.


FaSan

edi67

but i have it only after installed this mod before not was
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

FaSan

Quote from: edi67 on March 09, 2005, 03:24:24 PM
but i have it only after installed this mod before not was

Re-Install it ;)

edi67

i solved i think deleting this variable in Messageindex.php

IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS isRead,
t.ID_LAST_MSG AS lastMsgID, ml.posterTime AS lastPosterTime, ml.modifiedTime AS lastModifiedTime,

and rewrite so:

IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS isRead,
t.ID_LAST_MSG , ml.posterTime AS lastPosterTime, ml.modifiedTime AS lastModifiedTime,
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

FaSan

This is a partial of the original "descriptions.mod" and i don't see that modifications :

Quote
<edit file>
Sources/MessageIndex.php
</edit file>

<search for>
   // Grab the appropriate topic information.
   $result = db_query("
      SELECT
         t.ID_TOPIC, t.numReplies, t.locked, t.numViews, t.isSticky, t.ID_POLL,
         IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS isRead,
         t.ID_LAST_MSG, ml.posterTime AS lastPosterTime, ml.modifiedTime AS lastModifiedTime,
         ml.subject AS lastSubject, ml.icon AS lastIcon, ml.posterName AS lastMemberName,
         ml.ID_MEMBER AS lastID_MEMBER, IFNULL(meml.realName, ml.posterName) AS lastDisplayName,
         t.ID_FIRST_MSG, mf.posterTime AS firstPosterTime, mf.modifiedTime AS firstModifiedTime,
         mf.subject AS firstSubject, mf.icon AS firstIcon, mf.posterName AS firstMemberName,
         mf.ID_MEMBER AS firstID_MEMBER, IFNULL(memf.realName, mf.posterName) AS firstDisplayName,
         LEFT(ml.body, 384) AS lastBody, LEFT(mf.body, 384) AS firstBody, ml.smileysEnabled AS lastSmileys,
         mf.smileysEnabled AS firstSmileys
      FROM {$db_prefix}topics AS t, {$db_prefix}messages AS ml, {$db_prefix}messages AS mf
         LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
         LEFT JOIN {$db_prefix}members AS memf ON (memf.ID_MEMBER = mf.ID_MEMBER)
         LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
         LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = $board AND lmr.ID_MEMBER = $ID_MEMBER)
      WHERE t.ID_BOARD = $board
         AND ml.ID_MSG = t.ID_LAST_MSG
         AND mf.ID_MSG = t.ID_FIRST_MSG
      ORDER BY
         " . (!empty($modSettings['enableStickyTopics']) ? 't.isSticky' . ($fake_ascending ? '' : ' DESC') . ',
         ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . "
      LIMIT $start, $maxindex", __FILE__, __LINE__);
</search for>

<replace>
   // Grab the appropriate topic information.
   $result = db_query("
      SELECT
         t.ID_TOPIC, t.numReplies, t.locked, t.numViews, t.isSticky, t.ID_POLL,
         IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS isRead,
         t.ID_LAST_MSG, ml.posterTime AS lastPosterTime, ml.modifiedTime AS lastModifiedTime,
         ml.subject AS lastSubject, ml.icon AS lastIcon, ml.posterName AS lastMemberName,
         ml.ID_MEMBER AS lastID_MEMBER, IFNULL(meml.realName, ml.posterName) AS lastDisplayName,
         t.ID_FIRST_MSG, mf.posterTime AS firstPosterTime, mf.modifiedTime AS firstModifiedTime,
         mf.subject AS firstSubject, mf.icon AS firstIcon, mf.posterName AS firstMemberName,
         mf.ID_MEMBER AS firstID_MEMBER, IFNULL(memf.realName, mf.posterName) AS firstDisplayName,
         LEFT(ml.body, 384) AS lastBody, LEFT(mf.body, 384) AS firstBody, ml.smileysEnabled AS lastSmileys,
         mf.smileysEnabled AS firstSmileys, t.description AS topicDescription
      FROM {$db_prefix}topics AS t, {$db_prefix}messages AS ml, {$db_prefix}messages AS mf
         LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
         LEFT JOIN {$db_prefix}members AS memf ON (memf.ID_MEMBER = mf.ID_MEMBER)
         LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
         LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = $board AND lmr.ID_MEMBER = $ID_MEMBER)
      WHERE t.ID_BOARD = $board
         AND ml.ID_MSG = t.ID_LAST_MSG
         AND mf.ID_MSG = t.ID_FIRST_MSG
      ORDER BY
         " . (!empty($modSettings['enableStickyTopics']) ? 't.isSticky' . ($fake_ascending ? '' : ' DESC') . ',
         ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC') . "
      LIMIT $start, $maxindex", __FILE__, __LINE__);
</replace>

Advertisement: