Karma Description Mod

Started by Grek.Kamchatka, September 11, 2005, 11:48:26 PM

Previous topic - Next topic

Grek.Kamchatka


Grek.Kamchatka

New version now available. (Karma_Description_Mod_ver.1.8)

Grek.Kamchatka

Quote from: Brasileira on October 19, 2005, 04:49:04 AM
I want them to see the reason why they got + or - ....
but not who chanegd the karma  ::)
The most light variant is find in Viewkarma.template.php this code:

elseif (!empty($modSettings['karmalogview']))
{
        echo '
                        <tr class="windowbg">
                                <td width="14%" align="center"><a href="'. $scripturl . '?action=profile;u=' . $member['id_exec'] . '" title="' . $txt[92] . ' ' . $member['executor'] . '">' . $member['executor'] . '</a>';
                                if (!empty($modSettings['karmakarma']))
                                                echo' <span class="smalltext">(+',$member['executorkarmagood'],'/-',$member['executorkarmabad'],')</span>';
        echo '</td>

And replace it with this code:

elseif (!empty($modSettings['karmalogview']))
{
        echo '
                        <tr class="windowbg">
                                <td width="14%" align="center"></td>

Admin can see who it was, but other users not.

SirGotxi

Hi,

first of all congratulations for your great mod, one of my favourites !!!

Now I'm using v1.7 and I people has voted around 30 times. I want install this new mod and keep the old votes and descriptions. I think first I've to uninstall and then install mod 1.8, but I want to know if message will be there or will be lost.

Thanks again

Grek.Kamchatka

It will be lost. Hm...what you can do to keep old votes...
First of all, you can do all mod actions by your hand (Search and replace)
Second, i think, you can open Karma_Description_Mod_ver.1.7.zip on your server (Forum/Packages)
and edit file package-info.xml You must remove this code:

<code>uninstall.php</code>

And then you can uninstall mod. If you can't edit this file, just download it, i mean Karma_Description_Mod_ver.1.7.zip, from your host, unzip to the folder, edit package-info.xml and zip all files again to the Karma_Description_Mod_ver.1.7.zip. Upload back to the server, where it was and uninstall the mod. I think so =)
And third. You can copy your table "db_prefix_log_karma" on your mysql database to other place, like _log_karma2, for example, uninstall the mod, install new version and then replace _log_karma with old table _log_karma2. Don't forget to rename it to _log_karma =) You will save all your actions.

Can i see your worked version of my mod?

JustJa


SirGotxi

Quote from: Grek_Kamchatka on October 20, 2005, 07:52:54 PM
Can i see your worked version of my mod?

YEEEEES !!!

hxxp:foro.ssaf.net [nonactive]

Forum language is only in spanish. It's a forum for saint seiya knights of the zodiac collectors toys. To view the Karma (in my forums called Cosmos) you've to registry first. Please register with your username Grek_Kamchatka. The problem is you need 50 messages to see stats.

No spam please  :P I prefer send you a pictures of this mod working in my forums:  :P

hxxp:img454.imageshack.us/my.php?image=karma033xe.jpg [nonactive] hxxp:img454.imageshack.us/my.php?image=karma016gl.jpg [nonactive] hxxp:img454.imageshack.us/my.php?image=karma023hq.jpg [nonactive]

now I will test the mod. I've updated to v1.8 and I haven't lost votes. That's great by the moment !!!

SirGotxi

Hi,

I've a big problem !!! please help me !!!

Anybody can not vote !!!

I've removed the code uninstall.php as you've said me, then I've unistall the v1.7 mod and then I've installed v1.8, but when I want to vote to someone, I read the next message:

QuoteParse error: parse error, unexpected '}' in /home/ssafnet/public_html/foro/Sources/Karma.php on line 251

I think I've a problem with karma.php because I can not send any vote.

Please send me your karma.php to compare. My mail is [email protected]

Thanks

m00h

I think there's a conflict between your new version and the "show-only-negative-function" http://www.simplemachines.org/community/index.php?topic=49088.msg365050#msg365050



I. i get only this

II. and in the where-field i get only http://xy.com/smf/index.php?topic= without any topic numbers


would be great if you could fix it :)

Grek.Kamchatka

Quote from: SirGotxi on October 21, 2005, 08:29:16 AM
Hi,

I've a big problem !!! please help me !!!

Anybody can not vote !!!

I've removed the code uninstall.php as you've said me, then I've unistall the v1.7 mod and then I've installed v1.8, but when I want to vote to someone, I read the next message:

QuoteParse error: parse error, unexpected '}' in /home/ssafnet/public_html/foro/Sources/Karma.php on line 251

I think I've a problem with karma.php because I can not send any vote.

Please send me your karma.php to compare. My mail is [email protected]

Thanks
Delete 2 close brackets at the end of the file Karma.php. (When package manager uninstalling the mod, it can't remove it. I don't know why.)

Grek.Kamchatka

Quote from: m00h on October 21, 2005, 06:19:45 PM
I think there's a conflict between your new version and the "show-only-negative-function" http://www.simplemachines.org/community/index.php?topic=49088.msg365050#msg365050



I. i get only this

II. and in the where-field i get only http://xy.com/smf/index.php?topic= without any topic numbers


would be great if you could fix it :)
Hi, m00h =)
What version do you use? Do you have any errors in Error Log? If you use ver.1.8 what version do you use until you installed ver.1.8?

