aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/common.inc.php23
-rw-r--r--include/config.inc.php2
-rw-r--r--include/functions.inc.php62
-rw-r--r--include/functions_session.inc.php2
-rw-r--r--include/functions_user.inc.php77
5 files changed, 92 insertions, 74 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index 155890521..844c8f433 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -24,9 +24,11 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
-
-// determine the initial instant to indicate the generation time of this
-// page
+if( !defined("PHPWG_ROOT_PATH") )
+{
+ die ("Hacking attempt!");
+}
+// determine the initial instant to indicate the generation time of this page
$t1 = explode( ' ', microtime() );
$t2 = explode( '.', $t1[0] );
$t2 = $t1[1].'.'.$t2[1];
@@ -109,17 +111,20 @@ $page = array();
$user = array();
$lang = array();
+
+include(PHPWG_ROOT_PATH .'config.php');
if( !defined("PHPWG_INSTALLED") )
{
header( 'Location: install.php' );
exit;
}
-include( $phpwg_root_path.'include/constants.php' );
-include( $phpwg_root_path.'include/functions.inc.php' );
-include( $phpwg_root_path.'include/template.php' );
-include( $phpwg_root_path.'include/vtemplate.class.php' );
-include( $phpwg_root_path.'include/config.inc.php' );
+
+include(PHPWG_ROOT_PATH . 'include/constants.php');
+include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
+include(PHPWG_ROOT_PATH . 'include/template.php');
+include(PHPWG_ROOT_PATH . 'include/vtemplate.class.php');
+include(PHPWG_ROOT_PATH . 'include/config.inc.php');
//
// Database connection
@@ -197,7 +202,7 @@ foreach ( $infos as $info ) {
// A partir d'ici il faudra dispatcher le code dans d'autres fichiers
//---------------
-include($phpwg_root_path . 'include/user.inc.php');
+include(PHPWG_ROOT_PATH . 'include/user.inc.php');
// displaying the username in the language of the connected user, instead of
// "guest" as you can find in the database
diff --git a/include/config.inc.php b/include/config.inc.php
index d6bdd922d..e4185dcb9 100644
--- a/include/config.inc.php
+++ b/include/config.inc.php
@@ -54,7 +54,7 @@ $conf['top_number'] = 10;
$conf['anti-flood_time'] = 60; // seconds between 2 comments : 0 to disable
$conf['max_LOV_categories'] = 50;
-$conf['default_lang'] = 'francais';
+$conf['default_lang'] = 'fr_FR';
$conf['default_style'] = 'default';
?>
diff --git a/include/functions.inc.php b/include/functions.inc.php
index d4d10920b..55a4426d7 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -260,15 +260,16 @@ function get_picture_size( $original_width, $original_height,
// disponibles pour PhpWebGallery
function get_languages( $rep_language )
{
+ global $lang;
$languages = array();
$i = 0;
if ( $opendir = opendir ( $rep_language ) )
{
while ( $file = readdir ( $opendir ) )
{
- if ( is_dir ( $rep_language.$file )&& !substr_count($file,'.') )
+ if ( is_dir ( $rep_language.$file )&& !substr_count($file,'.') && isset($lang['lang'][$file]))
{
- $languages[$i++] =$file;
+ $languages[$i++] =$lang['lang'][$file];
}
}
}
@@ -387,7 +388,7 @@ function notify( $type, $infos = '' )
$options = '-f '.$conf['mail_webmaster'];
// retrieving all administrators
$query = 'SELECT username,mail_address,language';
- $query.= ' FROM '.PREFIX_TABLE.'users';
+ $query.= ' FROM '.USERS_TABLE;
$query.= " WHERE status = 'admin'";
$query.= ' AND mail_address IS NOT NULL';
$query.= ';';
@@ -460,57 +461,4 @@ function pwg_debug( $string )
$debug.= "\n";
}
-//
-// Initialise user settings on page load
-function init_userprefs($userdata)
-{
- global $conf, $template, $lang, $phpwg_root_path;
-
- $style = $conf['default_style'];
- if ( !$userdata['is_the_guest'] )
- {
- if ( !empty($userdata['language']))
- {
- $conf['default_lang'] = $userdata['language'];
- }
- if ( !empty($userdata['template']))
- {
- $style = $userdata['template'];
- }
- }
-
- if ( !file_exists(@realpath($phpwg_root_path . 'language/' . $conf['default_lang'] . '/lang_main.php')) )
- {
- $conf['default_lang'] = 'english';
- }
-
- include_once($phpwg_root_path . 'language/' . $conf['default_lang'] . '/lang_main.php');
- $template= setup_style($style);
-
- return;
-}
-
-function setup_style($style)
-{
- global $phpwg_root_path;
-
- $template_path = 'template/' ;
- $template_name = $style ;
-
- $template = new Template($phpwg_root_path . $template_path . $template_name);
- return $template;
-}
-
-function encode_ip($dotquad_ip)
-{
- $ip_sep = explode('.', $dotquad_ip);
- return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
-}
-
-function decode_ip($int_ip)
-{
- $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
- return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
-}
-
-?>
+?> \ No newline at end of file
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index f6b0fe46b..17991bb58 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -75,7 +75,7 @@ function session_create( $username )
}
// 2. retrieving id of the username given in parameter
$query = 'select id';
- $query.= ' from '.PREFIX_TABLE.'users';
+ $query.= ' from '.USERS_TABLE;
$query.= " where username = '".$username."';";
$row = mysql_fetch_array( mysql_query( $query ) );
$user_id = $row['id'];
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 0c67a970c..1d205414f 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -66,7 +66,7 @@ function register_user( $login, $password, $password_conf,
else
{
$query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'users';
+ $query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = '".$login."'";
$query.= ';';
$result = mysql_query( $query );
@@ -92,12 +92,12 @@ function register_user( $login, $password, $password_conf,
if ( $i > 0 ) $query.= ',';
$query.= $infos[$i];
}
- $query.= ' FROM '.PREFIX_TABLE.'users';
+ $query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = 'guest'";
$query.= ';';
$row = mysql_fetch_array( mysql_query( $query ) );
// 2. adding new user
- $query = 'INSERT INTO '.PREFIX_TABLE.'users';
+ $query = 'INSERT INTO '.USERS_TABLE;
$query.= ' (';
$query.= ' username,password,mail_address,status';
for ( $i = 0; $i < sizeof( $infos ); $i++ )
@@ -119,7 +119,7 @@ function register_user( $login, $password, $password_conf,
mysql_query( $query );
// 3. retrieving the id of the newly created user
$query = 'SELECT id';
- $query.= ' FROM '.PREFIX_TABLE.'users';
+ $query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = '".$login."';";
$row = mysql_fetch_array( mysql_query( $query ) );
$user_id = $row['id'];
@@ -188,7 +188,7 @@ function update_user( $user_id, $mail_address, $status,
if ( sizeof( $error ) == 0 )
{
- $query = 'UPDATE '.PREFIX_TABLE.'users';
+ $query = 'UPDATE '.USERS_TABLE;
$query.= " SET status = '".$status."'";
if ( $use_new_password )
{
@@ -224,4 +224,69 @@ function check_login_authorization()
}
}
}
-?>
+
+//
+// Initialise user settings on page load
+function init_userprefs($userdata)
+{
+ global $conf, $template, $lang, $lang_mapping;
+ $style = $conf['default_style'];
+ if ( !$userdata['is_the_guest'] )
+ {
+ if ( !empty($userdata['language']))
+ {
+ $conf['default_lang'] = $userdata['language'];
+ }
+ if ( !empty($userdata['template']))
+ {
+ $style = $userdata['template'];
+ }
+ }
+
+ if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/common.lang.php')) )
+ {
+ $conf['default_lang'] = 'en_EN';
+ }
+ include_once(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/common.lang.php');
+
+ if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/lang.lang.php')) )
+ {
+ $conf['default_lang'] = 'en_EN';
+ }
+ include_once(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/lang.lang.php');
+
+ if ($userdata['status'] == 'admin')
+ {
+ $admin_lang = $userdata['language'];
+ if ( !file_exists(@realpath(PHPWG_ROOT_PATH . 'language/' . $conf['default_lang'] . '/admin.lang.php')) )
+ {
+ $admin_lang = 'en_EN';
+ }
+ include_once(PHPWG_ROOT_PATH . 'language/' . $admin_lang . '/admin.lang.php');
+ }
+
+ $template= setup_style($style);
+ return;
+}
+
+function setup_style($style)
+{
+ $template_path = 'template/' ;
+ $template_name = $style ;
+
+ $template = new Template(PHPWG_ROOT_PATH . $template_path . $template_name);
+ return $template;
+}
+
+function encode_ip($dotquad_ip)
+{
+ $ip_sep = explode('.', $dotquad_ip);
+ return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
+}
+
+function decode_ip($int_ip)
+{
+ $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
+ return hexdec($hexipbang[0]). '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
+}
+?> \ No newline at end of file