Seite 2 von 3

Verfasst: 29.12.2003 16:08
von mono
Zum Beispiel das hier

Code: Alles auswählen

############################################################## 
## MOD Title:          Gender
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description:    This mod will add a Gender field into
##                     users' profile. Il may display "Gender: |image|"
##                     in posts too (optional). 
## MOD Version:        1.2.5
## Compatibility:      2.0.5->2.0.6
##
## Installation Level: Moderate
## Installation Time:  20 to 30 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      8 + 3 optional
##      viewtopic.php (optional) 
##      admin/admin_users.php
##      includes/usercp_avatar.php 
##      includes/usercp_register.php 
##      includes/usercp_viewprofile.php 
##      language/lang_english/lang_main.php 
##      templates/SubSilver/profile_add_body.tpl
##      templates/SubSilver/profile_view_body.tpl
##      templates/subSliver/subSilver.cfg (optional)
##      templates/subSliver/viewtopic_body.tpl (optional)
##      templates/subSilver/admin/user_edit_body.tpl
##
## Included Files:     2
##      templates/subSliver/images/icon_minigender_male.gif 
##      templates/subSliver/images/icon_minigender_female.gif 
##
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://www.phpbb.com/phpBB/viewtopic.php?t=124436
##
## However, on alpha releases of EM SQL commands are not performed!
## Then, meanwhile beta or final release (with DB alterations
## capabilities), you must update your database manually by
## copying the gender_db_update.php file in your phpBB
## root directory, execute it with your navigator and after,
## delete it.
##
## In any case, if you install this MOD manually or using an
## alpha release of EM, please run this file NOW, before
## editing phpBB files by EM or manually!!!
## Otherwise, you may have an error message during your next
## connection.
##
## Moreover, the French language provide with this MOD can
## be automatically installed too with EM 0.0.10a release.
## So, if you need this language apply the instructions at the
## bottom of the how-to manually.
##
## For updates, check this official link...
## http://mods.db9.dk/viewforum.php?f=3
##
############################################################## 
## MOD History: 
##
##   2003-08-05 - Version 1.2.5
##      - Part 1 & part 2 merge in a single how-to
##      - Add French translation
##      - How-to rewrite to be EasyMOD compatible
##
##   ????-??-?? - Version 1.2.4
##      - admin/admin_users.php added range check
##
##   ????-??-?? - Version 1.2.3
##      - confirmed for phpBB2 ver 2.0.5. by "kooky", no change needed
##      - changed for ver 2.0.4
##
##   ????-??-?? - Version 1.2.2
##      - changed a FIND tag
##
##   ????-??-?? - Version 1.2.1
##      - correct a type in the how-to
##
##   ????-??-?? - Version 1.2.0
##      - fist release for phpBB2 ver 2.0.1
##      - confirmed for phpBB2 ver 2.0.2 - no changes needed
##
##   ????-??-?? - Version 1.1.4
##      - Last release for phpBB2 ver 2.0.0
##
##   ????-??-?? - Version 0.9.0
##      - Initial release phpBB2 RC-1
##
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ SQL ]------------------------------------------------- 
#
# If you use an alpha release of EasyMOD, this instructions will not be executed!
# Please read author notes to update your database.
#
copy gender_db_update.php to gender_db_update.php
execute gender_db_update.php
delete gender_db_update.php

# 
#-----[ OPEN ]------------------------------------------------ 
# 
admin/admin_users.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$interests = ( !empty($HTTP_POST_VARS['interests']) )

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
$gender = ( isset($HTTP_POST_VARS['gender']) ) ? intval ($HTTP_POST_VARS['gender']) : 0;
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "UPDATE " . USERS_TABLE . "
SET

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
$user_rank

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, user_gender = '$gender'

# 
#-----[ FIND ]------------------------------------------------ 
# 
$interests = htmlspecialchars($this_userdata['user_interests']);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
$gender = $this_userdata['user_gender'];
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
$s_hidden_fields .= '<input type="hidden" name="viewemail"

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
$s_hidden_fields .= '<input type="hidden" name="gender" value="' . $gender . '" />';
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
//
// Let's do an overall check

# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#

