menu_bgservdownloadthemesdirforumhome
Smf عربى



المحرر موضوع: error in karma.php  (زيارة 5491 مرات)

0 الأعضاء و 1 ضيف يشاهدون هذا الموضوع.

غير متصل Mr. Anaboussi

  • الدعم الفنى
  • *
  • مشاركة: 33
  • الشعبية: +2/-0
    • مشاهدة الملف الشخصي
error in karma.php
« في: 13 , يوليو, 2009 - 01:28:42 مسائاً »
اكتير جربت بمود الكارمات المحدودة  بس شكلو ما رح يظبط دائما عم يعطي خطأ رغم اني عدلت يدويا عليه بس ماعم يظبط

بتمنى حدا اجربلي ياه وشفلي المشكلة وين

./
Sources/Karma.php
Find:
شفرة: [اختيار]
// The user ID _must_ be a number, no matter what.
$_REQUEST['uid'] = (int) $_REQUEST['uid'];

Add Before:
شفرة: [اختيار]
// Get the PM or Post that we have to record that this Karma has been given to...
if(!empty($_REQUEST['m'])
&& LimitKarma_message_exists((int) $_REQUEST['m'], 'm'))
{
$message_id = (int) $_REQUEST['m'];
$type = 'm';
}
elseif(!empty($_REQUEST['pm'])
&& LimitKarma_message_exists((int) $_REQUEST['pm'], 'pm'))
{
$message_id = (int) $_REQUEST['pm'];
$type = 'pm';
}
// Otherwise, show an error message.
else
fatal_lang_error('LimitKarma_error2', false);



Find:
شفرة: [اختيار]
// 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' => '-'));
}

Replace With:
شفرة: [اختيار]
// Is the user not limited by the Limit Karma Mod?
if(!is_LimitedByKarma($message_id, $type))
{
// 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' => '-'));
}
// Finally, increment the karma count.
increment_LimitKarmaCount($message_id, $type);
}
// Well, if they are limited then show the user an error message.
else
fatal_lang_error('LimitKarma_error', false);


Find (at the end of the file):

شفرة: [اختيار]
?>Add Before:
شفرة: [اختيار]