m00h

Oops :D

version 1.8 (+SMF 1.1 RC1)

I have a fresh install of my forum, so no previous version of your mod.

this is the error log when i run http://xysite.com/smf/index.php?action=viewkarma




thanks :)

SirGotxi

Quote from: Grek_Kamchatka on October 21, 2005, 08:25:53 PM
Delete 2 close brackets at the end of the file Karma.php. (When package manager uninstalling the mod, it can't remove it. I don't know why.)
This is not the error.  I do it and I see the same error. Please send me the karma.php file to my mail or if you say your mail, I can send tiy my Karma.php.

I will pu here as a quote:

Quote<?php
/******************************************************************************
* Karma.php                                                                   *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel ([email protected])                *
* =========================================================================== *
* Software Version:           SMF 1.1 Beta 3 Public                           *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2005 by:     Lewis Media (hxxp:www.lewismedia.com [nonactive])         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/
if (!defined('SMF'))
   die('Hacking attempt...');

/*   This file contains one humble function, which applauds or smites a user.

   void ModifyKarma()
      - gives or takes karma from a user.
      - redirects back to the referrer afterward, whether by javascript or
        the passed parameters.
      - requires the karma_edit permission, and that the user isn't a guest.
      - depends on the karmaMode, karmaWaitTime, and karmaTimeRestrictAdmins
        settings.
      - is accessed via ?action=modifykarma.
*/

