 | Need help with EM install |  |
Posted: 05/23/2007 10:14 PM |
|
|
|
|
|
| Caravan |
| Posts |
282 |
| Word Cnt. |
31,380 |
| BDay |
Apr 14 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Nov 01, 2006
Local time: 11:17 PM
Location: Denver, PA
|

|
|
|
|
 |
Hello Nightrider!
I have a find and replace with that I need help with in my easy subforums install on DM.
Original install file
The find and replace I am stuck on.
| Code:
|
#
#-----[ FIND ]------------------------------------------------
#
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
#
#-----[ REPLACE WITH ]----------------------------------------
#
// Modified by Easy Sub-Forums MOD
if (isset($HTTP_POST_VARS['detach_enabled']) && isset($HTTP_POST_VARS['has_subforums']))
{
$sql = "UPDATE ". FORUMS_TABLE. " SET attached_forum_id=-1 WHERE attached_forum_id=" . intval($HTTP_POST_VARS[POST_FORUM_URL]);
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't detach subforums", "", __LINE__, __FILE__, $sql);
}
}
if (intval($HTTP_POST_VARS['old_cat_id']) != intval($HTTP_POST_VARS[POST_CAT_URL]))
{
$HTTP_POST_VARS['attached_forum_id']=-1;
if (isset($HTTP_POST_VARS['has_subforums']) && !isset($HTTP_POST_VARS['detach_enabled']))
{
$sql = "UPDATE ". FORUMS_TABLE ." SET cat_id=". intval($HTTP_POST_VARS[POST_CAT_URL]) ." WHERE attached_forum_id=" . intval($HTTP_POST_VARS[POST_FORUM_URL]);
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't update subforums to new category", "", __LINE__, __FILE__, $sql);
}
}
}
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) .", attached_forum_id = " . intval($HTTP_POST_VARS['attached_forum_id']) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
// End Added by Easy Sub-Forums MOD
|
The find in my file
| Code:
|
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
, forum_postcount = " . intval($HTTP_POST_VARS['forum_postcount']) . "
WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);
|
|
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/23/2007 10:26 PM |
|
|
|
|
|
| Caravan |
| Posts |
282 |
| Word Cnt. |
31,380 |
| BDay |
Apr 14 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Nov 01, 2006
Local time: 11:17 PM
Location: Denver, PA
|

|
|
|
|
 |
| wait, I think I got it, sorry for jumping the gun there. It confused me the first time I saw it but I think I got it taken care of now. I might be right back with more though because this one seems to want to have trouble in every file! |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/23/2007 11:11 PM |
|
|
|
|
|
| Caravan |
| Posts |
282 |
| Word Cnt. |
31,380 |
| BDay |
Apr 14 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Nov 01, 2006
Local time: 11:17 PM
Location: Denver, PA
|

|
|
|
|
 |
Well I had to do 4 edits with a find and replace in .php files, and it obviously didn't work too well for me. But hey, I tried!
I got the mod to install smoothly with easyMOD, and do not have any errors yet that I can see, however the last post area of the index.php is messed up and the edits in the admin_forums.php didn't work either since I can't create a subforum.
I am going to go ahead and back it back out. I think my first edit was good, but this one I posted in this thread first might be the first edit where I went wrong. Can you go over it and let me know what the correct find and replace would be for this find.
It's probably easier for me to start over and get your help than for you to go troubleshoot my meshing of mods.  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/24/2007 2:24 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 11:17 PM
Location: St Pete, FL
|

|
|
|
|
 |
The first major problem I see with this MOD is that the files listed in most of the OPEN commands start with a /. Even though EM doesn't flag this as an error, EM will not overwrite those files with the edited versions. Since some of the OPEN commands are correct, that would explain why the MOD didn't install correctly. Some of the files were successfully modified while others weren't...
For example. This:
| Code:
|
#
#-----[ OPEN ]------------------------------------------------
#
/includes/functions.php
|
Should look like this instead:
| Code:
|
#
#-----[ OPEN ]------------------------------------------------
#
includes/functions.php
|
Many of the other OPENs need to be corrected as well...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/24/2007 2:47 PM |
|
|
|
|
|
| Caravan |
| Posts |
282 |
| Word Cnt. |
31,380 |
| BDay |
Apr 14 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Nov 01, 2006
Local time: 11:17 PM
Location: Denver, PA
|

|
|
|
|
 |
Yikes. Thank you, I will go through and fix all of those and try again and see how it goes. |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/24/2007 3:30 PM |
|
|
|
|
|
| Caravan |
| Posts |
282 |
| Word Cnt. |
31,380 |
| BDay |
Apr 14 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Nov 01, 2006
Local time: 11:17 PM
Location: Denver, PA
|

|
|
|
|
 |
Awesome! It is installed and working correctly except for my index.php edit.
The original mod:
| Code:
|
#
#-----[ FIND ]------------------------------------------------
#
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = $last_post_time . '<br />';
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
#
#-----[ REPLACE WITH ]----------------------------------------
#
// Modified by Easy Sub-Forums MOD
if (strlen($forum_data[$j]['topic_title'])>=25)
{
$forum_data[$j]['topic_title']=substr($forum_data[$j]['topic_title'], 0,25). "...";
}
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = '' . $last_post_time . '' . '<br />';
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> <a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
// END Modified by Easy Sub-Forums MOD
|
My original find I had to work with
| Code:
|
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = $last_post_time . '<br />';
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : color_group_colorize_name($forum_data[$j]['user_id']);
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
|
My edit that is not working. It was just a guess.
| Code:
|
#
#-----[ REPLACE WITH ]----------------------------------------
#
// Modified by Easy Sub-Forums MOD
if (strlen($forum_data[$j]['topic_title'])>=25)
{
$forum_data[$j]['topic_title']=substr($forum_data[$j]['topic_title'], 0,25). "...";
}
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = '' . $last_post_time . '' . '<br />';
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : color_group_colorize_name($forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> <a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
// END Modified by Easy Sub-Forums MOD
|
|
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/24/2007 11:22 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 11:17 PM
Location: St Pete, FL
|

|
|
|
|
 |
Yes, your guess was close. You added the color_group_colorize_name option correctly, but failed to remove the end of the hyperlink that it was replacing. This is the how you would fix the MOD script to install correctly:
OPEN
Easy Sub-Forums v1.0.8/install_edited.txt
FIND
| Code:
|
|
color_group_colorize_name($forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a>
|
IN-LINE FIND
| Code:
|
|
color_group_colorize_name($forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a>
|
IN-LINE REPLACE WITH
| Code:
|
|
color_group_colorize_name($forum_data[$j]['user_id']) . '
|
Save, upload, and try again using EM...
When done, the line would look like this:
| Code:
|
|
$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : color_group_colorize_name($forum_data[$j]['user_id']) . ' <a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
|
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/25/2007 7:58 AM |
|
|
|
|
|
| Caravan |
| Posts |
282 |
| Word Cnt. |
31,380 |
| BDay |
Apr 14 |
| Sign |
Aries |
| Sex |
 |
|
|
|
Joined: Nov 01, 2006
Local time: 11:17 PM
Location: Denver, PA
|

|
|
|
|
 |
Thank you very much Blake!  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: Need help with EM install |  |
Posted: 05/25/2007 3:27 PM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 11:17 PM
Location: St Pete, FL
|

|
|
|
|
 |
As always, you are quite welcome Sarah...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Information |  |
|