Table des matières

Hacks et modifications effectuées sur Punbb

Swisslinux.org's templates

include/template/
	|-> admin.tpl
	|-> help.tpl
	|-> main.tpl
	|-> redirect.tpl
	|-> maintenance.tpl

style/
	|-> Swisslinux.css
	|-> import/
		|-> Swisslinux_cs.css
		|-> base.css

Configuration

./
	|-> conf.php

Navlinks modification

include/
	|-> functions.php

"Modéré par" removed

./
	|-> index.php

Copyright mention removed

./
	|-> footer.php

Language files

/lang/
	|-> French_UTF8
        |-> German_UTF8
        |-> Italian_UTF8

Converterd to UTF-8 from the iso8859-1 packages.

Language autoswitcher

In include/functions.php line 56 added

		/** Swisslinux.org language switcher **/
		 require_once('/home/g-swisslinux/www/static.swisslinux.org/inc/templates/default/sl_l10n_getlang.inc.php');
		$pun_user['language'] = sl_getlang();
 
 
		// Set a default language if the user selected language no longer exists
                [...]

Line 125 replaced

	$pun_user['language'] = $pun_config['o_default_lang'];

by

	/** Swisslinux.org language switcher **/
	require_once('/home/g-swisslinux/www/static.swisslinux.org/inc/templates/default/sl_l10n_getlang.inc.php');
	$pun_user['language'] = sl_getlang();

Symlinks created

include/
	|-> user --> static.swisslinux.org/inc/

./
	|-> images --> static.swisslinux.org/images/
	|-> css --> static.swisslinux.org/css/
/lang/ (to switch the languages)
	|-> fr --> French_UTF8
        |-> de --> German_UTF8
        |-> it --> Italian_UTF8
        |-> en --> English

Avatar

./
	|-> viewtopic.php

Replaced $user_avatar=””; by $user_avatar=”&nbsp;” to avoid having an empty <dd> tag

Extern.php

Replaced substr by mb_strcut to handle UTF-8 encoding.

$subject_truncated = pun_htmlspecialchars(trim(mb_strcut( $cur_topic['subject'], 0 , ($max_subject_length-5), "UTF-8" ))).'&hellip;';
// old version not able to handle UTF-8
//pun_htmlspecialchars(trim(substr($cur_topic['subject'], 0, ($max_subject_length-5)))).' &hellip;';

Replace the require function for the file functions.php and common_db.php by require_once, to avoid errors.

Icons

See icones

RSS

See rss

Easy BB code

http://www.punres.org/desc.php?pid=50 Add an edition bar to the message edition formular.

post.php : Line 493 replaced with

<?php endif; require PUN_ROOT.'mod_easy_bbcode.php'; ?>						<label><strong><?php echo $lang_common['Message'] ?></strong><br />

edit.php : Line 210 replace with

<?php endif; $bbcode_form = 'edit'; $bbcode_field = 'req_message'; require PUN_ROOT.'mod_easy_bbcode.php'; ?>						<label><?php echo $lang_common['Message'] ?><br />

Login

./login.php

Modification pour le système de login “universel” de Swisslinux.org :

	redirect(htmlspecialchars($_POST['redirect_url']), $lang_login['Login redirect']);
[ou]
        header('Location: index.php');

ont été remplacé par :

	// Go back to the right page
	header('Location:'.$_SERVER['HTTP_REFERER']);

ligne 194 supprimé :

// Try to determine if the data in HTTP_REFERER is valid (if not, we redirect to index.php after login)
$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : 'index.php';

ligne 212 supprimé :

	<input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />

Changement de l'ordre des catégories selon la langue

config.php

Ajouter le code suivant à la fin du fichier

//Ajoute les option pour l'ordre de la langue ! (si une langue n'est pas dans la liste il prendra l'ordre par défaut)
//!!!!!!!!!!!!!!! Attention !!!!!!!!!!!!!!!!!
//Avant d'ajouter une langue il faut crée un champ "disp_position_<lng>" dans la table "categories"
// <lng> = abréviation de la langue
$lng_disp = array("en","de","it");

index.php

Pour changer l'ordre d'affichage.

Remplacer ce code

// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

Par ce code

// Si il y a une configuration spécial pour la langue de l'utilisateur changer la requete SQL
if (in_array($pun_user['language'],$lng_disp)) $compSQL = "_".$pun_user['language'];
 
// Print the categories and forums
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position'.$compSQL.' , c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

admin_categories.php

Pour l'ajout dans l'interface d'administration

Remplacer

$result = $db->query('SELECT id, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());

par ce code

// Ajoute la recherche de tout les champs
$compSQL="";// init var
for ($i=0;$i<sizeof($lng_disp);$i++)	$compSQL .= ", disp_position_".$lng_disp[$i];
 
$result = $db->query('SELECT id, disp_position'.$compSQL.' FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());

Remplacer

$db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cat_name[$i]).'\', disp_position='.$cat_order[$i].' WHERE id='.$cat_id) or error('Unable to update category', __FILE__, __LINE__, $db->error());