// Modify a user's karma.
function ModifyKarma()
{
   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 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;

   // Delete any older items from the log. (karmaWaitTime is by hour.)
   db_query("
      DELETE FROM {$db_prefix}log_karma
      WHERE " . time() . " - logTime > " . (int) ($modSettings['karmaWaitTime'] * 3600), __FILE__, __LINE__);

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

   // 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']))
   {
      // Put it in the log.
      db_query("
         REPLACE INTO {$db_prefix}log_karma
            (action, ID_TARGET, ID_EXECUTOR, logTime)
         VALUES ($dir, $_REQUEST[uid], $ID_MEMBER, " . time() . ')', __FILE__, __LINE__);

      // Change by one.
      updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karmaGood' : 'karmaBad' => '+'));
   }
   else
   {
      // If you are gonna try to repeat.... don't allow it.
      if ($action == $dir)
         fatal_error($txt['smf62'] . ' ' . $modSettings['karmaWaitTime'] . ' ' . $txt[578] . '.', false);

      // You decided to go back on your previous choice?
      db_query("
         UPDATE {$db_prefix}log_karma
         SET action = $dir, logTime = " . time() . "
         WHERE ID_TARGET = $_REQUEST[uid]
            AND ID_EXECUTOR = $ID_MEMBER
         LIMIT 1", __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' => '+', 'karmaGood' => '-'));
   }

   // 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'] : ''));
   // JavaScript as a last resort.
   else
   {
      echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "hxxp:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd [nonactive]">
<html>
   <head>
      <title>...</title>
      <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
         history.go(-1);
      // ]]></script>
   </head>
   <body>&laquo;</body>
</html>';

      obExit(false);
   }
}

// What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No siree.
function BookOfUnknown()
{
   global $context;

   if (strpos($_GET['action'], 'mozilla') !== false && !$context['browser']['is_gecko'])
      redirectexit('hxxp:www.getfirefox.com/'); [nonactive]
   elseif (strpos($_GET['action'], 'mozilla') !== false)
      redirectexit('about:mozilla');

   echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "hxxp:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd [nonactive]">
<html>
   <head>
      <title>The Book of Unknown, ', @$_GET['verse'] == '2:18' ? '2:18' : '4:16', '</title>
      <style type="text/css">
         em
         {
            font-size: 1.3em;
            line-height: 0;
         }
      </style>
   </head>
   <body style="background-color: #444455; color: white; font-style: italic; font-family: serif;">
      <div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">';
   if (@$_GET['verse'] == '2:18')
      echo '
         Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none.&nbsp;And it became to be in those days <em>something</em>.&nbsp; Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind.&nbsp; And thus what was to be known the <em>secret project</em> began into its existence.&nbsp; Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.';
   else
      echo '
         And it came to pass that the <em>unbelievers</em> dwindled in number, and the opposition found fear from the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together.&nbsp; Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to those on both sides.';
   echo '
      </div>
      <div style="margin-top: 2ex; font-size: 2em; text-align: right;">';
   if (@$_GET['verse'] == '2:18')
      echo '
         from <span style="font-family: Georgia, serif;"><strong><a href="hxxp:www.unknownbrackets.com/about:unknown [nonactive]" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>';
   else
      echo '
         from <span style="font-family: Georgia, serif;"><strong><a href="hxxp:www.unknownbrackets.com/about:unknown [nonactive]" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>';
   echo '
      </div>
   </body>
</html>';

   obExit(false);
}

?>

Thanks

Grek.Kamchatka

SirGotxi, i found some errors in your posted code, but i will send you a mail with Karma.php. Sorry for this error.

Grek.Kamchatka

Hm, i just now install SMF 11RC1 + Mod 1.8 but everything ok. May be you edit source code?  May be you try to install "show-only-negative-function"? It's a new version, so one of the changes may corrupt file.

m00h

Quote from: Grek_Kamchatka on October 22, 2005, 07:52:26 PM
Hm, i just now install SMF 11RC1 + Mod 1.8 but everything ok. May be you edit source code?  May be you try to install "show-only-negative-function"? It's a new version, so one of the changes may corrupt file.

Yes, i changed the source code because of the "show-only-negative-function".

It's all perfect when i install only the mod without the "show-only-negative-function". Because of this I said there's a conflict between this. :(

m00h

Thanks for your new version 1.9

I've installed it (without any modifications) but I (Admin) can't see the Link to the log on the Board Index. What's wrong? :(

On a fresh install of SMF i can see the link.

Grek.Kamchatka

SMF Default Theme? Do you enabled mod in admin panel?

P.S. New version 1.9.2 Update your mod.

m00h

Quote from: Grek_Kamchatka on October 27, 2005, 09:47:19 PM
SMF Default Theme? Do you enabled mod in admin panel?

P.S. New version 1.9.2 Update your mod.

Yes, SMF default theme and i enabled the mod.

I've updatet it too but the same strange problem.

m00h

And: If I applaud to an user, i get this message:

Parse error: parse error, unexpected $ in /usr/export/www/xy/abc/hosting/user/Sources/Karma.php on line 274

(original zip package of you, no source changed)

Advertisement: