News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Karma Error

Started by rockinaway, October 08, 2006, 07:39:57 AM

Previous topic - Next topic

rockinaway

When I try giving someone karma I get this error:

QuoteParse error: syntax error, unexpected $end in /home/.endora/etcworld/adminfuel.com/forum/Sources/Karma.php on line 891

But that line doesn't exist in the file :S
Have I helped you? Then please join AdminFuel - The forum for forum administrators.

If you need help managing your forum, or maybe launching it, then visit us and view the quality articles, downloads and posts.

redone

By the sounds of it you have some mods installed, infact from your other post about the Googlebot mod you certainly do.

I would look at any changes to your sources that involve changes to karma.php. Maybe you have the karma description mod installed? Replacing the karma.php with a clean copy should fix it.

rockinaway

Yes I have karma description installed, should I manually do the changes? I think that is the only MOD that change karma.php right?
Have I helped you? Then please join AdminFuel - The forum for forum administrators.

If you need help managing your forum, or maybe launching it, then visit us and view the quality articles, downloads and posts.

rockinaway

I manually did all the changes but same problem!
Have I helped you? Then please join AdminFuel - The forum for forum administrators.

If you need help managing your forum, or maybe launching it, then visit us and view the quality articles, downloads and posts.

redone

Replacing that file should fix any parse errors with that file. Test it out by placing a ~ infront of your current karma.php file and upload a clean one.

Does it work? If it does and you can give and take karma then yes your edits are to blame for your issues.

;)

rockinaway

Right I did that and it worked fine, so Tried adding code again manually and I get this error:

Fatal error: Cannot redeclare modkarm() (previously declared in /home/.endora/etcworld/adminfuel.com/forum/Sources/Karma.php:40) in /home/.endora/etcworld/adminfuel.com/forum/Sources/Karma.php on line 396

The code I see is very similar in two parts:

