Seite 1 von 1
doppelte DB-Tabellen...
Verfasst: 17.01.2006 09:05
von Prometeus
Hallo, hier einmal ne grundsätzlicheFrage.
Ich bin derzeit dabei verschieden Mods einzubauen, was natürlich auch zahlreiche DB-Updates nach sich zieht. Wie muss ich das handeln, wenn ich ein DB-Update machen muss, welches eine schon bereits existierende DB erstellen will?
Beispielsweise eine neue user_photo, welche es aber durch einen anderen Mod schon gibt. Muss ich den ganzen Mod umschreiben? Oder die DB-Tabelle?
Oder kann ich einfach die existierende löschen und die neue erstellen???
Verfasst: 17.01.2006 09:50
von Markus67
Hi ...
ich an deiner Stelle würde auf jeden Fall den Tabellennamen umändern. Wenn du den MOD neu schreibst dürfte es ja kein Problem sein der Tabelle einen anderen Namen zu geben und den Eintrag für die constants.php gleich mit anzupassen
Markus
Verfasst: 17.01.2006 11:10
von Prometeus
Markus67 hat geschrieben:Hi ...
ich an deiner Stelle würde auf jeden Fall den Tabellennamen umändern. Wenn du den MOD neu schreibst dürfte es ja kein Problem sein der Tabelle einen anderen Namen zu geben und den Eintrag für die constants.php gleich mit anzupassen
Markus
Naja, da kommen wir zum Hacken ander Sache. Ich habe vor drei Monaten erste angefangen mich mit php und html zu beschäftigen. Das beudetet, Foren aufbauen, mods einbauen und grafisch was verändern ist in Ordnung. Mod-Proggn, soweit bin ich noch nicht..
Ich hatte nur daran gedacht den Mod entsprechend zu ändern, um ihn an die Veränderten DB-Tabellen-Namen anzupassen. Alerdings weiß ich nicht welche Dateien dabei immer zu ändern sind. Wie sind die Befahele in einer Datei gekennzeichnet, dass mit einer bestimmten DB-Tabelle etwa angestellt werden soll?
Bsp:
Code: Alles auswählen
if ( @phpversion() < '4.0.3' )
{
message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
}
$move_file = 'move_uploaded_file';
}
else
{
$move_file = 'copy';
}
$move_file($photo_filename, './' . $board_config['photo_path'] . "/$new_filename");
}
@chmod('./' . $board_config['photo_path'] . "/$new_filename", 0777);
$photo_sql = " user_photo2 = '$new_filename', user_photo_type2 = " . USER_AVATAR_UPLOAD;
}
else
{
$l_photo_size = sprintf($lang['Photo_imagesize'], $board_config['photo_max_width'], $board_config['photo_max_height']);
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_photo_size : $l_photo_size;
}
return $photo_sql;
}
Was sagt mir dieser Schnipsel zum Beispiel??? Und welche Befehle sind das? Jaja, und sagt jetzt bitte nicht "kauf dir nen Handbuch in php-Programmierung"..
Gruß und Dank
Prom
Verfasst: 17.01.2006 11:13
von Markus67
Hi ....
Da musst du eigentlich nichts ändern.
Wie sieht denn in der Installationsanleitung der Eintrag für die constants.php aus?
Markus
Verfasst: 17.01.2006 11:16
von Prometeus
Die constants wird gar nicht bearbeitet. Editiert werden müssen:
profile.php
admin/admin_board.php
includes/usercp_register.php
includes/usercp_viewprofile.php
templates/subSilver/profile_add_body.tpl
templates/subSilver/profile_view_body.tpl
templates/subSilver/admin/board_config_body.tpl
Mehr nicht... Dann werden noch neue Dateien hinzugefügt...
profilephoto_mod.php
mod_table_inst.php (ist wieder gelöscht)
templates/subSilver/profile_photo_box.tpl
language/lang_XX/lang_profilephoto.php
...
Prometeus
Verfasst: 17.01.2006 11:20
von Markus67
Hi ...
verlinke doch mal bitte die komplette Anleitung ... sonst machen wir hier heiteres Rätselraten
Noch besser wäre ein Downloadlink für den MOD
Markus
Verfasst: 17.01.2006 11:24
von Prometeus
So hier kommt Anleitung und
link...
[ externes Bild ] für deine Hilfe
---------------------------------------------------------------
Code: Alles auswählen
###############################################################
## MOD Title: Photo and Signature Visible in Profile
## MOD Author: Matthew Smith < mattysmith@dsl.pipex.com>
## MOD 2nd Author: Acyd Burn < acyd.burn@gmx.de > - Meik Sievertsen - http://www.opentools.de/
## MOD Description: Displays the Users Photo and Signature on there profile
## MOD Version: v1.0
##
## Installation Level: Easy
## Installation Time: 15 Minutes
## Files To Edit: profile.php, admin/admin_board.php, includes/usercp_register.php, includes/usercp_viewprofile.php
## templates/subSilver/profile_add_body.tpl, templates/subSilver/profile_view_body.tpl,
## templates/subSilver/admin/board_config_body.tpl
## Included Files: 3 (+1 temporary file for installation)
##############################################################
## 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 makes adds a photo to the users profile and there signature.
##############################################################
## MOD History:
##
## 2005-06-28 - Version 1.0
## First Initial Release
###############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
# First of all, copy all files to their respective location
#
# These are:
# /profilephoto_mod.php
# /mod_table_inst.php (you can delete it after installation)
#
# /templates/subSilver/profile_photo_box.tpl
#
# /language/lang_XX/lang_profilephoto.php
#
Now we want to create the rows in the database, therefore we execute mod_table_inst.php (http://www.yoursite.com/phpBB2/mod_table_inst.php)
Contact me if you have questions about this.
Now you have to alter existing files, read the instructions carefully and make sure you find all lines.
#
# Changes to already existing files
#
#
#-----[ OPEN ]---------------------------------------------
#
./profile.php
#
#-----[ FIND ]---------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]---------------------------------------
#
include($phpbb_root_path . 'profilephoto_mod.'.$phpEx);
#
#-----[ FIND ]---------------------------------------------
#
// End page specific functions
// ---------------------------
#
#-----[ AFTER, ADD ]---------------------------------------
#
$profilephoto_mod->execute_mod();
#
#-----[ OPEN ]---------------------------------------------
#
./admin/admin_board.php
#
#-----[ FIND ]---------------------------------------------
#
$template->set_filenames(array(
"body" => "admin/board_config_body.tpl")
);
#
#-----[ AFTER, ADD ]---------------------------------------
#
//
// Profile Photo Mod
//
if ( !file_exists($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_profilephoto.'.$phpEx) )
{
include($phpbb_root_path . 'language/lang_english/lang_profilephoto.'.$phpEx);
}
else
{
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_profilephoto.' . $phpEx);
}
$photo_remote_yes = ( $new['allow_photo_remote'] ) ? 'checked="checked"' : '';
$photo_remote_no = ( !$new['allow_photo_remote'] ) ? 'checked="checked"' : '';
$photo_upload_yes = ( $new['allow_photo_upload'] ) ? 'checked="checked"' : '';
$photo_upload_no = ( !$new['allow_photo_upload'] ) ? 'checked="checked"' : '';
$template->assign_vars(array(
'L_PROFLE_PHOTO_SETTINGS' => $lang['Profile_photo_settings'],
'L_ALLOW_PHOTO_REMOTE' => $lang['Allow_photo_remote'],
'L_ALLOW_PHOTO_REMOTE_EXPLAIN' => $lang['Allow_photo_remote_explain'],
'L_ALLOW_PHOTO_UPLOAD' => $lang['Allow_photo_upload'],
'L_PHOTO_MAX_FILESIZE' => $lang['Photo_max_filesize'],
'L_PHOTO_MAX_FILESIZE_EXPLAIN' => $lang['Photo_max_filesize_explain'],
'L_MAX_PHOTO_SIZE' => $lang['Max_photo_size'],
'L_PHOTO_STORAGE_PATH' => $lang['Photo_storage_path'],
'L_PHOTO_STORAGE_PATH_EXPLAIN' => $lang['Photo_storage_path_explain'],
'PHOTO_REMOTE_YES' => $photo_remote_yes,
'PHOTO_REMOTE_NO' => $photo_remote_no,
'PHOTO_UPLOAD_YES' => $photo_upload_yes,
'PHOTO_UPLOAD_NO' => $photo_upload_no,
'PHOTO_FILESIZE' => $new['photo_filesize'],
'PHOTO_MAX_HEIGHT' => $new['photo_max_height'],
'PHOTO_MAX_WIDTH' => $new['photo_max_width'],
'PHOTO_PATH' => $new['photo_path'])
);
#
#-----[ OPEN ]---------------------------------------------
#
./includes/usercp_register.php
#
#-----[ FIND ]---------------------------------------------
#
$error = FALSE;
#
#-----[ REPLACE WITH ]-------------------------------------
#
// $error = FALSE;
#
#-----[ FIND ]---------------------------------------------
#
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]---------------------------------------
#
$profilephoto_mod->photo_insert($mode);
#
#-----[ OPEN ]---------------------------------------------
#
./templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]---------------------------------------------
#
<input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}" />
#
#-----[ REPLACE WITH ]-------------------------------------
#
<!--<input type="hidden" name="MAX_FILE_SIZE" value="{AVATAR_SIZE}" />-->
#
#-----[ FIND ]---------------------------------------------
#
<!-- END switch_avatar_block -->
#
#-----[ AFTER, ADD ]---------------------------------------
#
{PHOTO_BOX}
#
#-----[ OPEN ]--------------------------------------------------
#
./includes/usercp_viewprofile.php
#
#-----[ FIND ]--------------------------------------------------
#
$search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>';
#
#-----[ AFTER, ADD ]------------------------------------------
#
//====================================================================== |
//==== Signature in Profile ===================================== |
//==== V1.0 ========================================================== |
//====
$user_sig = '';
if ( $profiledata['user_attachsig'] && $board_config['allow_sig'] )
{
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$user_sig = $profiledata['user_sig'];
$user_sig_bbcode_uid = $profiledata['user_sig_bbcode_uid'];
if ( $user_sig != '' )
{
if ( !$board_config['allow_html'] && $profiledata['user_allowhtml'] )
{
$user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig);
}
if ( $board_config['allow_bbcode'] && $user_sig_bbcode_uid != '' )
{
$user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
}
$user_sig = make_clickable($user_sig);
if ( !$userdata['user_allowswearywords'] )
{
$orig_word = !empty($orig_word) ? $orig_word : array();
$replacement_word = !empty($replacement_word) ? $replacement_word : array();
obtain_word_list($orig_word, $replacement_word);
$user_sig = preg_replace($orig_word, $replacement_word, $user_sig);
}
if ( $profiledata['user_allowsmile'] )
{
$user_sig = smilies_pass($user_sig);
}
$user_sig = str_replace("\n", "\n<br />\n", $user_sig);
}
$template->assign_block_vars('switch_user_sig_block', array());
}
//====
//==== Author: Matthew Smith=================== |
//==== End Signature in Profile ======================================= |
//====================================================================== |
#
#-----[ FIND ]-------------------------------------------------
#
'POST_PERCENT_STATS' => sprintf($lang['User_post_pct_stats'], $percentage),
#
#-----[ AFTER, ADD ]-------------------------------------------------
#
//====================================================================== |
//==== Signature in Profile ===================================== |
//==== V1.0 ========================================================== |
//====
'USER_SIG' => $user_sig,
//====
//==== Author: Matthew Smith=================== |
//==== End Signature in Profile ======================================= |
//====================================================================== |
#
#-----[ FIND ]------------------------------------------
#
'L_INTERESTS' => $lang['Interests'],
#
#-----[ AFTER, ADD ]------------------------------------------------
#
//====================================================================== |
//==== Signature in Profile ===================================== |
//==== V1.0 ========================================================== |
//====
'L_SIG' => $lang['Signature'],
//====
//==== Author: Matthew Smith=================== |
//==== End Signature in Profile ======================================= |
//====================================================================== |
#
#-----[ OPEN ]---------------------------------------------
#
./templates/subsilver/profile_view_body.tpl
#
#
#-----[ FIND ]---------------------------------------------
#
//--></script><noscript>{ICQ_IMG}</noscript></td>
</tr>
#
#-----[ REPLACE WITH ]-------------------------------------
#
//--></script><noscript>{ICQ_IMG}</noscript></td>
</tr>
</table></table>
<table width="100%">
<tr>
<td class="catLeft" align="center" width="40%" height="28" colspan="2"><b><span class="gen">{L_PHOTO}</span></b></td>
<td width="40%" height="28" colspan="2" align="center" class="catright"><strong>{L_SIG}</strong></td>
<tr>
<td align="center" colspan="2" class="row1">{PHOTO_IMG}</td>
<td align = "center" class="row1"><span class="postbody">{USER_SIG}</span></td>
</tr>
</table>
#-----[ OPEN ]---------------------------------------------
#
./templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]---------------------------------------------
#
<td class="row2"><input type="text" size="20" maxlength="255" name="avatar_gallery_path" value="{AVATAR_GALLERY_PATH}" /></td>
</tr>
#
#-----[ AFTER, ADD ]---------------------------------------
#
<tr>
<th class="thHead" colspan="2">{L_PROFLE_PHOTO_SETTINGS}</th>
</tr>
<tr>
<td class="row1">{L_ALLOW_PHOTO_REMOTE} <br /><span class="gensmall">{L_ALLOW_PHOTO_REMOTE_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="allow_photo_remote" value="1" {PHOTO_REMOTE_YES} /> {L_YES} <input type="radio" name="allow_photo_remote" value="0" {PHOTO_REMOTE_NO} /> {L_NO}</td>
</tr>
<tr>
<td class="row1">{L_ALLOW_PHOTO_UPLOAD}</td>
<td class="row2"><input type="radio" name="allow_photo_upload" value="1" {PHOTO_UPLOAD_YES} /> {L_YES} <input type="radio" name="allow_photo_upload" value="0" {PHOTO_UPLOAD_NO} /> {L_NO}</td>
</tr>
<tr>
<td class="row1">{L_PHOTO_MAX_FILESIZE}<br /><span class="gensmall">{L_PHOTO_MAX_FILESIZE_EXPLAIN}</span></td>
<td class="row2"><input type="text" size="4" maxlength="10" name="photo_filesize" value="{PHOTO_FILESIZE}" /> Bytes</td>
</tr>
<tr>
<td class="row1">{L_MAX_PHOTO_SIZE} <br />
<span class="gensmall">{L_MAX_AVATAR_SIZE_EXPLAIN}</span>
</td>
<td class="row2"><input type="text" size="3" maxlength="4" name="photo_max_height" value="{PHOTO_MAX_HEIGHT}" /> x <input type="text" size="3" maxlength="4" name="photo_max_width" value="{PHOTO_MAX_WIDTH}"></td>
</tr>
<tr>
<td class="row1">{L_PHOTO_STORAGE_PATH} <br /><span class="gensmall">{L_PHOTO_STORAGE_PATH_EXPLAIN}</span></td>
<td class="row2"><input type="text" size="20" maxlength="255" name="photo_path" value="{PHOTO_PATH}" /></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Verfasst: 17.01.2006 11:58
von Markus67
Hi ...
der MOD fügt nur Felder in bestehende Tabellen ein. Welche Felder sind denn schon vorhanden?
Markus
Verfasst: 17.01.2006 12:38
von Prometeus
Puhh, kann ich erst heute Abend sagen...
Danke und bis später..
Verfasst: 18.01.2006 20:38
von Prometeus
OK; kann zu, weiter gings
hier...
Danke...