// Start add - Gender MOD
switch ($gender) 
{ 
   case 1: $gender_male_checked="checked=\"checked\"";break; 
   case 2: $gender_female_checked="checked=\"checked\"";break; 
   default:$gender_no_specify_checked="checked=\"checked\""; 
}
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
'INTERESTS' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
'GENDER' => $gender, 
'GENDER_NO_SPECIFY_CHECKED' => $gender_no_specify_checked, 
'GENDER_MALE_CHECKED' => $gender_male_checked, 
'GENDER_FEMALE_CHECKED' => $gender_female_checked,
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
'L_INTERESTS' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
'L_GENDER' =>$lang['Gender'], 
'L_GENDER_MALE' =>$lang['Male'], 
'L_GENDER_FEMALE' =>$lang['Female'], 
'L_GENDER_NOT_SPECIFY' =>$lang['No_gender_specify'],
// End add - Gender MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/usercp_avatar.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
function display_avatar_gallery(

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
)

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, &$gender

# 
#-----[ FIND ]------------------------------------------------ 
# 
$params = array(

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
);

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, 'gender'

# 
#-----[ OPEN ]------------------------------------------------ 
#  
includes/usercp_register.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$signature = str_replace(

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
$gender = ( isset($HTTP_POST_VARS['gender']) ) ? intval ($HTTP_POST_VARS['gender']) : 0;
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "UPDATE " . USERS_TABLE . "
SET

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
$avatar_sql . "

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, user_gender = '$gender'

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "INSERT INTO " . USERS_TABLE . "
VALUES

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
, user_style

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, user_gender

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
, $user_style

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, '$gender'

# 
#-----[ FIND ]------------------------------------------------ 
# 
$interests = $userdata['user_interests'];

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
$gender=$userdata['user_gender']; 
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
display_avatar_gallery(

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
);

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, $gender

# 
#-----[ FIND ]------------------------------------------------ 
# 
$smilies_status = (

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
switch ($gender) 
{ 
   case 1: $gender_male_checked="checked=\"checked\"";break; 
   case 2: $gender_female_checked="checked=\"checked\"";break; 
   default:$gender_no_specify_checked="checked=\"checked\""; 
}
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
'VIEW_EMAIL_YES' =>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
'LOCK_GENDER' =>($mode!='register') ? 'DISABLED':'', 
'GENDER' => $gender, 
'GENDER_NO_SPECIFY_CHECKED' => $gender_no_specify_checked, 
'GENDER_MALE_CHECKED' => $gender_male_checked, 
'GENDER_FEMALE_CHECKED' => $gender_female_checked, 
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
'L_INTERESTS' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
'L_GENDER' =>$lang['Gender'], 
'L_GENDER_MALE' =>$lang['Male'], 
'L_GENDER_FEMALE' =>$lang['Female'], 
'L_GENDER_NOT_SPECIFY' =>$lang['No_gender_specify'], 
// End add - Gender MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
includes/usercp_viewprofile.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
// 
// Generate page 

# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#

// Start add - Gender MOD
if ( !empty($profiledata['user_gender'])) 
{ 
           switch ($profiledata['user_gender']) 
           { 
                      case 1: $gender=$lang['Male'];break; 
                      case 2: $gender=$lang['Female'];break; 
                      default:$gender=$lang['No_gender_specify']; 
           } 
} else $gender=$lang['No_gender_specify']; 
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
'INTERESTS' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
'GENDER' => $gender, 
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
'L_INTERESTS' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
'L_GENDER' => $lang['Gender'], 

# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_english/lang_main.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#

// Start add - Gender MOD
$lang['Gender'] = 'Gender';//used in users profile to display witch gender he/she is 
$lang['Male'] = 'Male'; 
$lang['Female']='Female'; 
$lang['No_gender_specify'] = 'None Specified'; 
// End add - Gender MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/profile_add_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
# 
value="{INTERESTS}"
</td>
</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

<!-- Start add - Gender MOD -->
<tr> 
      <td class="row1"><span class="gen">{L_GENDER}:</span></td> 
      <td class="row2"> 
      <input type="radio" {LOCK_GENDER} name="gender" value="0" {GENDER_NO_SPECIFY_CHECKED}/> 
      <span class="gen">{L_GENDER_NOT_SPECIFY}</span>&nbsp;&nbsp; 
      <input type="radio" name="gender" value="1" {GENDER_MALE_CHECKED}/> 
      <span class="gen">{L_GENDER_MALE}</span>&nbsp;&nbsp; 
      <input type="radio" name="gender" value="2" {GENDER_FEMALE_CHECKED}/> 
      <span class="gen">{L_GENDER_FEMALE}</span></td> 
</tr>
<!-- End add - Gender MOD -->

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/profile_view_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
# 
{INTERESTS}
</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

<!-- Start add - Gender MOD --> 
<tr> 
	<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_GENDER}:</span></td>
	<td> <b><span class="gen">{GENDER}</span></b></td>
</tr>
<!-- End add - Gender MOD -->

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/admin/user_edit_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
# 
value="{INTERESTS}"
</td>
</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

<!-- Start add - Gender MOD -->
<tr> 
      <td class="row1"><span class="gen">{L_GENDER}:</span></td> 
      <td class="row2"> 
      <input type="radio" name="gender" value="0" {GENDER_NO_SPECIFY_CHECKED}/> 
      <span class="gen">{L_GENDER_NOT_SPECIFY}</span>&nbsp;&nbsp; 
      <input type="radio" name="gender" value="1" {GENDER_MALE_CHECKED}/> 
      <span class="gen">{L_GENDER_MALE}</span>&nbsp;&nbsp; 
      <input type="radio" name="gender" value="2" {GENDER_FEMALE_CHECKED}/> 
      <span class="gen">{L_GENDER_FEMALE}</span></td> 
</tr>
<!-- End add - Gender MOD -->

############################################################## 
## Start - Optional gender image display in posts
############################################################## 
# 
#-----[ COPY ]------------------------------------------------ 
# 
copy root/templates/subSilver/images/icon_minigender_female.gif to templates/subSilver/images/
copy root/templates/subSilver/images/icon_minigender_male.gif to templates/subSilver/images/

# 
#-----[ OPEN ]------------------------------------------------ 
# 
viewtopic.php

# 
#-----[ FIND ]------------------------------------------------ 
# 
$sql = "SELECT u.username

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
, p.*

# 
#-----[ IN-LINE BEFORE, ADD ]--------------------------------- 
# 
, u.user_gender

# 
#-----[ FIND ]------------------------------------------------ 
# 
$rank_image = ''; 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

// Start add - Gender MOD
$gender_image = ''; 
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
# 
$pm_img = '<a href=
    
# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
switch ($postrow[$i]['user_gender']) 
{ 
	case 1 : $gender_image = $lang['Gender'].": <img src=\"" . $images['icon_minigender_male'] . "\" alt=\"" . $lang['Gender'].  ":".$lang['Male']."\" title=\"" . $lang['Gender'] . ":".$lang['Male']. "\" border=\"0\" />"; break; 
	case 2 : $gender_image = $lang['Gender'].": <img src=\"" . $images['icon_minigender_female'] . "\" alt=\"" . $lang['Gender']. ":".$lang['Female']. "\" title=\"" . $lang['Gender'] . ":".$lang['Female']. "\" border=\"0\" />"; break; 
	default : $gender_image=""; 
}
// End add - Gender MOD
    
# 
#-----[ FIND ]------------------------------------------------ 
# 
'POSTER_RANK' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
'POSTER_GENDER' => $gender_image,
// End add - Gender MOD

# 
#-----[ FIND ]------------------------------------------------ 
#
'DELETE' =>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#

// Start add - Gender MOD
'L_GENDER' => $lang['Gender'],
// End add - Gender MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/subSilver.cfg

# 
#-----[ FIND ]------------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]----------------------------------------- 
#

// Start add - Gender MOD
$images['icon_minigender_male'] = "$current_template_images/icon_minigender_male.gif"; 
$images['icon_minigender_female'] = "$current_template_images/icon_minigender_female.gif";
// End add - Gender MOD

# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------------ 
# 
{postrow.POSTER_AVATAR}<br /><br /> 

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
{postrow.POSTER_AVATAR}<br /><br /> 

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
{postrow.POSTER_GENDER}<br /> 

#
############################################################## 
## End - Optional gender image display in posts
############################################################## 

# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM 

Verfasst: 29.12.2003 16:25
von Acid
höhms.. ich meinte eigentlich nur einen Teil posten. ;) (Ausnahmsweise kann es erstmal stehen bleiben.)

Also am Anfang der Anleitung steht lauter Kram, der für dich eigentlich nicht wichtig is (Versionsübersicht) etc. Für dich wichtig wäre..

Code: Alles auswählen

## Files To Edit:      8 + 3 optional
##      viewtopic.php (optional)
##      admin/admin_users.php
##      includes/usercp_avatar.php
##      includes/usercp_register.php
##      includes/usercp_viewprofile.php
##      language/lang_english/lang_main.php
##      templates/SubSilver/profile_add_body.tpl
##      templates/SubSilver/profile_view_body.tpl
##      templates/subSliver/subSilver.cfg (optional)
##      templates/subSliver/viewtopic_body.tpl (optional)
##      templates/subSilver/admin/user_edit_body.tpl
##
## Included Files:     2
##      templates/subSliver/images/icon_minigender_male.gif
##      templates/subSliver/images/icon_minigender_female.gif 
"Files to edit" zeigt dir an, welche Dateien du im folgenden ändern musst.
"Included Files" listet neue Dateien auf, die du entsprechend in den phpBB-Ordner laden musst.

Code: Alles auswählen

#
#-----[ SQL ]-------------------------------------------------
#
# If you use an alpha release of EasyMOD, this instructions will not be executed!
# Please read author notes to update your database.
#
copy gender_db_update.php to gender_db_update.php
execute gender_db_update.php
delete gender_db_update.ph
"copy".. du musst die gender_db_update.php in den phpBB Ordner kopieren
"execute"..du musst sie ausführen (Pfad zu der Datei im Browser eingeben)
"delete"..wenn vollbracht, die Datei wieder löschen

