= 5.1.0RC1
'hash_hmac', //(hash) - enabled by default as of PHP 5.1.2
'preg_last_error', // PHP 5 >= 5.2.0
'json_encode', // PHP 5 >= 5.2.0
) as $func)
{
if (!function_exists($func))
{
include_once(PHPWG_ROOT_PATH . 'include/php_compat/'.$func.'.php');
}
}
include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
if (isset($conf['local_dir_site']))
{
@include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
}
include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors']))
{
@ini_set('error_reporting', $conf['show_php_errors']);
@ini_set('display_errors', true);
}
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
include( PHPWG_ROOT_PATH .'include/template.class.php');
// Database connection
try
{
$pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
$conf['db_password'], $conf['db_base']);
}
catch (Exception $e)
{
my_error(l10n($e->getMessage()), true);
}
pwg_db_check_charset();
load_conf_from_db();
// Version 2.2 specific, in case of problem during automatic upgrade
if (!isset($conf['week_starts_on']))
{
redirect(get_root_url().'upgrade.php');
}
load_plugins();
include(PHPWG_ROOT_PATH.'include/user.inc.php');
if (in_array( substr($user['language'],0,2), array('fr','it','de','es','pl','hu','ru','nl') ) )
{
define('PHPWG_DOMAIN', substr($user['language'],0,2).'.piwigo.org');
}
elseif ('zh_CN' == $user['language']) {
define('PHPWG_DOMAIN', 'cn.piwigo.org');
}
else {
define('PHPWG_DOMAIN', 'piwigo.org');
}
define('PHPWG_URL', 'http://'.PHPWG_DOMAIN);
if(isset($conf['alternative_pem_url']) and $conf['alternative_pem_url']!='')
{
define('PEM_URL', $conf['alternative_pem_url']);
}
else
{
define('PEM_URL', 'http://'.PHPWG_DOMAIN.'/ext');
}
// language files
load_language('common.lang');
if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) )
{
load_language('admin.lang');
}
trigger_action('loading_lang');
load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
// only now we can set the localized username of the guest user (and not in
// include/user.inc.php)
if (is_a_guest())
{
$user['username'] = l10n('guest');
}
// template instance
if (defined('IN_ADMIN') and IN_ADMIN )
{// Admin template
$template = new Template(PHPWG_ROOT_PATH.'admin/themes', $conf['admin_theme']);
}
else
{ // Classic template
$template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme'] );
}
if ( !isset($conf['no_photo_yet']) )
{
include(PHPWG_ROOT_PATH.'include/no_photo_yet.inc.php');
}
if (isset($user['internal_status']['guest_must_be_guest'])
and
$user['internal_status']['guest_must_be_guest'] === true)
{
$header_msgs[] = l10n('Bad status for user "guest", using default status. Please notify the webmaster.');
}
if ($conf['gallery_locked'])
{
$header_msgs[] = l10n('The gallery is locked for maintenance. Please, come back later.');
if ( script_basename() != 'identification' and !is_admin() )
{
set_status_header(503, 'Service Unavailable');
@header('Retry-After: 900');
header('Content-Type: text/html; charset='.get_pwg_charset());
echo ''.l10n('The gallery is locked for maintenance. Please, come back later.').'';
echo str_repeat( ' ', 512); //IE6 doesn't error output if below a size
exit();
}
}
if ($conf['check_upgrade_feed'])
{
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php');
if (check_upgrade_feed())
{
$header_msgs[] = 'Some database upgrades are missing, '
.'upgrade now';
}
}
if (count($header_msgs) > 0)
{
$template->assign('header_msgs', $header_msgs);
$header_msgs=array();
}
if (!empty($conf['filter_pages']) and get_filter_page_value('used'))
{
include(PHPWG_ROOT_PATH.'include/filter.inc.php');
}
else
{
$filter['enabled'] = false;
}
if (isset($conf['header_notes']))
{
$header_notes = array_merge($header_notes, $conf['header_notes']);
}
// default event handlers
add_event_handler('render_category_literal_description', 'render_category_literal_description');
if ( !$conf['allow_html_descriptions'] )
{
add_event_handler('render_category_description', 'nl2br');
}
add_event_handler('render_comment_content', 'render_comment_content');
add_event_handler('render_comment_author', 'strip_tags');
add_event_handler('blockmanager_register_blocks', 'register_default_menubar_blocks', EVENT_HANDLER_PRIORITY_NEUTRAL-1);
trigger_action('init');
?>