Par ce code

// Ajoute la modification de tout les champs
$compSQL="";// init var
for ($w=0;$w<sizeof($lng_disp);$w++){ 
eval ('$temp= $_POST[\'cat_order_'.$lng_disp[$w].'\'];'); //var chercher chaque langue dans le POST
 
// teste si la valeur est correcte
if (is_integer($temp[$i])) message('La position doit être un nombre entier.');
 
$compSQL .= ", disp_position_".$lng_disp[$w]."=".$temp[$i];
}
 
$db->query('UPDATE '.$db->prefix.'categories SET cat_name=\''.$db->escape($cat_name[$i]).'\', disp_position='.$cat_order[$i].$compSQL.' WHERE id='.$cat_id) or error('Unable to update category', __FILE__, __LINE__, $db->error());
 

Remplacer

// Generate an array with all categories
$result = $db->query('SELECT id, cat_name, disp_position FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
$num_cats = $db->num_rows($result);

Par ce code

// Ajoute la recherche de tout les champs
$compSQL="";// init var
for ($i=0;$i<sizeof($lng_disp);$i++)	$compSQL .= ", disp_position_".$lng_disp[$i];
 
// Generate an array with all categories
$result = $db->query('SELECT id, cat_name, disp_position'.$compSQL.' FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
$num_cats = $db->num_rows($result);

Remplacer :

<th scope="col">Position</th>
<th>&nbsp;</th>

Par ce code

<th scope="col">Position</th>
<?php for ($i=0;$i<sizeof($lng_disp);$i++)	echo "<th scope=\"col\">Position ".$lng_disp[$i]."</th>"; ?>
<th>&nbsp;</th>

Puis remplacer :

list(, list($cat_id, $cat_name, $position)) = @each($cat_list);
 
?>
							<tr><td><input type="text" name="cat_name[<?php echo $i ?>]" value="<?php echo pun_htmlspecialchars($cat_name) ?>" size="35" maxlength="80" /></td><td><input type="text" name="cat_order[<?php echo $i ?>]" value="<?php echo $position ?>" size="3" maxlength="3" /></td><td>&nbsp;</td></tr>
<?php

Par ce code

list(, list($cat_id, $cat_name, $position)) = @each($cat_list);
?>
							<tr><td>
								<input type="text" name="cat_name[<?php echo $i ?>]" value="<?php echo pun_htmlspecialchars($cat_name) ?>" size="35" maxlength="80" />
							</td><td>
								<input type="text" name="cat_order[<?php echo $i ?>]" value="<?php echo $position ?>" size="3" maxlength="3" />					
<?php for ($z=0;$z<sizeof($lng_disp);$z++)	echo "</td><td><input type=\"text\" name=\"cat_order_".$lng_disp[$z]."[$i]\" value=\"".$cat_list[$i][$z+3]."\"size=\"3\" maxlength=\"3\" />"; ?>
								</td><td>&nbsp;</td></tr>
<?php

Pour désactiver les courriels entre utilisateurs.

misc.php

--- misc.php.old
+++ misc.php
@@ -72,6 +72,10 @@

 else if (isset($_GET['email']))
 {
+       /* Modification par OdyX le 2 juillet 2009 pour éviter les mails entre personnes */
+       message($lang_common['No user2user mail']);
+       /* FIN */
+
        if ($pun_user['is_guest'])
                message($lang_common['No permission']);

profile.php

--- profile.php.old     2009-07-02 18:12:51.000000000 +0200
+++ profile.php 2009-07-02 18:11:20.000000000 +0200
@@ -915,7 +915,10 @@
        if ($user['email_setting'] == '0' && !$pun_user['is_guest'])
                $email_field = '<a href="mailto:'.$user['email'].'">'.$user['email'].'</a>';
        else if ($user['email_setting'] == '1' && !$pun_user['is_guest'])
-               $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a>';
+               /* Modification faite par OdyX le 2 juillet 2009 pour eviter les courriels entre utilisateurs */
+               // $email_field = '<a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a>';
+               $email_field = '';
+               /* FIN */
        else
                $email_field = $lang_profile['Private'];

@@ -1056,7 +1059,10 @@
                        else
                                $username_field = '<p>'.$lang_common['Username'].': '.pun_htmlspecialchars($user['username']).'</p>'."\n";

-                       $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a></p>'."\n";
+                       /* Modification faite par OdyX le 2 juillet 2009 pour eviter les courriels entre utilisateurs */
+                       // $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label><p><a href="misc.php?email='.$id.'">'.$lang_common['Send e-mail'].'</a></p>'."\n";
+                       $email_field = '<label><strong>'.$lang_common['E-mail'].'</strong><br /><input type="text" name="req_email" value="'.$user['email'].'" size="40" maxlength="50" /><br /></label>'."\n";
+                       /* FIN */
                }
                else
                {