aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/configuration.php6
-rw-r--r--admin/waiting.php180
2 files changed, 132 insertions, 54 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 5d3864937..8829c0822 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -164,8 +164,6 @@ switch ($page['section'])
{
$history_yes = ($conf['log']=='true')?'checked="checked"':'';
$history_no = ($conf['log']=='false')?'checked="checked"':'';
- $notif_yes = ($conf['mail_notification']=='true')?'checked="checked"':'';
- $notif_no = ($conf['mail_notification']=='false')?'checked="checked"':'';
$lock_yes = ($conf['gallery_locked']=='true')?'checked="checked"':'';
$lock_no = ($conf['gallery_locked']=='false')?'checked="checked"':'';
@@ -179,8 +177,6 @@ switch ($page['section'])
'L_CONF_TN_PREFIX_INFO'=>$lang['conf_prefix_info'],
'L_CONF_HISTORY'=>$lang['history'],
'L_CONF_HISTORY_INFO'=>$lang['conf_log_info'],
- 'L_CONF_NOTIFICATION'=>$lang['conf_notification'],
- 'L_CONF_NOTIFICATION_INFO'=>$lang['conf_notification_info'],
'L_CONF_GALLERY_LOCKED'=>$lang['conf_gallery_locked'],
'L_CONF_GALLERY_LOCKED_INFO'=>$lang['conf_gallery_locked_info'],
@@ -188,8 +184,6 @@ switch ($page['section'])
'THUMBNAIL_PREFIX'=>$conf['prefix_thumbnail'],
'HISTORY_YES'=>$history_yes,
'HISTORY_NO'=>$history_no,
- 'NOTIFICATION_YES'=>$notif_yes,
- 'NOTIFICATION_NO'=>$notif_no,
'GALLERY_LOCKED_YES'=>$lock_yes,
'GALLERY_LOCKED_NO'=>$lock_no,
));
diff --git a/admin/waiting.php b/admin/waiting.php
index 3be00dd5c..7c8e05b51 100644
--- a/admin/waiting.php
+++ b/admin/waiting.php
@@ -30,49 +30,110 @@ if( !defined("PHPWG_ROOT_PATH") )
}
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
//--------------------------------------------------------------------- updates
-if ( isset( $_POST['submit'] ) )
+
+if (isset($_POST))
{
- $query = 'SELECT * FROM '.WAITING_TABLE;
- $query.= " WHERE validated = 'false';";
- $result = pwg_query( $query );
- while ( $row = mysql_fetch_array( $result ) )
+ $to_validate = array();
+ $to_reject = array();
+
+ if (isset($_POST['submit']))
+ {
+ foreach (explode(',', $_POST['list']) as $waiting_id)
+ {
+ if (isset($_POST['action-'.$waiting_id]))
+ {
+ switch ($_POST['action-'.$waiting_id])
+ {
+ case 'reject' :
+ {
+ array_push($to_reject, $waiting_id);
+ break;
+ }
+ case 'validate' :
+ {
+ array_push($to_validate, $waiting_id);
+ break;
+ }
+ }
+ }
+ }
+ }
+ else if (isset($_POST['validate-all']))
+ {
+ $to_validate = explode(',', $_POST['list']);
+ }
+ else if (isset($_POST['reject-all']))
{
- $key = 'validate-'.$row['id'];
- if ( isset( $_POST[$key] ) )
+ $to_reject = explode(',', $_POST['list']);
+ }
+
+ if (count($to_validate) > 0)
+ {
+ $query = '
+UPDATE '.WAITING_TABLE.'
+ SET validated = \'true\'
+ WHERE id IN ('.implode(',', $to_validate).')
+;';
+ pwg_query($query);
+
+ array_push(
+ $page['infos'],
+ sprintf(
+ l10n('%d waiting pictures validated'),
+ count($to_validate)
+ )
+ );
+ }
+
+ if (count($to_reject) > 0)
+ {
+ // The uploaded element was refused, we have to delete its reference in
+ // the database and to delete the element as well.
+ $query = '
+SELECT id, storage_category_id, file, tn_ext
+ FROM '.WAITING_TABLE.'
+ WHERE id IN ('.implode(',', $to_reject).')
+;';
+ $result = pwg_query($query);
+ while($row = mysql_fetch_array($result))
{
- if ( $_POST[$key] == 'true' )
+ $dir = get_complete_dir($row['storage_category_id']);
+ unlink($dir.$row['file']);
+ if (isset($row['tn_ext']) and $row['tn_ext'] != '')
{
- // The uploaded element was validated, we have to set the
- // "validated" field to "true"
- $query = 'UPDATE '.WAITING_TABLE;
- $query.= " SET validated = 'true'";
- $query.= ' WHERE id = '.$row['id'];
- $query.= ';';
- pwg_query( $query );
+ unlink(
+ get_thumbnail_src(
+ $dir.$row['file'],
+ $row['tn_ext']
+ )
+ );
}
- else
+ else if (@is_file(get_thumbnail_src($dir.$row['file'], 'jpg')))
{
- // The uploaded element was refused, we have to delete its reference
- // in the database and to delete the element as well.
- $query = 'DELETE FROM '.WAITING_TABLE;
- $query.= ' WHERE id = '.$row['id'];
- $query.= ';';
- pwg_query( $query );
- // deletion of the associated files
- $dir = get_complete_dir( $row['storage_category_id'] );
- unlink( $dir.$row['file'] );
- if (isset($row['tn_ext']) and $row['tn_ext'] != '' )
- {
- $thumbnail = $conf['prefix_thumbnail'];
- $thumbnail.= get_filename_wo_extension( $row['file'] );
- $thumbnail.= '.'.$row['tn_ext'];
- $url = $dir.'thumbnail/'.$thumbnail;
- unlink( $url );
- }
+ unlink(
+ get_thumbnail_src(
+ $dir.$row['file'],
+ 'jpg'
+ )
+ );
}
}
+
+ $query = '
+DELETE
+ FROM '.WAITING_TABLE.'
+ WHERE id IN ('.implode(',', $to_reject).')
+;';
+ pwg_query($query);
+
+ array_push(
+ $page['infos'],
+ sprintf(
+ l10n('%d waiting pictures rejected'),
+ count($to_reject)
+ )
+ );
}
- array_push($infos, $lang['waiting_update']);
}
//----------------------------------------------------- template initialization
@@ -92,6 +153,8 @@ $template->assign_vars(array(
//---------------------------------------------------------------- form display
$cat_names = array();
+$list = array();
+
$query = 'SELECT * FROM '.WAITING_TABLE;
$query.= " WHERE validated = 'false'";
$query.= ' ORDER BY storage_category_id';
@@ -113,16 +176,22 @@ while ( $row = mysql_fetch_array( $result ) )
$class='row1';
if ( $i++ % 2== 0 ) $class='row2';
- $template->assign_block_vars('picture' ,array(
- 'WAITING_CLASS'=>$class,
- 'CATEGORY_IMG'=>$cat_names[$row['storage_category_id']]['display_name'],
- 'ID_IMG'=>$row['id'],
- 'DATE_IMG'=>format_date( $row['date'], 'unix', true ),
- 'FILE_IMG'=>$row['file'],
- 'PREVIEW_URL_IMG'=>$preview_url,
- 'UPLOAD_EMAIL'=>$row['mail_address'],
- 'UPLOAD_USERNAME'=>$row['username']
- ));
+ $template->assign_block_vars(
+ 'picture',
+ array(
+ 'WAITING_CLASS'=>$class,
+ 'CATEGORY_IMG'=>$cat_names[$row['storage_category_id']]['display_name'],
+ 'ID_IMG'=>$row['id'],
+ 'DATE_IMG' => date('Y-m-d H:i:s', $row['date']),
+ 'FILE_TITLE'=>$row['file'],
+ 'FILE_IMG' =>
+ (strlen($row['file']) > 10) ?
+ (substr($row['file'], 0, 10)).'...' : $row['file'],
+ 'PREVIEW_URL_IMG'=>$preview_url,
+ 'UPLOAD_EMAIL'=>$row['mail_address'],
+ 'UPLOAD_USERNAME'=>$row['username']
+ )
+ );
// is there an existing associated thumnail ?
if ( !empty( $row['tn_ext'] ))
@@ -133,12 +202,27 @@ while ( $row = mysql_fetch_array( $result ) )
$url = $cat_names[$row['storage_category_id']]['dir'];
$url.= 'thumbnail/'.$thumbnail;
- $template->assign_block_vars('picture.thumbnail' ,array(
- 'PREVIEW_URL_TN_IMG'=>$url,
- 'FILE_TN_IMG'=>$thumbnail
- ));
+ $template->assign_block_vars(
+ 'picture.thumbnail',
+ array(
+ 'PREVIEW_URL_TN_IMG' => $url,
+ 'FILE_TN_IMG' =>
+ (strlen($thumbnail) > 10) ?
+ (substr($thumbnail, 0, 10)).'...' : $thumbnail,
+ 'FILE_TN_TITLE' => $thumbnail
+ )
+ );
}
+
+ array_push($list, $row['id']);
}
+
+$template->assign_vars(
+ array(
+ 'LIST' => implode(',', $list)
+ )
+ );
+
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'waiting');
?>