aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-05-18 21:42:32 +0000
committerz0rglub <z0rglub@piwigo.org>2003-05-18 21:42:32 +0000
commitaac81a8a382f7ec527e22d6dee959400d77e1a21 (patch)
treeb51b5180e85326af0cfebf88bcad005ba93d5118
parent2c2af65b6a95e20ba9ca49139683d2d150edb1b6 (diff)
*** empty log message ***
git-svn-id: http://piwigo.org/svn/trunk@14 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/edit_cat.php188
-rw-r--r--admin/include/functions.php4
-rw-r--r--admin/infos_images.php450
-rw-r--r--category.php8
-rw-r--r--include/config.inc.php18
-rw-r--r--include/functions_session.inc.php6
-rw-r--r--include/functions_user.inc.php1
-rw-r--r--profile.php18
-rw-r--r--template/default/htmlfunctions.inc.php33
-rw-r--r--template/default/profile.vtp6
10 files changed, 335 insertions, 397 deletions
diff --git a/admin/edit_cat.php b/admin/edit_cat.php
index c813bac66..9075039cc 100644
--- a/admin/edit_cat.php
+++ b/admin/edit_cat.php
@@ -1,9 +1,9 @@
<?php
/***************************************************************************
- * edit_cat.php is a part of PhpWebGallery *
+ * edit_cat.php is *
* ------------------- *
- * last update : Tuesday, July 16, 2002 *
- * email : pierrick@z0rglub.com *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
* *
***************************************************************************/
@@ -14,103 +14,87 @@
* the Free Software Foundation; *
* *
***************************************************************************/
- include_once( "./include/isadmin.inc.php" );
-
- if ( $HTTP_GET_VARS['valider'] == 1 )
- {
- $query = "update PREFIX_TABLE"."categories ";
- if ( $HTTP_POST_VARS['name'] == "" )
- {
- $query.= "set name = NULL, ";
- }
- else
- {
- $query.= "set name = '".htmlspecialchars( $HTTP_POST_VARS['name'], ENT_QUOTES)."', ";
- }
- if ( $HTTP_POST_VARS['comment'] == "" )
- {
- $query.= "comment = NULL, ";
- }
- else
- {
- $query.= "comment = '".htmlspecialchars( $HTTP_POST_VARS['comment'], ENT_QUOTES )."', ";
- }
- $query.= "status = '".$HTTP_POST_VARS['status']."' ";
- $query.= "where id = '".$HTTP_GET_VARS['cat']."';";
- mysql_query( $query );
-
- $result = mysql_query( "select id from PREFIX_TABLE"."users where pseudo != '".$conf['webmaster']."';" );
- while ( $row = mysql_fetch_array ( $result ) )
- {
- check_favorites( $row['id'] );
- }
-
- echo"<div style=\"color:red;text-align:center;\">".$lang['editcat_confirm']." [ <a href=\"".add_session_id_to_url( "./admin.php?page=cat" )."\">".$lang['editcat_back']."</a> ]</div>";
- }
-
- echo "
- <form action=\"".add_session_id_to_url( "./admin.php?page=edit_cat&amp;cat=".$HTTP_GET_VARS['cat']."&amp;valider=1" )."\" method=\"post\">
- <table style=\"width:100%;\">";
- $query = "select a.id,name,dir,status,comment,id_uppercat,site_id,galleries_url";
- $query.= " from PREFIX_TABLE"."categories as a, PREFIX_TABLE"."sites as b";
- $query.= " where a.id = ".$HTTP_GET_VARS['cat'];
- $query.= " and a.site_id = b.id;";
- $row = mysql_fetch_array( mysql_query( $query ) );
- $result = get_cat_info( $row['id'] );
- $array_cat_names = $result['name'];
- echo "
- <tr>
- <th colspan=\"2\">".$lang['editcat_title1']." ".$lang['category']." \"".get_cat_display_name( $array_cat_names, " - ", "font-style:italic;" )."\" [ dir : ".$row['dir']." ]</th>
- </tr>";
- if ( $row['site_id'] != 1 )
- {
- echo "
- <tr>
- <td style=\"width:20%;\">Server</td>
- <td class=\"row2\">".$row['galleries_url']."</td>
- </tr>";
- }
- echo "
- <tr>
- <td style=\"width:20%;\">".$lang['editcat_name']."</td>
- <td class=\"row2\"><input type=\"text\" name=\"name\" value=\"".$row['name']."\" maxlength=\"255\"/></td>
- </tr>
- <tr>
- <td style=\"width:20%;\">".$lang['editcat_comment']."</td>
- <td class=\"row2\"><textarea name=\"comment\" rows=\"5\" cols=\"50\" style=\"overflow:auto\">".$row['comment']."</textarea></td>
- </tr>
- <tr>
- <td style=\"width:20%;\">".$lang['editcat_status']."</td>
- <td class=\"row2\">
- <select name=\"status\">";
- // on récupère toutes les status possibles dans la base
- // par l'intermédiaire de la fonction get_enums trouvable
- // dans le fichier config.php
- $option = get_enums( PREFIX_TABLE."categories", "status" );
- for ( $i = 0; $i < sizeof( $option ); $i++ )
- {
- if ( $option[$i] == $row['status'] )
- {
- echo"
- <option selected>$option[$i]</option>";
- }
- else
- {
- echo"
- <option>$option[$i]</option>";
- }
- }
- echo"
- </select>
- ".$lang['editcat_status_info']."
- </td>
- </tr>
- <tr>
- <td colspan=\"2\">&nbsp;</td>
- </tr>
- <tr>
- <td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td>
- </tr>
- </table>
- </form>";
+
+include_once( './include/isadmin.inc.php' );
+//----------------------------------------------------- template initialization
+$sub = $vtp->Open( '../template/'.$user['template'].'/admin/edit_cat.vtp' );
+$tpl = array( 'remote_site','editcat_confirm','editcat_back','editcat_title1',
+ 'editcat_name', 'editcat_comment', 'editcat_status',
+ 'editcat_status_info', 'submit' );
+templatize_array( $tpl, 'lang', $sub );
+//--------------------------------------------------------- form criteria check
+if ( isset( $_POST['submit'] ) )
+{
+ $query = 'UPDATE '.PREFIX_TABLE.'categories';
+ if ( $_POST['name'] == '' )
+ {
+ $query.= ' SET name = NULL';
+ }
+ else
+ {
+ $query.= " SET name = '".htmlentities( $_POST['name'], ENT_QUOTES)."'";
+ }
+ if ( $_POST['comment'] == '' )
+ {
+ $query.= ', comment = NULL';
+ }
+ else
+ {
+ $query.= ", comment = '".htmlentities( $_POST['comment'], ENT_QUOTES )."'";
+ }
+ $query.= ", status = '".$_POST['status']."'";
+ $query.= " WHERE id = '".$_GET['cat']."'";
+ $query.= ';';
+ mysql_query( $query );
+
+ $query = 'SELECT id';
+ $query.= ' FROM '.PREFIX_TABLE.'users';
+ $query.= " WHERE username != '".$conf['webmaster']."'";
+ $query.= ';';
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array ( $result ) )
+ {
+ check_favorites( $row['id'] );
+ }
+ $vtp->addSession( $sub, 'confirmation' );
+ $url = add_session_id( './admin.php?page=cat' );
+ $vtp->setVar( $sub, 'confirmation.back_url', $url );
+ $vtp->closeSession( $sub, 'confirmation' );
+}
+//------------------------------------------------------------------------ form
+$form_action = './admin.php?page=edit_cat&amp;cat='.$_GET['cat'];
+$vtp->setVar( $sub, 'form_action', add_session_id( $form_action ) );
+
+$query = 'SELECT a.id,name,dir,status,comment';
+$query.= ',id_uppercat,site_id,galleries_url';
+$query.= ' FROM '.PREFIX_TABLE.'categories as a, '.PREFIX_TABLE.'sites as b';
+$query.= ' WHERE a.id = '.$_GET['cat'];
+$query.= ' AND a.site_id = b.id';
+$query.= ';';
+$row = mysql_fetch_array( mysql_query( $query ) );
+$result = get_cat_info( $row['id'] );
+
+$cat_name = get_cat_display_name( $result['name'], ' - ', '' );
+$vtp->setVar( $sub, 'cat:name', $cat_name );
+$vtp->setVar( $sub, 'cat:dir', $row['dir'] );
+if ( $row['site_id'] != 1 )
+{
+ $vtp->addSession( $sub, 'server' );
+ $vtp->setVar( $sub, 'server.url', $row['galleries_url'] );
+ $vtp->closeSession( $sub, 'server' );
+}
+$vtp->setVar( $sub, 'name', $row['name'] );
+$vtp->setVar( $sub, 'comment', $row['comment'] );
+$options = get_enums( PREFIX_TABLE.'categories', 'status' );
+foreach ( $options as $option ) {
+ $vtp->addSession( $sub, 'status_option' );
+ $vtp->setVar( $sub, 'status_option.option', $option );
+ if ( $option == $row['status'] )
+ {
+ $vtp->setVar( $sub, 'status_option.selected', ' selected="selected"' );
+ }
+ $vtp->closeSession( $sub, 'status_option' );
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
?> \ No newline at end of file
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 0828f0e06..ee7068c18 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -15,11 +15,11 @@
* *
***************************************************************************/
-$tab_ext_create_TN = array ( 'jpg', 'png' );
+$tab_ext_create_TN = array ( 'jpg', 'png', 'JPG', 'PNG' );
function is_image( $filename, $create_thumbnail = false )
{
- global $conf;
+ global $conf, $tab_ext_create_TN;
if ( is_file ( $filename ) )
{
diff --git a/admin/infos_images.php b/admin/infos_images.php
index f1921c6d3..92a7a3885 100644
--- a/admin/infos_images.php
+++ b/admin/infos_images.php
@@ -1,9 +1,9 @@
<?php
/***************************************************************************
- * infos_images.php is a part of PhpWebGallery *
- * ------------------- *
- * last update : Wednesday, July 25, 2002 *
- * email : pierrick@z0rglub.com *
+ * infos_images.php *
+ * ------------------ *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
* *
***************************************************************************/
@@ -14,235 +14,215 @@
* the Free Software Foundation; *
* *
***************************************************************************/
- function check_date_format ( $date )
- {
- // la date arrive à ce format : JJ/MM/AAAA
- // checkdate ( int month, int day, int year)
- $tab_date = explode( "/", $date );
- return checkdate ( $tab_date[1], $tab_date[0], $tab_date[2]);
- }
-
- function date_convert( $date )
- {
- // la date arrive à ce format : JJ/MM/AAAA
- // il faut la transformer en AAAA-MM-JJ
- $tab_date = explode( "/", $date );
- return $tab_date[2]."-".$tab_date[1]."-".$tab_date[0];
- }
-
- function date_convert_back( $date )
- {
- // la date arrive à ce format : AAAA-MM-JJ
- // il faut la transformer en JJ/MM/AAAA
- if ( $date != "" )
- {
- $tab_date = explode( "-", $date );
- return $tab_date[2]."/".$tab_date[1]."/".$tab_date[0];
- }
- else
- {
- return "";
- }
- }
-
- include_once( "./include/isadmin.inc.php" );
- $page['nb_image_page'] = 5;
- check_cat_id( $HTTP_GET_VARS['cat_id'] );
- if ( isset( $page['cat'] ) )
- {
- //------------------------------------------------------------mises à jour
- // 1. options individuelles
- $query = "select id,file ";
- $query.= "from PREFIX_TABLE"."images ";
- $query.= "where cat_id = ".$page['cat']." ";
- $result = mysql_query( $query );
- $i = 1;
- while ( $row = mysql_fetch_array( $result ) )
- {
- $name = "name-".$row['id'];
- $author = "author-".$row['id'];
- $comment = "comment-".$row['id'];
- $date_creation = "date_creation-".$row['id'];
- if ( isset( $HTTP_POST_VARS[$name] ) )
- {
- $query = "update PREFIX_TABLE"."images ";
- if ( $HTTP_POST_VARS[$name] == "" )
- {
- $query.= "set name = NULL ";
- }
- else
- {
- $query.= "set name = '".htmlspecialchars( $HTTP_POST_VARS[$name], ENT_QUOTES )."' ";
- }
- if ( $HTTP_POST_VARS[$author] == "" )
- {
- $query.= ", author = NULL ";
- }
- else
- {
- $query.= ", author = '".htmlspecialchars( $HTTP_POST_VARS[$author], ENT_QUOTES )."' ";
- }
- if ( $HTTP_POST_VARS[$comment] == "" )
- {
- $query.= ", comment = NULL ";
- }
- else
- {
- $query.= ", comment = '".htmlspecialchars( $HTTP_POST_VARS[$comment], ENT_QUOTES )."' ";
- }
- if ( check_date_format( $HTTP_POST_VARS[$date_creation] ) )
- {
- $date = date_convert( $HTTP_POST_VARS[$date_creation] );
- $query.= ", date_creation = '$date' ";
- }
- else if ( $HTTP_POST_VARS[$date_creation] == "" )
- {
- $query.= ", date_creation = NULL ";
- }
- $query.= "where id = '".$row['id']."';";
- mysql_query( $query );
- }
- }
- // 2. options générales
- if ( $HTTP_POST_VARS['use_common_author'] == 1 )
- {
- $query = "update PREFIX_TABLE"."images ";
- if ( $HTTP_POST_VARS['author_cat'] == "" )
- {
- $query.= "set author = NULL ";
- }
- else
- {
- $query.= "set author = '".$HTTP_POST_VARS['author_cat']."' ";
- }
- $query.= "where cat_id = ".$page['cat'].";";
- mysql_query( $query );
- }
- if ( $HTTP_POST_VARS['use_common_date_creation'] == 1 )
- {
- // la date arrive à ce format : JJ/MM/AAAA
- // il faut la transformer en AAAA-MM-JJ
- if ( check_date_format( $HTTP_POST_VARS['date_creation_cat'] ) )
- {
- $date = date_convert( $HTTP_POST_VARS['date_creation_cat'] );
- $query = "update PREFIX_TABLE"."images ";
- if ( $HTTP_POST_VARS['date_creation_cat'] == "" )
- {
- $query.= "set date_creation = NULL ";
- }
- else
- {
- $query.= "set date_creation = '$date' ";
- }
- $query.= "where cat_id = ".$page['cat'].";";
- mysql_query( $query );
- }
- else
- {
- echo $lang['infoimage_err_date'];
- }
- }
- //----------------------------------------------------affichage de la page
- // détection de la page en cours
- if( !isset( $HTTP_GET_VARS['start'] ) || !is_numeric( $HTTP_GET_VARS['start'] ) || ( is_numeric( $HTTP_GET_VARS['start'] ) && $HTTP_GET_VARS['start'] < 0 ) )
- {
- $page['start'] = 0;
- }
- else
- {
- $page['start'] = $HTTP_GET_VARS['start'];
- }
-
- if ( is_numeric( $HTTP_GET_VARS['num'] ) && $HTTP_GET_VARS['num'] >= 0 )
- {
- $page['start'] = floor( $HTTP_GET_VARS['num'] / $page['nb_image_page'] ) * $page['nb_image_page'];
- }
- // retrieving category information
- $result = get_cat_info( $page['cat'] );
- $cat['local_dir'] = $result['local_dir'];
- $cat['dir'] = $result['dir'];
- $cat['name'] = $result['name'];
- $cat['site_id'] = $result['site_id'];
- $cat['nb_images'] = $result['nb_images'];
-
- $url = "./admin.php?page=infos_images&amp;cat_id=".$page['cat'];
- $page['navigation_bar'] = create_navigation_bar( $url, $cat['nb_images'], $page['start'], $page['nb_image_page'], "" );
- echo"
- <form method=\"post\" action=\"".add_session_id_to_url( "./admin.php?page=infos_images&amp;cat_id=".$page['cat']."&amp;start=".$page['start'] )."\">
- <table width=\"100%\">
- <tr>
- <th colspan=\"3\">".$lang['infoimage_general']." \"".get_cat_display_name( $cat['name'], " - ", "font-style:italic;" )."\"</th>
- </tr>
- <tr>
- <td><div style=\"margin-left:50px;\">".$lang['author']."</div></td>
- <td style=\"text-align:center;\"><input type=\"text\" name=\"author_cat\" value=\"\" maxlength=\"255\"/></td>
- <td style=\"text-align:left;\"><input type=\"checkbox\" name=\"use_common_author\" value=\"1\"/>".$lang['infoimage_useforall']."</td>
- </tr>
- <tr>
- <td><div style=\"margin-left:50px;\">".$lang['infoimage_creation_date']." [DD/MM/YYYY]</div></td>
- <td style=\"text-align:center;\"><input type=\"text\" name=\"date_creation_cat\" value=\"\" size=\"12\" maxlength=\"10\"/></td>
- <td style=\"text-align:left;\"><input type=\"checkbox\" name=\"use_common_date_creation\" value=\"1\"/>".$lang['infoimage_useforall']."</td>
- </tr>
- </table>";
- echo"
- <table width=\"100%\">
- <tr>
- <th colspan=\"5\">".$lang['infoimage_detailed']."</th>
- </tr>
- <tr>
- <td colspan=\"5\" align=\"center\">".$page['navigation_bar']."</td>
- </tr>
- <tr>
- <td class=\"row2\" style=\"text-align:center;\">".$lang['thumbnail']."</td>
- <td class=\"row2\" style=\"text-align:center;\">".$lang['infoimage_title']."</td>
- <td class=\"row2\" style=\"text-align:center;\">".$lang['author']."</td>
- <td class=\"row2\" style=\"text-align:center;\">".$lang['infoimage_comment']."</td>
- <td class=\"row2\" style=\"text-align:center;\">".$lang['infoimage_creation_date']."</td>
- </tr>";
- $query = "select id,file,comment,author,tn_ext,name,date_creation";
- $query.= " from PREFIX_TABLE"."images";
- $query.= " where cat_id = ".$page['cat'];
- $query.= $conf['order_by'];
- $query.= " limit ".$page['start'].",".$page['nb_image_page'];
- $query.= ";";
- $result = mysql_query( $query );
- $i = 1;
- while ( $row = mysql_fetch_array( $result ) )
- {
- echo"
- <tr>";
- // création des liens vers la miniature
- $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
- if ( $cat['site_id'] == 1 )
- {
- $lien_thumbnail = "../galleries/".$cat['local_dir']."/";
- }
- else
- {
- $lien_thumbnail = $cat['dir'];
- }
- $lien_thumbnail.= "thumbnail/".$conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
- // création du "style" de la ligne
- $style = "style=\"text-align:center;\"";
- if ( $i%2 == 0 )
- {
- $style.= " class=\"row2\"";
- }
- echo"
- <td $style><a name=\"".$row['id']."\"><img src=\"$lien_thumbnail\" alt=\"\" class=\"miniature\" title=\"".$row['file']."\"/></td>
- <td $style>$file<br /><input type=\"text\" name=\"name-".$row['id']."\" value=\"".$row['name']."\" maxlength=\"255\"/></td>
- <td $style><input type=\"text\" name=\"author-".$row['id']."\" value=\"".$row['author']."\" maxlength=\"255\"/></td>
- <td $style><textarea name=\"comment-".$row['id']."\" rows=\"3\" cols=\"40\" style=\"overflow:auto\">".$row['comment']."</textarea></td>
- <td $style><input type=\"text\" name=\"date_creation-".$row['id']."\" value=\"".date_convert_back( $row['date_creation'] )."\" maxlength=\"10\" size=\"12\"/></td>";
- echo"
- </tr>";
- $i++;
- }
- echo"
- <tr>
- <td colspan=\"5\" style=\"text-align:center;\"><input type=\"submit\" value=\"".$lang['submit']."\"/></td>
- </tr>
- </table>
- </form>";
- }
+
+include_once( './include/isadmin.inc.php' );
+include_once( '../template/'.$user['template'].'/htmlfunctions.inc.php' );
+//------------------------------------------------------------------- functions
+function check_date_format ( $date )
+{
+ // date arrives at this format : DD/MM/YYYY
+ // checkdate ( int month, int day, int year)
+ $tab_date = explode( '/', $date );
+ return checkdate ( $tab_date[1], $tab_date[0], $tab_date[2]);
+}
+
+function date_convert( $date )
+{
+ // date arrives at this format : DD/MM/YYYY
+ // It must be transformed in YYYY-MM-DD
+ $tab_date = explode( '/', $date );
+ return $tab_date[2].'-'.$tab_date[1].'-'.$tab_date[0];
+}
+
+function date_convert_back( $date )
+{
+ // date arrives at this format : YYYY-MM-DD
+ // It must be transformed in DD/MM/YYYY
+ if ( $date != '' )
+ {
+ $tab_date = explode( '-', $date );
+ return $tab_date[2].'/'.$tab_date[1].'/'.$tab_date[0];
+ }
+ else
+ {
+ return '';
+ }
+}
+//-------------------------------------------------------------- initialization
+check_cat_id( $_GET['cat_id'] );
+
+if ( isset( $page['cat'] ) )
+{
+//--------------------------------------------------- update individual options
+ $query = 'SELECT id,file';
+ $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query.= ' WHERE cat_id = '.$page['cat'];
+ $query.= ';';
+ $result = mysql_query( $query );
+ $i = 1;
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $name = 'name-'.$row['id'];
+ $author = 'author-'.$row['id'];
+ $comment = 'comment-'.$row['id'];
+ $date_creation = 'date_creation-'.$row['id'];
+ if ( isset( $_POST[$name] ) )
+ {
+ $query = 'UPDATE '.PREFIX_TABLE.'images';
+ if ( $_POST[$name] == '' )
+ {
+ $query.= ' SET name = NULL';
+ }
+ else
+ {
+ $query.= " SET name = '".htmlentities( $_POST[$name], ENT_QUOTES )."'";
+ }
+ if ( $_POST[$author] == '' )
+ {
+ $query.= ', author = NULL';
+ }
+ else
+ {
+ $query.= ", author = '".htmlentities($_POST[$author],ENT_QUOTES)."'";
+ }
+ if ( $_POST[$comment] == '' )
+ {
+ $query.= ', comment = NULL';
+ }
+ else
+ {
+ $query.= ", comment = '".htmlentities($_POST[$comment],ENT_QUOTES)."'";
+ }
+ if ( check_date_format( $_POST[$date_creation] ) )
+ {
+ $date = date_convert( $_POST[$date_creation] );
+ $query.= ", date_creation = '".$date."'";
+ }
+ else if ( $_POST[$date_creation] == '' )
+ {
+ $query.= ', date_creation = NULL';
+ }
+ $query.= ' WHERE id = '.$row['id'];
+ $query.= ';';
+ mysql_query( $query );
+ }
+ }
+//------------------------------------------------------ update general options
+ if ( $_POST['use_common_author'] == 1 )
+ {
+ $query = 'UPDATE '.PREFIX_TABLE.'images';
+ if ( $_POST['author_cat'] == '' )
+ {
+ $query.= ' SET author = NULL';
+ }
+ else
+ {
+ $query.= ' SET author = ';
+ $query.= "'".htmlentities( $_POST['author_cat'], ENT_QUOTES )."'";
+ }
+ $query.= ' WHERE cat_id = '.$page['cat'];
+ $query.= ';';
+ mysql_query( $query );
+ }
+ if ( $_POST['use_common_date_creation'] == 1 )
+ {
+ if ( check_date_format( $_POST['date_creation_cat'] ) )
+ {
+ $date = date_convert( $_POST['date_creation_cat'] );
+ $query = 'UPDATE '.PREFIX_TABLE.'images';
+ if ( $_POST['date_creation_cat'] == '' )
+ {
+ $query.= ' SET date_creation = NULL';
+ }
+ else
+ {
+ $query.= " SET date_creation = '".$date."'";
+ }
+ $query.= ' WHERE cat_id = '.$page['cat'];
+ $query.= ';';
+ mysql_query( $query );
+ }
+ else
+ {
+ echo $lang['infoimage_err_date'];
+ }
+ }
+//--------------------------------------------------------- form initialization
+ $page['nb_image_page'] = 5;
+
+ if( !isset( $_GET['start'] )
+ or !is_numeric( $_GET['start'] )
+ or ( is_numeric( $_GET['start'] ) and $_GET['start'] < 0 ) )
+ {
+ $page['start'] = 0;
+ }
+ else
+ {
+ $page['start'] = $_GET['start'];
+ }
+
+ if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 )
+ {
+ $page['start'] = floor( $_GET['num'] / $page['nb_image_page'] ) * $page['nb_image_page'];
+ }
+ // retrieving category information
+ $result = get_cat_info( $page['cat'] );
+ $cat['local_dir'] = $result['local_dir'];
+ $cat['dir'] = $result['dir'];
+ $cat['name'] = $result['name'];
+ $cat['site_id'] = $result['site_id'];
+ $cat['nb_images'] = $result['nb_images'];
+//----------------------------------------------------- template initialization
+ $sub = $vtp->Open('../template/'.$user['template'].'/admin/infos_image.vtp');
+ $tpl = array( 'infoimage_general','author','infoimage_useforall','submit',
+ 'infoimage_creation_date','infoimage_detailed','thumbnail',
+ 'infoimage_title','infoimage_comment',
+ 'infoimage_creation_date' );
+ templatize_array( $tpl, 'lang', $sub );
+//------------------------------------------------------------------------ form
+ $url = './admin.php?page=infos_images&amp;cat_id='.$page['cat'];
+ $url.= '&amp;start='.$page['start'];
+ $vtp->setVar( $sub, 'form_action', add_session_id( $url ) );
+ $page['navigation_bar'] = create_navigation_bar(
+ $url, $cat['nb_images'],$page['start'], $page['nb_image_page'], '' );
+ $vtp->setVar( $sub, 'navigation_bar', $page['navigation_bar'] );
+ $cat_name = get_cat_display_name( $cat['name'], ' - ', 'font-style:italic;');
+ $vtp->setVar( $sub, 'cat_name', $cat_name );
+
+ $query = 'SELECT id,file,comment,author,tn_ext,name,date_creation';
+ $query.= ' FROM '.PREFIX_TABLE.'images';
+ $query.= ' WHERE cat_id = '.$page['cat'];
+ $query.= $conf['order_by'];
+ $query.= ' LIMIT '.$page['start'].','.$page['nb_image_page'];
+ $query.= ';';
+ $result = mysql_query( $query );
+ while ( $row = mysql_fetch_array( $result ) )
+ {
+ $vtp->addSession( $sub, 'picture' );
+ $vtp->setVar( $sub, 'picture.id', $row['id'] );
+ $vtp->setVar( $sub, 'picture.filename', $row['file'] );
+ $vtp->setVar( $sub, 'picture.name', $row['name'] );
+ $vtp->setVar( $sub, 'picture.author', $row['author'] );
+ $vtp->setVar( $sub, 'picture.comment', $row['comment'] );
+ $vtp->setVar( $sub, 'picture.date_creation',
+ date_convert_back( $row['date_creation'] ) );
+ $file = get_filename_wo_extension( $row['file'] );
+ $vtp->setVar( $sub, 'picture.default_name', $file );
+ // creating url to thumbnail
+ if ( $cat['site_id'] == 1 )
+ {
+ $thumbnail_url = '../galleries/'.$cat['local_dir'].'/';
+ }
+ else
+ {
+ $thumbnail_url = $cat['dir'];
+ }
+ $thumbnail_url.= 'thumbnail/';
+ $thumbnail_url.= $conf['prefixe_thumbnail'].$file.".".$row['tn_ext'];
+ $vtp->setVar( $sub, 'picture.thumbnail_url', $thumbnail_url );
+ $vtp->closeSession( $sub, 'picture' );
+ }
+}
+//----------------------------------------------------------- sending html code
+$vtp->Parse( $handle , 'sub', $sub );
?> \ No newline at end of file
diff --git a/category.php b/category.php
index 8aaf4941e..d79c178e7 100644
--- a/category.php
+++ b/category.php
@@ -101,8 +101,7 @@ templatize_array( $tpl, 'lang', $handle );
$tpl = array( 'mail_webmaster','webmaster','top_number','version','site_url' );
templatize_array( $tpl, 'conf', $handle );
-$tpl = array( 'short_period','long_period','style','lien_collapsed',
- 'username' );
+$tpl = array( 'short_period','long_period','lien_collapsed', 'username' );
templatize_array( $tpl, 'user', $handle );
$tpl = array( 'title','navigation_bar','cat_comment','cat_nb_images' );
@@ -465,8 +464,9 @@ if ( isset ( $page['cat'] ) )
// category comment
if ( isset( $page['comment'] ) and $page['comment'] != '' )
{
- $vtp->addSession( $handle, 'cat_comment' );
- $vtp->closeSession( $handle, 'cat_navigation' );
+ $vtp->addSession( $handle, 'comment' );
+ $vtp->setVar( $handle, 'comment.cat_comment', $page['comment'] );
+ $vtp->closeSession( $handle, 'comment' );
}
// total number of pictures in the category
if ( is_numeric( $page['cat'] ) )
diff --git a/include/config.inc.php b/include/config.inc.php
index 719edf156..fec4fa170 100644
--- a/include/config.inc.php
+++ b/include/config.inc.php
@@ -37,16 +37,16 @@ include_once( PREFIXE_INCLUDE.'./include/vtemplate.class.php' );
// 2. $conf['order_by'] = " order by file asc";
// will only order pictures by file ascending
// without taking into account the date_available
-$conf['order_by'] = " order by date_available desc, file asc";
+$conf['order_by'] = ' order by date_available desc, file asc';
$conf['repertoire_image'] = './images/';
-$conf['nb_image_row'] = array ('4','5','6','7','8');
-$conf['nb_row_page'] = array ('2','3','4','5','6','7','10','20','1000');
+$conf['nb_image_row'] = array('4','5','6','7','8');
+$conf['nb_row_page'] = array('2','3','4','5','6','7','10','20','1000');
$conf['version'] = '1.3';
$conf['site_url'] = 'http://www.phpwebgallery.net';
$conf['forum_url'] = 'http://forum.phpwebgallery.net';
-$conf['picture_ext'] = array ( 'jpg','JPG','gif','GIF','png','PNG' );
-$conf['document_ext'] = array( 'doc','pdf','zip' );
+$conf['picture_ext'] = array('jpg','JPG','gif','GIF','png','PNG');
+$conf['document_ext'] = array('doc','pdf','zip');
database_connection();
// rertieving the configuration informations for site
@@ -61,7 +61,7 @@ $infos = array( 'prefixe_thumbnail', 'webmaster', 'mail_webmaster', 'acces',
'upload_maxheight', 'upload_maxwidth_thumbnail',
'upload_maxheight_thumbnail' );
-$query = 'select';
+$query = 'SELECT';
for ( $i = 0; $i < sizeof( $infos ); $i++ )
{
if ( $i > 0 )
@@ -74,7 +74,7 @@ for ( $i = 0; $i < sizeof( $infos ); $i++ )
}
$query.= $infos[$i];
}
-$query .= ' from '.PREFIX_TABLE.'config;';
+$query .= ' FROM '.PREFIX_TABLE.'config;';
$row = mysql_fetch_array( mysql_query( $query ) );
@@ -90,6 +90,6 @@ for ( $i = 0; $i < sizeof( $infos ); $i++ )
$conf[$infos[$i]] = get_boolean( $row[$infos[$i]] );
}
}
-$conf['log'] = false;
-$conf['top_number'] = 10;
+$conf['log'] = false;
+$conf['top_number'] = 20;
?> \ No newline at end of file
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index 352e7cd7d..6109456cc 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -18,17 +18,17 @@ function generate_key()
{
global $conf;
$md5 = md5( substr( microtime(), 2, 6 ).$conf['session_keyword'] );
- $init = "";
+ $init = '';
for ( $i = 0; $i < strlen( $md5 ); $i++ )
{
if ( is_numeric( $md5[$i] ) )
{
- $init.= "$md5[$i]";
+ $init.= $md5[$i];
}
}
$init = substr( $init, 0, 8 );
mt_srand( $init );
- $key = "";
+ $key = '';
for ( $i = 0; $i < $conf['session_id_size']; $i++ )
{
$c = mt_rand( 0, 2 );
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index e9d3558d8..b19e53f18 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -207,6 +207,7 @@ function update_user( $user_id, $mail_address, $status,
function check_login_authorization()
{
global $user,$lang,$conf,$page;
+
if ( $user['is_the_guest']
and ( $conf['acces'] == 'restreint' or $page['cat'] == 'fav' ) )
{
diff --git a/profile.php b/profile.php
index 654497bce..c3ce554ca 100644
--- a/profile.php
+++ b/profile.php
@@ -1,9 +1,9 @@
<?php
/***************************************************************************
- * profile.php is a part of PhpWebGallery *
+ * profile.php *
* ------------------- *
- * last update : Tuesday, July 16, 2002 *
- * email : pierrick@z0rglub.com *
+ * application : PhpWebGallery 1.3 *
+ * author : Pierrick LE GALL <pierrick@z0rglub.com> *
* *
***************************************************************************/
@@ -144,16 +144,10 @@ if ( isset( $_POST['submit'] ) )
//----------------------------------------------------- template initialization
$vtp = new VTemplate;
$handle = $vtp->Open( './template/'.$user['template'].'/profile.vtp' );
-// language
-$vtp->setGlobalVar( $handle, 'customize_page_title',
- $lang['customize_page_title'] );
-$vtp->setGlobalVar( $handle, 'customize_title', $lang['customize_title'] );
-$vtp->setGlobalVar( $handle, 'password', $lang['password'] );
-$vtp->setGlobalVar( $handle, 'new', $lang['new'] );
-$vtp->setGlobalVar( $handle, 'reg_confirm', $lang['reg_confirm'] );
-$vtp->setGlobalVar( $handle, 'submit', $lang['submit'] );
-
initialize_template();
+$tpl = array( 'customize_page_title','customize_title','password','new',
+ 'reg_confirm','submit' );
+templatize_array( $tpl, 'lang', $handle );
//----------------------------------------------------------------- form action
$url = './profile.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
if ( $page['cat'] == 'search' )
diff --git a/template/default/htmlfunctions.inc.php b/template/default/htmlfunctions.inc.php
index d7464610c..141b32a7c 100644
--- a/template/default/htmlfunctions.inc.php
+++ b/template/default/htmlfunctions.inc.php
@@ -38,30 +38,6 @@ function get_icon( $date_comparaison )
}
return $output;
}
-/*
-function affiche_icone_recent( $date_comparaison )
-{
- global $user, $conf;
- $difference = time() - $date_comparaison;
- $jours = 24*60*60;
- $output = '';
- if ( $difference < $conf['periode_longue'] * $jours )
- {
- $icon_url = './theme/'.$user['theme'].'/';
- if ( $difference < $conf['periode_courte'] * $jours )
- {
- $icon_url.= 'new_long.gif';
- }
- else
- {
- $icon_url.= 'new_short.gif';
- }
- $size = getimagesize( $icon_url );
- $output = '<img src="'.$icon_url.'" style="border:0;height:'.$size[1].'px;width:'.$size[0].'px" alt="" />';
- }
- return $output;
-}
-*/
function create_navigation_bar( $url, $nb_element, $start,
$nb_element_page, $link_class )
@@ -121,12 +97,12 @@ function get_frame_start()
{
return '<table style="width:';
}
-/*
+
function get_frame_begin()
{
return ';">
<tr>
- <td style="border:2px solid lightgreen;width:100%;padding:5px;background-color:black;">';
+ <td style="border:1px dashed gray;width:100%;padding:5px;background-color:white;">';
}
function get_frame_end()
@@ -136,7 +112,7 @@ function get_frame_end()
</tr>
</table>';
}
-*/
+/*
function get_frame_begin()
{
global $user;
@@ -171,11 +147,12 @@ function get_frame_end()
</tr>
</table>';
}
-
+*/
function initialize_template()
{
global $vtp, $handle, $user;
+ $vtp->setGlobalVar( $handle, 'style', $user['style'] );
$vtp->setGlobalVar( $handle, 'frame_start', get_frame_start() );
$vtp->setGlobalVar( $handle, 'frame_begin', get_frame_begin() );
$vtp->setGlobalVar( $handle, 'frame_end', get_frame_end() );
diff --git a/template/default/profile.vtp b/template/default/profile.vtp
index ed6a8998a..2be4ae1e3 100644
--- a/template/default/profile.vtp
+++ b/template/default/profile.vtp
@@ -1,9 +1,10 @@
<html>
<head>
- {#page_style}
+ {#style}
<title>{#customize_page_title}</title>
- </head>
+ </head>
<body>
+ {#header}
<table style="width:100%;height:100%">
<tr align="center" valign="middle">
<td>
@@ -80,5 +81,6 @@
</td>
</tr>
</table>
+ {#footer}
</body>
</html> \ No newline at end of file