function ModKarm()
{
        global $modSettings, $db_prefix, $txt, $ID_MEMBER, $user_info, $topic;

        // If the mod is disabled, show an error.
        if (empty($modSettings['karmaMode']))
                fatal_lang_error('smf63');

if (!empty($modSettings['karmasurv']))
                ModKarm();

        // If you're a guest or can't do this, blow you off...
        is_not_guest();
// If you have ANY warning, also blow you off
if ($user_info['warning'] > 1)
fatal_error($txt['visual_no_karma']);
        isAllowedTo('karma_edit');

        checkSession('get');

        // If you don't have enough posts, tough luck.
        // !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
        if ($user_info['posts'] < $modSettings['karmaMinPosts'])
                fatal_error($txt['smf60'] . $modSettings['karmaMinPosts'] . '.');

        // And you can't modify your own, punk! (use the profile if you need to.)
        if (empty($_REQUEST['uid']) || (int) $_REQUEST['uid'] == $ID_MEMBER)
                fatal_lang_error('smf61', false);

        // The user ID _must_ be a number, no matter what.
        $_REQUEST['uid'] = (int) $_REQUEST['uid'];

        // Applauding or smiting?
        $dir = $_REQUEST['sa'] != 'applaud' ? -1 : 1;

        // Users can change karma to only topic starter if you check this function
        if (!empty($modSettings['karmatopicstarter']))
        {
        $request = db_query("
                        SELECT ID_MEMBER_STARTED
                        FROM {$db_prefix}topics
                        WHERE ID_TOPIC = $_REQUEST[topic]
                        LIMIT 1", __FILE__, __LINE__);
        $row = mysql_fetch_row($request);
                mysql_free_result($request);
        if ($_REQUEST['uid'] != $row[0] && $user_info['is_admin']!=1)
              fatal_lang_error('karma_not_topic_starter', false);
        }

        // Start off with no change in karma.
        $action = 0;

        (!isset($modSettings['karmawhatwrite'])) ? $Description='' : $Description=$modSettings['karmawhatwrite'];


          // Not an administrator... or one who is restricted as well.
        if (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum'))
        {
                // Find out if this user has done this recently...
                $request = db_query("
                        SELECT action
                        FROM {$db_prefix}log_karma
                        WHERE ID_TARGET = $_REQUEST[uid]
                                AND ID_EXECUTOR = $ID_MEMBER
                        LIMIT 1", __FILE__, __LINE__);
                if (mysql_num_rows($request) > 0)
                        list ($action) = mysql_fetch_row($request);
                mysql_free_result($request);
        }

        // They haven't, not before now, anyhow.
        if (empty($action) || empty($modSettings['karmaWaitTime']))
        {
                //Prepare link
                    if (isset ($_REQUEST['topic'])) {
                         $link = ($_REQUEST['topic']).'.msg'.($_REQUEST['m']).'#'.'msg'.($_REQUEST['m']);
                         $link = AddSlashes($link);
                         }
                elseif (isset($_REQUEST['f'])) {
                         $link = 'PM';
                         }

                // Put it in the log.
                db_query("
                        INSERT INTO {$db_prefix}log_karma
                                (action, ID_TARGET, Description, link, ID_EXECUTOR, logTime)
                        VALUES ($dir, $_REQUEST[uid], '$Description', '$link', $ID_MEMBER, ". time()." )
                        ", __FILE__, __LINE__);

                // Change by one.
                updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karmaGood' : 'karmaBad' => '+'));
        }
        else
        {       $request = db_query("
                                        SELECT logTime
                                        FROM {$db_prefix}log_karma
                                        WHERE ID_TARGET=$_REQUEST[uid]
                                        AND ID_EXECUTOR=$ID_MEMBER
                                        ORDER BY logTime DESC
                                        LIMIT 1
                                        ", __FILE__, __LINE__);
                $row = mysql_fetch_assoc($request);
                mysql_free_result($request);

                $restricttime = time() - $row['logTime'];
                $timelog = (int) ($modSettings['karmaWaitTime'] * 3600);

                // If you are gonna try to repeat.... don't allow it.
                if ($restricttime < $timelog)
                        fatal_error($txt['smf62'] . ' ' . $modSettings['karmaWaitTime'] . ' ' . $txt[578] . '.', false);

                //Prepare link
                    if (isset ($_REQUEST['topic'])) {
                         $link = ($_REQUEST['topic']).'.msg'.($_REQUEST['m']).'#'.'msg'.($_REQUEST['m']);
                         $link = AddSlashes($link);
                         }
                elseif (isset($_REQUEST['f'])) {
                         $link = 'PM';
                         }

                // You decided to go back on your previous choice?
                db_query("
                        INSERT INTO {$db_prefix}log_karma
                                (action, ID_TARGET, Description, link, ID_EXECUTOR, logTime)
                        VALUES ($dir, $_REQUEST[uid], '$Description', '$link', $ID_MEMBER, ". time()." )
                        ", __FILE__, __LINE__);

                // It was recently changed the OTHER way... so... reverse it!
                if ($dir == 1)
                        updateMemberData($_REQUEST['uid'], array('karmaGood' => '+', 'karmaBad' => '-'));
                else
                        updateMemberData($_REQUEST['uid'], array('karmaBad' => '+'));
        }

        // Figure out where to go back to.... the topic?
        if (isset($topic))
                redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . '#msg' . $_REQUEST['m']);
        // Hrm... maybe a personal message?
        elseif (isset($_REQUEST['f']))
                redirectexit('action=pm;f=' . $_REQUEST['f'] . ';start=' . $_REQUEST['start'] . (isset($_REQUEST['l']) ? ';l=' . $_REQUEST['l'] : '') . (isset($_REQUEST['pm']) ? '#' . $_REQUEST['pm'] : ''));

          else
        {
                echo '
<html>
        <head>
                <title>...</title>
                <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
                        history.go(-1);
                // ]',']></script>
        </head>
        <body>&laquo;</body>
</html>';

                obExit(false);
        }
}


and:

function ModKarm()
{
        global $modSettings, $db_prefix, $txt, $ID_MEMBER, $user_info, $topic, $options, $scripturl;

        // If the mod is disabled, show an error.
        if (empty($modSettings['karmaMode']))
                fatal_lang_error('smf63');

        // If you're a guest or can't do this, blow you off...
        is_not_guest();
        isAllowedTo('karma_edit');

        checkSession('get');

        // If you don't have enough posts, tough luck.
        // !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
        if ($user_info['posts'] < $modSettings['karmaMinPosts'])
                fatal_error($txt['smf60'] . $modSettings['karmaMinPosts'] . '.');

        // And you can't modify your own, punk! (use the profile if you need to.)
        if (empty($_REQUEST['uid']) || (int) $_REQUEST['uid'] == $ID_MEMBER)
                fatal_lang_error('smf61', false);

        // The user ID _must_ be a number, no matter what.
        $_REQUEST['uid'] = (int) $_REQUEST['uid'];

        // Applauding or smiting?
        $dir = $_REQUEST['sa'] != 'applaud' ? -1 : 1;

        // Users can change karma to only topic starter if you check this function
        if (!empty($modSettings['karmatopicstarter']))
        {
        $request = db_query("
                        SELECT ID_MEMBER_STARTED
                        FROM {$db_prefix}topics
                        WHERE ID_TOPIC = $_REQUEST[topic]
                        LIMIT 1", __FILE__, __LINE__);
        $row = mysql_fetch_row($request);
                mysql_free_result($request);
        if ($_REQUEST['uid'] != $row[0] && $user_info['is_admin']!=1)
              fatal_lang_error('karma_not_topic_starter', false);
        }

        // Start off with no change in karma.
        $action = 0;

        (!isset($modSettings['karmawhatwrite'])) ? $Description='' : $Description=$modSettings['karmawhatwrite'];


          // Not an administrator... or one who is restricted as well.
        if (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum'))
        {
                // Find out if this user has done this recently...
                $request = db_query("
                        SELECT action
                        FROM {$db_prefix}log_karma
                        WHERE ID_TARGET = $_REQUEST[uid]
                                AND ID_EXECUTOR = $ID_MEMBER
                        LIMIT 1", __FILE__, __LINE__);
                if (mysql_num_rows($request) > 0)
                        list ($action) = mysql_fetch_row($request);
                mysql_free_result($request);
        }

        // They haven't, not before now, anyhow.
        if (empty($action) || empty($modSettings['karmaWaitTime']))
        {
                //Prepare link
                    if (isset ($_REQUEST['topic'])) {
                         $link = ($_REQUEST['topic']).'.msg'.($_REQUEST['m']).'#'.'msg'.($_REQUEST['m']);
                         $link = AddSlashes($link);
                         }
                elseif (isset($_REQUEST['f'])) {
                         $link = 'PM';
                         }

                // Put it in the log.
                db_query("
                        INSERT INTO {$db_prefix}log_karma
                                (action, ID_TARGET, Description, link, ID_EXECUTOR, logTime)
                        VALUES ($dir, $_REQUEST[uid], '$Description', '$link', $ID_MEMBER, ". time()." )
                        ", __FILE__, __LINE__);

                // Change by one.
                updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karmaGood' : 'karmaBad' => '+'));
        }
        else
        {       $request = db_query("
                                        SELECT logTime
                                        FROM {$db_prefix}log_karma
                                        WHERE ID_TARGET=$_REQUEST[uid]
                                        AND ID_EXECUTOR=$ID_MEMBER
                                        ORDER BY logTime DESC
                                        LIMIT 1
                                        ", __FILE__, __LINE__);
                $row = mysql_fetch_assoc($request);
                mysql_free_result($request);

                $restricttime = time() - $row['logTime'];
                $timelog = (int) ($modSettings['karmaWaitTime'] * 3600);

                // If you are gonna try to repeat.... don't allow it.
                if ($restricttime < $timelog)
                        fatal_error($txt['smf62'] . ' ' . $modSettings['karmaWaitTime'] . ' ' . $txt[578] . '.', false);

                //Prepare link
                    if (isset ($_REQUEST['topic'])) {
                         $link = ($_REQUEST['topic']).'.msg'.($_REQUEST['m']).'#'.'msg'.($_REQUEST['m']);
                         $link = AddSlashes($link);
                         }
                elseif (isset($_REQUEST['f'])) {
                         $link = 'PM';
                         }

                // You decided to go back on your previous choice?
                db_query("
                        INSERT INTO {$db_prefix}log_karma
                                (action, ID_TARGET, Description, link, ID_EXECUTOR, logTime)
                        VALUES ($dir, $_REQUEST[uid], '$Description', '$link', $ID_MEMBER, ". time()." )
                        ", __FILE__, __LINE__);

                // It was recently changed the OTHER way... so... reverse it!
                if ($dir == 1)
                        updateMemberData($_REQUEST['uid'], array('karmaGood' => '+'));
                else
                        updateMemberData($_REQUEST['uid'], array('karmaBad' => '+'));
        }

$request = db_query("
SELECT value
FROM {$db_prefix}themes
WHERE variable='enable_notify'
AND ID_MEMBER=$_REQUEST[uid]
", __FILE__, __LINE__);
$row = mysql_fetch_row($request);
mysql_free_result($request);

if (isset($modSettings['karmanotifier']) && !$user_info['is_guest'] && ($row['0'])==2)
        {
        $link=='PM' ? $url=$scripturl.'?action=pm' : $url=$scripturl.'?topic='.$link;
     
if ($modSettings['karma_pm_send_link'])
if ($modSettings['karma_pm_send_changelink'])
{
$karma_pm_body = $txt['karma_pm_body'].$txt['karma_pm_body2'].$_REQUEST['uid'].$txt['karma_pm_send_changelink'].$url;
}
else
{
$karma_pm_body = $txt['karma_pm_body'].$txt['karma_pm_body2'].$_REQUEST['uid'];
}
else
$karma_pm_body = $txt['karma_pm_body'];

db_query("
INSERT INTO {$db_prefix}personal_messages
(ID_MEMBER_FROM, deletedBySender, fromName, subject, body, msgtime)
VALUES (SUBSTRING('$modSettings[karmaidmember]',1,255), '1', 'Admin', SUBSTRING('$txt[karma_pm_subject]', 1, 255), SUBSTRING('$karma_pm_body', 1, 65534), " . time() . ")
", __FILE__, __LINE__);

$ID_PM = db_insert_id();
$ID_PM2 = $_REQUEST['uid'];

db_query("
INSERT INTO {$db_prefix}pm_recipients
(ID_PM, ID_MEMBER)
VALUES ($ID_PM, $ID_PM2)", __FILE__, __LINE__);

db_query("
UPDATE {$db_prefix}log_karma
SET is_read=1
WHERE is_read=0
AND ID_TARGET=$_REQUEST[uid]
", __FILE__, __LINE__);

updateMemberData($_REQUEST['uid'], array('instantMessages' => '+', 'unreadMessages' => '+'));

}

        // Figure out where to go back to.... the topic?
        if (isset($topic))
                redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . '#msg' . $_REQUEST['m']);
        // Hrm... maybe a personal message?
        elseif (isset($_REQUEST['f']))
                redirectexit('action=pm;f=' . $_REQUEST['f'] . ';start=' . $_REQUEST['start'] . (isset($_REQUEST['l']) ? ';l=' . $_REQUEST['l'] : '') . (isset($_REQUEST['pm']) ? '#' . $_REQUEST['pm'] : ''));

          else
        {
                echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
        <head>
                <title>...</title>
                <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
                        history.go(-1);
                // ]',']></script>
        </head>
        <body>&laquo;</body>
</html>';

                obExit(false);
        }
}


But that is what it tells me to do in the install
Have I helped you? Then please join AdminFuel - The forum for forum administrators.

If you need help managing your forum, or maybe launching it, then visit us and view the quality articles, downloads and posts.

JayBachatero

Delete one of the duplicate functions.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Advertisement: