<?php
/*
   +----------------------------------------------------------------------+
   | Configuration Global Page    					  |
   | Author: Adam Goldberg						  |
   +----------------------------------------------------------------------+
   | Copyright (c) 2008-2009 Adam J Goldberg      			  |
   | This file is part of Lifebox.					  |
   |      								  |
   | Lifebox is free software: you can redistribute it and/or modify      |
   | it under the terms of the GNU General Public License as published by |
   | the Free Software Foundation, either version 3 of the License, or    |
   | (at your option) any later version.  				  |
   |      								  |
   | Lifebox is distributed in the hope that it will be useful,   	  |
   | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
   | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	  |
   | GNU General Public License for more details. 			  |
   |      								  |
   | You should have received a copy of the GNU General Public License    |
   | along with Lifebox.  If not, see <http://www.gnu.org/licenses/>.     |
   +----------------------------------------------------------------------+
   | Control global variables throughout the site 			  |
   | This file stores the configuration variables for all of the scripts  |
   | within the program -- it is included by each php page.       	  |
   +----------------------------------------------------------------------+
*/

//General
	$CONFIG['path'] =				'/var/www/lifebox/'; //Use trailing slash
	$CONFIG['full_site'] =				'http://photos.example.com/'; //Use trailing slash
	$CONFIG['domain'] =				'photos.example.com'; //Affixed to all e-mails
	$CONFIG['cookie_domain'] =			'photos.example.com'; //Leave . at front unless subdomain
	$CONFIG['media_path'] =				'/var/www/lifebox/media/originals';
	$CONFIG['media_path_modified'] =		'/var/www/lifebox/media/modified';
	$CONFIG['dump_dir'] =				'/var/www/lifebox/dump'; //Must be write accessible to web server
	$CONFIG['admin_password'] =			''; //This is the password the site admin will use to enter
	$CONFIG['admin_email'] =			''; //This is the site admin's email.  Must match database
	$CONFIG['featured_photo_id'] =			''; //Manually override the featured ID displayed on the homepage
	$CONFIG['text_copyright'] =			'COPYRIGHT 2009'; //Insert copyright text here
	$CONFIG['text_header'] =			''; //Create custom header text
	$CONFIG['site_title'] =				'My Lifebox'; //Title of site goes here
	$CONFIG['db_host'] =				'localhost'; //Database Hostname
	$CONFIG['db_port'] =				'3306'; //Database Port
	$CONFIG['db_type'] =				'mysql'; //Database Application (mysql,oracle,mssql,etc..)
	$CONFIG['db_name'] =				'lifebox'; //Database Name
	$CONFIG['db_user'] =				'user'; //Database User
	$CONFIG['db_pass'] =				'pass'; //Database Pass
	#$CONFIG['footer_links'] =			Array('ABOUT'=>'/about' , 'FAQ'=>'/faq'); //Insert custom footer links

// Variables -- ONLY EDIT BELOW THIS LINE IF YOU KNOW WHAT YOU ARE DOING --
	$CONFIG['main_featured_width'] =		440;
	$CONFIG['main_featured_height'] =		293;
	$CONFIG['main_album_width'] =			140;
	$CONFIG['main_album_height'] =			93;
	$CONFIG['main_event_width'] =			140;
	$CONFIG['main_event_height'] =			80;
	$CONFIG['main_recent_width'] =			240;
	$CONFIG['main_recent_height'] =			160;
	$CONFIG['album_width'] =			240;
	$CONFIG['album_height'] =			160;
	$CONFIG['thumb_width'] =			140;
	$CONFIG['thumb_height'] =			93;
	$CONFIG['preview_width'] =			740;
	$CONFIG['preview_height'] =			1200;
	$CONFIG['full_width'] =				1600;
	$CONFIG['full_height'] =			1200;
	$CONFIG['roll_width'] =				70;
	$CONFIG['roll_height'] =			50;
	$CONFIG['micro_width'] =			64;
	$CONFIG['micro_height'] =			36;
	$CONFIG['new_days'] =				3; 	#14 DAys
	$CONFIG['modified_extension'] = 		'jpg';
	
	$CONFIG['image_denied'] =			$CONFIG['path'].'html/images/bg_preview.png';

	$CONFIG['video_files'] =			Array('avi','mpg','mov','mp4');
	$CONFIG['default_prefix'] =			Array('img','_mg','dsc','mvi','batchpic');
	$CONFIG['acceptable_media'] =			Array('jpg','cr2','nef','tiff','jpeg','bmp','avi','mov','mpg','mpeg','mp4');

	$CONFIG['perpage_albums'] =			30;
	$CONFIG['perpage_rolls'] =			40;
	$CONFIG['perpage_contents'] =			180;
	$CONFIG['perpage_search'] =			90;
	$CONFIG['perpage_xml_photos'] =			20;
	$CONFIG['perpage_xml_videos'] =			20;
	$CONFIG['perpage_xml_comments'] =		20;
	$CONFIG['perpage_xml_albums'] =			100;
	$CONFIG['perpage_xml_rolls'] =			2000;

	$CONFIG['permission_show_admin_menu'] =		5;	
	$CONFIG['permission_change_level'] =		5;
	$CONFIG['permission_make_highlight'] =		4;
	$CONFIG['permission_create_album'] =		5;
	$CONFIG['permission_album_association'] =	4;
	$CONFIG['permission_download_original'] =	4;
	$CONFIG['permission_modify_photo_texts'] =	2;
	$CONFIG['permission_delete_photo_tags'] =	4;
	$CONFIG['permission_add_photo_tags'] =		2;
	$CONFIG['permission_view_activity'] =		5;
	$CONFIG['permission_download_all'] =		4;
	$CONFIG['permission_delete_comments'] =		5;

	$CONFIG['changelog_photo_permission'] =		1;
	$CONFIG['changelog_highlight'] =		2;
	$CONFIG['changelog_create_album'] =		3;
	$CONFIG['changelog_album_association'] =	4;
	$CONFIG['changelog_photo_title'] =		5;
	$CONFIG['changelog_photo_text'] =		6;
	$CONFIG['changelog_photo_tags'] =		7;
	$CONFIG['changelog_create_album_type'] =	8;
	
	$CONFIG['min_length_search'] =			3;
	$CONFIG['tag_threshold'] =			2;
	$CONFIG['tooltip_min_views'] =			3;
	$CONFIG['tag_queue_flush_time'] =		15 * 60; //15 minutes

	$CONFIG['ffmpeg_path'] =			'/usr/local/bin/ffmpeg';
	$CONFIG['ffmpeg_threads'] =			'';
	$CONFIG['qt_faststart_path'] =			'/usr/local/bin/qt-faststart';
	$CONFIG['mediainfo_path'] =			'/usr/bin/mediainfo';
	$CONFIG['convert_path'] =			'/usr/bin/convert';
	$CONFIG['identify_path'] =			'/usr/bin/identify';
	$CONFIG['nice_path'] =				'/usr/bin/nice';

	#Some configurations may have different encoding libraries.  To account
        #for this, the video encoding string can be adjusted here.  If "libmp3lame"
        #and "libx264" don't work, try just "mp3" and "h264"
        $CONFIG['ffmpeg_convert_flags'] =               '-acodec libmp3lame -ab 128k -vcodec libx264 -r 30 -b 1536k -maxrate 1536k';

	$CONFIG['cache_album_list'] =			0;
	$CONFIG['cache_album_count'] =			0;
	$CONFIG['cache_photo_list'] =			0;
	$CONFIG['cache_featured_photo'] =		0;
	$CONFIG['cache_popular_photos'] =		720;
	$CONFIG['cache_statistics'] =			0;
	$CONFIG['cache_latest_comments'] =		0;
	$CONFIG['cache_read_photo'] =			0 * 28 * 24 * 60 * 60; //24 days, set to 0 so file names upidate download titles
	$CONFIG['cache_s_access'] =			0;
	$CONFIG['cache_refresh'] =			0; //Cache header for all pages (in seconds)
	$CONFIG['cache_media'] =			31536000; //Cache header for thumbnails, images, and ideos only (in seconds)

	$CONFIG['email_from_auth'] =			'Lifebox <auth@'.$CONFIG['domain'].'>';
	$CONFIG['email_notify'] =			''; #Specify an optional contact email
	$CONFIG['email_from_comment'] =			'Lifebox <notify@'.$CONFIG['domain'].'>';
	$CONFIG['email_signature'] =			"Thanks,\r\n".$CONFIG['site_title'];
	$CONFIG['email_from_tag'] =			'Lifebox <notify@'.$CONFIG['domain'].'>';
	$CONFIG['email_envelope'] =			'postmaster@'.$CONFIG['domain'];

	$CONFIG['lifebox_cache'] =			$CONFIG['dump_dir'].'/cache-thumbs';

	$CONFIG['text_title'] =				'Suggest a title for this photo ...';
	$CONFIG['text_description'] =			'Click to add a description ...';
	$CONFIG['text_tags'] =				'Click to add tags to this photo (e.g., Tokyo, Fraises des Bois, Cathedral, etc ...)';

	#Check for less than 20 IPs per e-mail in the last
	#30 days.  This should prevent mass distributions.
	$CONFIG['auth_ips_per_email_long'] =		20;
	$CONFIG['auth_ips_per_email_long_period'] =	30;	// 30 DAYS
	$CONFIG['auth_ips_per_email_long_msg']	=	"This e-mail address has logged in from too many 
							 places in the past few weeks.  As a security precaution, 
							 we've sent you an e-mail verification to make sure 
							 it's you.  Click the link to get access immediately";


	#Check for less than 2 IPs in the last 24 hours.
	$CONFIG['auth_ips_per_email_short'] =		2;	
	$CONFIG['auth_ips_per_email_short_period'] =	24;	// 24 HOURS
	$CONFIG['auth_ips_per_email_short_msg']	=	"This e-mail address has logged in from a lot of different 
							 places today. To be sure it's you, we've sent you an e-mail.  
							 Click the link to authenticate.  It'll just take a second";

	#Check for less than 5 failed logins from the same
	#IP in the last 24 hours.  This eliminates brute
	#force attempts
	$CONFIG['auth_emails_per_ip_long'] =		5;	
	$CONFIG['auth_emails_per_ip_long_period'] =	30;	//1 DAY
	$CONFIG['auth_emails_per_ip_long_msg']	=	"You've attempted too many logins from this computer in 
							 the past 30 days.  As an added security precaution, 
							 we've sent a verification link to your e-mail.  
							 Click it to authenticate.  It'll only take a second!";

	#Check for less than 5 e-mails from the same 
	#IP in the last 30 days.  Another way to eliminate 
	#brute force attacks
	$CONFIG['auth_emails_per_ip_short'] =		5;	
	$CONFIG['auth_emails_per_ip_short_period'] =	1;	//1 DAY
	$CONFIG['auth_emails_per_ip_short_msg'] =	"You've attempted too many logins.  Try again 
							 later.  Send me an e-mail if you believe this is 
							 an error.";

	#Check that someone has not used this e-mail
	#address for access in the last 10 minutes
	$CONFIG['auth_last_access_period'] =		10;	//10 MINUTE
	$CONFIG['auth_last_access_period_msg'] =	"Sorry, this site is only for people that I personally 
							 know.  Concurrent users are not allowed.  Send me an 
							 e-mail if you believe this is an error.";

//Database

	$ADODB_CACHE_DIR =				$CONFIG['dump_dir'].'/cache-adodb';   //Query Cache Directory
	$ADODB_FETCH_MODE =				'ADODB_FETCH_ASSOC';
	$CONFIG['db_debug'] =				false; //Debug true or false
	$CONFIG['db_error'] =				true; //Show errors

//Smarty
	$CONFIG['smarty_templates'] =			$CONFIG['path'].'html/templates';
	$CONFIG['smarty_templates_c'] =			$CONFIG['dump_dir'].'/cache-templates';

//DB Table Names
	$CONFIG['tbl_photos'] =				'photos';
	$CONFIG['tbl_albums'] =				'albums';
	$CONFIG['tbl_album_photo_map'] =		'album_photo_map';
	$CONFIG['tbl_album_types'] =			'album_types';
	$CONFIG['tbl_views'] =				'views';
	$CONFIG['tbl_comments'] =			'comments';
	$CONFIG['tbl_tags'] =				'tags';
	$CONFIG['tbl_tag_photo_map'] =			'tag_photo_map';
	$CONFIG['tbl_changelog'] =			'changelog';
	$CONFIG['tbl_access'] =				'access';
	$CONFIG['tbl_logins'] =				'logins';
	$CONFIG['tbl_s_access'] =			's_access';
	$CONFIG['tbl_tag_queue'] =			'tag_queue';
	$CONFIG['tbl_dir_scan_cache'] =			'dir_scan_cache';

?>
