/*---------------------------------------------------+
| USER's PHOTO ALBUMS for PHP-Fusion 7.00
| Author: Sergei Gushchin (garry)
| e-mail: garry33@yandex.ru
+----------------------------------------------------*/

In this photo gallery, users can create their own photo albums and add photos without confirmation of administrator. The administrator can edit / remove all materials. Gallery made on the basis of the standard photo gallery PHP-Fusion v6.01.6 and adapted for PHP-Fusion v7.00.

UPDATE
(if you have already installed previous version of "User's photo albums" and upgraded PHP-Fusion from version 6.01 to 7.00)

1. Upload following files to the server:

upgrade_sql.php
showuserphoto.php
userphotogallery.php
administration/userphotoalbums.php
administration/userphotos.php
includes/user_fields/user_photo-albums_include.php
includes/user_fields/user_photo-albums_include_var.php
locale/your_language/user_fields/user_photo-albums.php

2. Run the file upgrade_sql.php by typing in your web browser http://your_site.com/upgrade_sql.php. It will modify your database. Then delete this file manually.

3. In the file maincore.php after:
if (iADMIN) {
	define("iAUTH", substr($userdata['user_password'],16,32));
	$aidlink = "?aid=".iAUTH;
}

add this:
if (iMEMBER) {
	define("iUSERAUTH", substr($userdata['user_password'],16,32));
	$uidlink = "?uid=".iUSERAUTH;
}

4. In the file includes/multisite_include.php after:
define("DB_USERS", DB_PREFIX."users");

add this:
define("DB_USERPHOTO_ALBUMS", DB_PREFIX."userphoto_albums");
define("DB_USERPHOTOS", DB_PREFIX."userphotos");

5. In the file infusions/user_info_panel/user_info_panel.php after:
echo THEME_BULLET." <a href='".BASEDIR."members.php' class='side'>".$locale['global_122']."</a><br />\n";

add new link:
echo THEME_BULLET." <a href='".ADMIN."userphotoalbums.php".$uidlink."' class='side'>My photo albums</a><br />\n";

(by following this link user enters to the administration of only his own photo albums, but superadministrator - to all albums.)

6. Add to the navigation menu link to the file userphotogallery.php (call it for example "User's photo albums").

7. You can set in the user profile link to the photo albums of this user if in the admin menu "User Fields" to allow the display of the number of photo albums.

Update completed.


INSTALLATION

1. Upload following files to the server:

install_sql.php
showuserphoto.php
userphotogallery.php
administration/userphotoalbums.php
administration/userphotos.php
includes/user_fields/user_photo-albums_include.php
includes/user_fields/user_photo-albums_include_var.php
locale/your_language/user_fields/user_photo-albums.php

2. Run the file install_sql.php by typing in your web browser http://your_site.com/install_sql.php. It will create two new tables in your database. Then delete this file manually.

3. In the file maincore.php after:
if (iADMIN) {
	define("iAUTH", substr($userdata['user_password'],16,32));
	$aidlink = "?aid=".iAUTH;
}

add this:
if (iMEMBER) {
	define("iUSERAUTH", substr($userdata['user_password'],16,32));
	$uidlink = "?uid=".iUSERAUTH;
}

4. In the file includes/multisite_include.php after:
define("DB_USERS", DB_PREFIX."users");

add this:
define("DB_USERPHOTO_ALBUMS", DB_PREFIX."userphoto_albums");
define("DB_USERPHOTOS", DB_PREFIX."userphotos");

5. In the file infusions/user_info_panel/user_info_panel.php after:
echo THEME_BULLET." <a href='".BASEDIR."members.php' class='side'>".$locale['global_122']."</a><br />\n";

add new link:
echo THEME_BULLET." <a href='".ADMIN."userphotoalbums.php".$uidlink."' class='side'>My photo albums</a><br />\n";

(by following this link user enters to the administration of only his own photo albums, but superadministrator - to all albums.)

6. Add to the navigation menu link to the file userphotogallery.php (call it for example "User's photo albums").

Installation completed.


OPTIONALLY

1. You can set in the user profile link to the photo albums of this user if in the admin menu "User Fields" to allow the display of the number of photo albums.


2. You can allow to upload photos only for one special user group. For this do the follows: 

a) find at the top of files administration/userphotoalbums.php and administration/userphotos.php line:
//if (!in_array(1, explode(".", iUSER_GROUPS))) fallback("../index.php");
uncomment it (remove two slashes - //) and replace digit 1 with id-number of user group required;

b) in the file infusions/user_info_panel/user_info_panel.php instead of mentioned above:
echo THEME_BULLET." <a href='".ADMIN."userphotoalbums.php".$uidlink."' class='side'>My photo albums</a><br />\n";
put this code:
if (in_array(1, explode(".", iUSER_GROUPS))) {
echo THEME_BULLET." <a href='".ADMIN."userphotoalbums.php".$uidlink."' class='side'>My photo albums</a><br />\n";
}
and replace digit 1 with id-number of user group required.


UNINSTALL

1. Prohibit the display of the number of photo albums in the admin menu "User Fields".

2. As superadministrator follow the link "My photo albums" and remove all photos and photo albums.

3. Remove from navigation menu link to the file userphotogallery.php ("User's photo albums") using admin panel.

4. In the file infusions/user_info_panel/user_info_panel.php remove link:
echo THEME_BULLET." <a href='".ADMIN."userphotoalbums.php".$uidlink."' class='side'>My photo albums</a><br />\n";
or, if you had used option wich allow to upload photos only for one special user group, remove the code:
if (in_array(1, explode(".", iUSER_GROUPS))) {
echo THEME_BULLET." <a href='".ADMIN."userphotoalbums.php".$uidlink."' class='side'>My photo albums</a><br />\n";
}

5. In the file maincore.php remove code:
if (iMEMBER) {
	define("iUSERAUTH", substr($userdata['user_password'],16,32));
	$uidlink = "?uid=".iUSERAUTH;
}

6. Upload to the server file uninstall_sql.php and run it by typing in your web browser http://your_site.com/uninstall_sql.php. It will delete two unnecessary tables from your database.

7. Remove from your server following files and directories:
showuserphoto.php
uninstall_sql.php
userphotogallery.php
administration/userphotoalbums.php
administration/userphotos.php
includes/user_fields/user_photo-albums_include.php
includes/user_fields/user_photo-albums_include_var.php
locale/your_language/user_fields/user_photo-albums.php
images/photoalbum/useralbum_1,2,3...

Good luck! :)

Sergei Gushchin (garry)
garry33@yandex.ru