Topic Description

Started by Rudolf, January 03, 2007, 09:12:29 AM

Previous topic - Next topic

JOSHSKORN

Now I'm having problems with this section of Sources.xml.  With both Sources.xml and Themes.xml, I had to reformat each file so I could read them easily, so I suppose it's possible I could've accidentally deleted a character or two.

In Sources.xml, there's a section that goes:

<operation><search position="after"><![CDATA[

if (empty($post_errors))

]]></search>

<add><![CDATA[
//-Topic description MOD- Start
if (isset($_POST['description']))
{
$_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
// Maximum number of characters.
if ($func['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($func['substr'](stripslashes($_POST['description']), 0, 200));
}
else $_POST['description'] = '';
//-Topic description MOD- End
]]></add>
</operation>


If I'm interpreting this correctly, I need to add the text AFTER THE brace, producing:

if (empty($post_errors))
{
        //-Topic description MOD- Start
        if (isset($_POST['description']))
               {
$_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
// Maximum number of characters.
if ($func['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($func['substr'](stripslashes($_POST['description']), 0, 200));
}
else
                $_POST['description'] = '';
//-Topic description MOD- End
$msgOptions = array(
'id' => $row['ID_MSG'],
'subject' => isset($_POST['subject']) ? $_POST['subject'] : null,
'body' => isset($_POST['message']) ? $_POST['message'] : null,
'icon' => isset($_POST['icon']) ? preg_replace('~[\./\\\\*\':"<>]~', '', $_POST['icon']) : null,
);


I omitted some lines.  Now, with the limited knowledge of PHP that I have, I'm noticing that after the 'else' statement, there is only one line of code, no braces.  Therefore, lines under $_POST['description'] = ''; would not be included into the if statement.

So how can I correctly implement this segment of coding?

JOSHSKORN

#101
Sorry double post. just realized I could modify my post, didn't need to add another one like I did earlier.

JOSHSKORN

Sorry that was a double post just now.  Can someone delete one to avoid confusion?  It won't let me remove my own post.

Rudolf

You are doing it backwards.

<operation><search position="after"><![CDATA[

if (empty($post_errors))

]]></search>

Means that you have to add the text before that code. The position is the position of the search text relative to the added text.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

JOSHSKORN

ouch ok...I've been doing it backwards all along. Funny thing is, is that I haven't had any problems yet.

JOSHSKORN

After installation, I click on any forum and receive the following message:

Unknown column 'mf.description' in 'field list'
File: /hsphere/local/home/threei/3iclan.net/thesite/Sources/MessageIndex.php
Line: 457

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 1.1.3, while your database is at version 1.1.2. The above error might possibly go away if you execute the latest version of upgrade.php.


After doing some thinking, I suspect that it's because my host somehow isn't really allowing me to execute any files correctly even though I've done ALL of the correct CHMODS prior to installation.  In particular, I noticed that this mod has the file DB.php included into it, which didn't execute properly.  I tried two things, going to the url www.mysite.net/mysitefolder/Packages/temp/DB.php where it was correctly extracted by default, and then I also tried placing the file in SMF's root, thus going to www.mysite.net/mysitefolder/DB.php, no luck.  In either case, I received the message:

Error: Cannot install - please verify you put this in the same place as SMF's index.php

Anyway, I need to somehow manually update my database.  I have direct DB access using phpMyAdmin.  Can you tell me the proper queries and syntax to use in the SQL button?  I realize that the code in DB.php is written in PHP.  Another problem I had, is that I couldn't properly interpret the MySQL code and determine which table(s) is/are being modified.  Here's the contents of DB.php:

<?php
if (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

//DB.php Version 1.0
//create the column if not exists
$result = db_query("SHOW COLUMNS FROM {$db_prefix}messages LIKE 'description'",__FILE__,__LINE__);
if (!
mysql_num_rows($result))
{
$result = db_query("ALTER IGNORE TABLE {$db_prefix}messages ADD column description TINYTEXT NOT NULL AFTER subject",__FILE__,__LINE__);
}

?>

Thanks!

Rudolf

Add require('SSI.php') after <?php and run the file from the forum's root.

If still doesn't work then run this query using phpmyadmin

ALTER IGNORE TABLE {$db_prefix}messages ADD column description MEDIUMTEXT NOT NULL AFTER subject
Replace {$db_prefix} with your database prefix.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

JOSHSKORN

#107
ok that fixed it.  I'm now receiving an error in the file Display.template.php.  Can you help me solve this one?  The error is:


Template Parse Error
233: <tr class="titlebg" id="description_row" style="font-weight: normal; ',(empty($context['description']) ? 'display: none' : '') , '">


The file Display.template.php has been attached.

I have a few other mods installed, nothing crazy like some people have (I've read that one person had 78 mods installed), only about 20 or so. Here's a list (all of them installed manually):


1.  Treasury  1.23
2. TinyPortal 0.983
3. SMF 1.0.11 / 1.1.3 Update 1.1
4. Profile Comments 1.2.1
5. User Control Panel By Alan S 1.2
6. No Temp Directory Removal 1.0
7. Admin Notepad 1.0
8. Member Notepad 1.0
9. Active Members In Topic 1.5
10. New Topic Button 1.0
11. Custom Profile Field Mod 3.16
12. Country Flags 1.0.1
13. Youtube Field by Alan S 1.0
14. YouTube BBC Tag (XHTML Compliant) 1.2
15. Contact Page 1.1
16. Allowed Groups Embedded Flash 1.2.0
17. Bookmarks 1.0
18. Enhanced Forum Statistics 1.0
19. Export Personal Messages 1.0
20. SMF File Manager 2.0
21. Google Talk Field 1.0.2
22. Group Moderators 1.4


Every mod I've got installed works perfectly and there are no other forum errors.

I also realize that programming can be misleading and that the error COULD be somewhere else. Let me know if I need to post any other files and I will.  Thanks.

Rudolf

You added in the wrong place a block of code.
The search was
<search position="after"><![CDATA[';
if (!empty($settings['display_who_viewing']))]]></search>

so you need to add before the ';

echo'<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">';
if (!empty($settings['display_who_viewing']))


becomes
echo'<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">
<!-- //-Topic description MOD- Start -->
<tr class="titlebg" id="description_row" style="font-weight: normal; ',(empty($context['description']) ? 'display: none' : '') , '">
<td valign="middle" width="2%" style="padding-left: 6px;">
</td>
<td width="13%"></td>
<td valign="middle" width="85%" style="padding-left: 6px;" id="top_description">
', $txt['topic_description'], ': ', $context['description'], '
</td>
</tr>
<!-- //-Topic description MOD- End -->';

if (!empty($settings['display_who_viewing']))
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

JOSHSKORN

Thank you so much!  You are awesome!  Thanks for putting up with me and my n00bness and being such a great help and teacher.   :)

Rudolf

You're welcome.
Please remove the attachment from your previous post as it is not needed anymore.
I don't mind it leaving there, but it takes up server resources without any usefulness.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

edi67

Mod for fine but i got always such kinds of errors:

8: Undefined index: description
File: /home2/craxxxxxxxs/www/Sources/Subs-Post.php
Linea: 1518


some solution ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Slappy

#112
Whenever I use my quick reply, I get the following errors:
8: Undefined index: description
File: ...../forum/Sources/Post.php
Line: 1380


8: Undefined index: description
File: ...../forum/Sources/Post.php
Line: 1382


Here is the coding for lines 1377 to 1387.


//-Topic description MOD- Start
  if ($func['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($func['substr'](stripslashes($_POST['description']), 0, 200));
  $_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
  //-Topic description MOD- End
// At this point, we want to make sure the subject isn't too long.
if ($func['strlen']($_POST['subject']) > 100)
$_POST['subject'] = addslashes($func['substr'](stripslashes($_POST['subject']), 0, 100));



The other Mods I have installed are:
1.     SMF Trader System 1.1
2.    View Single Post 1.1
3.    Global Headers Footers 1.3
4.    Member Color Link 2.0.0
5.    Signature BBCode Bar 1.4
6.    View Topic Permissions 1.1.0a
7.    SMF Ranks 1.1
8.    User Control Panel By Alan S 1.2
9.    Profil Moderator Managment
10.    Topic description 1.1
11.    Group Moderators 1.4
12.    User Post Limit Options 1.0
13.    Default Membergroup on Registration 1.1
14.    Users Active in Last 24 Hours 1.0
15.    Enhanced Quick Reply

Rudolf

This should happen when you are using a different theme and you haven't applied the changes to it. To fix this
open Post.php and replace this bit
//-Topic description MOD- Start
  if ($func['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($func['substr'](stripslashes($_POST['description']), 0, 200));
  $_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
  //-Topic description MOD- End


with
//-Topic description MOD- Start
  if (!isset($_POST['description']))
  $_POST['description'] = '';
  else
  {
  if ($func['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($func['substr'](stripslashes($_POST['description']), 0, 200));
  $_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
  }
  //-Topic description MOD- End


I think I will include this in the main package, to avoid having errors because of the template.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Slappy

#114
Okay. That fixed the error completely. I've found another error. When I  press the preview button located  under the quick reply, I get the following errors:
8: Undefined index: description
File: /hsphere/local/home/manareal/duelplanet.com/forum/Sources/Post.php
Line: 377

8: Undefined index: description
File: /hsphere/local/home/manareal/duelplanet.com/forum/Sources/Post.php
Line: 444


Here are lines 370 to 380 in Post.php:
if ($func['htmltrim']($_REQUEST['subject']) == '')
$context['post_error']['no_subject'] = true;
if ($func['htmltrim']($_REQUEST['message']) == '')
$context['post_error']['no_message'] = true;
if (!empty($modSettings['max_messageLength']) && $func['strlen']($_REQUEST['message']) > $modSettings['max_messageLength'])
$context['post_error']['long_message'] = true;
$func['htmltrim']($_REQUEST['description']); //-Topic description MOD-

// Are you... a guest?
if ($user_info['is_guest'])

Here are lines 440 to 450:
$context['post_error']['no_subject'] = true;


//-Topic description MOD- Start
$form_description = strtr($func['htmlspecialchars'](stripslashes($_REQUEST['description'])), array("\r" => '', "\n" => '', "\t" => ''));
if ($func['strlen']($form_description) > 200)
$form_description = $func['substr']($form_description, 0, 200);
//-Topic description MOD- End
// Any errors occurred?
if (!empty($context['post_error']))
{


I attached my Post.php file if you want to take a closer look.

Slappy


Slappy

PLEASE help me with this ASAP. It's really halting the development of my site. I want to get this resolved before I continue.

Alpay

#117
Hi

error:

http://www..../forum/index.php?action=post2

Lİne: 1421 & 1419

1421 :
$_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));

1419 :
if ($func['strlen']($_POST['description']) > 200)

1418 - 1422

//-Topic description MOD- Start
  if ($func['strlen']($_POST['description']) > 200)
$_POST['description'] = addslashes($func['substr'](stripslashes($_POST['description']), 0, 200));
  $_POST['description'] = strtr($func['htmlspecialchars']($_POST['description']), array("\r" => '', "\n" => '', "\t" => ''));
  //-Topic description MOD- End

Lew Cipher

#118
Rudolph,

Sorry for the PM, I am an idiot. I missed this thread somehow & the link didn't work for me. User error, I'm sure.  ::)

I'll post my question here.

Is there any way I can make the text smaller for the description that shows when you view a board. See arrow #2 in the pic below.

Also, the subject/description box seems to be double spaced (between "Top" and "Secret"). How can I fix this and make it single spaced? See arrow #1 in the pic below.

In this pic, "Top" is the subject & "Secret" is the description.




Thanks for your mod & your time!
Version: SMF 1.1.2
Many mods installed

Lew Cipher

Quote from: Lew Cipher on August 09, 2007, 06:09:13 PM
Rudolph,

Sorry for the PM, I am an idiot. I missed this thread somehow & the link didn't work for me. User error, I'm sure.  ::)

I'll post my question here.

Is there any way I can make the text smaller for the description that shows when you view a board. See arrow #2 in the pic below.

Also, the subject/description box seems to be double spaced (between "Top" and "Secret"). How can I fix this and make it single spaced? See arrow #1 in the pic below.

In this pic, "Top" is the subject & "Secret" is the description.




Thanks for your mod & your time!

Alternately, a way to turn it on & off per board would be great.
Version: SMF 1.1.2
Many mods installed

Advertisement: