Intégration de la réputation de Dle Forum Dans DataLife Engine

17 Dec, 2020

816 Vues

1 Commentaires



Intégration de la réputation de Dle Forum Dans DataLife Engine

Installation du hack sur le site:

1. Dans le fichier: engine/modules/show.full.php, trouvez la ligne:

$comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, " . PREFIX . "_comments.rating, " . PREFIX . "_comments.vote_num, " . PREFIX . "_comments.parent, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, xfields FROM " . PREFIX . "_comments 
LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '$news_id'" . $where_approve . " ORDER BY " . PREFIX . "_comments.id " . $comm_msort;


Remplacer par
$comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, " . PREFIX . "_comments.rating, " . PREFIX . "_comments.vote_num, " . PREFIX . "_comments.parent, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, forum_reputation, xfields FROM " . PREFIX . "_comments 
LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '$news_id'" . $where_approve . " ORDER BY " . PREFIX . "_comments.id " . $comm_msort;


2. Dans le fichier: engine/modules/lastcomments.php, recherchez la ligne:
$comments->query = "SELECT cm.id, post_id, cm.user_id, cm.date, cm.autor as gast_name, cm.email as gast_email, text, ip, is_register, cm.rating, cm.vote_num, name, u.email, news_num, u.comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, u.xfields, p.title, p.date as newsdate, p.alt_name, p.category FROM 
" . PREFIX . "_comments cm LEFT JOIN " . PREFIX . "_post p ON cm.post_id=p.id LEFT JOIN " . USERPREFIX . "_users u ON cm.user_id=u.user_id INNER JOIN (SELECT cm.id FROM " . PREFIX . "_comments cm " . $join . $where . " ORDER BY id desc LIMIT ".$fromcstart.", ".intval($config['comm_nummers'])." ) as sub ON sub.id = cm.id ORDER BY id desc";


Remplacer par
$comments->query = "SELECT cm.id, post_id, cm.user_id, cm.date, cm.autor as gast_name, cm.email as gast_email, text, ip, is_register, cm.rating, cm.vote_num, name, u.email, news_num, u.comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, forum_reputation, u.xfields, p.title, p.date as newsdate, p.alt_name, p.category 
FROM " . PREFIX . "_comments cm LEFT JOIN " . PREFIX . "_post p ON cm.post_id=p.id LEFT JOIN " . USERPREFIX . "_users u ON cm.user_id=u.user_id INNER JOIN (SELECT cm.id FROM " . PREFIX . "_comments cm " . $join . $where . " ORDER BY id desc LIMIT ".$fromcstart.", ".intval($config['comm_nummers'])." ) as sub ON sub.id = cm.id ORDER BY id desc";


3. Dans le fichier engine/classes/comments.class.php recherchez la ligne:
$tpl->set( '{comment}', "<div>" . $row['text'] . "</div>" );


Ajoutez en dessous Attention remplacer [THEME] par {THEME}
require_once ENGINE_DIR . '/data/forum_config.php';
			require_once ENGINE_DIR . '/forum/sources/modules/dle_func.php';
			
			if ($forum_config['reputation']) {
				$rep_m = "<a><img src="{THEME}/forum/images/rep_mf.gif" alt="-" border="0"></a> ";
	                        $rep_p = " <a><img src="{THEME}/forum/images/rep_p.gif" alt="+" border="0"></a>";
				$reputation = $rep_m . link_rep($row['name'], $row['forum_reputation']) . $rep_p;
				$tpl->set('{reputation}', "<span id="rep-&quot;.$row[">".$reputation."</span>");
			}
			else {
				$tpl->set('{reputation}', "--");
			}
			unset ($reputation);


4. Dans le fichier engine/modules/profile.php, recherchez la ligne:
$tpl->set( '{lastdate}', langdate( "j F Y H:i", $row['lastdate'] ) );


Ajoutez en dessous Attention remplacer [THEME] par {THEME}
require_once ENGINE_DIR . '/data/forum_config.php';
	require_once ENGINE_DIR . '/forum/sources/modules/dle_func.php';
			
	if ($forum_config['reputation']) {
	  $rep_m = "<a><img src="[THEME]/forum/images/rep_mf.gif" alt="-" border="0"></a> ";
	  $rep_p = " <a><img src="[THEME]/forum/images/rep_p.gif" alt="+" border="0"></a>";
	  $reputation = $rep_m . link_rep($row['name'], $row['forum_reputation']) . $rep_p;
	  $tpl->set('{reputation}', "<span>".$reputation."</span>");
	  } else {
	  $tpl->set('{reputation}', "--");
	  }
	unset ($reputation);


5. Dans le répertoire engine/forum/sources/modules/créez un fichier dle_func.php , et collez le code ci-dessous:
<?php

	if(!defined('DATALIFEENGINE')) die("Hacking attempt!");
	
	//reputation
	if (!function_exists("link_rep")) {
		function link_rep($user, $title = false) {
			global $config;
			
			if (!$title) $title = "0";
			
			if ($config['allow_alt_url'] == "yes") {
				$forum_url = $config['http_home_url']."forum";
				return("[url=/reputation/]{$title}[/url]");
			}
			else {
				$forum_url = $config['http_home_url']."index.php?do=forum";
				return("<a href="" target="_blank">{$title}</a>");
			}
		}
	}
?>


6. Dans le fichier main.tpl de votre modèle, après la ligne {AJAX}, insérez le code:
[aviable=showfull|lastcomments|userinfo][/aviable]


7. Enfin , dans les fichiers modèles: comments.tpl et userinfo.tpl , insérez {reputation} si nécessaire.

Ajouter un commentaire

Votre adresse électronique ne sera pas publiée. Les champs obligatoires sont marqués *

Information

Les utilisateurs du Invités ne sont pas autorisés à ajouter des commentaires à cette publication.

Commentaires 1
  1. 16-03-2025 11:39

    Svayke

    pour le Dle 16, est-il possible de refaire? Sur la version 16 ne fonctionne pas.

Sondage important
Quel version DataLife utilisez vous?

De mon avis perso, depuis la version 16.0 de Dle, vous n'êtes pas obligé de mettre à jour votre version. Depuis Dle 18.x avec l'intégration de l'IA la mise à jour n'a plus d'intêrets!!