*** empty log message ***
git-svn-id: http://piwigo.org/svn/trunk@26 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
55a0a61aaf
commit
2fa9252446
25 changed files with 1058 additions and 1116 deletions
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
/***************************************************************************
|
||||
* waiting.php is a part of PhpWebGallery *
|
||||
* waiting.php *
|
||||
* ------------------- *
|
||||
* last update : Monday, October 28, 2002 *
|
||||
* email : pierrick@z0rglub.com *
|
||||
* application : PhpWebGallery 1.3 *
|
||||
* author : Pierrick LE GALL <pierrick@z0rglub.com> *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
|
@ -14,104 +14,121 @@
|
|||
* the Free Software Foundation; *
|
||||
* *
|
||||
***************************************************************************/
|
||||
include_once( "./include/isadmin.inc.php" );
|
||||
//-------------------------------------------------------------- mise à jour
|
||||
if ( isset( $HTTP_POST_VARS['submit'] ) )
|
||||
{
|
||||
$query = "select id,cat_id,file,tn_ext";
|
||||
$query.= " from PREFIX_TABLE"."waiting";
|
||||
$query.= ";";
|
||||
$result = mysql_query( $query );
|
||||
while ( $row = mysql_fetch_array( $result ) )
|
||||
{
|
||||
$key = "validate-".$row['id'];
|
||||
if ( isset( $HTTP_POST_VARS[$key] ) )
|
||||
{
|
||||
$query = "delete from PREFIX_TABLE"."waiting";
|
||||
$query.= " where id = ".$row['id'];
|
||||
$query.= ";";
|
||||
mysql_query( $query );
|
||||
if ( $HTTP_POST_VARS[$key] == "false" )
|
||||
{
|
||||
// we have to delete the picture and the thumbnail if it exists
|
||||
$cat = get_cat_info( $row['cat_id'] );
|
||||
unlink( ".".$cat['dir'].$row['file'] );
|
||||
if ( $row['tn_ext'] != "" )
|
||||
{
|
||||
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
|
||||
unlink( ".".$cat['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------- formulaire
|
||||
$cat_names = array();
|
||||
echo "
|
||||
<form action=\"".add_session_id_to_url( "./admin.php?page=waiting" )."\" method=\"post\">
|
||||
<table style=\"width:100%;\">
|
||||
<tr>
|
||||
<th style=\"width:20%;\">".$lang['category']."</th>
|
||||
<th style=\"width:20%;\">".$lang['date']."</th>
|
||||
<th style=\"width:20%;\">".$lang['file']."</th>
|
||||
<th style=\"width:20%;\">".$lang['thumbnail']."</th>
|
||||
<th style=\"width:20%;\">".$lang['author']."</th>
|
||||
<th style=\"width:1px;\"> </th>
|
||||
</tr>";
|
||||
$query = "select id,cat_id,file,username,mail_address,date,tn_ext";
|
||||
$query.= " from PREFIX_TABLE"."waiting";
|
||||
$query.= " order by cat_id";
|
||||
$query.= ";";
|
||||
$result = mysql_query( $query );
|
||||
$i = 0;
|
||||
while ( $row = mysql_fetch_array( $result ) )
|
||||
{
|
||||
$style = "";
|
||||
if ( $i%2 == 0 )
|
||||
{
|
||||
$style = "class=\"row2\"";
|
||||
}
|
||||
if ( !isset( $cat_names[$row['cat_id']] ) )
|
||||
{
|
||||
$cat = get_cat_info( $row['cat_id'] );
|
||||
$cat_names[$row['cat_id']] = array();
|
||||
$cat_names[$row['cat_id']]['dir'] = ".".$cat['dir'];
|
||||
$cat_names[$row['cat_id']]['display_name'] = get_cat_display_name( $cat['name'], " - ", "font-style:italic;" );
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td $style style=\"white-space:nowrap;\">".$cat_names[$row['cat_id']]['display_name']."</td>
|
||||
<td $style style=\"white-space:nowrap;\">".$lang['day'][date( "w", $row['date'] )].date( " j ", $row['date'] ).$lang['month'][date( "n", $row['date'] )].date( " Y G:i", $row['date'] )."</td>
|
||||
<td $style style=\"white-space:nowrap;\">
|
||||
<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir'].$row['file']."\">".$row['file']."</td>
|
||||
</td>
|
||||
<td $style style=\"white-space:nowrap;\">";
|
||||
if ( $row['tn_ext'] != "" )
|
||||
{
|
||||
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
|
||||
echo "<a target=\"_blank\" href=\"".$cat_names[$row['cat_id']]['dir']."thumbnail/".$conf['prefix_thumbnail'].$file.".".$row['tn_ext']."\">".$conf['prefix_thumbnail'].$file.".".$row['tn_ext'];
|
||||
}
|
||||
else
|
||||
{
|
||||
echo " ";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
<td $style style=\"white-space:nowrap;\">
|
||||
<a href=\"mailto:".$row['mail_address']."\">".$row['username']."</a>
|
||||
</td>
|
||||
<td $style style=\"white-space:nowrap;\">
|
||||
<input type=\"radio\" name=\"validate-".$row['id']."\" value=\"true\" />".$lang['submit']."
|
||||
<input type=\"radio\" name=\"validate-".$row['id']."\" value=\"false\" />".$lang['delete']."
|
||||
</td>
|
||||
</tr>";
|
||||
$i++;
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td colspan=\"5\" align=\"center\"><input type=\"submit\" name=\"submit\" value=\"".$lang['submit']."\" style=\"margin:5px;\" /></td>
|
||||
</tr>";
|
||||
echo "
|
||||
</table>
|
||||
</form>";
|
||||
include_once( './include/isadmin.inc.php' );
|
||||
//--------------------------------------------------------------------- updates
|
||||
if ( isset( $_POST['submit'] ) )
|
||||
{
|
||||
$query = 'SELECT id,cat_id,file,tn_ext';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'waiting';
|
||||
$query.= " WHERE validated = 'false'";
|
||||
$query.= ';';
|
||||
$result = mysql_query( $query );
|
||||
while ( $row = mysql_fetch_array( $result ) )
|
||||
{
|
||||
$key = 'validate-'.$row['id'];
|
||||
if ( isset( $_POST[$key] ) )
|
||||
{
|
||||
if ( $_POST[$key] == 'true' )
|
||||
{
|
||||
// The uploaded element was validated, we have to set the
|
||||
// "validated" field to "true"
|
||||
$query = 'UPDATE '.PREFIX_TABLE.'waiting';
|
||||
$query.= " SET validated = 'true'";
|
||||
$query.= ' WHERE id = '.$row['id'];
|
||||
$query.= ';';
|
||||
mysql_query( $query );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The uploaded element was refused, we have to delete its reference
|
||||
// in the database and to delete the element as well.
|
||||
$query = 'DELETE FROM '.PREFIX_TABLE.'waiting';
|
||||
$query.= ' WHERE id = '.$row['id'];
|
||||
$query.= ';';
|
||||
mysql_query( $query );
|
||||
// deletion of the associated files
|
||||
$cat = get_cat_info( $row['cat_id'] );
|
||||
unlink( '.'.$cat['dir'].$row['file'] );
|
||||
if ( $row['tn_ext'] != '' )
|
||||
{
|
||||
$thumbnail = $conf['prefix_thumbnail'];
|
||||
$thumbnail.= get_filename_wo_extension( $row['file'] );
|
||||
$thumbnail.= '.'.$row['tn_ext'];
|
||||
$url = '.'.$cat['dir'].'thumbnail/'.$thumbnail;
|
||||
unlink( $url );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------- template initialization
|
||||
$sub = $vtp->Open( '../template/'.$user['template'].'/admin/waiting.vtp' );
|
||||
$tpl = array( 'category','date','author','thumbnail','file','delete',
|
||||
'submit' );
|
||||
templatize_array( $tpl, 'lang', $sub );
|
||||
//---------------------------------------------------------------- form display
|
||||
$cat_names = array();
|
||||
$query = 'SELECT id,cat_id,file,username,mail_address,date,tn_ext';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'waiting';
|
||||
$query.= " WHERE validated = 'false'";
|
||||
$query.= ' ORDER BY cat_id';
|
||||
$query.= ';';
|
||||
$result = mysql_query( $query );
|
||||
$i = 0;
|
||||
while ( $row = mysql_fetch_array( $result ) )
|
||||
{
|
||||
$vtp->addSession( $sub, 'picture' );
|
||||
$vtp->setVar( $sub, 'picture.id', $row['id'] );
|
||||
if ( $i++ % 2 == 0 )
|
||||
{
|
||||
$vtp->setVar( $sub, 'picture.class', 'row2' );
|
||||
}
|
||||
if ( !isset( $cat_names[$row['cat_id']] ) )
|
||||
{
|
||||
$cat = get_cat_info( $row['cat_id'] );
|
||||
$cat_names[$row['cat_id']] = array();
|
||||
$cat_names[$row['cat_id']]['dir'] = '.'.$cat['dir'];
|
||||
$cat_names[$row['cat_id']]['display_name'] =
|
||||
get_cat_display_name( $cat['name'], ' > ', 'font-weight:bold;' );
|
||||
}
|
||||
// category name
|
||||
$vtp->setVar( $sub, 'picture.cat_name',
|
||||
$cat_names[$row['cat_id']]['display_name'] );
|
||||
// date displayed like this (in English ) :
|
||||
// Sunday 15 June 2003 21:29
|
||||
$date = $lang['day'][date( 'w', $row['date'] )]; // Sunday
|
||||
$date.= date( ' j ', $row['date'] ); // 15
|
||||
$date.= $lang['month'][date( 'n', $row['date'] )]; // June
|
||||
$date.= date( ' Y G:i', $row['date'] ); // 2003 21:29
|
||||
$vtp->setVar( $sub, 'picture.date', $date );
|
||||
// file preview link
|
||||
$url = $cat_names[$row['cat_id']]['dir'].$row['file'];
|
||||
$vtp->setVar( $sub, 'picture.preview_url', $url );
|
||||
// file name
|
||||
$vtp->setVar( $sub, 'picture.file', $row['file'] );
|
||||
// is there an existing associated thumnail ?
|
||||
if ( $row['tn_ext'] != '' )
|
||||
{
|
||||
$vtp->addSession( $sub, 'thumbnail' );
|
||||
$thumbnail = $conf['prefix_thumbnail'];
|
||||
$thumbnail.= get_filename_wo_extension( $row['file'] );
|
||||
$thumbnail.= '.'.$row['tn_ext'];
|
||||
$url = $cat_names[$row['cat_id']]['dir'].'thumbnail/'.$thumbnail;
|
||||
$vtp->setVar( $sub, 'thumbnail.preview_url', $url );
|
||||
$vtp->setVar( $sub, 'thumbnail.file', $thumbnail );
|
||||
$vtp->closeSession( $sub, 'thumbnail' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$vtp->addSession( $sub, 'no_thumbnail' );
|
||||
$vtp->closeSession( $sub, 'no_thumbnail' );
|
||||
}
|
||||
// username and associated mail address
|
||||
$vtp->setVar( $sub, 'picture.mail_address', $row['mail_address'] );
|
||||
$vtp->setVar( $sub, 'picture.username', $row['username'] );
|
||||
|
||||
$vtp->closeSession( $sub, 'picture' );
|
||||
}
|
||||
//----------------------------------------------------------- sending html code
|
||||
$vtp->Parse( $handle , 'sub', $sub );
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue