aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorgweltas <gweltas@piwigo.org>2004-03-26 17:08:09 +0000
committergweltas <gweltas@piwigo.org>2004-03-26 17:08:09 +0000
commit9fd459d0510534ab6f92b7f4e9a3a4598ff3c1ab (patch)
tree95e08d38d2604c350c1b200e0cb2c20cc53bbfc8 /include
parent4128835db8d7b8e619951d4c31e23bd934758f09 (diff)
- Template migration
- Admin Control Panel migration - Category management git-svn-id: http://piwigo.org/svn/trunk@394 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/common.inc.php11
-rw-r--r--include/functions.inc.php13
-rw-r--r--include/functions_category.inc.php42
-rw-r--r--include/functions_user.inc.php1
-rw-r--r--include/htmlfunctions.inc.php (renamed from template/default/htmlfunctions.inc.php)59
5 files changed, 53 insertions, 73 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index 2478850a9..6a06706ce 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -120,7 +120,6 @@ if( !defined("PHPWG_INSTALLED") )
exit;
}
-define( 'PREFIX_INCLUDE', '' );// en attendant la migration complète
include(PHPWG_ROOT_PATH . 'include/constants.php');
include(PHPWG_ROOT_PATH . 'include/config.inc.php');
include(PHPWG_ROOT_PATH . 'include/functions.inc.php');
@@ -140,7 +139,8 @@ or die ( "Could not connect to database" );
//
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) != '' )
{
- $client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
+ $client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ?
+ $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
if ( preg_match("/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/",
getenv('HTTP_X_FORWARDED_FOR'), $ip_list) )
@@ -158,13 +158,14 @@ if ( getenv( 'HTTP_X_FORWARDED_FOR' ) != '' )
}
else
{
- $client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
+ $client_ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ?
+ $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );
}
$user_ip = encode_ip($client_ip);
//
-// Setup forum wide options, if this fails then we output a CRITICAL_ERROR
-// since basic forum information is not available
+// Setup gallery wide options, if this fails then we output a CRITICAL_ERROR
+// since basic gallery information is not available
//
$query = 'SELECT param,value';
$query.= ' FROM '.CONFIG_TABLE;
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 5287bf99e..4cf4a2337 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -24,11 +24,12 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
-include( PHPWG_ROOT_PATH .'include/functions_user.inc.php' );
-include( PHPWG_ROOT_PATH .'include/functions_session.inc.php' );
-include( PHPWG_ROOT_PATH .'include/functions_category.inc.php' );
-include( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' );
-include( PHPWG_ROOT_PATH .'include/functions_group.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/functions_user.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/functions_session.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/functions_category.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/functions_xml.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/functions_group.inc.php' );
+include_once( PHPWG_ROOT_PATH .'include/htmlfunctions.inc.php' );
//----------------------------------------------------------- generic functions
@@ -396,7 +397,7 @@ function notify( $type, $infos = '' )
while ( $row = mysql_fetch_array( $result ) )
{
$to = $row['mail_address'];
- include( PREFIX_INCLUDE.'./language/'.$row['language'].'.php' );
+ include( PHPWG_ROOT_PATH.'language/'.$row['language'].'.php' );
$content = $lang['mail_hello']."\n\n";
switch ( $type )
{
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 1652f3b6e..5f8aed0cf 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -111,10 +111,17 @@ function get_user_plain_structure()
{
$category = array();
foreach ( $infos as $info ) {
- if ( $info == 'uc.date_last' )
+ if ( $info == 'uc.date_last')
{
- list($year,$month,$day) = explode( '-', $row['date_last'] );
- $category['date_last'] = mktime(0,0,0,$month,$day,$year);
+ if (empty($row['date_last']))
+ {
+ $category['date_last']= 0;
+ }
+ else
+ {
+ list($year,$month,$day) = explode( '-', $row['date_last'] );
+ $category['date_last'] = mktime(0,0,0,$month,$day,$year);
+ }
}
else if ( isset( $row[$info] ) ) $category[$info] = $row[$info];
else $category[$info] = '';
@@ -239,8 +246,6 @@ function count_user_total_images()
// $cat['site_id']
function get_cat_info( $id )
{
- global $page;
-
$infos = array( 'nb_images','id_uppercat','comment','site_id','galleries_url'
,'dir','date_last','uploadable','status','visible'
,'representative_picture_id','uppercats' );
@@ -270,14 +275,14 @@ function get_cat_info( $id )
$cat['name'] = array();
- $query = 'SELECT name FROM '.CATEGORIES_TABLE;
+ $query = 'SELECT name,id FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id IN ('.$cat['uppercats'].')';
$query.= ' ORDER BY id ASC';
$query.= ';';
$result = mysql_query( $query );
while( $row = mysql_fetch_array( $result ) )
{
- array_push( $cat['name'], $row['name'] );
+ $cat['name'][$row['id']] = $row['name'];
}
return $cat;
@@ -350,28 +355,6 @@ function get_site_url( $category_id )
return $row['galleries_url'];
}
-// The function get_cat_display_name returns a string containing the list
-// of upper categories to the root category from the lowest category shown
-// example : "anniversaires - fete mere 2002 - animaux - erika"
-// You can give two parameters :
-// - $separation : the string between each category name " - " for example
-// - $style : the style of the span tag for the lowest category,
-// "font-style:italic;" for example
-function get_cat_display_name( $array_cat_names, $separation,
- $style, $replace_space = true )
-{
- $output = '';
- foreach ( $array_cat_names as $i => $name ) {
- if ( $i > 0 ) $output.= $separation;
- if ( $i < count( $array_cat_names ) - 1 or $style == '')
- $output.= $name;
- else
- $output.= '<span style="'.$style.'">'.$name.'</span>';
- }
- if ( $replace_space ) return replace_space( $output );
- else return $output;
-}
-
// initialize_category initializes ;-) the variables in relation
// with category :
// 1. calculation of the number of pictures in the category
@@ -633,3 +616,4 @@ function get_first_non_empty_cat_id( $id_uppercat )
return false;
}
?>
+
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 0c6671974..cf3f01fb3 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -260,7 +260,6 @@ function setup_style($style)
{
$template_path = 'template/' ;
$template_name = $style ;
- include_once( PHPWG_ROOT_PATH . $template_path . $template_name.'/htmlfunctions.inc.php' );
$template = new Template(PHPWG_ROOT_PATH . $template_path . $template_name);
return $template;
}
diff --git a/template/default/htmlfunctions.inc.php b/include/htmlfunctions.inc.php
index 6031d1e45..426ef8e82 100644
--- a/template/default/htmlfunctions.inc.php
+++ b/include/htmlfunctions.inc.php
@@ -107,38 +107,6 @@ function create_navigation_bar( $url, $nb_element, $start,
return $navigation_bar;
}
-
-
-function make_jumpbox($value, $selected, $usekeys=false)
-{
- $boxstring = '';
- $nb = sizeof( $value);
- $keys = ($usekeys?array_keys($value):$value);
- $value = ($usekeys?array_values($value):$value);
- for ( $i = 0; $i < $nb; $i++ )
- {
- $boxstring .= '<option value="'.$keys[$i].'"';
- if ($selected == $keys[$i]) $boxstring .=' selected="selected"';
- $boxstring .='>'.$value[$i].'</option>';
- }
- return $boxstring;
-}
-
-function make_radio($name, $value, $selected, $usekeys=false)
-{
- $boxstring = '';
- $nb = sizeof( $value);
- $keys = ($usekeys?array_keys($value):$value);
- $value = ($usekeys?array_values($value):$value);
- for ( $i = 0; $i < $nb; $i++ )
- {
- $boxstring .= '<input type="radio" name="'.$name.'" value="'.$keys[$i].'"';
- if ($selected == $keys[$i]) $boxstring .=' checked';
- $boxstring .='/>'.$value[$i];
- }
- return $boxstring;
-}
-
//
// Pick a language, any language ...
//
@@ -192,4 +160,31 @@ function style_select($default_style, $select_name = "style")
closedir($dir);
return $style_select;
}
+
+// The function get_cat_display_name returns a string containing the list
+// of upper categories to the root category from the lowest category shown
+// example : "anniversaires - fete mere 2002 - animaux - erika"
+// You can give this parameters :
+// - $style : the style of the span tag for the lowest category,
+// "font-style:italic;" for example
+function get_cat_display_name( $cat_informations, $separator,
+ $url = 'category.php?cat=', $replace_space = true)
+{
+ $output = '';
+ $i=0;
+ while ( list ($id, $name) = each($cat_informations))
+ {
+ if ( $i ) $output.= $separator;
+ $i++;
+ if (empty($style) && empty($url) || ($i == count( $cat_informations)))
+ $output.= $name;
+ elseif (!empty($url))
+ $output.= '<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.$url.$id).'">'.$name."</a>";
+ else
+ $output.= '<span style="'.$style.'">'.$name.'</span>';
+ }
+ if ( $replace_space ) return replace_space( $output );
+ else return $output;
+}
?>
+