Welcome to Gallery 2.1. This integration package is part of the ongoing effort to seamlessly integrate Gallery 2 in phpBB2. Please read through this document carefully before integrating Gallery 2 and before asking for help. We have taken care to try to answer as many of your questions here as possible. If you don't read this and have problems, we may refer you back to this document as a first resource.
This package contains all the information you will need in order to include an optional mod to the basic integration package that will add a gallery button to the users profile and posts. Standard Disclaimer: Back up all files/folders/databases related to Gallery 2 and phpBB2 before attempting this integration.
Simply put, this MOD will create a "Gallery" button in the user's profile, as well as in the user's posts where the AIM/ICQ buttons appear, as shown in the sample screenshots.
This package does not install or configure Gallery 2 for you. Before you proceed with this add-on mod, you must install and configure Gallery 2 and get the basic integration working.
This integration package does not install or configure Gallery 2 for you. Before you proceed with this integration, you must install and configure Gallery 2 and have the basic integration already working.
This package contains these folders:
To install, simply follow the mod instructions.
The following MOD contains the required SQL and file modifications:
############################################################## ## MOD Title: Gallery Profile Mod ## MOD Author: PilotSpike < firefighterspike33@yahoo.com > (N/A) NA ## MOD Description: This mod integrates the nuked G2 integration into user profiles ## MOD Version: 0.1.0 ## ## Installation Level: Intermediate ## Installation Time: 45 Minutes ## Files To Edit: admin/admin_users.php, ## includes/usercp_register.php, ## includes/usercp_viewprofile.php, ## includes/functions_validate.php, ## language/lang_english/lang_admin.php, ## language/lang_english/lang_main.php, ## templates/subSilver/admin/user_edit_body.tpl, ## templates/subSilver/viewtopic_body.tpl, ## templates/subSilver/profile_view_body.tpl, ## templates/subSilver/privmsgs_read_body.tpl, ## templates/subSilver/subSilver.cfg, ## viewtopic.php, ## privmsg.php ## Included Files: images/icon_gallery.gif ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################## ## For security purposes, please check: http://www.phpbb.com/mods/ ## for the latest version of this MOD. Although MODs are checked ## before being allowed in the MODs Database there is no guarantee ## that there are no security problems within the MOD. No support ## will be given for MODs not found within the MODs Database which ## can be found at http://www.phpbb.com/mods/ ############################################################## ## Author Notes: ## ############################################################## ## MOD History: ## ## 2005-12-17 - Version 0.1.0 ## - Initial Developmental Release ## ## 2006-01-16 - A few tweaks to make code functional - Scott Gregory (aka...jettyrat) ## includes/usercp_register.php, ## includes/usercp_viewprofile.php, ## language/lang_english/lang_main.php, ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ SQL ]------------------------------------------ # ALTER TABLE phpbb_users ADD user_gallery VARCHAR(10) NULL DEFAULT NULL; # #-----[ COPY ]------------------------------------------ # images/icon_gallery.gif to templates/subSilver/images/lang_english/icon_gallery.gif # #-----[ OPEN ]------------------------------------------ # admin/admin_users.php # #-----[ FIND ]------------------------------------------ # $yim = ( !empty($HTTP_POST_VARS['yim']) ) ? trim(strip_tags( $HTTP_POST_VARS['yim'] ) ) : ''; # #-----[ AFTER, ADD ]------------------------------------------ # $user_gallery = ( !empty($HTTP_POST_VARS['user_gallery']) ) ? trim( strip_tags($HTTP_POST_VARS['user_gallery'] ) ) : ''; # #----[ FIND ]----------------------------------- # validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature); # #-----[ REPLACE WITH ]---------------------------------- # validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $user_gallery); # #-----[ FIND ]---------------------------------------- # $yim = htmlspecialchars(stripslashes($yim)); # #-----[ AFTER, ADD ]------------------------------------------------------ # $gallery = htmlspecialchars(stripslashes($gallery)); # #-----[ FIND ]------------------------------------------- # SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . " # #-----[ IN-LINE FIND ]------------------------------------------------ # user_rank = $user_rank # #-----[ IN-LINE AFTER, ADD ]----------------------------- # , user_gallery = '" . str_replace("\'", "''", $user_gallery) . "' # #-----[ FIND ]-------------------------------------- # $yim = htmlspecialchars(stripslashes($yim)); # #-----[ AFTER, ADD ]------------------------------------------------------ # $gallery = htmlspecialchars(stripslashes($gallery)); # #-----[ FIND ]--------------------------------------------- # $yim = htmlspecialchars($this_userdata['user_yim']); # #-----[ AFTER, ADD ]------------------------------------ # $user_gallery = htmlspecialchars($this_userdata['user_gallery']); # #-----[ FIND ]--------------------------------------- # $s_hidden_fields .= '<input type="hidden" name="user_rank" value="' . $user_rank . '" />'; # #-----[ AFTER, ADD]----------------------------------- # $s_hidden_fields .= '<input type="hidden" name="user_gallery" value="' . $user_gallery . '" />'; # #-----[ FIND ]------------------------------------ # 'RANK_SELECT_BOX' => $rank_select_box, # #-----[ AFTER, ADD ]------------------------------------ # 'GALLERYID' => $user_gallery, # #-----[ FIND ]------------------------------------ # 'L_SELECT_RANK' => $lang['Rank_title'], # #-----[ AFTER, ADD ]------------------------------------ # 'L_GALLERY_ID' => $lang['Gallery_id'], # #-----[ OPEN ]------------------------------------ # includes/usercp_register.php # #-----[ FIND ]------------------------------------ # validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature); # #-----[ REPLACE WITH ]------------------------------------ # validate_optional_fields($icq, $aim, $msn, $yim, $website, $location, $occupation, $interests, $signature, $gallery); # #-----[ OPEN ]------------------------------------ # includes/usercp_viewprofile.php # #-----[ FIND ]------------------------------------ # $aim_img = ( $profiledata['user_aim'] ) ? '<a href="aim:goim?screenname=' . $profiledata['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ' '; # #-----[ BEFORE, ADD ]------------------------------------ # if ( !empty($profiledata['user_gallery']) ) { $gallery_uri = append_sid("gallery2.$phpEx?g2_view=core.ShowItem&g2_itemId=" . $profiledata['user_gallery']); $gallery_img = '<a href="' . $gallery_uri . '"><img src="' . $images['icon_gallery'] . '" alt="' . $lang['Gallery'] . '" title="' . $lang['Gallery'] . '" border="0" /></a>'; } else { $gallery_img = ""; } # #-----[ FIND ]------------------------------------ # 'YIM' => $yim, # #-----[ AFTER, ADD ]------------------------------------ # 'GALLERY_IMG' => $gallery_img, # #-----[ FIND ]------------------------------------ # 'L_INTERESTS' => $lang['Interests'], # #-----[ AFTER, ADD]------------------------------------ # 'L_GALLERY' => $lang['Gallery'], # #-----[ OPEN ]------------------------------------ # includes/functions_validate.php # #-----[ FIND ]------------------------------------ # function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$location, &$occupation, &$interests, &$sig) # #-----[ REPLACE WITH ]------------------------------------ # function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$location, &$occupation, &$interests, &$sig, &$gallery) # #-----[ FIND ]------------------------------------ # // website has to start with http://, followed by something with length at least 3 that # #-----[ BEFORE, ADD ]------------------------------------ # // Gallery ID has to be only numbers. if (!preg_match('/^[0-9]+$/', $gallery)) { $gallery = ''; } # #-----[ OPEN ]------------------------------------ # language/lang_english/lang_admin.php # #-----[ FIND ]------------------------------------ # $lang['User_special_explain'] = 'These fields are not able to be modified by the users. Here you can set their status and other options that are not given to users.'; # #-----[ AFTER, ADD]------------------------------------ # $lang['Gallery_id'] = 'Gallery ID'; # #-----[ OPEN ]------------------------------------ # language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------ # $lang['YIM'] = 'Yahoo Messenger'; # #-----[ AFTER, ADD]------------------------------------ # $lang['Gallery'] = 'Gallery'; # #-----[ OPEN ]------------------------------------ # templates/subSilver/admin/user_edit_body.tpl # #-----[ FIND ]------------------------------------ # <tr> <td class="row1"><span class="gen">{L_SELECT_RANK}</span></td> <td class="row2"><select name="user_rank">{RANK_SELECT_BOX}</select></td> </tr> # #-----[ AFTER, ADD ]------------------------------------ # <tr> <td class="row1"><span class="gen">{L_GALLERY_ID}</span></td> <td class="row2"><input class="post" type="text" name="user_gallery" size="10" maxlength="10" value="{GALLERYID}" /></td> </tr> # #-----[ OPEN ]------------------------------------ # templates/subSilver/viewtopic_body.tpl # #-----[ FIND ]------------------------------------ # <td valign="middle" nowrap="nowrap">{postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG} <script language="JavaScript" type="text/javascript"><!-- # #-----[ IN-LINE FIND ]------------------------------------ # {postrow.MSN_IMG} # #-----[ IN-LINE AFTER, ADD ]------------------------------------ # {postrow.GALLERY_IMG} # #-----[ OPEN ]------------------------------------ # templates/subSilver/profile_view_body.tpl # #-----[ FIND ]------------------------------------ # //--></script><noscript>{ICQ_IMG}</noscript></td> </tr> # #-----[ AFTER, ADD ]------------------------------------ # <tr> <td valign="middle" nowrap="nowrap" align="right"><span class="gen">{L_GALLERY}:</span></td> <td class="row1" valign="middle"><span class="gen">{GALLERY_IMG}</span></td> </tr> # #-----[ OPEN ]------------------------------------ # templates/subSilver/privmsgs_read_body.tpl # #-----[ FIND ]------------------------------------ # {WWW_IMG} {AIM_IMG} {YIM_IMG} {MSN_IMG} </td><td> </td><td valign="top" nowrap="nowrap"><script language="JavaScript" type="text/javascript"><!-- # #-----[ IN-LINE FIND ]------------------------------------ # {MSN_IMG} # #-----[ IN-LINE AFTER, ADD ]------------------------------------ # {GALLERY_IMG} # #-----[ OPEN ]------------------------------------ # templates/subSilver/subSilver.cfg # #----[ FIND ]------------------------------------ # $images['icon_msnm'] = "$current_template_images/{LANG}/icon_msnm.gif"; # #----[ AFTER, ADD ]------------------------------------ # $images['icon_gallery'] = "$current_template_images/{LANG}/icon_gallery.gif"; # #-----[ OPEN ]------------------------------------ # viewtopic.php # #-----[ FIND ]------------------------------------ # $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid # #-----[ IN-LINE FIND ]------------------------------------ # pt.bbcode_uid # #----[ IN-LINE AFTER, ADD ]------------------------------------ # , u.user_gallery # #-----[ FIND ]------------------------------------ # $aim_img = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ''; # #-----[ BEFORE, ADD ]------------------------------------ # if ( !empty($postrow[$i]['user_gallery']) ) { $gallery_uri = append_sid("gallery2.$phpEx?g2_view=core.ShowItem&g2_itemId=" . $postrow[$i]['user_gallery']); $gallery_img = '<a href="' . $gallery_uri . '"><img src="' . $images['icon_gallery'] . '" alt="' . $lang['Gallery'] . '" title="' . $lang['Gallery'] . '" border="0" /></a>'; } else { $gallery_img = ""; } # #-----[ FIND ]------------------------------------ # $icq = ''; # #-----[ AFTER, ADD ]------------------------------------ # $gallery_img = ''; # #-----[ FIND ]------------------------------------ # 'ICQ' => $icq, # #-----[ AFTER, ADD ]------------------------------------ # 'GALLERY_IMG' => $gallery_img, # #-----[ OPEN ]------------------------------------ # privmsg.php # #-----[ FIND ]------------------------------------ # $sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, u.user_sig_bbcode_uid, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_avatar, pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text # #-----[ IN-LINE FIND ]------------------------------------ # u.user_avatar, # #-----[ IN-LINE AFTER, ADD ]------------------------------------ # u.user_gallery, # #-----[ FIND ]------------------------------------ # $aim_img = ( $privmsg['user_aim'] ) ? '<a href="aim:goim?screenname=' . $privmsg['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ''; # #-----[ BEFORE, ADD ]------------------------------------ # if ( !empty($privmsg['user_gallery']) ) { $gallery_uri = append_sid("gallery2.$phpEx?g2_view=core.ShowItem&g2_itemId=" . $privmsg['user_gallery']); $gallery_img = '<a href="' . $gallery_uri . '"><img src="' . $images['icon_gallery'] . '" alt="' . $lang['Gallery'] . '" title="' . $lang['Gallery'] . '" border="0" /></a>'; } else { $gallery_img = ""; } # #-----[ FIND ]------------------------------------ # 'ICQ' => $icq, # #----[ AFTER, ADD ]------------------------------------ # 'GALLERY_IMG' => $gallery_img, # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM
The following optional MOD contains the required file modifications to automatically allow the integration to manage the Gallery album setting for users that own an album:
############################################################## ## MOD Title: MOD for PilotSpikes MOD to Auto-manage Gallery Album ID ## MOD Author: Scott Gregory < jettyrat@jettyfishing.com > (N/A) NA ## MOD Description: This mod allows the integration to auto-manage the album id field ## MOD Version: 0.1.0 ## ## Installation Level: Easy ## Installation Time: 5 Minutes ## Files To Edit: g2helper.inc, ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################## ## Author Notes: ## ############################################################## ## MOD History: ## ## 2006-04-21 - Version 0.1.0 ## - Initial Developmental Release ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################### #-----[ OPEN ]------------------------------------------ # g2helper.inc # #-----[ FIND ]------------------------------------------ # $this->_init_array['activeUserId'] = $userdata['user_id']; $ret = GalleryEmbed::isExternalIdMapped($userdata['user_id'], 'GalleryUser'); if (empty($ret)) { # #-----[ AFTER, ADD ]------------------------------------------ # $this->_mapGalleryLink($userdata['user_id'], $userdata['user_gallery']); # #-----[ FIND ]------------------------------------------ # function _createUser($id, $level, $newUserData) { # #-----[ BEFORE, ADD ]------------------------------------------ # function _mapGalleryLink($userId, $userGallery) { global $db, $lang, $gallery; if (isset($userGallery)) { list ($ret, $entityId) = GalleryCoreApi::loadEntityByExternalId($userId, 'GalleryUser'); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_LOADENTITYBYEXTID_FAILED'], $userId) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } list ($ret, $itemIds) = GalleryCoreApi::fetchAllItemIdsByOwnerId($entityId->getId()); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_FETCHITEMSBYOWNER_FAILED'], $entityId->getId()) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } if (in_array($userGallery, $itemIds)) { return; } } if (empty($entityId)) { list ($ret, $entityId) = GalleryCoreApi::loadEntityByExternalId($userId, 'GalleryUser'); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_LOADENTITYBYEXTID_FAILED'], $userId) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } } if (empty($itemIds)) { list ($ret, $itemIds) = GalleryCoreApi::fetchAllItemIdsByOwnerId($entityId->getId()); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, sprintf($lang['G2_FETCHITEMSBYOWNER_FAILED'], $entityId->getId()) . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } } $query = "SELECT [Entity::id] FROM [Entity] WHERE [Entity::entityType] = ?"; list ($ret, $results) = $gallery->search($query, array('GalleryAlbumItem')); if (isset($ret)) { $this->_errorHandler(GENERAL_ERROR, $lang['G2_FETCHENTITYID_FAILED'] . $lang['G2_ERROR'] . $ret->getAsHtml(), __LINE__, __FILE__); } while ($g2Result = $results->nextResult()) { if (in_array($g2Result[0], $itemIds)) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_gallery = ' . $g2Result[0] . " WHERE user_id = $userId"; if (!$db->sql_query($sql)) { $this->_errorHandler(CRITICAL_ERROR, $lang['UPDATE_GALLERYUSER_FAILED'], __LINE__, __FILE__, $sql); } return; } } $sql = 'UPDATE ' . USERS_TABLE . " SET user_gallery = NULL WHERE user_id = $userId"; if (!$db->sql_query($sql)) { $this->_errorHandler(CRITICAL_ERROR, $lang['UPDATE_GALLERYUSER_FAILED'], __LINE__, __FILE__, $sql); } } # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM
If you are not going to use the auto-manage addition to this mod, then an admin will have to manually set the album id for each user in the ACP. If you are using the auto-manage mod, no configuration is necessary.
If you are having problems getting your add-on mod completed successfully, start out by searching the Forums at NukedGallery.net. Gallery2 specific help is offered in this forum on NukedGallery.
If you are having general Gallery 2 problems, you should start by looking in the Gallery 2 Support Forum on the Gallery Website. Search the forum to see if somebody else has posted a similar problem and maybe there's an answer there, otherwise start a new topic to get help. If the problem seems like a bug in the Gallery 2 software you can file a bug in our bug tracker on SourceForge. Please read our tracker guidelines before filing a bug so that we can cut down on the number of spurious reports. If you're unsure whether to file a bug you can always post in the forums first and we'll ask you to file a bug if needed. If you want to chat in real time, you can talk on our user-to-user irc support channel, #gallery-support on irc.freenode.net.
Remember - reporting bugs is good. Even if you think it's silly, go ahead and report it. We can always close the bug or refile it (please don't be offended in this case) but it's harder to find bugs than it is to fix them so we're counting on you to help us with the finding part.
The following are known issues with this add-on mod package:
For a list of known issues with Gallery 2, view the Gallery 2 README.
$Id: Readme.html 14689 2006-10-05 13:34:05Z dmolavi $