// Function to work out, if the current user can give karma to a specific PM or Post.
// Assume that they are allowed to give karma normally, just find out if they are restricted by the Limit Karma Mod or not.
function is_LimitedByKarma($id, $type)
{
global $db_prefix, $user_info, $ID_MEMBER, $modSettings, $user_settings;

$max_count = 0;
// Go through and check this users membergroups for a higher max count.
foreach($user_info['groups'] as $group_id)
{
// Do we have a supergroup? With no max limit? And a valid group?
if(empty($modSettings['LimitKarma_'.$group_id]) && !(!empty($user_settings['ID_POST_GROUP']) && ($group_id == $user_settings['ID_POST_GROUP']) && empty($modSettings['permission_enable_postgroups'])))
return false;
// Otherwise, check to see if this group has a higher max limit, then previous groups.
elseif(!empty($modSettings['LimitKarma_'.$group_id])
&& ($modSettings['LimitKarma_'.$group_id] > $max_count))
$max_count = $modSettings['LimitKarma_'.$group_id];
}

$count = 0;
// Try to work out the current count of the karma for this post.
$request = db_query("
SELECT count
FROM {$db_prefix}limit_karma
WHERE ID_MSG = $id
AND ID_EXECUTOR = '$ID_MEMBER'
AND type = '$type'
LIMIT 1", __FILE__, __LINE__);

if (mysql_num_rows($request) > 0)
list ($count) = mysql_fetch_row($request);

// Don't forget to free the db request!
mysql_free_result($request);

// Is our count value more than our max count value? If so, then return true.
if($count >= $max_count)
return true;

// Otherwise, we have just let them add some more karma.
return false;
}

// Function to increment the count of Karma for a particular PM/Post.
function increment_LimitKarmaCount($id, $type)
{
global $db_prefix, $ID_MEMBER;

// Try to find an already existing value;
$request = db_query("
SELECT count
FROM {$db_prefix}limit_karma
WHERE ID_EXECUTOR = '$ID_MEMBER'
AND ID_MSG = '$id'
AND type = '$type'
LIMIT 1", __FILE__, __LINE__);

// Try to get the count value.
if (mysql_num_rows($request) > 0)
list ($count) = mysql_fetch_row($request);

// Don't forget to free the db request!
mysql_free_result($request);

// If we have no count value, then assume its 1.
if(empty($count))
$count = 1;
// Otherwise, we can increment the count value.
else
$count++;

// Finally save the new count value, and be happy!!! :D
db_query("
REPLACE INTO {$db_prefix}limit_karma
(ID_EXECUTOR, ID_MSG, count, type)
VALUES
('$ID_MEMBER', '$id', '$count', '$type')", __FILE__, __LINE__);
}
// Function to check if this message actually exists.
function LimitKarma_message_exists($msg_id, $type)
{
global $db_prefix;

if($type == 'pm')
{
$select_var = 'ID_PM';
$table = 'pm_recipients';
}
else
{
$select_var = 'ID_MSG';
$table = 'messages';
}

// Try to find an already existing value;
$request = db_query("
SELECT $select_var
FROM {$db_prefix}$table
WHERE $select_var = '$msg_id'", __FILE__, __LINE__);

// Try to get the count value.
if (mysql_num_rows($request) > 0)
list ($return) = mysql_fetch_row($request);

// Don't forget to free the db request!
mysql_free_result($request);

// If we have a valid message ID.
if(!empty($return))
return true;
// Otherwise, return false.
return false;
}


غير متصل SAFAD

  • الدعم الفنى
  • *
  • مشاركة: 392
  • الشعبية: +11/-1
  • الجنس: ذكر
  • دمتم في حفظ الرحمن
    • مشاهدة الملف الشخصي
    • أكاديمية صفد سوفت
رد: error in karma.php
« رد #1 في: 13 , يوليو, 2009 - 01:50:50 مسائاً »
ممكن تعطينا الخطأ بالكامل ؟
دمتم في حفظ الرحمن
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron inc

غير متصل islam2hamy

  • فريق الإدارة
  • *
  • مشاركة: 952
  • الشعبية: +23/-0
  • الجنس: ذكر
  • أهلا بك فى موقع smf عربى
    • مشاهدة الملف الشخصي
رد: error in karma.php
« رد #2 في: 13 , يوليو, 2009 - 01:57:50 مسائاً »
ما هو اسم المود او الرابط الخاص به



غير متصل Mr. Anaboussi

  • الدعم الفنى
  • *
  • مشاركة: 33
  • الشعبية: +2/-0
    • مشاهدة الملف الشخصي
رد: error in karma.php
« رد #3 في: 13 , يوليو, 2009 - 04:48:14 مسائاً »
أسف انسيت اذكر اسم المود
المود هو
http://custom.simplemachines.org/mods/index.php?mod=1308
الخطأ فقط بالملف
karma.php

غير متصل SAFAD

  • الدعم الفنى
  • *
  • مشاركة: 392
  • الشعبية: +11/-1
  • الجنس: ذكر
  • دمتم في حفظ الرحمن
    • مشاهدة الملف الشخصي
    • أكاديمية صفد سوفت
رد: error in karma.php
« رد #4 في: 13 , يوليو, 2009 - 10:13:45 مسائاً »
أعلم أن الخطأ هناك
لكن ماهو الخطأ ؟
دمتم في حفظ الرحمن
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron inc

غير متصل Mr. Anaboussi

  • الدعم الفنى
  • *
  • مشاركة: 33
  • الشعبية: +2/-0
    • مشاهدة الملف الشخصي
رد: error in karma.php
« رد #5 في: 14 , يوليو, 2009 - 12:47:53 صباحاً »
الخطأ لما احاول نزل المود المذكور في الاعلى
انا رح ارجع جرب بكرا وانشالله خير
« آخر تحرير: 14 , يوليو, 2009 - 12:50:43 صباحاً بواسطة Mr. Anaboussi »

غير متصل SAFAD

  • الدعم الفنى
  • *
  • مشاركة: 392
  • الشعبية: +11/-1
  • الجنس: ذكر
  • دمتم في حفظ الرحمن
    • مشاهدة الملف الشخصي
    • أكاديمية صفد سوفت
رد: error in karma.php
« رد #6 في: 14 , يوليو, 2009 - 09:07:46 صباحاً »
يا عمي أعلم أن الخطأ في ذلك الملف
لكن ماهو الخطأ
ماذا يقول لك ؟
مثلا Parse Error On Line
Unexpected $End

ماذا يفول ؟
دمتم في حفظ الرحمن
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron inc