Ignore:
Timestamp:
Mar 19, 2016, 6:33:31 AM (8 years ago)
Author:
ddtddt
Message:

[extensions] - see_photos_by_user - 2.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/see_photos_by_user/admin.php

    r30432 r31460  
    11<?php
    2 
     2// +-----------------------------------------------------------------------+
     3// | See photos by user plugin for piwigo                                  |
     4// +-----------------------------------------------------------------------+
     5// | Copyright(C) 2014 - 2016 ddtddt             http://temmii.com/piwigo/ |
     6// +-----------------------------------------------------------------------+
     7// | This program is free software; you can redistribute it and/or modify  |
     8// | it under the terms of the GNU General Public License as published by  |
     9// | the Free Software Foundation                                          |
     10// |                                                                       |
     11// | This program is distributed in the hope that it will be useful, but   |
     12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
     13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
     14// | General Public License for more details.                              |
     15// |                                                                       |
     16// | You should have received a copy of the GNU General Public License     |
     17// | along with this program; if not, write to the Free Software           |
     18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
     19// | USA.                                                                  |
     20// +-----------------------------------------------------------------------+
    321if (!defined('PHPWG_ROOT_PATH'))
    422    die('Hacking attempt!');
    523global $template, $conf, $user;
    6 include_once(PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php');
    7 load_language('plugin.lang', SPBA_PATH);
    8 $my_base_url = get_admin_plugin_menu_link(__FILE__);
    924
    1025// +-----------------------------------------------------------------------+
     
    1631
    1732$template->assign(
    18         array(
    19             'SPBU1' => $conf['see_photos_by_user_nbphotos'],
    20             'SPBU2' => $conf['see_photos_by_user_limit'],
    21             'SPBU3' => $conf['see_photos_by_user_order'],
    22             'SPBU4' => $conf['see_photos_by_user_show'],
    23             'SPBU5' => $conf['see_photos_by_user_color'],
    24             'SPBU6' => $conf['see_photos_by_user_show_user_home'],
    25             'SPBU7' => $conf['see_photos_by_user_shape'],
    26             'SPBA_PATH2'=> get_root_url() . SPBA_PATH,
    27         )
     33  array(
     34        'SPBU1' => $conf['see_photos_by_user_nbphotos'],
     35        'SPBU2' => $conf['see_photos_by_user_limit'],
     36        'SPBU3' => $conf['see_photos_by_user_order'],
     37        'SPBU4' => $conf['see_photos_by_user_show'],
     38        'SPBU5' => $conf['see_photos_by_user_color'],
     39        'SPBU6' => $conf['see_photos_by_user_show_user_home'],
     40        'SPBU7' => $conf['see_photos_by_user_shape'],
     41        'SPBA_PATH2'=> get_root_url() . SPBA_PATH,
     42  )
    2843);
    2944
    3045$SPBU3T = array(
    31     l10n('users in alphabetical order'),
    32     l10n('users by reverse alphabetical order'),
    33     l10n('by increasing number of photos'),
    34     l10n('by decreasing number of photos'),
     46  l10n('users in alphabetical order'),
     47  l10n('users by reverse alphabetical order'),
     48  l10n('by increasing number of photos'),
     49  l10n('by decreasing number of photos'),
    3550);
    3651
    3752$SPBU3 = array(
    38     'username ASC',
    39     'username DESC',
    40     'PBU ASC',
    41     'PBU DESC',
     53  'username ASC',
     54  'username DESC',
     55  'PBU ASC',
     56  'PBU DESC',
    4257);
    4358
     
    4661
    4762$PAPAB = pwg_db_fetch_assoc(pwg_query("SELECT state FROM " . PLUGINS_TABLE . " WHERE id = 'Photo_add_by';"));
    48 if($PAPAB['state'] == 'active')
    49 {
    50    $SPBU3T2 = array(
     63if($PAPAB['state'] == 'active'){
     64  $SPBU3T2 = array(
    5165    l10n('nothing'),
    5266    l10n('link Specials menu'),
    5367    l10n('bloc menu users'),
    54     );
    55     $SPBU32 = array(
     68  );
     69  $SPBU32 = array(
    5670    '-1',
    5771    '1',
     
    5973    );
    6074}else{
    61     $SPBU3T2 = array(
     75  $SPBU3T2 = array(
    6276    l10n('link Specials menu'),
    6377    l10n('bloc menu users'),
    64     );
    65     $SPBU32 = array(
    66         '1',
    67         '2',
    68     );
     78  );
     79  $SPBU32 = array(
     80        '1',
     81        '2',
     82  );
    6983}
    7084
     
    7387
    7488$SPBU4T2 = array(
    75   //  l10n('nothing'),
    76     l10n('users cloud'),
    77     l10n('cumulus users cloud'),
    78     l10n('select users box'),
     89  l10n('users cloud'),
     90  l10n('cumulus users cloud'),
     91  l10n('select users box'),
    7992);
    8093
    8194$SPBU42 = array(
    82   //  '-1',
    83     '1',
    84     '2',
    85     '3'
     95  '1',
     96  '2',
     97  '3'
    8698);
    8799
     
    90102
    91103$SPBU7 = array(
    92     'sphere',
    93     'vcylinder',
    94     'hcylinder',
    95     'vring',
    96     'hring',
     104  'sphere',
     105  'vcylinder',
     106  'hcylinder',
     107  'vring',
     108  'hring',
    97109);
    98110
    99111$SPBUT7 = array(
    100     l10n('sphere'),
    101     l10n('vertical cylinder'),
    102     l10n('horizontal cylinder'),
    103     l10n('vertical ring'),
    104     l10n('horizontal ring'),
     112  l10n('sphere'),
     113  l10n('vertical cylinder'),
     114  l10n('horizontal cylinder'),
     115  l10n('vertical ring'),
     116  l10n('horizontal ring'),
    105117);
    106118
     
    109121
    110122if (isset($_POST['submitspbu'])) {
    111     if (is_numeric($_POST['insspbu1'])) {
    112         conf_update_param('see_photos_by_user_nbphotos', $_POST['insspbu1']);
    113     } else {
    114         array_push($page['errors'], l10n('Maximal number users is incorrect !'));
    115     }
    116     if (is_numeric($_POST['insspbu2']))
    117         conf_update_param('see_photos_by_user_limit', $_POST['insspbu2']);
    118     else {
    119         array_push($page['errors'], l10n('Minimal number photos for show users is incorrect !'));
    120     }
    121     conf_update_param('see_photos_by_user_order', $_POST['insspbu3']);
    122     conf_update_param('see_photos_by_user_show', $_POST['insspbu4']);
    123     conf_update_param('see_photos_by_user_color', $_POST['insspbu5']);
    124     conf_update_param('see_photos_by_user_show_user_home', $_POST['insspbu6']);
    125     conf_update_param('see_photos_by_user_shape', $_POST['insspbu7']);
    126     if (!$page['errors']) {
    127         array_push($page['infos'], l10n('Update Complete'));
    128     }
    129 
    130     $template->assign(
    131             array(
    132                 'SPBU1' => stripslashes($_POST['insspbu1']),
    133                 'SPBU2' => stripslashes($_POST['insspbu2']),
    134                 'SPBU3' => stripslashes($_POST['insspbu3']),
    135                 'SPBU4' => stripslashes($_POST['insspbu4']),
    136                 'SPBU5' => stripslashes($_POST['insspbu5']),
    137                 'SPBU6' => stripslashes($_POST['insspbu6']),
    138                 'SPBU7' => stripslashes($_POST['insspbu7']),
    139             )
    140     );
     123  if (is_numeric($_POST['insspbu1'])) {
     124    conf_update_param('see_photos_by_user_nbphotos', $_POST['insspbu1']);
     125  } else {
     126    array_push($page['errors'], l10n('Maximal number users is incorrect !'));
     127  }
     128  if (is_numeric($_POST['insspbu2']))
     129    conf_update_param('see_photos_by_user_limit', $_POST['insspbu2']);
     130  else {
     131    array_push($page['errors'], l10n('Minimal number photos for show users is incorrect !'));
     132  }
     133  conf_update_param('see_photos_by_user_order', $_POST['insspbu3']);
     134  conf_update_param('see_photos_by_user_show', $_POST['insspbu4']);
     135  conf_update_param('see_photos_by_user_color', $_POST['insspbu5']);
     136  conf_update_param('see_photos_by_user_show_user_home', $_POST['insspbu6']);
     137  conf_update_param('see_photos_by_user_shape', $_POST['insspbu7']);
     138  if (!$page['errors']) {
     139    array_push($page['infos'], l10n('Update Complete'));
     140  }
     141  $template->assign(
     142        array(
     143          'SPBU1' => stripslashes($_POST['insspbu1']),
     144          'SPBU2' => stripslashes($_POST['insspbu2']),
     145          'SPBU3' => stripslashes($_POST['insspbu3']),
     146          'SPBU4' => stripslashes($_POST['insspbu4']),
     147          'SPBU5' => stripslashes($_POST['insspbu5']),
     148          'SPBU6' => stripslashes($_POST['insspbu6']),
     149          'SPBU7' => stripslashes($_POST['insspbu7']),
     150        )
     151  );
    141152}
    142153
Note: See TracChangeset for help on using the changeset viewer.