mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 01:42:29 +02:00
feature 2108 added: user upload removed from core. It will come back as a
"new generation" user upload in the Community plugin. git-svn-id: http://piwigo.org/svn/trunk@8651 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -69,8 +69,6 @@ if (isset($_POST['submit']))
|
||||
'id' => $_GET['cat_id'],
|
||||
'name' => @$_POST['name'],
|
||||
'commentable' => isset($_POST['commentable'])?$_POST['commentable']:'false',
|
||||
'uploadable' =>
|
||||
isset($_POST['uploadable']) ? $_POST['uploadable'] : 'false',
|
||||
'comment' =>
|
||||
$conf['allow_html_descriptions'] ?
|
||||
@$_POST['comment'] : strip_tags(@$_POST['comment']),
|
||||
@@ -245,7 +243,6 @@ $template->assign(
|
||||
'CAT_STATUS' => $category['status'],
|
||||
'CAT_VISIBLE' => boolean_to_string($category['visible']),
|
||||
'CAT_COMMENTABLE' => boolean_to_string($category['commentable']),
|
||||
'CAT_UPLOADABLE' => boolean_to_string($category['uploadable']),
|
||||
|
||||
'IMG_ORDER_DEFAULT' => empty($category['image_order']) ?
|
||||
'checked="checked"' : '',
|
||||
@@ -304,10 +301,6 @@ else
|
||||
$category['cat_full_dir'] )
|
||||
)
|
||||
);
|
||||
if (!url_is_remote($category['cat_full_dir']) )
|
||||
{
|
||||
$template->assign('SHOW_UPLOADABLE', true);
|
||||
}
|
||||
}
|
||||
|
||||
// image order management
|
||||
|
||||
+2
-51
@@ -47,16 +47,6 @@ if (isset($_POST['falsify'])
|
||||
{
|
||||
switch ($_GET['section'])
|
||||
{
|
||||
case 'upload' :
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET uploadable = \'false\'
|
||||
WHERE id IN ('.implode(',', $_POST['cat_true']).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
break;
|
||||
}
|
||||
case 'comments' :
|
||||
{
|
||||
$query = '
|
||||
@@ -95,16 +85,6 @@ else if (isset($_POST['trueify'])
|
||||
{
|
||||
switch ($_GET['section'])
|
||||
{
|
||||
case 'upload' :
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.CATEGORIES_TABLE.'
|
||||
SET uploadable = \'true\'
|
||||
WHERE id IN ('.implode(',', $_POST['cat_false']).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
break;
|
||||
}
|
||||
case 'comments' :
|
||||
{
|
||||
$query = '
|
||||
@@ -162,10 +142,6 @@ $tabsheet = new tabsheet();
|
||||
$opt_link = $link_start.'cat_options&section=';
|
||||
$tabsheet->add('status', l10n('Public / Private'), $opt_link.'status');
|
||||
$tabsheet->add('visible', l10n('Lock'), $opt_link.'visible');
|
||||
if ($conf['enable_synchronization'])
|
||||
{
|
||||
$tabsheet->add('upload', l10n('Upload'), $opt_link.'upload');
|
||||
}
|
||||
$tabsheet->add('comments', l10n('Comments'), $opt_link.'comments');
|
||||
if ($conf['allow_random_representative'])
|
||||
{
|
||||
@@ -182,8 +158,8 @@ $tabsheet->assign();
|
||||
|
||||
// for each section, categories in the multiselect field can be :
|
||||
//
|
||||
// - true : uploadable for upload section
|
||||
// - false : un-uploadable for upload section
|
||||
// - true : commentable for comment section
|
||||
// - false : un-commentable for comment section
|
||||
// - NA : (not applicable) for virtual categories
|
||||
//
|
||||
// for true and false status, we associates an array of category ids,
|
||||
@@ -193,31 +169,6 @@ $cats_true = array();
|
||||
$cats_false = array();
|
||||
switch ($page['section'])
|
||||
{
|
||||
case 'upload' :
|
||||
{
|
||||
$query_true = '
|
||||
SELECT id,name,uppercats,global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE uploadable = \'true\'
|
||||
AND dir IS NOT NULL
|
||||
AND site_id = 1
|
||||
;';
|
||||
$query_false = '
|
||||
SELECT id,name,uppercats,global_rank
|
||||
FROM '.CATEGORIES_TABLE.'
|
||||
WHERE uploadable = \'false\'
|
||||
AND dir IS NOT NULL
|
||||
AND site_id = 1
|
||||
;';
|
||||
$template->assign(
|
||||
array(
|
||||
'L_SECTION' => l10n('Select uploadable albums'),
|
||||
'L_CAT_OPTIONS_TRUE' => l10n('Authorized'),
|
||||
'L_CAT_OPTIONS_FALSE' => l10n('Forbidden'),
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'comments' :
|
||||
{
|
||||
$query_true = '
|
||||
|
||||
@@ -60,11 +60,6 @@ $history_checkboxes = array(
|
||||
'history_guest'
|
||||
);
|
||||
|
||||
$upload_checkboxes = array(
|
||||
'upload_link_everytime',
|
||||
'email_admin_on_picture_uploaded',
|
||||
);
|
||||
|
||||
$comments_checkboxes = array(
|
||||
'comments_forall',
|
||||
'comments_validation',
|
||||
@@ -144,14 +139,6 @@ if (isset($_POST['submit']))
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'upload' :
|
||||
{
|
||||
foreach( $upload_checkboxes as $checkbox)
|
||||
{
|
||||
$_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'default' :
|
||||
{
|
||||
// Never go here
|
||||
@@ -217,10 +204,6 @@ $tabsheet->add('main', l10n('Main'), $conf_link.'main');
|
||||
$tabsheet->add('display', l10n('Display'), $conf_link.'display');
|
||||
$tabsheet->add('history', l10n('History'), $conf_link.'history');
|
||||
$tabsheet->add('comments', l10n('Comments'), $conf_link.'comments');
|
||||
if ($conf['enable_synchronization'])
|
||||
{
|
||||
$tabsheet->add('upload', l10n('Upload'), $conf_link.'upload');
|
||||
}
|
||||
$tabsheet->add('default', l10n('Guest Settings'), $conf_link.'default');
|
||||
// TabSheet selection
|
||||
$tabsheet->select($page['section']);
|
||||
@@ -300,28 +283,6 @@ switch ($page['section'])
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'upload' :
|
||||
{
|
||||
$template->assign(
|
||||
'upload',
|
||||
array(
|
||||
'upload_user_access_options'=> get_user_access_level_html_options(ACCESS_GUEST),
|
||||
'upload_user_access_options_selected' => array($conf['upload_user_access'])
|
||||
)
|
||||
);
|
||||
//Necessary for merge_block_vars
|
||||
foreach ($upload_checkboxes as $checkbox)
|
||||
{
|
||||
$template->append(
|
||||
'upload',
|
||||
array(
|
||||
$checkbox => $conf[$checkbox]
|
||||
),
|
||||
true
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'default' :
|
||||
{
|
||||
$edit_user = build_user($conf['guest_id'], false);
|
||||
|
||||
@@ -46,13 +46,6 @@ $tabs[] = array(
|
||||
'code' => 'groups',
|
||||
'label' => l10n('Groups'),
|
||||
);
|
||||
if ($conf['enable_synchronization'])
|
||||
{
|
||||
$tabs[] = array(
|
||||
'code' => 'user_upload',
|
||||
'label' => l10n('User Upload'),
|
||||
);
|
||||
}
|
||||
$tabs[] = array(
|
||||
'code' => 'virtual_links',
|
||||
'label' => l10n('Virtual Links'),
|
||||
|
||||
@@ -54,7 +54,6 @@ function prepare_conf_upgrade()
|
||||
define('USERS_TABLE', $prefixeTable.'users');
|
||||
define('USER_INFOS_TABLE', $prefixeTable.'user_infos');
|
||||
define('USER_FEED_TABLE', $prefixeTable.'user_feed');
|
||||
define('WAITING_TABLE', $prefixeTable.'waiting');
|
||||
define('RATE_TABLE', $prefixeTable.'rate');
|
||||
define('USER_CACHE_TABLE', $prefixeTable.'user_cache');
|
||||
define('USER_CACHE_CATEGORIES_TABLE', $prefixeTable.'user_cache_categories');
|
||||
|
||||
@@ -239,25 +239,6 @@ SELECT MIN(date_available)
|
||||
);
|
||||
}
|
||||
|
||||
// waiting elements
|
||||
$query = '
|
||||
SELECT COUNT(*)
|
||||
FROM '.WAITING_TABLE.'
|
||||
WHERE validated=\'false\'
|
||||
;';
|
||||
list($nb_waiting) = pwg_db_fetch_row(pwg_query($query));
|
||||
|
||||
if ($nb_waiting > 0)
|
||||
{
|
||||
$template->assign(
|
||||
'waiting',
|
||||
array(
|
||||
'URL' => PHPWG_ROOT_PATH.'admin.php?page=upload',
|
||||
'INFO' => sprintf(l10n('%d waiting for validation'), $nb_waiting)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// unvalidated comments
|
||||
$query = '
|
||||
SELECT COUNT(*)
|
||||
|
||||
+2
-80
@@ -240,9 +240,6 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
|
||||
'site_id' => $site_id,
|
||||
'commentable' =>
|
||||
boolean_to_string($conf['newcat_default_commentable']),
|
||||
'uploadable' => $site_is_remote
|
||||
? 'false'
|
||||
: boolean_to_string($conf['newcat_default_uploadable']),
|
||||
'status' => $conf['newcat_default_status'],
|
||||
'visible' => boolean_to_string($conf['newcat_default_visible']),
|
||||
);
|
||||
@@ -312,7 +309,7 @@ SELECT id_uppercat, MAX(rank)+1 AS next_rank
|
||||
{
|
||||
$dbfields = array(
|
||||
'id','dir','name','site_id','id_uppercat','uppercats','commentable',
|
||||
'uploadable','visible','status','rank','global_rank'
|
||||
'visible','status','rank','global_rank'
|
||||
);
|
||||
mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
|
||||
}
|
||||
@@ -359,7 +356,6 @@ if (isset($_POST['submit']) and $_POST['sync'] == 'files'
|
||||
$cat_ids = array_diff(array_keys($db_categories), $to_delete);
|
||||
|
||||
$db_elements = array();
|
||||
$db_unvalidated = array();
|
||||
|
||||
if (count($cat_ids) > 0)
|
||||
{
|
||||
@@ -373,26 +369,6 @@ SELECT id, path
|
||||
"\n"
|
||||
).')';
|
||||
$db_elements = simple_hash_from_query($query, 'id', 'path');
|
||||
|
||||
// searching the unvalidated waiting elements (they must not be taken into
|
||||
// account)
|
||||
$query = '
|
||||
SELECT file,storage_category_id
|
||||
FROM '.WAITING_TABLE.'
|
||||
WHERE storage_category_id IN (
|
||||
'.wordwrap(implode(', ', $cat_ids), 80, "\n").')
|
||||
AND validated = \'false\'';
|
||||
$result = pwg_query($query);
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
array_push(
|
||||
$db_unvalidated,
|
||||
array_search(
|
||||
$row['storage_category_id'],
|
||||
$db_fulldirs)
|
||||
.'/'.$row['file']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// next element id available
|
||||
@@ -403,7 +379,7 @@ SELECT file,storage_category_id
|
||||
$inserts = array();
|
||||
$insert_links = array();
|
||||
|
||||
foreach (array_diff(array_keys($fs), $db_elements, $db_unvalidated) as $path)
|
||||
foreach (array_diff(array_keys($fs), $db_elements) as $path)
|
||||
{
|
||||
$insert = array();
|
||||
// storage category must exist
|
||||
@@ -529,60 +505,6 @@ SELECT file,storage_category_id
|
||||
$template->append('footer_elements', '<!-- scanning files : '
|
||||
. get_elapsed_time($start_files, get_moment())
|
||||
. ' -->' );
|
||||
|
||||
// retrieving informations given by uploaders
|
||||
if (!$simulate and count($cat_ids) > 0)
|
||||
{
|
||||
$query = '
|
||||
SELECT id,file,storage_category_id,infos
|
||||
FROM '.WAITING_TABLE.'
|
||||
WHERE storage_category_id IN (
|
||||
'.wordwrap(implode(', ', $cat_ids), 80, "\n").')
|
||||
AND validated = \'true\'';
|
||||
$result = pwg_query($query);
|
||||
|
||||
$datas = array();
|
||||
$fields =
|
||||
array(
|
||||
'primary' => array('id'),
|
||||
'update' => array('date_creation', 'author', 'name', 'comment')
|
||||
);
|
||||
|
||||
$waiting_to_delete = array();
|
||||
|
||||
while ($row = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE storage_category_id = '.$row['storage_category_id'].'
|
||||
AND file = \''.$row['file'].'\'';
|
||||
list($data['id']) = pwg_db_fetch_row(pwg_query($query));
|
||||
|
||||
foreach ($fields['update'] as $field)
|
||||
{
|
||||
$data[$field] = addslashes( getAttribute($row['infos'], $field) );
|
||||
}
|
||||
|
||||
array_push($datas, $data);
|
||||
array_push($waiting_to_delete, $row['id']);
|
||||
}
|
||||
|
||||
if (count($datas) > 0)
|
||||
{
|
||||
mass_updates(IMAGES_TABLE, $fields, $datas);
|
||||
|
||||
// delete now useless waiting elements
|
||||
$query = '
|
||||
DELETE
|
||||
FROM '.WAITING_TABLE.'
|
||||
WHERE id IN ('.implode(',', $waiting_to_delete).')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
@@ -18,9 +18,6 @@ jQuery(document).ready(function(){ldelim}
|
||||
<dd>
|
||||
<ul>
|
||||
<li><a href="{$U_ADD_PHOTOS}">{'Add'|@translate}</a></li>
|
||||
{if $ENABLE_SYNCHRONIZATION}
|
||||
<li><a href="{$U_WAITING}">{'Waiting'|@translate}</a></li>
|
||||
{/if}
|
||||
<li><a href="{$U_RATING}">{'Rating'|@translate}</a></li>
|
||||
<li><a href="{$U_TAGS}">{'Tags'|@translate}</a></li>
|
||||
<li><a href="{$U_CADDIE}">{'Caddie'|@translate}</a></li>
|
||||
|
||||
@@ -85,14 +85,6 @@
|
||||
{html_radios name='commentable' values='false,true'|@explode output='No,Yes'|@explode|translate selected=$CAT_COMMENTABLE}
|
||||
</td>
|
||||
</tr>
|
||||
{if isset($SHOW_UPLOADABLE) }
|
||||
<tr>
|
||||
<td><strong>{'Authorize upload'|@translate}</strong>
|
||||
<td>
|
||||
{html_radios name='uploadable' values='false,true'|@explode output='No,Yes'|@explode|translate selected=$CAT_UPLOADABLE}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
|
||||
@@ -187,29 +187,6 @@
|
||||
</fieldset>
|
||||
{/if}
|
||||
|
||||
{if isset($upload)}
|
||||
<fieldset id="uploadConf">
|
||||
<legend></legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label><span class="property">{'Show upload link every time'|@translate}</span>
|
||||
<input type="checkbox" name="upload_link_everytime" {if ($upload.upload_link_everytime)}checked="checked"{/if}></label>
|
||||
</li>
|
||||
<li>
|
||||
<label><span class="property">{'User access level to upload'|@translate}</span>
|
||||
{html_options name="upload_user_access" options=$upload.upload_user_access_options selected=$upload.upload_user_access_options_selected}
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<span class="property">{'Email admins when a picture is uploaded'|@translate}</span>
|
||||
<input type="checkbox" name="email_admin_on_picture_uploaded" {if ($upload.email_admin_on_picture_uploaded)}checked="checked"{/if}>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
{/if}
|
||||
|
||||
</div> <!-- configContent -->
|
||||
|
||||
{if isset($default)}
|
||||
|
||||
@@ -37,10 +37,6 @@ jQuery().ready(function(){ldelim}
|
||||
<ul>
|
||||
<li>
|
||||
{$DB_ELEMENTS}
|
||||
{if isset($waiting)}
|
||||
(<a href="{$waiting.URL}">{$waiting.INFO}</a>)
|
||||
{/if}
|
||||
|
||||
{if isset($first_added)}
|
||||
({$first_added.DB_DATE})
|
||||
{/if}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<div class="titrePage">
|
||||
<h2>{'Waiting'|@translate} {$TABSHEET_TITLE}</h2>
|
||||
</div>
|
||||
|
||||
<h3>{'Pictures waiting for validation'|@translate}</h3>
|
||||
|
||||
<form action="{$F_ACTION}" method="post" id="waiting">
|
||||
<table style="width:99%;" >
|
||||
<tr class="throw">
|
||||
<td style="width:20%;">{'Album'|@translate}</td>
|
||||
<td style="width:20%;">{'Date'|@translate}</td>
|
||||
<td style="width:20%;">{'File'|@translate}</td>
|
||||
<td style="width:20%;">{'Thumbnail'|@translate}</td>
|
||||
<td style="width:20%;">{'Author'|@translate}</td>
|
||||
<td style="width:1px;"> </td>
|
||||
</tr>
|
||||
|
||||
{if not empty($pictures) }
|
||||
{foreach from=$pictures item=picture name=picture_loop}
|
||||
<tr class="{if $smarty.foreach.picture_loop.index is odd}row1{else}row2{/if}">
|
||||
<td style="white-space:nowrap;">{$picture.CATEGORY_IMG}</td>
|
||||
<td style="white-space:nowrap;">{$picture.DATE_IMG}</td>
|
||||
<td style="white-space:nowrap;">
|
||||
<a href="{$picture.PREVIEW_URL_IMG}" title="{$picture.FILE_TITLE}">{$picture.FILE_IMG}</a>
|
||||
</td>
|
||||
<td style="white-space:nowrap;">
|
||||
{if not empty($picture.thumbnail) }
|
||||
<a href="{$picture.thumbnail.PREVIEW_URL_TN_IMG}" title="{$picture.thumbnail.FILE_TN_TITLE}">{$picture.thumbnail.FILE_TN_IMG}</a>
|
||||
{/if}
|
||||
</td>
|
||||
<td style="white-space:nowrap;">
|
||||
<a href="mailto:{$picture.UPLOAD_EMAIL}">{$picture.UPLOAD_USERNAME}</a>
|
||||
</td>
|
||||
<td style="white-space:nowrap;">
|
||||
<label><input type="radio" name="action-{$picture.ID_IMG}" value="validate"> {'Validate'|@translate}</label>
|
||||
<label><input type="radio" name="action-{$picture.ID_IMG}" value="reject"> {'Reject'|@translate}</label>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</table>
|
||||
|
||||
<p class="bottomButtons">
|
||||
<input type="hidden" name="list" value="{$LIST}">
|
||||
<input class="submit" type="submit" name="submit" value="{'Submit'|@translate}">
|
||||
<input class="submit" type="submit" name="validate-all" value="{'Validate All'|@translate}">
|
||||
<input class="submit" type="submit" name="reject-all" value="{'Reject All'|@translate}">
|
||||
<input class="submit" type="reset" value="{'Reset'|@translate}">
|
||||
</p>
|
||||
|
||||
</form>
|
||||
@@ -1,205 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based picture gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
if( !defined("PHPWG_ROOT_PATH") )
|
||||
{
|
||||
die ("Hacking attempt!");
|
||||
}
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Check Access and exit when user status is not ok |
|
||||
// +-----------------------------------------------------------------------+
|
||||
check_status(ACCESS_ADMINISTRATOR);
|
||||
|
||||
//--------------------------------------------------------------------- updates
|
||||
|
||||
if (isset($_POST))
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (isset($_POST['validate-all']) and !empty($_POST['list']))
|
||||
{
|
||||
$to_validate = explode(',', $_POST['list']);
|
||||
}
|
||||
elseif (isset($_POST['reject-all']) and !empty($_POST['list']))
|
||||
{
|
||||
$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 = pwg_db_fetch_assoc($result))
|
||||
{
|
||||
$dir = get_complete_dir($row['storage_category_id']);
|
||||
unlink($dir.$row['file']);
|
||||
$element_info = array(
|
||||
'path' => $dir.$row['file'],
|
||||
'tn_ext' =>
|
||||
(isset($row['tn_ext']) and $row['tn_ext']!='') ? $row['tn_ext']:'jpg'
|
||||
);
|
||||
$tn_path = get_thumbnail_path( $element_info );
|
||||
|
||||
if ( @is_file($tn_path) )
|
||||
{
|
||||
unlink( $tn_path );
|
||||
}
|
||||
}
|
||||
|
||||
$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)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------- template initialization
|
||||
$template->set_filenames(array('upload'=>'upload.tpl'));
|
||||
|
||||
$template->assign(array(
|
||||
'F_ACTION'=>str_replace( '&', '&', $_SERVER['REQUEST_URI'])
|
||||
));
|
||||
|
||||
//---------------------------------------------------------------- form display
|
||||
$cat_names = array();
|
||||
$list = array();
|
||||
|
||||
$query = 'SELECT * FROM '.WAITING_TABLE;
|
||||
$query.= " WHERE validated = 'false'";
|
||||
$query.= ' ORDER BY storage_category_id';
|
||||
$query.= ';';
|
||||
$result = pwg_query( $query );
|
||||
while ( $row = pwg_db_fetch_assoc( $result ) )
|
||||
{
|
||||
if ( !isset( $cat_names[$row['storage_category_id']] ) )
|
||||
{
|
||||
$cat = get_cat_info( $row['storage_category_id'] );
|
||||
$cat_names[$row['storage_category_id']] = array();
|
||||
$cat_names[$row['storage_category_id']]['dir'] =
|
||||
PHPWG_ROOT_PATH.get_complete_dir( $row['storage_category_id'] );
|
||||
$cat_names[$row['storage_category_id']]['display_name'] =
|
||||
get_cat_display_name($cat['upper_names']);
|
||||
}
|
||||
$preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file'];
|
||||
|
||||
$tpl_var =
|
||||
array(
|
||||
'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'=>get_email_address_as_display_text($row['mail_address']),
|
||||
'UPLOAD_USERNAME'=>stripslashes($row['username'])
|
||||
);
|
||||
|
||||
// is there an existing associated thumnail ?
|
||||
if ( !empty( $row['tn_ext'] ))
|
||||
{
|
||||
$thumbnail = $conf['prefix_thumbnail'];
|
||||
$thumbnail.= get_filename_wo_extension( $row['file'] );
|
||||
$thumbnail.= '.'.$row['tn_ext'];
|
||||
$url = $cat_names[$row['storage_category_id']]['dir'];
|
||||
$url.= $conf['dir_thumbnail'].'/'.$thumbnail;
|
||||
|
||||
$tpl_var['thumbnail'] =
|
||||
array(
|
||||
'PREVIEW_URL_TN_IMG' => $url,
|
||||
'FILE_TN_IMG' =>
|
||||
(strlen($thumbnail) > 10) ?
|
||||
(substr($thumbnail, 0, 10)).'...' : $thumbnail,
|
||||
'FILE_TN_TITLE' => $thumbnail
|
||||
);
|
||||
}
|
||||
$template->append('pictures', $tpl_var);
|
||||
array_push($list, $row['id']);
|
||||
}
|
||||
|
||||
$template->assign('LIST',implode(',', $list) );
|
||||
|
||||
//----------------------------------------------------------- sending html code
|
||||
$template->assign_var_from_handle('ADMIN_CONTENT', 'upload');
|
||||
?>
|
||||
Reference in New Issue
Block a user