Skip to content

Commit

Permalink
feature 2108 added: user upload removed from core. It will come back …
Browse files Browse the repository at this point in the history
…as a

"new generation" user upload in the Community plugin.


git-svn-id: http://piwigo.org/svn/trunk@8651 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Jan 13, 2011
1 parent f03dcee commit fe569ab
Show file tree
Hide file tree
Showing 109 changed files with 99 additions and 1,829 deletions.
1 change: 0 additions & 1 deletion admin.php
Expand Up @@ -125,7 +125,6 @@
'U_MOVE'=> $link_start.'cat_move',
'U_CAT_OPTIONS'=> $link_start.'cat_options',
'U_CAT_UPDATE'=> $link_start.'site_update&site=1',
'U_WAITING'=> $link_start.'upload',
'U_RATING'=> $link_start.'rating',
'U_CADDIE'=> $link_start.'batch_manager&cat=caddie',
'U_RECENT_SET'=> $link_start.'batch_manager&cat=recent',
Expand Down
7 changes: 0 additions & 7 deletions admin/cat_modify.php
Expand Up @@ -69,8 +69,6 @@
'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']),
Expand Down Expand Up @@ -245,7 +243,6 @@
'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"' : '',
Expand Down Expand Up @@ -304,10 +301,6 @@
$category['cat_full_dir'] )
)
);
if (!url_is_remote($category['cat_full_dir']) )
{
$template->assign('SHOW_UPLOADABLE', true);
}
}

// image order management
Expand Down
53 changes: 2 additions & 51 deletions admin/cat_options.php
Expand Up @@ -47,16 +47,6 @@
{
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 = '
Expand Down Expand Up @@ -95,16 +85,6 @@
{
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 = '
Expand Down Expand Up @@ -162,10 +142,6 @@
$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'])
{
Expand All @@ -182,8 +158,8 @@

// 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,
Expand All @@ -193,31 +169,6 @@
$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 = '
Expand Down
39 changes: 0 additions & 39 deletions admin/configuration.php
Expand Up @@ -60,11 +60,6 @@
'history_guest'
);

$upload_checkboxes = array(
'upload_link_everytime',
'email_admin_on_picture_uploaded',
);

$comments_checkboxes = array(
'comments_forall',
'comments_validation',
Expand Down Expand Up @@ -144,14 +139,6 @@
}
break;
}
case 'upload' :
{
foreach( $upload_checkboxes as $checkbox)
{
$_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
}
break;
}
case 'default' :
{
// Never go here
Expand Down Expand Up @@ -217,10 +204,6 @@
$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']);
Expand Down Expand Up @@ -300,28 +283,6 @@
}
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);
Expand Down
7 changes: 0 additions & 7 deletions admin/help.php
Expand Up @@ -46,13 +46,6 @@
'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'),
Expand Down
1 change: 0 additions & 1 deletion admin/include/functions_upgrade.php
Expand Up @@ -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');
Expand Down
19 changes: 0 additions & 19 deletions admin/intro.php
Expand Up @@ -239,25 +239,6 @@
);
}

// 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(*)
Expand Down
82 changes: 2 additions & 80 deletions admin/site_update.php
Expand Up @@ -240,9 +240,6 @@
'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']),
);
Expand Down Expand Up @@ -312,7 +309,7 @@
{
$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);
}
Expand Down Expand Up @@ -359,7 +356,6 @@
$cat_ids = array_diff(array_keys($db_categories), $to_delete);

$db_elements = array();
$db_unvalidated = array();

if (count($cat_ids) > 0)
{
Expand All @@ -373,26 +369,6 @@
"\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
Expand All @@ -403,7 +379,7 @@
$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
Expand Down Expand Up @@ -529,60 +505,6 @@
$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);
}
}
}

// +-----------------------------------------------------------------------+
Expand Down
3 changes: 0 additions & 3 deletions admin/themes/default/template/admin.tpl
Expand Up @@ -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>
Expand Down
8 changes: 0 additions & 8 deletions admin/themes/default/template/cat_modify.tpl
Expand Up @@ -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>

Expand Down

0 comments on commit fe569ab

Please sign in to comment.