Ignore:
Timestamp:
Feb 20, 2014, 11:28:01 PM (10 years ago)
Author:
ddtddt
Message:

[extensions] - see_photos_by_user - bug desactivate plug - link direct user only for autorise user

Location:
extensions/see_photos_by_user
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/see_photos_by_user/main.inc.php

    r27429 r27442  
    4747function section_init_SPBA()
    4848{
    49  global $tokens;
     49 global $tokens, $conf;
    5050$testa = explode('user-', $_SERVER['REQUEST_URI']);
    5151if (!empty ($testa[1]))
    5252{
    5353$testd= explode('/', $testa[1]);
     54$query = '
     55SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU, IT.id
     56 FROM ' . USERS_TABLE . ' as UT
     57 INNER JOIN '.IMAGES_TABLE.' AS IT ON IT.added_by = UT.id
     58 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON IT.id = ic.image_id
     59  '.get_sql_condition_FandF
     60  (
     61    array
     62      (
     63        'forbidden_categories' => 'category_id',
     64        'visible_categories' => 'category_id',
     65        'visible_images' => 'id'
     66      ),
     67    'WHERE'
     68  ).'
     69 GROUP BY IT.added_by
     70 HAVING PBU >'.$conf['see_photos_by_user_nbphotos'].'
     71 ORDER BY '.$conf['see_photos_by_user_order'].'
     72 LIMIT '.$conf['see_photos_by_user_limit'].';';
     73
     74$result = pwg_query($query);
     75$userok = array();
     76while ($row = pwg_db_fetch_assoc($result))
     77 {
     78  $userok[] = $row['username'];
     79}
     80
     81if (in_array($testd[0], $userok))
     82{
    5483$me = 'user-'.$testd[0];
     84}
     85else
     86{
     87 $redirect_url = get_root_url().'index.php?/categories';
     88 redirect($redirect_url);
     89}
    5590}
    5691else
  • extensions/see_photos_by_user/maintain.inc.php

    r27438 r27442  
    55function plugin_activate()
    66{
     7
     8global $conf;
     9
    710if (!isset($conf['see_photos_by_user_nbphotos']))
    811 {
Note: See TracChangeset for help on using the changeset viewer.