Und im folgenden werden dann die Änderungen an den Dateien beschrieben. "open" heisst, du sollt die angegebene Datei öffnen. "find", du sollst etwas finden. "add", du sollst den Code dann danach oder davor einfügen. "replace", du sollst den gefundenen Code ersetzen.

Wenn es zu dem Hack keine deutsche Anleitung gibt, wird zwar ein wenig Englisch vorausgesetzt, aber Wörter wie find, replace, add kann man mit jedem Wörterbuch übersetzen.

Verfasst: 29.12.2003 16:33
von mono
und wo finde ich die "Files To Edit"
Ich meine wie ich es aufrufe

Verfasst: 29.12.2003 16:47
von Acid
Nun, im Regelfall hast du ja einen Ordner /phpBB mit allen Unterordnern und Dateien auf deiner Festplatte (den du irgendwann mal zur Installation auf den Server kopiert hast). Wenn das nicht mehr der Fall ist, dann lade dir nochmal das Paket herunter. (Bevor du Dateien änderst, solltest du übrigens immer Sicherheitskopien der jeweiligen Dateien anlegen.)
Nun öffnest du die besagte Datei mit einem Editor (z.B. Notepad von Windows oder www.textpad.com ) ...

Verfasst: 29.12.2003 17:02
von mono
Und wo kann ich es laden

Verfasst: 29.12.2003 17:12
von Acid
hmm :-? Die geänderte Datei muss dann auf den Server geladen werden.

Verfasst: 29.12.2003 17:14
von mono
meins stammt von Lycos

Verfasst: 29.12.2003 17:16
von Acid
Gratuliere.. :lol: :wink:

Verfasst: 30.12.2003 10:42
von mono
und wie heist die datei

Verfasst: 30.12.2003 10:58
von Acid
## Files To Edit: 8 + 3 optional
## viewtopic.php (optional)
## admin/admin_users.php
## includes/usercp_avatar.php
## includes/usercp_register.php
## includes/usercp_viewprofile.php
## language/lang_english/lang_main.php
## templates/SubSilver/profile_add_body.tpl
## templates/SubSilver/profile_view_body.tpl
## templates/subSliver/subSilver.cfg (optional)
## templates/subSliver/viewtopic_body.tpl (optional)
## templates/subSilver/admin/user_edit_body.tpl
##
## Included Files: 2
## templates/subSliver/images/icon_minigender_male.gif
## templates/subSliver/images/icon_minigender_female.gif