Ignore:
Timestamp:
Mar 31, 2010, 6:32:40 PM (14 years ago)
Author:
george
Message:
  • Upraveno: Aktualizace fóra.
Location:
trunk/forum/includes/acp
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/forum/includes/acp/acp_attachments.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_attachments.php 9041 2008-11-02 11:19:12Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    125125                                                'img_display_inlined'           => array('lang' => 'DISPLAY_INLINED',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    126126                                                'img_create_thumbnail'          => array('lang' => 'CREATE_THUMBNAIL',          'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    127                                                 'img_max_thumb_width'           => array('lang' => 'MAX_THUMB_WIDTH',           'validate' => 'int',    'type' => 'text:7:15', 'explain' => true, 'append' => ' px'),
     127                                                'img_max_thumb_width'           => array('lang' => 'MAX_THUMB_WIDTH',           'validate' => 'int',    'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
    128128                                                'img_min_thumb_filesize'        => array('lang' => 'MIN_THUMB_FILESIZE',        'validate' => 'int',    'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
    129129                                                'img_imagick'                           => array('lang' => 'IMAGICK_PATH',                      'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => '&nbsp;&nbsp;<span>[ <a href="' . $this->u_action . '&amp;action=imgmagick">' . $user->lang['SEARCH_IMAGICK'] . '</a> ]</span>'),
    130                                                 'img_max'                                       => array('lang' => 'MAX_IMAGE_SIZE',            'validate' => 'int',    'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px'),
    131                                                 'img_link'                                      => array('lang' => 'IMAGE_LINK_SIZE',           'validate' => 'int',    'type' => 'dimension:3:4', 'explain' => true, 'append' => ' px'),
     130                                                'img_max'                                       => array('lang' => 'MAX_IMAGE_SIZE',            'validate' => 'int',    'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
     131                                                'img_link'                                      => array('lang' => 'IMAGE_LINK_SIZE',           'validate' => 'int',    'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
    132132                                        )
    133133                                );
     
    685685                                                }
    686686
    687                                                 $size_format = ($ext_group_row['max_filesize'] >= 1048576) ? 'mb' : (($ext_group_row['max_filesize'] >= 1024) ? 'kb' : 'b');
    688                                                 $ext_group_row['max_filesize'] = get_formatted_filesize($ext_group_row['max_filesize'], false);
     687                                                $max_filesize = get_formatted_filesize($ext_group_row['max_filesize'], false, array('mb', 'kb', 'b'));
     688                                                $size_format = $max_filesize['si_identifier'];
     689                                                $ext_group_row['max_filesize'] = $max_filesize['value'];
    689690
    690691                                                $img_path = $config['upload_icons_path'];
     
    695696                                                $imglist = filelist($phpbb_root_path . $img_path);
    696697
    697                                                 if (sizeof($imglist))
     698                                                if (!empty($imglist['']))
    698699                                                {
    699700                                                        $imglist = array_values($imglist);
     
    10041005                                                if ($files_added)
    10051006                                                {
    1006                                                         set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
    1007                                                         set_config('num_files', $config['num_files'] + $files_added, true);
     1007                                                        set_config_count('upload_dir_size', $space_taken, true);
     1008                                                        set_config_count('num_files', $files_added, true);
    10081009                                                }
    10091010                                        }
     
    10271028                                                'FILESIZE'                      => get_formatted_filesize($row['filesize']),
    10281029                                                'FILETIME'                      => $user->format_date($row['filetime']),
    1029                                                 'REAL_FILENAME'         => basename($row['real_filename']),
    1030                                                 'PHYSICAL_FILENAME'     => basename($row['physical_filename']),
     1030                                                'REAL_FILENAME'         => utf8_basename($row['real_filename']),
     1031                                                'PHYSICAL_FILENAME'     => utf8_basename($row['physical_filename']),
    10311032                                                'ATTACH_ID'                     => $row['attach_id'],
    10321033                                                'POST_IDS'                      => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '',
     
    14301431        {
    14311432                // Determine size var and adjust the value accordingly
    1432                 $size_var = ($value >= 1048576) ? 'mb' : (($value >= 1024) ? 'kb' : 'b');
    1433                 $value = get_formatted_filesize($value, false);
     1433                $filesize = get_formatted_filesize($value, false, array('mb', 'kb', 'b'));
     1434                $size_var = $filesize['si_identifier'];
     1435                $value = $filesize['value'];
    14341436
    14351437                return '<input type="text" id="' . $key . '" size="8" maxlength="15" name="config[' . $key . ']" value="' . $value . '" /> <select name="' . $key . '">' . size_select_options($size_var) . '</select>';
  • trunk/forum/includes/acp/acp_ban.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_ban.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    157157                                        WHERE (ban_end >= ' . time() . "
    158158                                                        OR ban_end = 0)
    159                                                 AND ban_ip <> ''";
     159                                                AND ban_ip <> ''
     160                                        ORDER BY ban_ip";
    160161                        break;
    161162
     
    169170                                        WHERE (ban_end >= ' . time() . "
    170171                                                        OR ban_end = 0)
    171                                                 AND ban_email <> ''";
     172                                                AND ban_email <> ''
     173                                        ORDER BY ban_email";
    172174                        break;
    173175                }
     
    182184
    183185                        $time_length = ($row['ban_end']) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0;
    184                         $ban_length[$row['ban_id']] = (isset($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : $user->lang['UNTIL'] . ' -> ' . $user->format_date($row['ban_end']);
     186
     187                        if ($time_length == 0)
     188                        {
     189                                // Banned permanently
     190                                $ban_length[$row['ban_id']] = $user->lang['PERMANENT'];
     191                        }
     192                        else if (isset($ban_end_text[$time_length]))
     193                        {
     194                                // Banned for a given duration
     195                                $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DURATION'], $ban_end_text[$time_length], $user->format_date($row['ban_end'], false, true));
     196                        }
     197                        else
     198                        {
     199                                // Banned until given date
     200                                $ban_length[$row['ban_id']] = sprintf($user->lang['BANNED_UNTIL_DATE'], $user->format_date($row['ban_end'], false, true));
     201                        }
    185202
    186203                        $ban_reasons[$row['ban_id']] = $row['ban_reason'];
  • trunk/forum/includes/acp/acp_bbcodes.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_bbcodes.php 8743 2008-08-12 16:03:18Z Kellanved $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    125125                        case 'create':
    126126
    127                                 $data = $this->build_regexp($bbcode_match, $bbcode_tpl);
    128 
    129                                 // Make sure the user didn't pick a "bad" name for the BBCode tag.
    130                                 $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash=');
    131 
    132                                 if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create'))
    133                                 {
    134                                         $sql = 'SELECT 1 as test
    135                                                 FROM ' . BBCODES_TABLE . "
    136                                                 WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'";
    137                                         $result = $db->sql_query($sql);
    138                                         $info = $db->sql_fetchrow($result);
    139                                         $db->sql_freeresult($result);
    140 
    141                                         // Grab the end, interrogate the last closing tag
    142                                         if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)))
    143                                         {
    144                                                 trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING);
    145                                         }
    146                                 }
    147 
    148                                 if (substr($data['bbcode_tag'], -1) === '=')
    149                                 {
    150                                         $test = substr($data['bbcode_tag'], 0, -1);
    151                                 }
    152                                 else
    153                                 {
    154                                         $test = $data['bbcode_tag'];
    155                                 }
    156 
    157                                 if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match))
    158                                 {
    159                                         trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING);
    160                                 }
    161 
    162                                 if (strlen($data['bbcode_tag']) > 16)
    163                                 {
    164                                         trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
    165                                 }
    166 
    167                                 if (strlen($bbcode_match) > 4000)
    168                                 {
    169                                         trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
    170                                 }
    171                                
    172                                
    173                                 if (strlen($bbcode_helpline) > 255)
    174                                 {
    175                                         trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
    176                                 }
    177 
    178                                 $sql_ary = array(
    179                                         'bbcode_tag'                            => $data['bbcode_tag'],
    180                                         'bbcode_match'                          => $bbcode_match,
    181                                         'bbcode_tpl'                            => $bbcode_tpl,
    182                                         'display_on_posting'            => $display_on_posting,
    183                                         'bbcode_helpline'                       => $bbcode_helpline,
    184                                         'first_pass_match'                      => $data['first_pass_match'],
    185                                         'first_pass_replace'            => $data['first_pass_replace'],
    186                                         'second_pass_match'                     => $data['second_pass_match'],
    187                                         'second_pass_replace'           => $data['second_pass_replace']
    188                                 );
    189 
    190                                 if ($action == 'create')
    191                                 {
    192                                         $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id
    193                                                 FROM ' . BBCODES_TABLE;
    194                                         $result = $db->sql_query($sql);
    195                                         $row = $db->sql_fetchrow($result);
    196                                         $db->sql_freeresult($result);
    197 
    198                                         if ($row)
    199                                         {
    200                                                 $bbcode_id = $row['max_bbcode_id'] + 1;
    201 
    202                                                 // Make sure it is greater than the core bbcode ids...
    203                                                 if ($bbcode_id <= NUM_CORE_BBCODES)
     127                                $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl);
     128                                if (!$warn_text || confirm_box(true))
     129                                {
     130                                        $data = $this->build_regexp($bbcode_match, $bbcode_tpl);
     131
     132                                        // Make sure the user didn't pick a "bad" name for the BBCode tag.
     133                                        $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash=');
     134
     135                                        if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create'))
     136                                        {
     137                                                $sql = 'SELECT 1 as test
     138                                                        FROM ' . BBCODES_TABLE . "
     139                                                        WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'";
     140                                                $result = $db->sql_query($sql);
     141                                                $info = $db->sql_fetchrow($result);
     142                                                $db->sql_freeresult($result);
     143
     144                                                // Grab the end, interrogate the last closing tag
     145                                                if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)))
     146                                                {
     147                                                        trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING);
     148                                                }
     149                                        }
     150
     151                                        if (substr($data['bbcode_tag'], -1) === '=')
     152                                        {
     153                                                $test = substr($data['bbcode_tag'], 0, -1);
     154                                        }
     155                                        else
     156                                        {
     157                                                $test = $data['bbcode_tag'];
     158                                        }
     159
     160                                        if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match))
     161                                        {
     162                                                trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING);
     163                                        }
     164
     165                                        if (strlen($data['bbcode_tag']) > 16)
     166                                        {
     167                                                trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
     168                                        }
     169
     170                                        if (strlen($bbcode_match) > 4000)
     171                                        {
     172                                                trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
     173                                        }
     174
     175
     176                                        if (strlen($bbcode_helpline) > 255)
     177                                        {
     178                                                trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING);
     179                                        }
     180
     181                                        $sql_ary = array(
     182                                                'bbcode_tag'                            => $data['bbcode_tag'],
     183                                                'bbcode_match'                          => $bbcode_match,
     184                                                'bbcode_tpl'                            => $bbcode_tpl,
     185                                                'display_on_posting'            => $display_on_posting,
     186                                                'bbcode_helpline'                       => $bbcode_helpline,
     187                                                'first_pass_match'                      => $data['first_pass_match'],
     188                                                'first_pass_replace'            => $data['first_pass_replace'],
     189                                                'second_pass_match'                     => $data['second_pass_match'],
     190                                                'second_pass_replace'           => $data['second_pass_replace']
     191                                        );
     192
     193                                        if ($action == 'create')
     194                                        {
     195                                                $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id
     196                                                        FROM ' . BBCODES_TABLE;
     197                                                $result = $db->sql_query($sql);
     198                                                $row = $db->sql_fetchrow($result);
     199                                                $db->sql_freeresult($result);
     200
     201                                                if ($row)
     202                                                {
     203                                                        $bbcode_id = $row['max_bbcode_id'] + 1;
     204
     205                                                        // Make sure it is greater than the core bbcode ids...
     206                                                        if ($bbcode_id <= NUM_CORE_BBCODES)
     207                                                        {
     208                                                                $bbcode_id = NUM_CORE_BBCODES + 1;
     209                                                        }
     210                                                }
     211                                                else
    204212                                                {
    205213                                                        $bbcode_id = NUM_CORE_BBCODES + 1;
    206214                                                }
     215
     216                                                if ($bbcode_id > 1511)
     217                                                {
     218                                                        trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING);
     219                                                }
     220
     221                                                $sql_ary['bbcode_id'] = (int) $bbcode_id;
     222
     223                                                $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
     224                                                $cache->destroy('sql', BBCODES_TABLE);
     225
     226                                                $lang = 'BBCODE_ADDED';
     227                                                $log_action = 'LOG_BBCODE_ADD';
    207228                                        }
    208229                                        else
    209230                                        {
    210                                                 $bbcode_id = NUM_CORE_BBCODES + 1;
    211                                         }
    212 
    213                                         if ($bbcode_id > 1511)
    214                                         {
    215                                                 trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING);
    216                                         }
    217 
    218                                         $sql_ary['bbcode_id'] = (int) $bbcode_id;
    219 
    220                                         $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
    221                                         $cache->destroy('sql', BBCODES_TABLE);
    222 
    223                                         $lang = 'BBCODE_ADDED';
    224                                         $log_action = 'LOG_BBCODE_ADD';
     231                                                $sql = 'UPDATE ' . BBCODES_TABLE . '
     232                                                        SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
     233                                                        WHERE bbcode_id = ' . $bbcode_id;
     234                                                $db->sql_query($sql);
     235                                                $cache->destroy('sql', BBCODES_TABLE);
     236
     237                                                $lang = 'BBCODE_EDITED';
     238                                                $log_action = 'LOG_BBCODE_EDIT';
     239                                        }
     240
     241                                        add_log('admin', $log_action, $data['bbcode_tag']);
     242
     243                                        trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
    225244                                }
    226245                                else
    227246                                {
    228                                         $sql = 'UPDATE ' . BBCODES_TABLE . '
    229                                                 SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
    230                                                 WHERE bbcode_id = ' . $bbcode_id;
    231                                         $db->sql_query($sql);
    232                                         $cache->destroy('sql', BBCODES_TABLE);
    233 
    234                                         $lang = 'BBCODE_EDITED';
    235                                         $log_action = 'LOG_BBCODE_EDIT';
    236                                 }
    237 
    238                                 add_log('admin', $log_action, $data['bbcode_tag']);
    239 
    240                                 trigger_error($user->lang[$lang] . adm_back_link($this->u_action));
     247                                        confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array(
     248                                                'action'                                => $action,
     249                                                'bbcode'                                => $bbcode_id,
     250                                                'bbcode_match'                  => $bbcode_match,
     251                                                'bbcode_tpl'                    => htmlspecialchars($bbcode_tpl),
     252                                                'bbcode_helpline'               => $bbcode_helpline,
     253                                                'display_on_posting'    => $display_on_posting,
     254                                                ))
     255                                        , 'confirm_bbcode.html');
     256                                }
    241257
    242258                        break;
     
    300316                $bbcode_match = trim($bbcode_match);
    301317                $bbcode_tpl = trim($bbcode_tpl);
     318                $utf8 = strpos($bbcode_match, 'INTTEXT') !== false;
     319
     320                // make sure we have utf8 support
     321                $utf8_pcre_properties = false;
     322                if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>=')))
     323                {
     324                        // While this is the proper range of PHP versions, PHP may not be linked with the bundled PCRE lib and instead with an older version
     325                        if (@preg_match('/\p{L}/u', 'a') !== false)
     326                        {
     327                                $utf8_pcre_properties = true;
     328                        }
     329                }
    302330
    303331                $fp_match = preg_quote($bbcode_match, '!');
     
    326354                        'SIMPLETEXT' => array(
    327355                                '!([a-zA-Z0-9-+.,_ ]+)!'         =>     "$1"
     356                        ),
     357                        'INTTEXT' => array(
     358                                ($utf8_pcre_properties) ? '!([\p{L}\p{N}\-+,_. ]+)!u' : '!([a-zA-Z0-9\-+,_. ]+)!u'       =>     "$1"
    328359                        ),
    329360                        'IDENTIFIER' => array(
     
    344375                        'TEXT' => '(.*?)',
    345376                        'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)',
     377                        'INTTEXT' => ($utf8_pcre_properties) ? '([\p{L}\p{N}\-+,_. ]+)' : '([a-zA-Z0-9\-+,_. ]+)',
    346378                        'IDENTIFIER' => '([a-zA-Z0-9-_]+)',
    347379                        'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',
     
    351383                $pad = 0;
    352384                $modifiers = 'i';
     385                $modifiers .= ($utf8 && $utf8_pcre_properties) ? 'u' : '';
    353386
    354387                if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))
     
    399432
    400433                        $fp_match = '!' . $fp_match . '!' . $modifiers;
    401                         $sp_match = '!' . $sp_match . '!s';
     434                        $sp_match = '!' . $sp_match . '!s' . (($utf8) ? 'u' : '');
    402435
    403436                        if (strpos($fp_match, 'e') !== false)
  • trunk/forum/includes/acp/acp_board.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_board.php 8911 2008-09-23 13:03:33Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    3030                global $db, $user, $auth, $template;
    3131                global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
     32                global $cache;
    3233
    3334                $user->add_lang('acp/board');
    3435
    3536                $action = request_var('action', '');
    36                 $submit = (isset($_POST['submit'])) ? true : false;
     37                $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false;
    3738
    3839                $form_key = 'acp_board';
     
    6566                                                'legend2'                               => 'WARNINGS',
    6667                                                'warnings_expire_days'  => array('lang' => 'WARNINGS_EXPIRE',           'validate' => 'int',    'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
     68
     69                                                'legend3'                                       => 'ACP_SUBMIT_CHANGES',
    6770                                        )
    6871                                );
     
    8083                                                'allow_attachments'             => array('lang' => 'ALLOW_ATTACHMENTS',         'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
    8184                                                'allow_pm_attach'               => array('lang' => 'ALLOW_PM_ATTACHMENTS',      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
     85                                                'allow_pm_report'               => array('lang' => 'ALLOW_PM_REPORT',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    8286                                                'allow_bbcode'                  => array('lang' => 'ALLOW_BBCODE',                      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
    8387                                                'allow_smilies'                 => array('lang' => 'ALLOW_SMILIES',                     'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
     
    8690                                                'allow_bookmarks'               => array('lang' => 'ALLOW_BOOKMARKS',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    8791                                                'allow_birthdays'               => array('lang' => 'ALLOW_BIRTHDAYS',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
     92                                                'allow_quick_reply'             => array('lang' => 'ALLOW_QUICK_REPLY',         'validate' => 'bool',   'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
    8893
    8994                                                'legend2'                               => 'ACP_LOAD_SETTINGS',
     
    9499                                                'load_cpf_viewprofile'  => array('lang' => 'LOAD_CPF_VIEWPROFILE',      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
    95100                                                'load_cpf_viewtopic'    => array('lang' => 'LOAD_CPF_VIEWTOPIC',        'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
     101
     102                                                'legend3'                                       => 'ACP_SUBMIT_CHANGES',
    96103                                        )
    97104                                );
     
    109116                                                'avatar_max_height'             => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,),
    110117
     118                                                'allow_avatar'                  => array('lang' => 'ALLOW_AVATARS',                     'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    111119                                                'allow_avatar_local'    => array('lang' => 'ALLOW_LOCAL',                       'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
    112120                                                'allow_avatar_remote'   => array('lang' => 'ALLOW_REMOTE',                      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    113121                                                'allow_avatar_upload'   => array('lang' => 'ALLOW_UPLOAD',                      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
     122                                                'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool',     'type' => 'radio:yes_no', 'explain' => true),
    114123                                                'avatar_filesize'               => array('lang' => 'MAX_FILESIZE',                      'validate' => 'int:0',  'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']),
    115124                                                'avatar_min'                    => array('lang' => 'MIN_AVATAR_SIZE',           'validate' => 'int:0',  'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
     
    144153                                                'auth_img_pm'                   => array('lang' => 'ALLOW_IMG_PM',                      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
    145154                                                'auth_flash_pm'                 => array('lang' => 'ALLOW_FLASH_PM',            'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    146                                                 'enable_pm_icons'               => array('lang' => 'ENABLE_PM_ICONS',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false)
     155                                                'enable_pm_icons'               => array('lang' => 'ENABLE_PM_ICONS',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
     156
     157                                                'legend3'                                       => 'ACP_SUBMIT_CHANGES',
    147158                                        )
    148159                                );
     
    163174                                                'allow_bookmarks'               => array('lang' => 'ALLOW_BOOKMARKS',           'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
    164175                                                'enable_post_confirm'   => array('lang' => 'VISUAL_CONFIRM_POST',       'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => true),
     176                                                'allow_quick_reply'             => array('lang' => 'ALLOW_QUICK_REPLY',         'validate' => 'bool',   'type' => 'custom', 'method' => 'quick_reply', 'explain' => true),
    165177
    166178                                                'legend2'                               => 'POSTING',
    167                                                 'enable_queue_trigger'  => array('lang' => 'ENABLE_QUEUE_TRIGGER',      'validate' => 'bool',           'type' => 'radio:yes_no', 'explain' => true),
    168                                                 'queue_trigger_posts'   => array('lang' => 'QUEUE_TRIGGER_POSTS',       'validate' => 'int:0:250',      'type' => 'text:4:4', 'explain' => true),
    169179                                                'bump_type'                             => false,
    170180                                                'edit_time'                             => array('lang' => 'EDIT_TIME',                         'validate' => 'int:0',          'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
     181                                                'delete_time'                   => array('lang' => 'DELETE_TIME',                       'validate' => 'int:0',          'type' => 'text:5:5', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
    171182                                                'display_last_edited'   => array('lang' => 'DISPLAY_LAST_EDITED',       'validate' => 'bool',           'type' => 'radio:yes_no', 'explain' => true),
    172183                                                'flood_interval'                => array('lang' => 'FLOOD_INTERVAL',            'validate' => 'int:0',          'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
     
    174185                                                'topics_per_page'               => array('lang' => 'TOPICS_PER_PAGE',           'validate' => 'int:1',          'type' => 'text:3:4', 'explain' => false),
    175186                                                'posts_per_page'                => array('lang' => 'POSTS_PER_PAGE',            'validate' => 'int:1',          'type' => 'text:3:4', 'explain' => false),
     187                                                'smilies_per_page'              => array('lang' => 'SMILIES_PER_PAGE',          'validate' => 'int:1',          'type' => 'text:3:4', 'explain' => false),
    176188                                                'hot_threshold'                 => array('lang' => 'HOT_THRESHOLD',                     'validate' => 'int:0',          'type' => 'text:3:4', 'explain' => true),
    177189                                                'max_poll_options'              => array('lang' => 'MAX_POLL_OPTIONS',          'validate' => 'int:2:127',      'type' => 'text:4:4', 'explain' => false),
    178190                                                'max_post_chars'                => array('lang' => 'CHAR_LIMIT',                        'validate' => 'int:0',          'type' => 'text:4:6', 'explain' => true),
     191                                                'min_post_chars'                => array('lang' => 'MIN_CHAR_LIMIT',            'validate' => 'int:0',          'type' => 'text:4:6', 'explain' => true),
    179192                                                'max_post_smilies'              => array('lang' => 'SMILIES_LIMIT',                     'validate' => 'int:0',          'type' => 'text:4:4', 'explain' => true),
    180193                                                'max_post_urls'                 => array('lang' => 'MAX_POST_URLS',                     'validate' => 'int:0',          'type' => 'text:5:4', 'explain' => true),
     
    183196                                                'max_post_img_width'    => array('lang' => 'MAX_POST_IMG_WIDTH',        'validate' => 'int:0',          'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
    184197                                                'max_post_img_height'   => array('lang' => 'MAX_POST_IMG_HEIGHT',       'validate' => 'int:0',          'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
     198
     199                                                'legend3'                                       => 'ACP_SUBMIT_CHANGES',
    185200                                        )
    186201                                );
     
    206221                                                'max_sig_img_width'             => array('lang' => 'MAX_SIG_IMG_WIDTH',         'validate' => 'int:0',  'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
    207222                                                'max_sig_img_height'    => array('lang' => 'MAX_SIG_IMG_HEIGHT',        'validate' => 'int:0',  'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']),
     223
     224                                                'legend3'                                       => 'ACP_SUBMIT_CHANGES',
    208225                                        )
    209226                                );
     
    219236
    220237                                                'require_activation'    => array('lang' => 'ACC_ACTIVATION',    'validate' => 'int',    'type' => 'custom', 'method' => 'select_acc_activation', 'explain' => true),
     238                                                'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'text:4:4', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']),
     239                                                'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
    221240                                                'min_name_chars'                => array('lang' => 'USERNAME_LENGTH',   'validate' => 'int:1',  'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true),
    222241                                                'min_pass_chars'                => array('lang' => 'PASSWORD_LENGTH',   'validate' => 'int:1',  'type' => 'custom', 'method' => 'password_length', 'explain' => true),
     
    236255                                                'coppa_mail'            => array('lang' => 'COPPA_MAIL',                'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true),
    237256                                                'coppa_fax'                     => array('lang' => 'COPPA_FAX',                 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false),
     257
     258                                                'legend4'                       => 'ACP_SUBMIT_CHANGES',
     259                                        )
     260                                );
     261                        break;
     262
     263                        case 'feed':
     264                                $display_vars = array(
     265                                        'title' => 'ACP_FEED_MANAGEMENT',
     266                                        'vars'  => array(
     267                                                'legend1'                                       => 'ACP_FEED_GENERAL',
     268                                                'feed_enable'                           => array('lang' => 'ACP_FEED_ENABLE',                           'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     269                                                'feed_item_statistics'          => array('lang' => 'ACP_FEED_ITEM_STATISTICS',          'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true),
     270                                                'feed_http_auth'                        => array('lang' => 'ACP_FEED_HTTP_AUTH',                        'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true),
     271
     272                                                'legend2'                                       => 'ACP_FEED_POST_BASED',
     273                                                'feed_limit_post'                       => array('lang' => 'ACP_FEED_LIMIT',                            'validate' => 'int:5',  'type' => 'text:3:4',                           'explain' => true),
     274                                                'feed_overall'                          => array('lang' => 'ACP_FEED_OVERALL',                          'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     275                                                'feed_forum'                            => array('lang' => 'ACP_FEED_FORUM',                            'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     276                                                'feed_topic'                            => array('lang' => 'ACP_FEED_TOPIC',                            'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     277
     278                                                'legend3'                                       => 'ACP_FEED_TOPIC_BASED',
     279                                                'feed_limit_topic'                      => array('lang' => 'ACP_FEED_LIMIT',                            'validate' => 'int:5',  'type' => 'text:3:4',                           'explain' => true),
     280                                                'feed_topics_new'                       => array('lang' => 'ACP_FEED_TOPICS_NEW',                       'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     281                                                'feed_topics_active'            => array('lang' => 'ACP_FEED_TOPICS_ACTIVE',            'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     282                                                'feed_news_id'                          => array('lang' => 'ACP_FEED_NEWS',                                     'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
     283
     284                                                'legend4'                                       => 'ACP_FEED_SETTINGS_OTHER',
     285                                                'feed_overall_forums'           => array('lang' => 'ACP_FEED_OVERALL_FORUMS',           'validate' => 'bool',   'type' => 'radio:enabled_disabled',     'explain' => true ),
     286                                                'feed_exclude_id'                       => array('lang' => 'ACP_FEED_EXCLUDE_ID',                       'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true),
    238287                                        )
    239288                                );
     
    280329                                                'load_cpf_viewprofile'  => array('lang' => 'LOAD_CPF_VIEWPROFILE',      'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
    281330                                                'load_cpf_viewtopic'    => array('lang' => 'LOAD_CPF_VIEWTOPIC',        'validate' => 'bool',   'type' => 'radio:yes_no', 'explain' => false),
     331
     332                                                'legend4'                                       => 'ACP_SUBMIT_CHANGES',
    282333                                        )
    283334                                );
     
    313364                                                'server_port'                   => array('lang' => 'SERVER_PORT',               'validate' => 'int:0',                  'type' => 'text:5:5', 'explain' => true),
    314365                                                'script_path'                   => array('lang' => 'SCRIPT_PATH',               'validate' => 'script_path',    'type' => 'text::255', 'explain' => true),
     366
     367                                                'legend4'                                       => 'ACP_SUBMIT_CHANGES',
    315368                                        )
    316369                                );
     
    361414                                                'smtp_auth_method'              => array('lang' => 'SMTP_AUTH_METHOD',          'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true),
    362415                                                'smtp_username'                 => array('lang' => 'SMTP_USERNAME',                     'validate' => 'string', 'type' => 'text:25:255', 'explain' => true),
    363                                                 'smtp_password'                 => array('lang' => 'SMTP_PASSWORD',                     'validate' => 'string', 'type' => 'password:25:255', 'explain' => true)
     416                                                'smtp_password'                 => array('lang' => 'SMTP_PASSWORD',                     'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
     417
     418                                                'legend3'                                       => 'ACP_SUBMIT_CHANGES',
    364419                                        )
    365420                                );
     
    401456                        }
    402457
    403                         if ($config_name == 'auth_method')
     458                        if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id')
    404459                        {
    405460                                continue;
     
    418473                        {
    419474                                set_config($config_name, $config_value);
    420                         }
     475
     476                                if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))
     477                                {
     478                                        enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2));
     479                                }
     480                        }
     481                }
     482
     483                // Store news and exclude ids
     484                if ($mode == 'feed' && $submit)
     485                {
     486                        $cache->destroy('_feed_news_forum_ids');
     487                        $cache->destroy('_feed_excluded_forum_ids');
     488
     489                        $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
     490                        $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
    421491                }
    422492
     
    795865
    796866        /**
     867        * Global quick reply enable/disable setting and button to enable in all forums
     868        */
     869        function quick_reply($value, $key)
     870        {
     871                global $user;
     872
     873                $radio_ary = array(1 => 'YES', 0 => 'NO');
     874
     875                return h_radio('config[allow_quick_reply]', $radio_ary, $value) .
     876                        '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />';
     877        }
     878
     879
     880        /**
    797881        * Select default dateformat
    798882        */
     
    831915                <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />";
    832916        }
     917
     918        /**
     919        * Select multiple forums
     920        */
     921        function select_news_forums($value, $key)
     922        {
     923                global $user, $config;
     924
     925                $forum_list = make_forum_select(false, false, true, true, true, false, true);
     926
     927                // Build forum options
     928                $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
     929                foreach ($forum_list as $f_id => $f_row)
     930                {
     931                        $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']);
     932
     933                        $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
     934                }
     935                $s_forum_options .= '</select>';
     936
     937                return $s_forum_options;
     938        }
     939
     940        function select_exclude_forums($value, $key)
     941        {
     942                global $user, $config;
     943
     944                $forum_list = make_forum_select(false, false, true, true, true, false, true);
     945
     946                // Build forum options
     947                $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
     948                foreach ($forum_list as $f_id => $f_row)
     949                {
     950                        $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']);
     951
     952                        $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
     953                }
     954                $s_forum_options .= '</select>';
     955
     956                return $s_forum_options;
     957        }
     958
     959        function store_feed_forums($option, $key)
     960        {
     961                global $db, $cache;
     962
     963                // Get key
     964                $values = request_var($key, array(0 => 0));
     965
     966                // Empty option bit for all forums
     967                $sql = 'UPDATE ' . FORUMS_TABLE . '
     968                        SET forum_options = forum_options - ' . (1 << $option) . '
     969                        WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0');
     970                $db->sql_query($sql);
     971
     972                // Already emptied for all...
     973                if (sizeof($values))
     974                {
     975                        // Set for selected forums
     976                        $sql = 'UPDATE ' . FORUMS_TABLE . '
     977                                SET forum_options = forum_options + ' . (1 << $option) . '
     978                                WHERE ' . $db->sql_in_set('forum_id', $values);
     979                        $db->sql_query($sql);
     980                }
     981
     982                // Empty sql cache for forums table because options changed
     983                $cache->destroy('sql', FORUMS_TABLE);
     984        }
     985
    833986}
    834987
  • trunk/forum/includes/acp/acp_captcha.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_captcha.php 8722 2008-07-29 15:13:13Z Kellanved $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    3030                $user->add_lang('acp/board');
    3131
     32                include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
     33                $captchas = phpbb_captcha_factory::get_captcha_types();
    3234
    33                 $captcha_vars = array(
    34                         'captcha_gd_x_grid'                             => 'CAPTCHA_GD_X_GRID',
    35                         'captcha_gd_y_grid'                             => 'CAPTCHA_GD_Y_GRID',
    36                         'captcha_gd_foreground_noise'   => 'CAPTCHA_GD_FOREGROUND_NOISE',
    37                         'captcha_gd'                                    => 'CAPTCHA_GD_PREVIEWED'
    38                 );
     35                $selected = request_var('select_captcha', $config['captcha_plugin']);
     36                $selected = (isset($captchas['available'][$selected]) || isset($captchas['unavailable'][$selected])) ? $selected : $config['captcha_plugin'];
     37                $configure = request_var('configure', false);
    3938
    40                 if (isset($_GET['demo']))
     39
     40                // Oh, they are just here for the view
     41                if (isset($_GET['captcha_demo']))
    4142                {
    42                         $captcha_vars = array_keys($captcha_vars);
    43                         foreach ($captcha_vars as $captcha_var)
     43                        $this->deliver_demo($selected);
     44                }
     45
     46                // Delegate
     47                if ($configure)
     48                {
     49                        $config_captcha =& phpbb_captcha_factory::get_instance($selected);
     50                        $config_captcha->acp_page($id, $this);
     51                }
     52                else
     53                {
     54                        $config_vars = array(
     55                                'enable_confirm'                => array('tpl' => 'REG_ENABLE', 'default' => false),
     56                                'enable_post_confirm'   => array('tpl' => 'POST_ENABLE', 'default' => false),
     57                                'confirm_refresh'               => array('tpl' => 'CONFIRM_REFRESH', 'default' => false),
     58                                'max_reg_attempts'              => array('tpl' => 'REG_LIMIT', 'default' => 0),
     59                                'max_login_attempts'            => array('tpl' => 'MAX_LOGIN_ATTEMPTS', 'default' => 0),
     60                        );
     61
     62                        $this->tpl_name = 'acp_captcha';
     63                        $this->page_title = 'ACP_VC_SETTINGS';
     64                        $form_key = 'acp_captcha';
     65                        add_form_key($form_key);
     66
     67                        $submit = request_var('main_submit', false);
     68
     69                        if ($submit && check_form_key($form_key))
    4470                        {
    45                                 $config[$captcha_var] = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
     71                                foreach ($config_vars as $config_var => $options)
     72                                {
     73                                        set_config($config_var, request_var($config_var, $options['default']));
     74                                }
     75
     76                                if ($selected !== $config['captcha_plugin'])
     77                                {
     78                                        // sanity check
     79                                        if (isset($captchas['available'][$selected]))
     80                                        {
     81                                                $old_captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
     82                                                $old_captcha->uninstall();
     83
     84                                                set_config('captcha_plugin', $selected);
     85                                                $new_captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
     86                                                $new_captcha->install();
     87
     88                                                add_log('admin', 'LOG_CONFIG_VISUAL');
     89                                        }
     90                                        else
     91                                        {
     92                                                trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action));
     93                                        }
     94                                }
     95                                trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
    4696                        }
    47                         if ($config['captcha_gd'])
     97                        else if ($submit)
    4898                        {
    49                                 include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
     99                                trigger_error($user->lang['FORM_INVALID'] . adm_back_link());
    50100                        }
    51101                        else
    52102                        {
    53                                 include($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
     103                                $captcha_select = '';
     104                                foreach ($captchas['available'] as $value => $title)
     105                                {
     106                                        $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
     107                                        $captcha_select .= '<option value="' . $value . '"' . $current . '>' . $user->lang[$title] . '</option>';
     108                                }
     109
     110                                foreach ($captchas['unavailable'] as $value => $title)
     111                                {
     112                                        $current = ($selected !== false && $value == $selected) ? ' selected="selected"' : '';
     113                                        $captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang[$title] . '</option>';
     114                                }
     115
     116                                $demo_captcha =& phpbb_captcha_factory::get_instance($selected);
     117
     118                                foreach ($config_vars as $config_var => $options)
     119                                {
     120                                        $template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? request_var($config_var, $options['default']) : $config[$config_var]) ;
     121                                }
     122
     123                                $template->assign_vars(array(
     124                                        'CAPTCHA_PREVIEW_TPL'   => $demo_captcha->get_demo_template($id),
     125                                        'S_CAPTCHA_HAS_CONFIG'  => $demo_captcha->has_config(),
     126                                        'CAPTCHA_SELECT'                => $captcha_select,
     127                                ));
    54128                        }
    55                         $captcha = new captcha();
    56                         $captcha->execute(gen_rand_string(mt_rand(5, 8)), time());
    57                         exit;
    58129                }
     130        }
    59131
    60                 $config_vars = array(
    61                         'enable_confirm'                => 'REG_ENABLE',
    62                         'enable_post_confirm'   => 'POST_ENABLE',
    63                         'captcha_gd'                    => 'CAPTCHA_GD',
    64                 );
     132        /**
     133        * Entry point for delivering image CAPTCHAs in the ACP.
     134        */
     135        function deliver_demo($selected)
     136        {
     137                global $db, $user, $config;
    65138
    66                 $this->tpl_name = 'acp_captcha';
    67                 $this->page_title = 'ACP_VC_SETTINGS';
    68                 $form_key = 'acp_captcha';
    69                 add_form_key($form_key);
     139                $captcha =& phpbb_captcha_factory::get_instance($selected);
     140                $captcha->init(CONFIRM_REG);
     141                $captcha->execute_demo();
    70142
    71                 $submit = request_var('submit', '');
    72 
    73                 if ($submit && check_form_key($form_key))
    74                 {
    75                         $config_vars = array_keys($config_vars);
    76                         foreach ($config_vars as $config_var)
    77                         {
    78                                 set_config($config_var, request_var($config_var, ''));
    79                         }
    80                         $captcha_vars = array_keys($captcha_vars);
    81                         foreach ($captcha_vars as $captcha_var)
    82                         {
    83                                 $value = request_var($captcha_var, 0);
    84                                 if ($value >= 0)
    85                                 {
    86                                         set_config($captcha_var, $value);
    87                                 }
    88                         }
    89                         trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
    90                 }
    91                 else if ($submit)
    92                 {
    93                                 trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action));
    94                 }
    95                 else
    96                 {
    97 
    98                         $preview_image_src = append_sid(append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&amp;demo=demo"));
    99                         if (@extension_loaded('gd'))
    100                         {
    101                                 $template->assign_var('GD', true);
    102                         }
    103                         foreach ($config_vars as $config_var => $template_var)
    104                         {
    105                                 $template->assign_var($template_var, (isset($_REQUEST[$config_var])) ? request_var($config_var, '') : $config[$config_var]) ;
    106                         }
    107                         foreach ($captcha_vars as $captcha_var => $template_var)
    108                         {
    109                                 $var = (isset($_REQUEST[$captcha_var])) ? request_var($captcha_var, 0) : $config[$captcha_var];
    110                                 $template->assign_var($template_var, $var);
    111                                 $preview_image_src .= "&amp;$captcha_var=" . $var;
    112                         }
    113                         $template->assign_vars(array(
    114                                 'CAPTCHA_PREVIEW'       => $preview_image_src,
    115                                 'PREVIEW'                       => isset($_POST['preview']),
    116                         ));
    117 
    118                 }
     143                garbage_collection();
     144                exit_handler();
    119145        }
    120146}
  • trunk/forum/includes/acp/acp_database.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_database.php 8814 2008-09-04 12:01:47Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    2828                global $cache, $db, $user, $auth, $template, $table_prefix;
    2929                global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
    30                
     30
    3131                $user->add_lang('acp/database');
    3232
     
    8383
    8484                                                @set_time_limit(1200);
     85                                                @set_time_limit(0);
    8586
    8687                                                $time = time();
     
    142143
    143144                                                                        case 'oracle':
    144                                                                                 $extractor->flush('TRUNCATE TABLE ' . $table_name . "\\\n");
     145                                                                                $extractor->flush('TRUNCATE TABLE ' . $table_name . "/\n");
    145146                                                                        break;
    146147
     
    188189                                                        'U_ACTION'      => $this->u_action . '&amp;action=download'
    189190                                                ));
    190                                                
     191
    191192                                                $available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2');
    192193
     
    425426                                                $dh = @opendir($dir);
    426427
     428                                                $backup_files = array();
     429
    427430                                                if ($dh)
    428431                                                {
     
    431434                                                                if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))
    432435                                                                {
    433                                                                         $supported = in_array($matches[2], $methods);
    434 
    435                                                                         if ($supported == 'true')
     436                                                                        if (in_array($matches[2], $methods))
    436437                                                                        {
    437                                                                                 $template->assign_block_vars('files', array(
    438                                                                                         'FILE'          => $file,
    439                                                                                         'NAME'          => gmdate("d-m-Y H:i:s", $matches[1]),
    440                                                                                         'SUPPORTED'     => $supported
    441                                                                                 ));
     438                                                                                $backup_files[gmdate("d-m-Y H:i:s", $matches[1])] = $file;
    442439                                                                        }
    443440                                                                }
    444441                                                        }
    445442                                                        closedir($dh);
     443                                                }
     444
     445                                                if (!empty($backup_files))
     446                                                {
     447                                                        krsort($backup_files);
     448
     449                                                        foreach ($backup_files as $name => $file)
     450                                                        {
     451                                                                $template->assign_block_vars('files', array(
     452                                                                        'FILE'          => $file,
     453                                                                        'NAME'          => $name,
     454                                                                        'SUPPORTED'     => true,
     455                                                                ));
     456                                                        }
    446457                                                }
    447458
     
    509520                        header("Content-Type: $mimetype; name=\"$name\"");
    510521                        header("Content-disposition: attachment; filename=$name");
    511        
     522
    512523                        switch ($format)
    513524                        {
     
    528539                        }
    529540                }
    530                
     541
    531542                if ($store == true)
    532543                {
    533544                        global $phpbb_root_path;
    534545                        $file = $phpbb_root_path . 'store/' . $filename . $ext;
    535        
     546
    536547                        $this->fp = $open($file, 'w');
    537        
     548
    538549                        if (!$this->fp)
    539550                        {
    540                                 trigger_error('Unable to write temporary file to storage folder', E_USER_ERROR);
     551                                trigger_error('FILE_WRITE_FAIL', E_USER_ERROR);
    541552                        }
    542553                }
     
    546557        {
    547558                static $close;
     559
    548560                if ($this->store)
    549561                {
     
    663675                {
    664676                        $fields_cnt = mysqli_num_fields($result);
    665                
     677
    666678                        // Get field information
    667679                        $field = mysqli_fetch_fields($result);
    668680                        $field_set = array();
    669                
     681
    670682                        for ($j = 0; $j < $fields_cnt; $j++)
    671683                        {
     
    680692                        $query_len              = 0;
    681693                        $max_len                = get_usable_memory();
    682                
     694
    683695                        while ($row = mysqli_fetch_row($result))
    684696                        {
     
    751763                        }
    752764                        $field_set = array();
    753                        
     765
    754766                        for ($j = 0; $j < $fields_cnt; $j++)
    755767                        {
     
    967979                }
    968980                $db->sql_freeresult($result);
    969                
     981
    970982                foreach ($ar as $value)
    971983                {
     
    11251137                }
    11261138                $db->sql_freeresult($result);
    1127        
     1139
    11281140                $field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull
    11291141                        FROM pg_class c, pg_attribute a, pg_type t
     
    11461158                                        AND d.adnum = " . $row['attnum'];
    11471159                        $def_res = $db->sql_query($sql_get_default);
    1148 
    1149                         if (!$def_res)
     1160                        $def_row = $db->sql_fetchrow($def_res);
     1161                        $db->sql_freeresult($def_res);
     1162
     1163                        if (empty($def_row))
    11501164                        {
    11511165                                unset($row['rowdefault']);
     
    11531167                        else
    11541168                        {
    1155                                 $row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res);
    1156                         }
    1157                         $db->sql_freeresult($def_res);
     1169                                $row['rowdefault'] = $def_row['rowdefault'];
     1170                        }
    11581171
    11591172                        if ($row['type'] == 'bpchar')
     
    11891202                                $line .= ' NOT NULL';
    11901203                        }
    1191                        
     1204
    11921205                        $lines[] = $line;
    11931206                }
     
    13891402                $sql_data .= "\nCREATE TABLE [$table_name] (\n";
    13901403                $rows = array();
    1391        
     1404
    13921405                $text_flag = false;
    1393        
     1406
    13941407                $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY
    13951408                        FROM INFORMATION_SCHEMA.COLUMNS
    13961409                        WHERE TABLE_NAME = '$table_name'";
    13971410                $result = $db->sql_query($sql);
    1398        
     1411
    13991412                while ($row = $db->sql_fetchrow($result))
    14001413                {
    14011414                        $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]";
    1402        
     1415
    14031416                        if ($row['DATA_TYPE'] == 'text')
    14041417                        {
    14051418                                $text_flag = true;
    14061419                        }
    1407        
     1420
    14081421                        if ($row['IS_IDENTITY'])
    14091422                        {
    14101423                                $line .= ' IDENTITY (1 , 1)';
    14111424                        }
    1412        
     1425
    14131426                        if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text')
    14141427                        {
    14151428                                $line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')';
    14161429                        }
    1417        
     1430
    14181431                        if ($row['IS_NULLABLE'] == 'YES')
    14191432                        {
     
    14241437                                $line .= ' NOT NULL';
    14251438                        }
    1426        
     1439
    14271440                        if ($row['COLUMN_DEFAULT'])
    14281441                        {
    14291442                                $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT'];
    14301443                        }
    1431        
     1444
    14321445                        $rows[] = $line;
    14331446                }
    14341447                $db->sql_freeresult($result);
    1435        
     1448
    14361449                $sql_data .= implode(",\n", $rows);
    14371450                $sql_data .= "\n) ON [PRIMARY]";
    1438        
     1451
    14391452                if ($text_flag)
    14401453                {
    14411454                        $sql_data .= " TEXTIMAGE_ON [PRIMARY]";
    14421455                }
    1443        
     1456
    14441457                $sql_data .= "\nGO\n\n";
    14451458                $rows = array();
    1446        
     1459
    14471460                $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME
    14481461                        FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
     
    14641477                }
    14651478                $db->sql_freeresult($result);
    1466        
     1479
    14671480                $index = array();
    14681481                $sql = "EXEC sp_statistics '$table_name'";
     
    14761489                }
    14771490                $db->sql_freeresult($result);
    1478        
     1491
    14791492                foreach ($index as $index_name => $column_name)
    14801493                {
    14811494                        $index[$index_name] = implode(', ', $column_name);
    14821495                }
    1483        
     1496
    14841497                foreach ($index as $index_name => $columns)
    14851498                {
     
    15091522                $ident_set = false;
    15101523                $sql_data = '';
    1511                
     1524
    15121525                // Grab all of the data from current table.
    15131526                $sql = "SELECT *
     
    16031616                $ident_set = false;
    16041617                $sql_data = '';
    1605                
     1618
    16061619                // Grab all of the data from current table.
    16071620                $sql = "SELECT *
     
    17041717                global $db;
    17051718                $sql_data = '-- Table: ' . $table_name . "\n";
    1706                 $sql_data .= "DROP TABLE $table_name;\n";
    1707                 $sql_data .= '\\' . "\n";
     1719                $sql_data .= "DROP TABLE $table_name\n/\n";
    17081720                $sql_data .= "\nCREATE TABLE $table_name (\n";
    17091721
     
    17201732                        if ($row['data_type'] !== 'CLOB')
    17211733                        {
    1722                                 if ($row['data_type'] !== 'VARCHAR2')
     1734                                if ($row['data_type'] !== 'VARCHAR2' && $row['data_type'] !== 'CHAR')
    17231735                                {
    17241736                                        $line .= '(' . $row['data_precision'] . ')';
     
    17501762                $result = $db->sql_query($sql);
    17511763
    1752                 while ($row = $db->sql_fetchrow($result))
    1753                 {
    1754                         $rows[] = "  CONSTRAINT {$row['constraint_name']} PRIMARY KEY ({$row['column_name']})";
    1755                 }
    1756                 $db->sql_freeresult($result);
     1764                $primary_key = array();
     1765                $contraint_name = '';
     1766                while ($row = $db->sql_fetchrow($result))
     1767                {
     1768                        $constraint_name = '"' . $row['constraint_name'] . '"';
     1769                        $primary_key[] = '"' . $row['column_name'] . '"';
     1770                }
     1771                $db->sql_freeresult($result);
     1772
     1773                if (sizeof($primary_key))
     1774                {
     1775                        $rows[] = "  CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')';
     1776                }
    17571777
    17581778                $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME
     
    17631783                $result = $db->sql_query($sql);
    17641784
    1765                 while ($row = $db->sql_fetchrow($result))
    1766                 {
    1767                         $rows[] = "  CONSTRAINT {$row['constraint_name']} UNIQUE ({$row['column_name']})";
    1768                 }
    1769                 $db->sql_freeresult($result);
     1785                $unique = array();
     1786                $contraint_name = '';
     1787                while ($row = $db->sql_fetchrow($result))
     1788                {
     1789                        $constraint_name = '"' . $row['constraint_name'] . '"';
     1790                        $unique[] = '"' . $row['column_name'] . '"';
     1791                }
     1792                $db->sql_freeresult($result);
     1793
     1794                if (sizeof($unique))
     1795                {
     1796                        $rows[] = "  CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')';
     1797                }
    17701798
    17711799                $sql_data .= implode(",\n", $rows);
    1772                 $sql_data .= "\n)\n\\";
    1773 
    1774                 $sql = "SELECT A.REFERENCED_NAME
    1775                         FROM USER_DEPENDENCIES A, USER_TRIGGERS B
     1800                $sql_data .= "\n)\n/\n";
     1801
     1802                $sql = "SELECT A.REFERENCED_NAME, C.*
     1803                        FROM USER_DEPENDENCIES A, USER_TRIGGERS B, USER_SEQUENCES C
    17761804                        WHERE A.REFERENCED_TYPE = 'SEQUENCE'
    17771805                                AND A.NAME = B.TRIGGER_NAME
    1778                                 AND B. TABLE_NAME = '{$table_name}'";
     1806                                AND B.TABLE_NAME = '{$table_name}'
     1807                                AND C.SEQUENCE_NAME = A.REFERENCED_NAME";
    17791808                $result = $db->sql_query($sql);
    1780                 while ($row = $db->sql_fetchrow($result))
    1781                 {
    1782                         $sql_data .= "\nCREATE SEQUENCE {$row['referenced_name']}\\\n";
     1809
     1810                $type = request_var('type', '');
     1811
     1812                while ($row = $db->sql_fetchrow($result))
     1813                {
     1814                        $sql_data .= "\nDROP SEQUENCE \"{$row['referenced_name']}\"\n/\n";
     1815                        $sql_data .= "\nCREATE SEQUENCE \"{$row['referenced_name']}\"";
     1816
     1817                        if ($type == 'full')
     1818                        {
     1819                                $sql_data .= ' START WITH ' . $row['last_number'];
     1820                        }
     1821
     1822                        $sql_data .= "\n/\n";
    17831823                }
    17841824                $db->sql_freeresult($result);
     
    17901830                while ($row = $db->sql_fetchrow($result))
    17911831                {
    1792                         $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\\";
     1832                        $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\n/\n";
    17931833                }
    17941834                $db->sql_freeresult($result);
     
    18101850                foreach ($index as $index_name => $column_names)
    18111851                {
    1812                         $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n\\";
     1852                        $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n/\n";
    18131853                }
    18141854                $db->sql_freeresult($result);
     
    18201860                global $db;
    18211861                $ary_type = $ary_name = array();
    1822                
     1862
    18231863                // Grab all of the data from current table.
    18241864                $sql = "SELECT *
     
    18431883                        for ($i = 0; $i < $i_num_fields; $i++)
    18441884                        {
    1845                                 $str_val = $row[$ary_name[$i]];
    1846 
    1847                                 if (preg_match('#char|text|bool|raw#i', $ary_type[$i]))
     1885                                // Oracle uses uppercase - we use lowercase
     1886                                $str_val = $row[strtolower($ary_name[$i])];
     1887
     1888                                if (preg_match('#char|text|bool|raw|clob#i', $ary_type[$i]))
    18481889                                {
    18491890                                        $str_quote = '';
     
    18741915
    18751916                                $schema_vals[$i] = $str_quote . $str_val . $str_quote;
    1876                                 $schema_fields[$i] = '"' . $ary_name[$i] . "'";
     1917                                $schema_fields[$i] = '"' . $ary_name[$i] . '"';
    18771918                        }
    18781919
    18791920                        // Take the ordered fields and their associated data and build it
    18801921                        // into a valid sql statement to recreate that field in the data.
    1881                         $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
     1922                        $sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ")\n/\n";
    18821923
    18831924                        $this->flush($sql_data);
     
    19161957                global $db;
    19171958                $ary_type = $ary_name = array();
    1918                
     1959
    19191960                // Grab all of the data from current table.
    19201961                $sql = "SELECT *
     
    21982239function sanitize_data_oracle($text)
    21992240{
    2200         $data = preg_split('/[\0\n\t\r\b\f\'"\\\]/', $text);
    2201         preg_match_all('/[\0\n\t\r\b\f\'"\\\]/', $text, $matches);
     2241//      $data = preg_split('/[\0\n\t\r\b\f\'"\/\\\]/', $text);
     2242//      preg_match_all('/[\0\n\t\r\b\f\'"\/\\\]/', $text, $matches);
     2243        $data = preg_split('/[\0\b\f\'\/]/', $text);
     2244        preg_match_all('/[\0\r\b\f\'\/]/', $text, $matches);
    22022245
    22032246        $val = array();
     
    22452288        $record = '';
    22462289        $delim_len = strlen($delim);
    2247        
     2290
    22482291        while (!$eof($fp))
    22492292        {
  • trunk/forum/includes/acp/acp_email.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_email.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    109109                                        trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING);
    110110                                }
    111        
     111
    112112                                $i = $j = 0;
    113113
     
    122122                                        if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) ||
    123123                                                ($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) ||
    124                                                 ($row['user_notify_type'] == NOTIFY_BOTH && $row['user_email'] && $row['user_jabber']))
     124                                                ($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])))
    125125                                        {
    126126                                                if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
     
    174174                                        $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
    175175                                        $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
    176                        
     176
    177177                                        $messenger->subject(htmlspecialchars_decode($subject));
    178178                                        $messenger->set_mail_priority($priority);
     
    182182                                                'MESSAGE'               => htmlspecialchars_decode($message))
    183183                                        );
    184        
     184
    185185                                        if (!($messenger->send($used_method)))
    186186                                        {
     
    240240                $select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>';
    241241                $select_list .= group_select_options($group_id, $exclude);
    242                
     242
    243243                $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>';
    244244                $s_priority_options .= '<option value="' . MAIL_NORMAL_PRIORITY . '" selected="selected">' . $user->lang['MAIL_NORMAL_PRIORITY'] . '</option>';
  • trunk/forum/includes/acp/acp_forums.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_forums.php 8898 2008-09-19 17:07:13Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    140140                                                'enable_prune'                  => request_var('enable_prune', false),
    141141                                                'enable_post_review'    => request_var('enable_post_review', true),
     142                                                'enable_quick_reply'    => request_var('enable_quick_reply', false),
    142143                                                'prune_days'                    => request_var('prune_days', 7),
    143144                                                'prune_viewed'                  => request_var('prune_viewed', 7),
     
    151152                                        );
    152153
     154                                        // On add, add empty forum_options... else do not consider it (not updating it)
     155                                        if ($action == 'add')
     156                                        {
     157                                                $forum_data['forum_options'] = 0;
     158                                        }
     159
    153160                                        // Use link_display_on_index setting if forum type is link
    154161                                        if ($forum_data['forum_type'] == FORUM_LINK)
     
    163170                                        }
    164171
    165                                         $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', false) : request_var('display_active', false);
     172                                        $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', true) : request_var('display_active', true);
    166173
    167174                                        // Get data for forum rules if specified...
     
    182189                                        {
    183190                                                $forum_perm_from = request_var('forum_perm_from', 0);
     191                                                $cache->destroy('sql', FORUMS_TABLE);
    184192
    185193                                                // Copy permissions?
    186                                                 if ($forum_perm_from && !empty($forum_perm_from) && $forum_perm_from != $forum_data['forum_id'] &&
    187                                                         (($action != 'edit') || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
     194                                                if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] &&
     195                                                        ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))))
    188196                                                {
    189                                                         // if we edit a forum delete current permissions first
    190                                                         if ($action == 'edit')
    191                                                         {
    192                                                                 $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
    193                                                                         WHERE forum_id = ' . (int) $forum_data['forum_id'];
    194                                                                 $db->sql_query($sql);
    195 
    196                                                                 $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
    197                                                                         WHERE forum_id = ' . (int) $forum_data['forum_id'];
    198                                                                 $db->sql_query($sql);
    199                                                         }
    200 
    201                                                         // From the mysql documentation:
    202                                                         // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
    203                                                         // Due to this we stay on the safe side if we do the insertion "the manual way"
    204 
    205                                                         // Copy permisisons from/to the acl users table (only forum_id gets changed)
    206                                                         $sql = 'SELECT user_id, auth_option_id, auth_role_id, auth_setting
    207                                                                 FROM ' . ACL_USERS_TABLE . '
    208                                                                 WHERE forum_id = ' . $forum_perm_from;
    209                                                         $result = $db->sql_query($sql);
    210 
    211                                                         $users_sql_ary = array();
    212                                                         while ($row = $db->sql_fetchrow($result))
    213                                                         {
    214                                                                 $users_sql_ary[] = array(
    215                                                                         'user_id'                       => (int) $row['user_id'],
    216                                                                         'forum_id'                      => (int) $forum_data['forum_id'],
    217                                                                         'auth_option_id'        => (int) $row['auth_option_id'],
    218                                                                         'auth_role_id'          => (int) $row['auth_role_id'],
    219                                                                         'auth_setting'          => (int) $row['auth_setting']
    220                                                                 );
    221                                                         }
    222                                                         $db->sql_freeresult($result);
    223 
    224                                                         // Copy permisisons from/to the acl groups table (only forum_id gets changed)
    225                                                         $sql = 'SELECT group_id, auth_option_id, auth_role_id, auth_setting
    226                                                                 FROM ' . ACL_GROUPS_TABLE . '
    227                                                                 WHERE forum_id = ' . $forum_perm_from;
    228                                                         $result = $db->sql_query($sql);
    229 
    230                                                         $groups_sql_ary = array();
    231                                                         while ($row = $db->sql_fetchrow($result))
    232                                                         {
    233                                                                 $groups_sql_ary[] = array(
    234                                                                         'group_id'                      => (int) $row['group_id'],
    235                                                                         'forum_id'                      => (int) $forum_data['forum_id'],
    236                                                                         'auth_option_id'        => (int) $row['auth_option_id'],
    237                                                                         'auth_role_id'          => (int) $row['auth_role_id'],
    238                                                                         'auth_setting'          => (int) $row['auth_setting']
    239                                                                 );
    240                                                         }
    241                                                         $db->sql_freeresult($result);
    242 
    243                                                         // Now insert the data
    244                                                         $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary);
    245                                                         $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary);
     197                                                        copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false);
    246198                                                        cache_moderators();
    247199                                                }
    248 
     200/* Commented out because of questionable UI workflow - re-visit for 3.0.7
     201                                                else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))
     202                                                {
     203                                                        $this->copy_permission_page($forum_data);
     204                                                        return;
     205                                                }
     206*/
    249207                                                $auth->acl_clear_prefetch();
    250                                                 $cache->destroy('sql', FORUMS_TABLE);
    251208
    252209                                                $acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_data['forum_id'];
     
    424381                                        $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
    425382                                        $forum_data['forum_flags'] += (request_var('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0;
     383                                        $forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0;
    426384                                }
    427385
     
    485443                                                        'prune_viewed'                  => 7,
    486444                                                        'prune_freq'                    => 1,
    487                                                         'forum_flags'                   => FORUM_FLAG_POST_REVIEW,
     445                                                        'forum_flags'                   => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS,
     446                                                        'forum_options'                 => 0,
    488447                                                        'forum_password'                => '',
    489448                                                        'forum_password_confirm'=> '',
     
    561520                                        WHERE forum_type = ' . FORUM_POST . "
    562521                                                AND forum_id <> $forum_id";
    563                                 $result = $db->sql_query($sql);
    564 
     522                                $result = $db->sql_query_limit($sql, 1);
     523
     524                                $postable_forum_exists = false;
    565525                                if ($db->sql_fetchrow($result))
    566526                                {
    567                                         $template->assign_vars(array(
    568                                                 'S_MOVE_FORUM_OPTIONS'          => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
    569                                         );
     527                                        $postable_forum_exists = true;
    570528                                }
    571529                                $db->sql_freeresult($result);
     
    584542                                        $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
    585543
    586                                         $sql = 'SELECT forum_id
    587                                                 FROM ' . FORUMS_TABLE . '
    588                                                 WHERE forum_type = ' . FORUM_POST . "
    589                                                         AND forum_id <> $forum_id";
    590                                         $result = $db->sql_query($sql);
    591 
    592                                         if ($db->sql_fetchrow($result))
     544                                        if ($postable_forum_exists)
    593545                                        {
    594546                                                $template->assign_vars(array(
     
    596548                                                );
    597549                                        }
    598                                         $db->sql_freeresult($result);
    599550
    600551                                        $template->assign_vars(array(
    601552                                                'S_HAS_SUBFORUMS'               => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
    602553                                                'S_FORUMS_LIST'                 => $forums_list)
     554                                        );
     555                                }
     556                                else if ($postable_forum_exists)
     557                                {
     558                                        $template->assign_vars(array(
     559                                                'S_MOVE_FORUM_OPTIONS'          => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false))
    603560                                        );
    604561                                }
     
    685642                                        'S_DISPLAY_ACTIVE_TOPICS'       => ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) ? true : false,
    686643                                        'S_ENABLE_POST_REVIEW'          => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false,
     644                                        'S_ENABLE_QUICK_REPLY'          => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false,
    687645                                        'S_CAN_COPY_PERMISSIONS'        => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false,
    688646                                ));
     
    715673                                        WHERE forum_type = ' . FORUM_POST . "
    716674                                                AND forum_id <> $forum_id";
    717                                 $result = $db->sql_query($sql);
     675                                $result = $db->sql_query_limit($sql, 1);
    718676
    719677                                if ($db->sql_fetchrow($result))
     
    743701                                return;
    744702                        break;
     703
     704                        case 'copy_perm':
     705                                $forum_perm_from = request_var('forum_perm_from', 0);
     706
     707                                // Copy permissions?
     708                                if (!empty($forum_perm_from) && $forum_perm_from != $forum_id)
     709                                {
     710                                        copy_forum_permissions($forum_perm_from, $forum_id, true);
     711                                        cache_moderators();
     712                                        $auth->acl_clear_prefetch();
     713                                        $cache->destroy('sql', FORUMS_TABLE);
     714
     715                                        $acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_id;
     716
     717                                        $message = $user->lang['FORUM_UPDATED'];
     718
     719                                        // Redirect to permissions
     720                                        if ($auth->acl_get('a_fauth'))
     721                                        {
     722                                                $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
     723                                        }
     724
     725                                        trigger_error($message . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
     726                                }
     727
     728                        break;
    745729                }
    746730
     
    807791
    808792                                $url = $this->u_action . "&amp;parent_id=$this->parent_id&amp;f={$row['forum_id']}";
    809 
    810                                 $forum_title = ($forum_type != FORUM_LINK) ? '<a href="' . $this->u_action . '&amp;parent_id=' . $row['forum_id'] . '">' : '';
    811                                 $forum_title .= $row['forum_name'];
    812                                 $forum_title .= ($forum_type != FORUM_LINK) ? '</a>' : '';
    813793
    814794                                $template->assign_block_vars('forums', array(
     
    889869        function update_forum_data(&$forum_data)
    890870        {
    891                 global $db, $user, $cache;
     871                global $db, $user, $cache, $phpbb_root_path;
    892872
    893873                $errors = array();
     
    926906                        array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'),
    927907                );
     908
     909                if (!empty($forum_data['forum_image']) && !file_exists($phpbb_root_path . $forum_data['forum_image']))
     910                {
     911                        $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST'];
     912                }
    928913
    929914                validate_range($range_test_ary, $errors);
     
    943928                $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
    944929                $forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0;
     930                $forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0;
    945931
    946932                // Unset data that are not database fields
     
    953939                unset($forum_data_sql['show_active']);
    954940                unset($forum_data_sql['enable_post_review']);
     941                unset($forum_data_sql['enable_quick_reply']);
    955942                unset($forum_data_sql['forum_password_confirm']);
    956943
     
    19291916                adm_page_footer();
    19301917        }
     1918
     1919        /**
     1920        * Display copy permission page
     1921        * Not used at the moment - we will have a look at it for 3.0.7
     1922        */
     1923        function copy_permission_page($forum_data)
     1924        {
     1925                global $phpEx, $phpbb_admin_path, $template, $user;
     1926
     1927                $acl_url = '&amp;mode=setting_forum_local&amp;forum_id[]=' . $forum_data['forum_id'];
     1928                $action = append_sid($this->u_action . "&amp;parent_id={$this->parent_id}&amp;f={$forum_data['forum_id']}&amp;action=copy_perm");
     1929
     1930                $l_acl = sprintf($user->lang['COPY_TO_ACL'], '<a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url) . '">', '</a>');
     1931
     1932                $this->tpl_name = 'acp_forums_copy_perm';
     1933
     1934                $template->assign_vars(array(
     1935                        'U_ACL'                         => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url),
     1936                        'L_ACL_LINK'            => $l_acl,
     1937                        'L_BACK_LINK'           => adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id),
     1938                        'S_COPY_ACTION'         => $action,
     1939                        'S_FORUM_OPTIONS'       => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false),
     1940                ));
     1941        }
     1942
    19311943}
    19321944
  • trunk/forum/includes/acp/acp_groups.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_groups.php 9053 2008-11-09 15:10:40Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    310310                                                'max_recipients'        => request_var('group_max_recipients', 0),
    311311                                                'founder_manage'        => 0,
     312                                                'skip_auth'                     => request_var('group_skip_auth', 0),
    312313                                        );
    313314
     
    401402
    402403                                                $group_attributes = array();
    403                                                 $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients', 'founder_manage');
    404                                                 foreach ($test_variables as $test)
     404                                                $test_variables = array(
     405                                                        'rank'                  => 'int',
     406                                                        'colour'                => 'string',
     407                                                        'avatar'                => 'string',
     408                                                        'avatar_type'   => 'int',
     409                                                        'avatar_width'  => 'int',
     410                                                        'avatar_height' => 'int',
     411                                                        'receive_pm'    => 'int',
     412                                                        'legend'                => 'int',
     413                                                        'message_limit' => 'int',
     414                                                        'max_recipients'=> 'int',
     415                                                        'founder_manage'=> 'int',
     416                                                        'skip_auth'             => 'int',
     417                                                );
     418
     419                                                foreach ($test_variables as $test => $type)
    405420                                                {
    406421                                                        if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test]))
    407422                                                        {
     423                                                                settype($submit_ary[$test], $type);
    408424                                                                $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
    409425                                                        }
     
    563579                                        'GROUP_MAX_RECIPIENTS'  => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0,
    564580                                        'GROUP_COLOUR'                  => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '',
    565 
     581                                        'GROUP_SKIP_AUTH'               => (!empty($group_row['group_skip_auth'])) ? ' checked="checked"' : '',
    566582
    567583                                        'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'],
     
    592608                                        'U_ACTION'                      => "{$this->u_action}&amp;action=$action&amp;g=$group_id",
    593609                                        'L_AVATAR_EXPLAIN'      => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),
    594                                         )
    595                                 );
     610                                ));
    596611
    597612                                return;
     
    608623
    609624                                // Grab the leaders - always, on every page...
    610                                 $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
     625                                $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
    611626                                        FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
    612627                                        WHERE ug.group_id = $group_id
     
    622637
    623638                                                'USERNAME'                      => $row['username'],
     639                                                'USERNAME_COLOUR'       => $row['user_colour'],
    624640                                                'S_GROUP_DEFAULT'       => ($row['group_id'] == $group_id) ? true : false,
    625641                                                'JOINED'                        => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
    626642                                                'USER_POSTS'            => $row['user_posts'],
    627                                                 'USER_ID'                       => $row['user_id'])
    628                                         );
     643                                                'USER_ID'                       => $row['user_id'],
     644                                        ));
    629645                                }
    630646                                $db->sql_freeresult($result);
     
    663679
    664680                                // Grab the members
    665                                 $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
     681                                $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending
    666682                                        FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug
    667683                                        WHERE ug.group_id = $group_id
     
    688704
    689705                                                'USERNAME'                      => $row['username'],
     706                                                'USERNAME_COLOUR'       => $row['user_colour'],
    690707                                                'S_GROUP_DEFAULT'       => ($row['group_id'] == $group_id) ? true : false,
    691708                                                'JOINED'                        => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ',
     
    764781                                        'GROUP_NAME'    => $group_name,
    765782                                        'TOTAL_MEMBERS' => $row['total_members'],
    766                                         )
    767                                 );
     783                                ));
    768784                        }
    769785                }
  • trunk/forum/includes/acp/acp_icons.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_icons.php 8974 2008-10-06 13:23:41Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    9090                                        }
    9191
     92                                        // adjust the width and height to be lower than 128px while perserving the aspect ratio (for icons)
     93                                        if ($mode == 'icons')
     94                                        {
     95                                                if ($img_size[0] > 127 && $img_size[0] > $img_size[1])
     96                                                {
     97                                                        $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0]));
     98                                                        $img_size[0] = 127;
     99                                                }
     100                                                else if ($img_size[1] > 127)
     101                                                {
     102                                                        $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1]));
     103                                                        $img_size[1] = 127;
     104                                                }
     105                                        }
     106
    92107                                        $_images[$path . $img]['file'] = $path . $img;
    93108                                        $_images[$path . $img]['width'] = $img_size[0];
     
    169184                                        }
    170185                                }
    171                                
     186
    172187                                $sql = "SELECT *
    173188                                        FROM $table
    174189                                        ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC');
    175190                                $result = $db->sql_query($sql);
    176                                
     191
    177192                                $data = array();
    178193                                $after = false;
     
    181196                                $add_order_lists = array('', '');
    182197                                $display_count = 0;
    183                                
     198
    184199                                while ($row = $db->sql_fetchrow($result))
    185200                                {
     
    232247                                }
    233248
    234                                 $colspan = (($mode == 'smilies') ? '7' : '5');
     249                                $colspan = (($mode == 'smilies') ? 7 : 5);
    235250                                $colspan += ($icon_id) ? 1 : 0;
    236251                                $colspan += ($action == 'add') ? 2 : 0;
    237                                
     252
    238253                                $template->assign_vars(array(
    239254                                        'S_EDIT'                => true,
    240255                                        'S_SMILIES'             => ($mode == 'smilies') ? true : false,
    241256                                        'S_ADD'                 => ($action == 'add') ? true : false,
    242                                        
     257
    243258                                        'S_ORDER_LIST_DISPLAY'          => $order_list . $order_lists[1],
    244259                                        'S_ORDER_LIST_UNDISPLAY'        => $order_list . $order_lists[0],
     
    287302
    288303                                                'S_IMG_OPTIONS'         => $smiley_options,
    289                                                
     304
    290305                                                'S_ADD_ORDER_LIST_DISPLAY'              => $add_order_list . $add_order_lists[1],
    291306                                                'S_ADD_ORDER_LIST_UNDISPLAY'    => $add_order_list . $add_order_lists[0],
    292                                                
     307
    293308                                                'IMG_SRC'                       => $phpbb_root_path . $img_path . '/' . $default_row['smiley_url'],
    294309                                                'IMG_PATH'                      => $img_path,
     
    304319
    305320                                return;
    306        
     321
    307322                        break;
    308323
     
    312327                                // Get items to create/modify
    313328                                $images = (isset($_POST['image'])) ? array_keys(request_var('image', array('' => 0))) : array();
    314                                
     329
    315330                                // Now really get the items
    316331                                $image_id               = (isset($_POST['id'])) ? request_var('id', array('' => 0)) : array();
     
    349364                                }
    350365
     366                                if ($mode == 'smilies' && $action == 'create')
     367                                {
     368                                        $smiley_count = $this->item_count($table);
     369
     370                                        $addable_smileys_count = sizeof($images);
     371                                        foreach ($images as $image)
     372                                        {
     373                                                if (!isset($image_add[$image]))
     374                                                {
     375                                                        --$addable_smileys_count;
     376                                                }
     377                                        }
     378
     379                                        if ($smiley_count + $addable_smileys_count > SMILEY_LIMIT)
     380                                        {
     381                                                trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING);
     382                                        }
     383                                }
     384
    351385                                $icons_updated = 0;
    352386                                $errors = array();
     
    368402                                                        $image_width[$image] = $img_size[0];
    369403                                                        $image_height[$image] = $img_size[1];
     404                                                }
     405
     406                                                // Adjust image width/height for icons
     407                                                if ($mode == 'icons')
     408                                                {
     409                                                        if ($image_width[$image] > 127 && $image_width[$image] > $image_height[$image])
     410                                                        {
     411                                                                $image_height[$image] = (int) ($image_height[$image] * (127 / $image_width[$image]));
     412                                                                $image_width[$image] = 127;
     413                                                        }
     414                                                        else if ($image_height[$image] > 127)
     415                                                        {
     416                                                                $image_width[$image] = (int) ($image_width[$image] * (127 / $image_height[$image]));
     417                                                                $image_height[$image] = 127;
     418                                                        }
    370419                                                }
    371420
     
    427476                                                        $icons_updated++;
    428477                                                }
    429                                                
     478
    430479                                        }
    431480                                }
    432                                
     481
    433482                                $cache->destroy('_icons');
    434483                                $cache->destroy('sql', $table);
    435                                
     484
    436485                                $level = E_USER_NOTICE;
    437486                                switch ($icons_updated)
     
    441490                                                $level = E_USER_WARNING;
    442491                                                break;
    443                                                
     492
    444493                                        case 1:
    445494                                                $suc_lang = "{$lang}_ONE";
    446495                                                break;
    447                                                
     496
    448497                                        default:
    449498                                                $suc_lang = $lang;
     
    496545                                        }
    497546
    498 
    499547                                        // The user has already selected a smilies_pak file
    500548                                        if ($current == 'delete')
     
    540588                                                }
    541589                                                $db->sql_freeresult($result);
     590                                        }
     591
     592                                        if ($mode == 'smilies')
     593                                        {
     594                                                $smiley_count = $this->item_count($table);
     595                                                if ($smiley_count + sizeof($pak_ary) > SMILEY_LIMIT)
     596                                                {
     597                                                        trigger_error(sprintf($user->lang['TOO_MANY_SMILIES'], SMILEY_LIMIT) . adm_back_link($this->u_action), E_USER_WARNING);
     598                                                }
    542599                                        }
    543600
     
    836893
    837894                $spacer = false;
     895                $pagination_start = request_var('start', 0);
     896
     897                $item_count = $this->item_count($table);
    838898
    839899                $sql = "SELECT *
    840900                        FROM $table
    841901                        ORDER BY {$fields}_order ASC";
    842                 $result = $db->sql_query($sql);
     902                $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $pagination_start);
    843903
    844904                while ($row = $db->sql_fetchrow($result))
     
    856916                                'U_EDIT'                => $this->u_action . '&amp;action=edit&amp;id=' . $row[$fields . '_id'],
    857917                                'U_DELETE'              => $this->u_action . '&amp;action=delete&amp;id=' . $row[$fields . '_id'],
    858                                 'U_MOVE_UP'             => $this->u_action . '&amp;action=move_up&amp;id=' . $row[$fields . '_id'],
    859                                 'U_MOVE_DOWN'   => $this->u_action . '&amp;action=move_down&amp;id=' . $row[$fields . '_id'])
    860                         );
     918                                'U_MOVE_UP'             => $this->u_action . '&amp;action=move_up&amp;id=' . $row[$fields . '_id'] . '&amp;start=' . $pagination_start,
     919                                'U_MOVE_DOWN'   => $this->u_action . '&amp;action=move_down&amp;id=' . $row[$fields . '_id'] . '&amp;start=' . $pagination_start,
     920                        ));
    861921
    862922                        if (!$spacer && !$row['display_on_posting'])
     
    866926                }
    867927                $db->sql_freeresult($result);
     928
     929                $template->assign_var('PAGINATION',
     930                        generate_pagination($this->u_action, $item_count, $config['smilies_per_page'], $pagination_start, true)
     931                );
     932        }
     933
     934        /**
     935         * Returns the count of smilies or icons in the database
     936         *
     937         * @param string $table The table of items to count.
     938         * @return int number of items
     939         */
     940        /* private */ function item_count($table)
     941        {
     942                global $db;
     943
     944                $sql = "SELECT COUNT(*) AS item_count
     945                        FROM $table";
     946                $result = $db->sql_query($sql);
     947                $item_count = (int) $db->sql_fetchfield('item_count');
     948                $db->sql_freeresult($result);
     949
     950                return $item_count;
    868951        }
    869952}
  • trunk/forum/includes/acp/acp_inactive.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_inactive.php 8598 2008-06-04 15:37:06Z naderman $
     5* @version $Id$
    66* @copyright (c) 2006 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    5252                add_form_key($form_key);
    5353
     54                // We build the sort key and per page settings here, because they may be needed later
     55
     56                // Number of entries to display
     57                $per_page = request_var('users_per_page', (int) $config['topics_per_page']);
     58
     59                // Sorting
     60                $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
     61                $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'd' => $user->lang['SORT_LAST_REMINDER'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME'], 'p' => $user->lang['SORT_POSTS'], 'e' => $user->lang['SORT_REMINDER']);
     62                $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'd' => 'user_reminded_time', 'r' => 'user_inactive_reason', 'u' => 'username_clean', 'p' => 'user_posts', 'e' => 'user_reminded');
     63
     64                $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
     65                gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
     66
    5467                if ($submit && sizeof($mark))
    5568                {
     
    6881                                                WHERE ' . $db->sql_in_set('user_id', $mark);
    6982                                        $result = $db->sql_query($sql);
    70                                
     83
    7184                                        $user_affected = array();
    7285                                        while ($row = $db->sql_fetchrow($result))
     
    7891                                        if ($action == 'activate')
    7992                                        {
    80                                                 if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
    81                                                 {
    82                                                         // Get those 'being activated'...
    83                                                         $sql = 'SELECT user_id, username, user_email, user_lang
    84                                                                 FROM ' . USERS_TABLE . '
    85                                                                 WHERE ' . $db->sql_in_set('user_id', $mark) . '
    86                                                                         AND user_type = ' . USER_INACTIVE;
    87                                                         $result = $db->sql_query($sql);
    88 
    89                                                         $inactive_users = array();
    90                                                         while ($row = $db->sql_fetchrow($result))
    91                                                         {
    92                                                                 $inactive_users[] = $row;
    93                                                         }
    94                                                         $db->sql_freeresult($result);
    95                                                 }
     93                                                // Get those 'being activated'...
     94                                                $sql = 'SELECT user_id, username' . (($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ', user_email, user_lang' : '') . '
     95                                                        FROM ' . USERS_TABLE . '
     96                                                        WHERE ' . $db->sql_in_set('user_id', $mark) . '
     97                                                                AND user_type = ' . USER_INACTIVE;
     98                                                $result = $db->sql_query($sql);
     99
     100                                                $inactive_users = array();
     101                                                while ($row = $db->sql_fetchrow($result))
     102                                                {
     103                                                        $inactive_users[] = $row;
     104                                                }
     105                                                $db->sql_freeresult($result);
    96106
    97107                                                user_active_flip('activate', $mark);
     
    101111                                                        include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
    102112
    103                                                         $messenger = new messenger();
     113                                                        $messenger = new messenger(false);
    104114
    105115                                                        foreach ($inactive_users as $row)
     
    112122                                                                $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
    113123                                                                $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
     124                                                                $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
    114125
    115126                                                                $messenger->assign_vars(array(
     
    122133                                                        $messenger->save_queue();
    123134                                                }
     135
     136                                                if (!empty($inactive_users))
     137                                                {
     138                                                        foreach ($inactive_users as $row)
     139                                                        {
     140                                                                add_log('admin', 'LOG_USER_ACTIVE', $row['username']);
     141                                                                add_log('user', $row['user_id'], 'LOG_USER_ACTIVE_USER');
     142                                                        }
     143                                                }
     144
     145                                                // For activate we really need to redirect, else a refresh can result in users being deactivated again
     146                                                $u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
     147                                                $u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';
     148
     149                                                redirect($u_action);
    124150                                        }
    125151                                        else if ($action == 'delete')
     
    162188                                        $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey
    163189                                                FROM ' . USERS_TABLE . '
    164                                                 WHERE ' . $db->sql_in_set('user_id', $mark);
     190                                                WHERE ' . $db->sql_in_set('user_id', $mark) . '
     191                                                        AND user_inactive_reason';
     192
     193                                        $sql .= ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? ' = ' . INACTIVE_REMIND : ' <> ' . INACTIVE_MANUAL;
     194
    165195                                        $result = $db->sql_query($sql);
    166196
     
    171201
    172202                                                $messenger = new messenger();
    173                                                 $usernames = array();
     203                                                $usernames = $user_ids = array();
    174204
    175205                                                do
     
    180210                                                        $messenger->im($row['user_jabber'], $row['username']);
    181211
     212                                                        $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
     213                                                        $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
     214                                                        $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
     215                                                        $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
     216
    182217                                                        $messenger->assign_vars(array(
    183218                                                                'USERNAME'              => htmlspecialchars_decode($row['username']),
    184                                                                 'REGISTER_DATE' => $user->format_date($row['user_regdate']),
     219                                                                'REGISTER_DATE' => $user->format_date($row['user_regdate'], false, true),
    185220                                                                'U_ACTIVATE'    => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey'])
    186221                                                        );
     
    189224
    190225                                                        $usernames[] = $row['username'];
     226                                                        $user_ids[] = (int) $row['user_id'];
    191227                                                }
    192228                                                while ($row = $db->sql_fetchrow($result));
    193229
    194230                                                $messenger->save_queue();
     231
     232                                                // Add the remind state to the database
     233                                                $sql = 'UPDATE ' . USERS_TABLE . '
     234                                                        SET user_reminded = user_reminded + 1,
     235                                                                user_reminded_time = ' . time() . '
     236                                                        WHERE ' . $db->sql_in_set('user_id', $user_ids);
     237                                                $db->sql_query($sql);
    195238
    196239                                                add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames));
     
    198241                                        }
    199242                                        $db->sql_freeresult($result);
    200                
     243
     244                                        // For remind we really need to redirect, else a refresh can result in more than one reminder
     245                                        $u_action = $this->u_action . "&amp;$u_sort_param&amp;start=$start";
     246                                        $u_action .= ($per_page != $config['topics_per_page']) ? "&amp;users_per_page=$per_page" : '';
     247
     248                                        redirect($u_action);
     249
    201250                                break;
    202251                        }
    203252                }
    204253
    205                 // Sorting
    206                 $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']);
    207                 $sort_by_text = array('i' => $user->lang['SORT_INACTIVE'], 'j' => $user->lang['SORT_REG_DATE'], 'l' => $user->lang['SORT_LAST_VISIT'], 'r' => $user->lang['SORT_REASON'], 'u' => $user->lang['SORT_USERNAME']);
    208                 $sort_by_sql = array('i' => 'user_inactive_time', 'j' => 'user_regdate', 'l' => 'user_lastvisit', 'r' => 'user_inactive_reason', 'u' => 'username_clean');
    209 
    210                 $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
    211                 gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
    212 
    213254                // Define where and sort sql for use in displaying logs
    214255                $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
     
    218259                $inactive_count = 0;
    219260
    220                 $start = view_inactive_users($inactive, $inactive_count, $config['topics_per_page'], $start, $sql_where, $sql_sort);
     261                $start = view_inactive_users($inactive, $inactive_count, $per_page, $start, $sql_where, $sql_sort);
    221262
    222263                foreach ($inactive as $row)
     
    224265                        $template->assign_block_vars('inactive', array(
    225266                                'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),
     267                                'REMINDED_DATE' => $user->format_date($row['user_reminded_time']),
    226268                                'JOINED'                => $user->format_date($row['user_regdate']),
    227269                                'LAST_VISIT'    => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
     270
    228271                                'REASON'                => $row['inactive_reason'],
    229272                                'USER_ID'               => $row['user_id'],
    230                                 'USERNAME'              => $row['username'],
    231                                 'U_USER_ADMIN'  => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
    232                         );
     273                                'POSTS'                 => ($row['user_posts']) ? $row['user_posts'] : 0,
     274                                'REMINDED'              => $row['user_reminded'],
     275
     276                                'REMINDED_EXPLAIN'      => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])),
     277
     278                                'USERNAME_FULL'         => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview')),
     279                                'USERNAME'                      => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
     280                                'USER_COLOR'            => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
     281
     282                                'U_USER_ADMIN'  => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"),
     283                                'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&amp;sr=posts") : '',
     284                        ));
    233285                }
    234286
     
    246298                        'S_SORT_KEY'    => $s_sort_key,
    247299                        'S_SORT_DIR'    => $s_sort_dir,
    248                         'S_ON_PAGE'             => on_page($inactive_count, $config['topics_per_page'], $start),
    249                         'PAGINATION'    => generate_pagination($this->u_action . "&amp;$u_sort_param", $inactive_count, $config['topics_per_page'], $start, true),
    250                        
     300                        'S_ON_PAGE'             => on_page($inactive_count, $per_page, $start),
     301                        'PAGINATION'    => generate_pagination($this->u_action . "&amp;$u_sort_param&amp;users_per_page=$per_page", $inactive_count, $per_page, $start, true),
     302                        'USERS_PER_PAGE'        => $per_page,
     303
    251304                        'U_ACTION'              => $this->u_action . '&amp;start=' . $start,
    252305                ));
  • trunk/forum/includes/acp/acp_jabber.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_jabber.php 8990 2008-10-09 15:41:19Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    4545                $this->page_title = 'ACP_JABBER_SETTINGS';
    4646
    47                 $jab_enable                     = request_var('jab_enable', $config['jab_enable']);
    48                 $jab_host                       = request_var('jab_host', $config['jab_host']);
    49                 $jab_port                       = request_var('jab_port', $config['jab_port']);
    50                 $jab_username           = request_var('jab_username', $config['jab_username']);
    51                 $jab_password           = request_var('jab_password', $config['jab_password']);
    52                 $jab_package_size       = request_var('jab_package_size', $config['jab_package_size']);
    53                 $jab_use_ssl            = request_var('jab_use_ssl', $config['jab_use_ssl']);
     47                $jab_enable                     = request_var('jab_enable',                     (bool)          $config['jab_enable']);
     48                $jab_host                       = request_var('jab_host',                       (string)        $config['jab_host']);
     49                $jab_port                       = request_var('jab_port',                       (int)           $config['jab_port']);
     50                $jab_username           = request_var('jab_username',           (string)        $config['jab_username']);
     51                $jab_password           = request_var('jab_password',           (string)        $config['jab_password']);
     52                $jab_package_size       = request_var('jab_package_size',       (int)           $config['jab_package_size']);
     53                $jab_use_ssl            = request_var('jab_use_ssl',            (bool)          $config['jab_use_ssl']);
    5454
    5555                $form_name = 'acp_jabber';
     
    8989                        {
    9090                                // This feature is disabled.
    91                                 // We update the user table to be sure all users that have IM as notify type are set to both  as notify type
     91                                // We update the user table to be sure all users that have IM as notify type are set to both as notify type
     92                                // We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled.
    9293                                $sql_ary = array(
    9394                                        'user_notify_type'              => NOTIFY_BOTH,
     
    117118                        'L_JAB_SERVER_EXPLAIN'  => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'),
    118119                        'JAB_HOST'                              => $jab_host,
    119                         'JAB_PORT'                              => $jab_port,
     120                        'JAB_PORT'                              => ($jab_port) ? $jab_port : '',
    120121                        'JAB_USERNAME'                  => $jab_username,
    121122                        'JAB_PASSWORD'                  => $jab_password,
  • trunk/forum/includes/acp/acp_language.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_language.php 8780 2008-08-22 12:52:48Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    767767                                }
    768768
    769                                 $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id);
    770 
    771                                 $sql = 'UPDATE ' . USERS_TABLE . "
    772                                         SET user_lang = '" . $db->sql_escape($config['default_lang']) . "'
    773                                         WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
    774                                 $db->sql_query($sql);
    775 
    776                                 // We also need to remove the translated entries for custom profile fields - we want clean tables, don't we?
    777                                 $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;
    778                                 $db->sql_query($sql);
    779 
    780                                 $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;
    781                                 $db->sql_query($sql);
    782 
    783                                 $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
    784                                 $result = $db->sql_query($sql);
    785 
    786                                 $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
    787 
    788                                 add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']);
    789 
    790                                 trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action));
     769                                if (confirm_box(true))
     770                                {
     771                                        $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id);
     772
     773                                        $sql = 'UPDATE ' . USERS_TABLE . "
     774                                                SET user_lang = '" . $db->sql_escape($config['default_lang']) . "'
     775                                                WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
     776                                        $db->sql_query($sql);
     777
     778                                        // We also need to remove the translated entries for custom profile fields - we want clean tables, don't we?
     779                                        $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;
     780                                        $db->sql_query($sql);
     781
     782                                        $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;
     783                                        $db->sql_query($sql);
     784
     785                                        $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
     786                                        $result = $db->sql_query($sql);
     787
     788                                        $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
     789
     790                                        add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']);
     791
     792                                        trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action));
     793                                }
     794                                else
     795                                {
     796                                        $s_hidden_fields = array(
     797                                                'i'                     => $id,
     798                                                'mode'          => $mode,
     799                                                'action'        => $action,
     800                                                'id'            => $lang_id,
     801                                        );
     802                                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
     803                                }
    791804                        break;
    792805
     
    11081121                        while (($file = readdir($dp)) !== false)
    11091122                        {
     1123                                if (!is_dir($phpbb_root_path . 'language/' . $file))
     1124                                {
     1125                                        continue;
     1126                                }
     1127
    11101128                                if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt"))
    11111129                                {
     
    12551273
    12561274                $non_static             = array_shift($keys);
    1257                 $value                  = array_shift($keys);
     1275                $value                  = utf8_normalize_nfc(array_shift($keys));
    12581276
    12591277                if (!$non_static)
  • trunk/forum/includes/acp/acp_logs.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_logs.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    3434                $action         = request_var('action', '');
    3535                $forum_id       = request_var('f', 0);
     36                $topic_id       = request_var('t', 0);
    3637                $start          = request_var('start', 0);
    3738                $deletemark = (!empty($_POST['delmarked'])) ? true : false;
     
    105106                $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
    106107
     108                $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
     109                $keywords_param = !empty($keywords) ? '&amp;keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';
     110
    107111                $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS'];
    108112                $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN'];
     
    124128                $log_data = array();
    125129                $log_count = 0;
    126                 view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
     130                view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort, $keywords);
    127131
    128132                $template->assign_vars(array(
     
    132136
    133137                        'S_ON_PAGE'             => on_page($log_count, $config['topics_per_page'], $start),
    134                         'PAGINATION'    => generate_pagination($this->u_action . "&amp;$u_sort_param", $log_count, $config['topics_per_page'], $start, true),
     138                        'PAGINATION'    => generate_pagination($this->u_action . "&amp;$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true),
    135139
    136140                        'S_LIMIT_DAYS'  => $s_limit_days,
     
    138142                        'S_SORT_DIR'    => $s_sort_dir,
    139143                        'S_CLEARLOGS'   => $auth->acl_get('a_clearlogs'),
     144                        'S_KEYWORDS'    => $keywords,
    140145                        )
    141146                );
  • trunk/forum/includes/acp/acp_main.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_main.php 9171 2008-12-04 14:53:04Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    9797                                                $confirm = true;
    9898                                                $confirm_lang = 'PURGE_CACHE_CONFIRM';
     99                                        break;
     100                                        case 'purge_sessions':
     101                                                $confirm = true;
     102                                                $confirm_lang = 'PURGE_SESSIONS_CONFIRM';
    99103                                        break;
    100104
     
    342346                                                add_log('admin', 'LOG_PURGE_CACHE');
    343347                                        break;
     348
     349                                        case 'purge_sessions':
     350                                                if ((int) $user->data['user_type'] !== USER_FOUNDER)
     351                                                {
     352                                                        trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
     353                                                }
     354
     355                                                $tables = array(CONFIRM_TABLE, SESSIONS_TABLE);
     356
     357                                                foreach ($tables as $table)
     358                                                {
     359                                                        switch ($db->sql_layer)
     360                                                        {
     361                                                                case 'sqlite':
     362                                                                case 'firebird':
     363                                                                        $db->sql_query("DELETE FROM $table");
     364                                                                break;
     365
     366                                                                default:
     367                                                                        $db->sql_query("TRUNCATE TABLE $table");
     368                                                                break;
     369                                                        }
     370                                                }
     371
     372                                                // let's restore the admin session
     373                                                $reinsert_ary = array(
     374                                                                'session_id'                    => (string) $user->session_id,
     375                                                                'session_page'                  => (string) substr($user->page['page'], 0, 199),
     376                                                                'session_forum_id'              => $user->page['forum'],
     377                                                                'session_user_id'               => (int) $user->data['user_id'],
     378                                                                'session_start'                 => (int) $user->data['session_start'],
     379                                                                'session_last_visit'    => (int) $user->data['session_last_visit'],
     380                                                                'session_time'                  => (int) $user->time_now,
     381                                                                'session_browser'               => (string) trim(substr($user->browser, 0, 149)),
     382                                                                'session_forwarded_for' => (string) $user->forwarded_for,
     383                                                                'session_ip'                    => (string) $user->ip,
     384                                                                'session_autologin'             => (int) $user->data['session_autologin'],
     385                                                                'session_admin'                 => 1,
     386                                                                'session_viewonline'    => (int) $user->data['session_viewonline'],
     387                                                );
     388
     389                                                $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary);
     390                                                $db->sql_query($sql);
     391
     392                                                add_log('admin', 'LOG_PURGE_SESSIONS');
     393                                        break;
    344394                                }
    345395                        }
     396                }
     397
     398                // Version check
     399                $user->add_lang('install');
     400
     401                if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.2.0', '<'))
     402                {
     403                        $template->assign_vars(array(
     404                                'S_PHP_VERSION_OLD'     => true,
     405                                'L_PHP_VERSION_OLD'     => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="http://www.phpbb.com/community/viewtopic.php?f=14&amp;t=1958605">', '</a>'),
     406                        ));
     407                }
     408
     409                $latest_version_info = false;
     410                if (($latest_version_info = obtain_latest_version_info(request_var('versioncheck_force', false))) === false)
     411                {
     412                        $template->assign_var('S_VERSIONCHECK_FAIL', true);
     413                }
     414                else
     415                {
     416                        $latest_version_info = explode("\n", $latest_version_info);
     417
     418                        $latest_version = str_replace('rc', 'RC', strtolower(trim($latest_version_info[0])));
     419                        $current_version = str_replace('rc', 'RC', strtolower($config['version']));
     420
     421                        $template->assign_vars(array(
     422                                'S_VERSION_UP_TO_DATE'  => version_compare($current_version, $latest_version, '<') ? false : true,
     423                        ));
    346424                }
    347425
     
    436514                        'TOTAL_ORPHAN'          => $total_orphan,
    437515                        'S_TOTAL_ORPHAN'        => ($total_orphan === false) ? false : true,
    438                         'GZIP_COMPRESSION'      => ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'],
     516                        'GZIP_COMPRESSION'      => ($config['gzip_compress'] && @extension_loaded('zlib')) ? $user->lang['ON'] : $user->lang['OFF'],
    439517                        'DATABASE_INFO'         => $db->sql_server_info(),
    440518                        'BOARD_VERSION'         => $config['version'],
     
    443521                        'U_ADMIN_LOG'           => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&amp;mode=admin'),
    444522                        'U_INACTIVE_USERS'      => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&amp;mode=list'),
     523                        'U_VERSIONCHECK'        => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&amp;mode=version_check'),
     524                        'U_VERSIONCHECK_FORCE'  => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=1&amp;versioncheck_force=1'),
    445525
    446526                        'S_ACTION_OPTIONS'      => ($auth->acl_get('a_board')) ? true : false,
     
    469549                if ($auth->acl_get('a_user'))
    470550                {
     551                        $user->add_lang('memberlist');
     552
    471553                        $inactive = array();
    472554                        $inactive_count = 0;
     
    478560                                $template->assign_block_vars('inactive', array(
    479561                                        'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),
     562                                        'REMINDED_DATE' => $user->format_date($row['user_reminded_time']),
    480563                                        'JOINED'                => $user->format_date($row['user_regdate']),
    481564                                        'LAST_VISIT'    => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
     565
    482566                                        'REASON'                => $row['inactive_reason'],
    483567                                        'USER_ID'               => $row['user_id'],
    484                                         'USERNAME'              => $row['username'],
    485                                         'U_USER_ADMIN'  => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
    486                                 );
     568                                        'POSTS'                 => ($row['user_posts']) ? $row['user_posts'] : 0,
     569                                        'REMINDED'              => $row['user_reminded'],
     570
     571                                        'REMINDED_EXPLAIN'      => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])),
     572
     573                                        'USERNAME_FULL'         => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&amp;mode=overview')),
     574                                        'USERNAME'                      => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']),
     575                                        'USER_COLOR'            => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']),
     576
     577                                        'U_USER_ADMIN'  => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&amp;mode=overview&amp;u={$row['user_id']}"),
     578                                        'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&amp;sr=posts") : '',
     579                                ));
    487580                        }
    488581
     
    500593
    501594                // Warn if install is still present
    502                 if (file_exists($phpbb_root_path . 'install'))
     595                if (file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
    503596                {
    504597                        $template->assign_var('S_REMOVE_INSTALL', true);
    505598                }
    506599
    507                 if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx))
     600                if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx))
    508601                {
    509602                        // World-Writable? (000x)
    510603                        $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
     604                }
     605
     606                // Fill dbms version if not yet filled
     607                if (empty($config['dbms_version']))
     608                {
     609                        set_config('dbms_version', $db->sql_server_info(true));
    511610                }
    512611
  • trunk/forum/includes/acp/acp_permissions.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_permissions.php 8710 2008-07-29 13:35:49Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    2424        var $u_action;
    2525        var $permission_dropdown;
    26        
     26
    2727        function main($id, $mode)
    2828        {
     
    5555                                return;
    5656                        }
     57                        trigger_error('NO_MODE', E_USER_ERROR);
     58                }
     59
     60                // Copy forum permissions
     61                if ($mode == 'setting_forum_copy')
     62                {
     63                        $this->tpl_name = 'permission_forum_copy';
     64
     65                        if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))
     66                        {
     67                                $this->page_title = 'ACP_FORUM_PERMISSIONS_COPY';
     68                                $this->copy_forum_permissions();
     69                                return;
     70                        }
     71
    5772                        trigger_error('NO_MODE', E_USER_ERROR);
    5873                }
     
    95110                        $db->sql_freeresult($result);
    96111                }
    97                
     112
    98113                // Map usernames to ids and vice versa
    99114                if ($usernames)
     
    113128                }
    114129                unset($username);
    115                
     130
    116131                // Build forum ids (of all forums are checked or subforum listing used)
    117132                if ($all_forums)
     
    218233                }
    219234
    220 
    221235                // Handle actions
    222236                if (strpos($mode, 'setting_') === 0 && $action)
     
    225239                        {
    226240                                case 'delete':
    227 
    228                                         if (!check_form_key($form_name))
    229                                         {
    230                                                 trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
    231                                         }
    232                                         // All users/groups selected?
    233                                         $all_users = (isset($_POST['all_users'])) ? true : false;
    234                                         $all_groups = (isset($_POST['all_groups'])) ? true : false;
    235 
    236                                         if ($all_users || $all_groups)
    237                                         {
    238                                                 $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type);
    239 
    240                                                 if ($all_users && sizeof($items['user_ids']))
     241                                        if (confirm_box(true))
     242                                        {
     243                                                // All users/groups selected?
     244                                                $all_users = (isset($_POST['all_users'])) ? true : false;
     245                                                $all_groups = (isset($_POST['all_groups'])) ? true : false;
     246
     247                                                if ($all_users || $all_groups)
    241248                                                {
    242                                                         $user_id = $items['user_ids'];
     249                                                        $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type);
     250
     251                                                        if ($all_users && sizeof($items['user_ids']))
     252                                                        {
     253                                                                $user_id = $items['user_ids'];
     254                                                        }
     255                                                        else if ($all_groups && sizeof($items['group_ids']))
     256                                                        {
     257                                                                $group_id = $items['group_ids'];
     258                                                        }
    243259                                                }
    244                                                 else if ($all_groups && sizeof($items['group_ids']))
     260
     261                                                if (sizeof($user_id) || sizeof($group_id))
    245262                                                {
    246                                                         $group_id = $items['group_ids'];
     263                                                        $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id);
    247264                                                }
    248                                         }
    249 
    250                                         if (sizeof($user_id) || sizeof($group_id))
    251                                         {
    252                                                 $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id);
     265                                                else
     266                                                {
     267                                                        trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
     268                                                }
    253269                                        }
    254270                                        else
    255271                                        {
    256                                                 trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);
     272                                                if (isset($_POST['cancel']))
     273                                                {
     274                                                        $u_redirect = $this->u_action . '&amp;type=' . $permission_type;
     275                                                        foreach ($forum_id as $fid)
     276                                                        {
     277                                                                $u_redirect .= '&amp;forum_id[]=' . $fid;
     278                                                        }
     279                                                        redirect($u_redirect);
     280                                                }
     281
     282                                                $s_hidden_fields = array(
     283                                                        'i'                             => $id,
     284                                                        'mode'                  => $mode,
     285                                                        'action'                => array($action => 1),
     286                                                        'user_id'               => $user_id,
     287                                                        'group_id'              => $group_id,
     288                                                        'forum_id'              => $forum_id,
     289                                                        'type'                  => $permission_type,
     290                                                );
     291                                                if (isset($_POST['all_users']))
     292                                                {
     293                                                        $s_hidden_fields['all_users'] = 1;
     294                                                }
     295                                                if (isset($_POST['all_groups']))
     296                                                {
     297                                                        $s_hidden_fields['all_groups'] = 1;
     298                                                }
     299                                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
    257300                                        }
    258301                                break;
     
    529572                                continue;
    530573                        }
    531                        
     574
    532575                        if ($branch_there)
    533576                        {
     
    540583                return $s_options;
    541584        }
    542        
     585
    543586        /**
    544587        * Build dropdown field for changing permission types
     
    547590        {
    548591                global $user, $auth;
    549                
     592
    550593                $s_dropdown_options = '';
    551594                foreach ($options as $setting)
     
    627670                        trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
    628671                }
    629                
     672
    630673                $ug_id = $forum_id = 0;
    631674
     
    763806                $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids);
    764807
    765                 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
     808                if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
     809                {
     810                        trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_ids)));
     811                }
     812                else
     813                {
     814                        trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
     815                }
    766816        }
    767817
     
    810860        {
    811861                global $user, $db, $auth;
    812                        
     862
    813863                // User or group to be set?
    814864                $ug_type = (sizeof($user_id)) ? 'user' : 'group';
     
    830880                $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0)));
    831881
    832                 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
     882                if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
     883                {
     884                        trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_id)));
     885                }
     886                else
     887                {
     888                        trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
     889                }
    833890        }
    834891
     
    9501007                        WHERE ug.user_id = ' . $user_id . '
    9511008                                AND ug.user_pending = 0
     1009                                AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1)
    9521010                        ORDER BY g.group_type DESC, g.group_id DESC';
    9531011                $result = $db->sql_query($sql);
     
    11111169
    11121170        /**
     1171        * Handles copying permissions from one forum to others
     1172        */
     1173        function copy_forum_permissions()
     1174        {
     1175                global $auth, $cache, $template, $user;
     1176
     1177                $user->add_lang('acp/forums');
     1178
     1179                $submit = isset($_POST['submit']) ? true : false;
     1180
     1181                if ($submit)
     1182                {
     1183                        $src = request_var('src_forum_id', 0);
     1184                        $dest = request_var('dest_forum_ids', array(0));
     1185
     1186                        if (confirm_box(true))
     1187                        {
     1188                                if (copy_forum_permissions($src, $dest))
     1189                                {
     1190                                        cache_moderators();
     1191
     1192                                        $auth->acl_clear_prefetch();
     1193                                        $cache->destroy('sql', FORUMS_TABLE);
     1194
     1195                                        trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
     1196                                }
     1197                                else
     1198                                {
     1199                                        trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
     1200                                }
     1201                        }
     1202                        else
     1203                        {
     1204                                $s_hidden_fields = array(
     1205                                        'submit'                        => $submit,
     1206                                        'src_forum_id'          => $src,
     1207                                        'dest_forum_ids'        => $dest,
     1208                                );
     1209
     1210                                $s_hidden_fields = build_hidden_fields($s_hidden_fields);
     1211
     1212                                confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields);
     1213                        }
     1214                }
     1215
     1216                $template->assign_vars(array(
     1217                        'S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false),
     1218                ));
     1219        }
     1220
     1221        /**
    11131222        * Get already assigned users/groups
    11141223        */
     
    11511260                        $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')';
    11521261                }
    1153                 else
     1262                else if (sizeof($role_ids))
     1263                {
     1264                        $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids);
     1265                }
     1266                else if (sizeof($option_ids))
    11541267                {
    11551268                        $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids);
  • trunk/forum/includes/acp/acp_profile.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_profile.php 9127 2008-11-26 19:58:35Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    370370                                                'field_no_view'         => 0,
    371371                                                'field_show_on_reg'     => 0,
     372                                                'field_show_on_vt'      => 0,
    372373                                                'lang_name'                     => utf8_normalize_nfc(request_var('field_ident', '', true)),
    373374                                                'lang_explain'          => '',
     
    380381                                // $exclude contains the data we gather in each step
    381382                                $exclude = array(
    382                                         1       => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'),
     383                                        1       => array('field_ident', 'lang_name', 'lang_explain', 'field_option_none', 'field_show_on_reg', 'field_show_on_vt', 'field_required', 'field_hide', 'field_show_profile', 'field_no_view'),
    383384                                        2       => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'),
    384385                                        3       => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options')
     
    406407                                        'field_required',
    407408                                        'field_show_on_reg',
     409                                        'field_show_on_vt',
    408410                                        'field_show_profile',
    409411                                        'field_hide',
     
    508510                                                $var = request_var('field_default_value', 0);
    509511                                        }*/
     512                                        else if ($field_type == FIELD_INT && $key == 'field_default_value')
     513                                        {
     514                                                // Permit an empty string
     515                                                if (request_var('field_default_value', '') === '')
     516                                                {
     517                                                        $var = '';
     518                                                }
     519                                        }
    510520
    511521                                        $cp->vars[$key] = $var;
     
    722732                                                        'S_FIELD_REQUIRED'      => ($cp->vars['field_required']) ? true : false,
    723733                                                        'S_SHOW_ON_REG'         => ($cp->vars['field_show_on_reg']) ? true : false,
     734                                                        'S_SHOW_ON_VT'          => ($cp->vars['field_show_on_vt']) ? true : false,
    724735                                                        'S_FIELD_HIDE'          => ($cp->vars['field_hide']) ? true : false,
    725736                                                        'S_SHOW_PROFILE'        => ($cp->vars['field_show_profile']) ? true : false,
     
    923934                        case FIELD_TEXT:
    924935                        case FIELD_STRING:
    925                                 if ($cp->vars['lang_default_value'])
     936                                if (strlen($cp->vars['lang_default_value']))
    926937                                {
    927938                                        $options['lang_default_value'] = ($field_type == FIELD_STRING) ? 'string' : 'text';
     
    10371048                        'field_required'                => $cp->vars['field_required'],
    10381049                        'field_show_on_reg'             => $cp->vars['field_show_on_reg'],
     1050                        'field_show_on_vt'              => $cp->vars['field_show_on_vt'],
    10391051                        'field_hide'                    => $cp->vars['field_hide'],
    10401052                        'field_show_profile'    => $cp->vars['field_show_profile'],
     
    15401552
    15411553                                // We are defining the biggest common value, because of the possibility to edit the min/max values of each field.
    1542                                 $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD \"$field_ident\" ";
     1554                                $sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" ';
    15431555
    15441556                                switch ($field_type)
  • trunk/forum/includes/acp/acp_prune.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_prune.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    407407                        $where_sql .= ($count !== '') ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : '';
    408408
    409                         if (sizeof($active) && $active_select != 'lt')
     409                        // First handle pruning of users who never logged in, last active date is 0000-00-00
     410                        if (sizeof($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0)
     411                        {
     412                                $where_sql .= ' AND user_lastvisit = 0';
     413                        }                       
     414                        else if (sizeof($active) && $active_select != 'lt')
    410415                        {
    411416                                $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]);
  • trunk/forum/includes/acp/acp_ranks.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_ranks.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    4040                $this->page_title = 'ACP_MANAGE_RANKS';
    4141
    42                 $form_name = 'acp_prune';
     42                $form_name = 'acp_ranks';
    4343                add_form_key($form_name);
    4444
     
    169169                                                $img = $path . $img;
    170170
    171                                                 if (!in_array($img, $existing_imgs) || $action == 'edit')
     171                                                if ($ranks && $img == $ranks['rank_image'])
    172172                                                {
    173                                                         if ($ranks && $img == $ranks['rank_image'])
    174                                                         {
    175                                                                 $selected = ' selected="selected"';
    176                                                                 $edit_img = $img;
    177                                                         }
    178                                                         else
    179                                                         {
    180                                                                 $selected = '';
    181                                                         }
    182 
    183                                                         if (strlen($img) > 255)
    184                                                         {
    185                                                                 continue;
    186                                                         }
    187 
    188                                                         $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>';
     173                                                        $selected = ' selected="selected"';
     174                                                        $edit_img = $img;
    189175                                                }
     176                                                else
     177                                                {
     178                                                        $selected = '';
     179                                                }
     180
     181                                                if (strlen($img) > 255)
     182                                                {
     183                                                        continue;
     184                                                }
     185
     186                                                $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . ((in_array($img, $existing_imgs)) ? ' ' . $user->lang['RANK_IMAGE_IN_USE'] : '') . '</option>';
    190187                                        }
    191188                                }
  • trunk/forum/includes/acp/acp_search.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_search.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    6464                        'limit_search_load'                     => 'float',
    6565                        'min_search_author_chars'       => 'integer',
     66                        'max_num_search_keywords'       => 'integer',
    6667                        'search_store_results'          => 'integer',
    6768                );
     
    217218                        'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'],
    218219                        'SEARCH_STORE_RESULTS'  => (int) $config['search_store_results'],
     220                        'MAX_NUM_SEARCH_KEYWORDS'       => (int) $config['max_num_search_keywords'],
    219221
    220222                        'S_SEARCH_TYPES'                => $search_options,
     
    592594                ksort($this->state);
    593595
    594                 set_config('search_indexing_state', implode(',', $this->state));
     596                set_config('search_indexing_state', implode(',', $this->state), true);
    595597        }
    596598
  • trunk/forum/includes/acp/acp_styles.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_styles.php 9152 2008-12-02 16:49:59Z acydburn $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    3838                $bitfield = new bitfield();
    3939                $bitfield->set(0);
     40                $bitfield->set(1);
     41                $bitfield->set(2);
    4042                $bitfield->set(3);
     43                $bitfield->set(4);
    4144                $bitfield->set(8);
    4245                $bitfield->set(9);
     
    208211                                                }
    209212
    210                                                 $sql = 'UPDATE ' . STYLES_TABLE . '
    211                                                         SET style_active = ' . (($action == 'activate') ? 1 : 0) . '
    212                                                         WHERE style_id = ' . $style_id;
    213                                                 $db->sql_query($sql);
    214 
    215                                                 // Set style to default for any member using deactivated style
    216                                                 if ($action == 'deactivate')
     213                                                if (($action == 'deactivate' && confirm_box(true)) || $action == 'activate')
    217214                                                {
    218                                                         $sql = 'UPDATE ' . USERS_TABLE . '
    219                                                                 SET user_style = ' . $config['default_style'] . "
    220                                                                 WHERE user_style = $style_id";
     215                                                        $sql = 'UPDATE ' . STYLES_TABLE . '
     216                                                                SET style_active = ' . (($action == 'activate') ? 1 : 0) . '
     217                                                                WHERE style_id = ' . $style_id;
    221218                                                        $db->sql_query($sql);
    222219
    223                                                         $sql = 'UPDATE ' . FORUMS_TABLE . '
    224                                                                 SET forum_style = 0
    225                                                                 WHERE forum_style = ' . $style_id;
    226                                                         $db->sql_query($sql);
     220                                                        // Set style to default for any member using deactivated style
     221                                                        if ($action == 'deactivate')
     222                                                        {
     223                                                                $sql = 'UPDATE ' . USERS_TABLE . '
     224                                                                        SET user_style = ' . $config['default_style'] . "
     225                                                                        WHERE user_style = $style_id";
     226                                                                $db->sql_query($sql);
     227
     228                                                                $sql = 'UPDATE ' . FORUMS_TABLE . '
     229                                                                        SET forum_style = 0
     230                                                                        WHERE forum_style = ' . $style_id;
     231                                                                $db->sql_query($sql);
     232                                                        }
     233                                                }
     234                                                else if ($action == 'deactivate')
     235                                                {
     236                                                        $s_hidden_fields = array(
     237                                                                'i'                     => $id,
     238                                                                'mode'          => $mode,
     239                                                                'action'        => $action,
     240                                                                'style_id'      => $style_id,
     241                                                        );
     242                                                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
    227243                                                }
    228244                                        break;
     
    628644                        while (($file = readdir($dp)) !== false)
    629645                        {
     646                                if (!is_dir($phpbb_root_path . 'styles/' . $file))
     647                                {
     648                                        continue;
     649                                }
     650
    630651                                $subpath = ($mode != 'style') ? "$mode/" : '';
    631652                                if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg"))
     
    732753                                if (!($fp = @fopen($file, 'wb')))
    733754                                {
    734                                         trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
     755                                        // File exists and is writeable, but still not able to be written to
     756                                        trigger_error(sprintf($user->lang['TEMPLATE_FILE_NOT_WRITABLE'], htmlspecialchars($template_file)) . adm_back_link($this->u_action), E_USER_WARNING);
    735757                                }
    736758                                fwrite($fp, $template_data);
     
    744766                                if (!$template_info['template_storedb'])
    745767                                {
    746                                         if ($this->get_super('template', $template_id))
     768                                        if ($super = $this->get_super('template', $template_id))
    747769                                        {
    748770                                                $this->store_in_db('template', $super['template_id']);
     
    825847                }
    826848
     849                if (empty($filelist['']))
     850                {
     851                        trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING);
     852                }
     853
    827854                // Now create the categories
    828855                $filelist_cats[''] = array();
     
    10221049                foreach ($file_ary as $file)
    10231050                {
    1024                         $file           = str_replace('/', '.', $file);
     1051                        $file           = str_replace('/', '.', $file);
    10251052
    10261053                        // perform some dirty guessing to get the path right.
    10271054                        // We assume that three dots in a row were '../'
    1028                         $tpl_file       = str_replace('.', '/', $file);
    1029                         $tpl_file       = str_replace('///', '../', $tpl_file);
     1055                        $tpl_file       = str_replace('.', '/', $file);
     1056                        $tpl_file       = str_replace('///', '../', $tpl_file);
    10301057
    10311058                        $filename = "{$cache_prefix}_$file.html.$phpEx";
     
    10591086                        }
    10601087
     1088                        // Correct the filename if it is stored in database and the file is in a subfolder.
     1089                        if ($template_row['template_storedb'])
     1090                        {
     1091                                $file = str_replace('.', '/', $file);
     1092                        }
    10611093
    10621094                        $template->assign_block_vars('file', array(
     
    10661098                                'FILENAME'              => $file,
    10671099                                'FILENAME_PATH' => $file_tpl,
    1068                                 'FILESIZE'              => sprintf('%.1f ' . $user->lang['KIB'], filesize("{$phpbb_root_path}cache/$filename") / 1024),
     1100                                'FILESIZE'              => get_formatted_filesize(filesize("{$phpbb_root_path}cache/$filename")),
    10691101                                'MODIFIED'              => $user->format_date((!$template_row['template_storedb']) ? filemtime($file_tpl) : $filemtime[$file . '.html']))
    10701102                        );
     
    12641296        }
    12651297
    1266 
    12671298        /**
    12681299        * Edit imagesets
     
    12761307                $this->page_title = 'EDIT_IMAGESET';
    12771308
     1309                if (!$imageset_id)
     1310                {
     1311                        trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
     1312                }
     1313
    12781314                $update         = (isset($_POST['update'])) ? true : false;
    12791315
    1280                 $imgname        = request_var('imgname', '');
    1281                 $imgpath        = request_var('imgpath', '');
    1282                 $imgsize        = request_var('imgsize', false);
    1283                 $imgwidth       = request_var('imgwidth', 0);
    1284                 $imgheight      = request_var('imgheight', 0);
    1285 
     1316                $imgname        = request_var('imgname', 'site_logo');
    12861317                $imgname        = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname);
    1287                 $imgpath        = str_replace('..', '.', $imgpath);
    1288 
    1289                 if ($imageset_id)
    1290                 {
    1291                         $sql = 'SELECT imageset_path, imageset_name
    1292                                 FROM ' . STYLES_IMAGESET_TABLE . "
    1293                                 WHERE imageset_id = $imageset_id";
    1294                         $result = $db->sql_query($sql);
    1295                         $imageset_row = $db->sql_fetchrow($result);
    1296                         $db->sql_freeresult($result);
    1297 
    1298                         $imageset_path          = $imageset_row['imageset_path'];
    1299                         $imageset_name          = $imageset_row['imageset_name'];
    1300 
    1301                         $sql_extra = '';
    1302                         if (strpos($imgname, '-') !== false)
    1303                         {
    1304                                 list($imgname, $imgnamelang) = explode('-', $imgname);
    1305                                 $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')";
    1306                         }
    1307 
    1308                         $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id
    1309                                 FROM ' . STYLES_IMAGESET_DATA_TABLE . "
    1310                                 WHERE imageset_id = $imageset_id
    1311                                         AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra";
    1312                         $result = $db->sql_query($sql);
    1313                         $imageset_data_row = $db->sql_fetchrow($result);
    1314                         $db->sql_freeresult($result);
    1315 
    1316                         $image_filename = $imageset_data_row['image_filename'];
    1317                         $image_width    = $imageset_data_row['image_width'];
    1318                         $image_height   = $imageset_data_row['image_height'];
    1319                         $image_lang             = $imageset_data_row['image_lang'];
    1320                         $image_id               = $imageset_data_row['image_id'];
    1321 
    1322                         if (!$imageset_row)
    1323                         {
    1324                                 trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
    1325                         }
    1326 
    1327                         // Check to see whether the selected image exists in the table
    1328                         $valid_name = ($update) ? false : true;
    1329 
    1330                         foreach ($this->imageset_keys as $category => $img_ary)
    1331                         {
    1332                                 if (in_array($imgname, $img_ary))
    1333                                 {
    1334                                         $valid_name = true;
    1335                                         break;
    1336                                 }
    1337                         }
    1338 
    1339                         if ($update && isset($_POST['imgpath']))
    1340                         {
    1341                                 if ($valid_name)
    1342                                 {
    1343                                         // If imgwidth and imgheight are non-zero grab the actual size
    1344                                         // from the image itself ... we ignore width settings for the poll center image
    1345                                         $imgwidth       = request_var('imgwidth', 0);
    1346                                         $imgheight      = request_var('imgheight', 0);
    1347                                         $imglang = '';
    1348 
    1349                                         if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
    1350                                         {
    1351                                                 trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
    1352                                         }
    1353 
    1354                                         if ($imgsize && $imgpath)
    1355                                         {
    1356                                                 if (!$imgwidth || !$imgheight)
    1357                                                 {
    1358                                                         list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath");
    1359                                                         $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file;
    1360                                                         $imgheight = ($imgheight) ? $imgheight : $imgheight_file;
    1361                                                 }
    1362                                                 $imgwidth       = ($imgname != 'poll_center') ? (int) $imgwidth : 0;
    1363                                                 $imgheight      = (int) $imgheight;
    1364                                         }
    1365 
    1366 
    1367                                         if (strpos($imgpath, '/') !== false)
    1368                                         {
    1369                                                 list($imglang, $imgfilename) = explode('/', $imgpath);
    1370                                         }
    1371                                         else
    1372                                         {
    1373                                                 $imgfilename = $imgpath;
    1374                                         }
    1375 
    1376                                         $sql_ary = array(
    1377                                                 'image_filename'        => (string) $imgfilename,
    1378                                                 'image_width'           => (int) $imgwidth,
    1379                                                 'image_height'          => (int) $imgheight,
    1380                                                 'image_lang'            => (string) $imglang,
    1381                                         );
    1382 
    1383                                         // already exists
    1384                                         if ($imageset_data_row)
    1385                                         {
    1386                                                 $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . '
    1387                                                         SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
    1388                                                         WHERE image_id = $image_id";
    1389                                                 $db->sql_query($sql);
    1390                                         }
    1391                                         // does not exist
    1392                                         else if (!$imageset_data_row)
    1393                                         {
    1394                                                 $sql_ary['image_name']  = $imgname;
    1395                                                 $sql_ary['imageset_id'] = (int) $imageset_id;
    1396                                                 $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
    1397                                         }
    1398 
    1399                                         $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
    1400 
    1401                                         add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
    1402 
    1403                                         $template->assign_var('SUCCESS', true);
    1404 
    1405                                         $image_filename = $imgfilename;
    1406                                         $image_width    = $imgwidth;
    1407                                         $image_height   = $imgheight;
    1408                                         $image_lang             = $imglang;
    1409                                 }
    1410                         }
     1318                $sql_extra = $imgnamelang = '';
     1319
     1320                $sql = 'SELECT imageset_path, imageset_name
     1321                        FROM ' . STYLES_IMAGESET_TABLE . "
     1322                        WHERE imageset_id = $imageset_id";
     1323                $result = $db->sql_query($sql);
     1324                $imageset_row = $db->sql_fetchrow($result);
     1325                $db->sql_freeresult($result);
     1326
     1327                if (!$imageset_row)
     1328                {
     1329                        trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
     1330                }
     1331
     1332                $imageset_path          = $imageset_row['imageset_path'];
     1333                $imageset_name          = $imageset_row['imageset_name'];
     1334
     1335                if (strpos($imgname, '-') !== false)
     1336                {
     1337                        list($imgname, $imgnamelang) = explode('-', $imgname);
     1338                        $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')";
     1339                }
     1340
     1341                $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id
     1342                        FROM ' . STYLES_IMAGESET_DATA_TABLE . "
     1343                        WHERE imageset_id = $imageset_id
     1344                                AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra";
     1345                $result = $db->sql_query($sql);
     1346                $imageset_data_row = $db->sql_fetchrow($result);
     1347                $db->sql_freeresult($result);
     1348
     1349                $image_filename = $imageset_data_row['image_filename'];
     1350                $image_width    = $imageset_data_row['image_width'];
     1351                $image_height   = $imageset_data_row['image_height'];
     1352                $image_lang             = $imageset_data_row['image_lang'];
     1353                $image_id               = $imageset_data_row['image_id'];
     1354                $imgsize                = ($imageset_data_row['image_width'] && $imageset_data_row['image_height']) ? 1 : 0;
     1355
     1356                // Check to see whether the selected image exists in the table
     1357                $valid_name = ($update) ? false : true;
     1358
     1359                foreach ($this->imageset_keys as $category => $img_ary)
     1360                {
     1361                        if (in_array($imgname, $img_ary))
     1362                        {
     1363                                $valid_name = true;
     1364                                break;
     1365                        }
     1366                }
     1367
     1368                if ($update && isset($_POST['imgpath']) && $valid_name)
     1369                {
     1370                        // If imgwidth and imgheight are non-zero grab the actual size
     1371                        // from the image itself ... we ignore width settings for the poll center image
     1372                        $imgwidth       = request_var('imgwidth', 0);
     1373                        $imgheight      = request_var('imgheight', 0);
     1374                        $imgsize        = request_var('imgsize', 0);
     1375                        $imgpath        = request_var('imgpath', '');
     1376                        $imgpath        = str_replace('..', '.', $imgpath);
     1377
     1378                        // If no dimensions selected, we reset width and height to 0 ;)
     1379                        if (!$imgsize)
     1380                        {
     1381                                $imgwidth = $imgheight = 0;
     1382                        }
     1383
     1384                        $imglang = '';
     1385
     1386                        if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
     1387                        {
     1388                                trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
     1389                        }
     1390
     1391                        // Determine width/height. If dimensions included and no width/height given, we detect them automatically...
     1392                        if ($imgsize && $imgpath)
     1393                        {
     1394                                if (!$imgwidth || !$imgheight)
     1395                                {
     1396                                        list($imgwidth_file, $imgheight_file) = getimagesize("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath");
     1397                                        $imgwidth = ($imgwidth) ? $imgwidth : $imgwidth_file;
     1398                                        $imgheight = ($imgheight) ? $imgheight : $imgheight_file;
     1399                                }
     1400                                $imgwidth       = ($imgname != 'poll_center') ? (int) $imgwidth : 0;
     1401                                $imgheight      = (int) $imgheight;
     1402                        }
     1403
     1404                        if (strpos($imgpath, '/') !== false)
     1405                        {
     1406                                list($imglang, $imgfilename) = explode('/', $imgpath);
     1407                        }
     1408                        else
     1409                        {
     1410                                $imgfilename = $imgpath;
     1411                        }
     1412
     1413                        $sql_ary = array(
     1414                                'image_filename'        => (string) $imgfilename,
     1415                                'image_width'           => (int) $imgwidth,
     1416                                'image_height'          => (int) $imgheight,
     1417                                'image_lang'            => (string) $imglang,
     1418                        );
     1419
     1420                        // already exists
     1421                        if ($imageset_data_row)
     1422                        {
     1423                                $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . '
     1424                                        SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
     1425                                        WHERE image_id = $image_id";
     1426                                $db->sql_query($sql);
     1427                        }
     1428                        // does not exist
     1429                        else if (!$imageset_data_row)
     1430                        {
     1431                                $sql_ary['image_name']  = $imgname;
     1432                                $sql_ary['imageset_id'] = (int) $imageset_id;
     1433                                $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
     1434                        }
     1435
     1436                        $cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
     1437
     1438                        add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
     1439
     1440                        $template->assign_var('SUCCESS', true);
     1441
     1442                        $image_filename = $imgfilename;
     1443                        $image_width    = $imgwidth;
     1444                        $image_height   = $imgheight;
     1445                        $image_lang             = $imglang;
    14111446                }
    14121447
     
    15301565                        'NAME'                          => $imageset_name,
    15311566                        'A_NAME'                        => addslashes($imageset_name),
     1567                        'PATH'                          => $imageset_path,
     1568                        'A_PATH'                        => addslashes($imageset_path),
    15321569                        'ERROR'                         => !$valid_name,
    15331570                        'IMG_SRC'                       => ($image_found) ? '../styles/' . $imageset_path . '/imageset/' . $img_val : 'images/no_image.png',
     
    23962433                }
    23972434
    2398 
    23992435                if ($mode == 'template')
    24002436                {
     
    25272563                                        trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file", E_USER_ERROR);
    25282564                                }
    2529                                 $template_data = fread($fp, filesize("{$phpbb_root_path}styles/$template_path$pathfile$file"));
     2565
     2566                                $filesize = filesize("{$phpbb_root_path}styles/$template_path$pathfile$file");
     2567
     2568                                if ($filesize)
     2569                                {
     2570                                        $template_data = fread($fp, $filesize);
     2571                                }
     2572
    25302573                                fclose($fp);
     2574
     2575                                if (!$filesize)
     2576                                {
     2577                                        // File is empty
     2578                                        continue;
     2579                                }
    25312580
    25322581                                if (preg_match_all('#<!-- INCLUDE (.*?\.html) -->#is', $template_data, $matches))
     
    31963245                $db->sql_freeresult($result);
    31973246
    3198 
    31993247                if ($row)
    32003248                {
     
    32113259                if (isset($cfg_data['inherit_from']) && $cfg_data['inherit_from'])
    32123260                {
    3213                         $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb
     3261                        if ($mode === 'template')
     3262                        {
     3263                                $select_bf = ', bbcode_bitfield';
     3264                        }
     3265                        else
     3266                        {
     3267                                $select_bf = '';
     3268                        }
     3269
     3270                        $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, {$mode}_storedb $select_bf
    32143271                                FROM $sql_from
    32153272                                WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "'
     
    32263283                                $inherit_id = $row["{$mode}_id"];
    32273284                                $inherit_path = $row["{$mode}_path"];
     3285                                $inherit_bf = ($mode === 'template') ? $row["bbcode_bitfield"] : false;
    32283286                                $cfg_data['store_db'] = $row["{$mode}_storedb"];
    32293287                                $store_db = $row["{$mode}_storedb"];
     
    32343292                        $inherit_id = 0;
    32353293                        $inherit_path = '';
    3236                 }
    3237 
     3294                        $inherit_bf = false;
     3295                }
    32383296
    32393297                if (sizeof($error))
     
    32553313                                {
    32563314                                        $sql_ary['bbcode_bitfield'] = $cfg_data['template_bitfield'];
     3315                                }
     3316                                else if ($inherit_bf)
     3317                                {
     3318                                        $sql_ary['bbcode_bitfield'] = $inherit_bf;
    32573319                                }
    32583320                                else
     
    35023564                }
    35033565
    3504 
    35053566                $sql = "SELECT {$mode}_inherits_id
    35063567                        FROM $sql_from
  • trunk/forum/includes/acp/acp_update.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_update.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    3838                $errno = 0;
    3939
    40                 $info = get_remote_file('www.phpbb.com', '/updatecheck', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno);
     40                $info = obtain_latest_version_info(request_var('versioncheck_force', false), true);
    4141
    4242                if ($info === false)
    4343                {
    44                         trigger_error($errstr, E_USER_WARNING);
     44                        trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING);
    4545                }
    4646
     
    4949
    5050                $announcement_url = trim($info[1]);
     51                $announcement_url = (strpos($announcement_url, '&amp;') === false) ? str_replace('&', '&amp;', $announcement_url) : $announcement_url;
    5152                $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update');
    5253
     
    6970                        'S_VERSION_CHECK'       => true,
    7071                        'U_ACTION'                      => $this->u_action,
     72                        'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&amp;versioncheck_force=1'),
    7173
    7274                        'LATEST_VERSION'        => $latest_version,
  • trunk/forum/includes/acp/acp_users.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_users.php 8831 2008-09-05 19:02:36Z toonarmy $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    386386                                                        user_active_flip('flip', $user_id);
    387387
     388                                                        if ($user_row['user_type'] == USER_INACTIVE)
     389                                                        {
     390                                                                if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
     391                                                                {
     392                                                                        include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
     393
     394                                                                        $messenger = new messenger(false);
     395
     396                                                                        $messenger->template('admin_welcome_activated', $user_row['user_lang']);
     397
     398                                                                        $messenger->to($user_row['user_email'], $user_row['username']);
     399
     400                                                                        $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
     401                                                                        $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
     402                                                                        $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
     403                                                                        $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
     404
     405                                                                        $messenger->assign_vars(array(
     406                                                                                'USERNAME'      => htmlspecialchars_decode($user_row['username']))
     407                                                                        );
     408
     409                                                                        $messenger->send(NOTIFY_EMAIL);
     410                                                                }
     411                                                        }
     412
    388413                                                        $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
    389414                                                        $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE';
     
    494519                                                        }
    495520
     521                                                break;
     522
     523                                                case 'deloutbox':
     524
     525                                                        if (confirm_box(true))
     526                                                        {
     527                                                                $msg_ids = array();
     528                                                                $lang = 'EMPTY';
     529
     530                                                                $sql = 'SELECT msg_id
     531                                                                        FROM ' . PRIVMSGS_TO_TABLE . "
     532                                                                        WHERE author_id = $user_id
     533                                                                                AND folder_id = " . PRIVMSGS_OUTBOX;
     534                                                                $result = $db->sql_query($sql);
     535
     536                                                                if ($row = $db->sql_fetchrow($result))
     537                                                                {
     538                                                                        if (!function_exists('delete_pm'))
     539                                                                        {
     540                                                                                include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
     541                                                                        }
     542
     543                                                                        do
     544                                                                        {
     545                                                                                $msg_ids[] = (int) $row['msg_id'];
     546                                                                        }
     547                                                                        while ($row = $db->sql_fetchrow($result));
     548
     549                                                                        $db->sql_freeresult($result);
     550
     551                                                                        delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX);
     552
     553                                                                        add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']);
     554
     555                                                                        $lang = 'EMPTIED';
     556                                                                }
     557                                                                $db->sql_freeresult($result);
     558
     559                                                                trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
     560                                                        }
     561                                                        else
     562                                                        {
     563                                                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
     564                                                                        'u'                             => $user_id,
     565                                                                        'i'                             => $id,
     566                                                                        'mode'                  => $mode,
     567                                                                        'action'                => $action,
     568                                                                        'update'                => true))
     569                                                                );
     570                                                        }
    496571                                                break;
    497572
     
    651726
    652727                                                break;
     728
     729                                                case 'leave_nr':
     730
     731                                                        if (confirm_box(true))
     732                                                        {
     733                                                                remove_newly_registered($user_id, $user_row);
     734
     735                                                                add_log('admin', 'LOG_USER_REMOVED_NR', $user_row['username']);
     736                                                                trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
     737                                                        }
     738                                                        else
     739                                                        {
     740                                                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
     741                                                                        'u'                             => $user_id,
     742                                                                        'i'                             => $id,
     743                                                                        'mode'                  => $mode,
     744                                                                        'action'                => $action,
     745                                                                        'update'                => true))
     746                                                                );
     747                                                        }
     748
     749                                                break;
    653750                                        }
    654751
     
    776873                                                        $sql_ary += array(
    777874                                                                'user_email'            => $update_email,
    778                                                                 'user_email_hash'       => crc32($update_email) . strlen($update_email)
     875                                                                'user_email_hash'       => phpbb_email_hash($update_email),
    779876                                                        );
    780877
     
    821918                                if ($user_id == $user->data['user_id'])
    822919                                {
    823                                         $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
     920                                        $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX');
     921                                        if ($user_row['user_new'])
     922                                        {
     923                                                $quick_tool_ary['leave_nr'] = 'LEAVE_NR';
     924                                        }
    824925                                }
    825926                                else
     
    837938                                        }
    838939
    839                                         $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH');
     940                                        $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX');
    840941
    841942                                        if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE))
    842943                                        {
    843944                                                $quick_tool_ary['reactivate'] = 'FORCE';
     945                                        }
     946
     947                                        if ($user_row['user_new'])
     948                                        {
     949                                                $quick_tool_ary['leave_nr'] = 'LEAVE_NR';
    844950                                        }
    845951                                }
     
    9181024                                        'U_MCP_QUEUE'   => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '',
    9191025
    920                                         'U_SWITCH_PERMISSIONS'  => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&amp;u={$user_row['user_id']}") : '',
     1026                                        'U_SWITCH_PERMISSIONS'  => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&amp;u={$user_row['user_id']}&amp;hash=" . generate_link_hash('switchperm')) : '',
    9211027
    9221028                                        'POSTS_IN_QUEUE'        => $user_row['posts_in_queue'],
     
    9731079                                                $sql = 'DELETE FROM ' . LOG_TABLE . '
    9741080                                                        WHERE log_type = ' . LOG_USERS . "
     1081                                                        AND reportee_id = $user_id
    9751082                                                        $where_sql";
    9761083                                                $db->sql_query($sql);
     
    10321139                                        );
    10331140                                }
     1141
     1142                        break;
     1143
     1144                        case 'warnings':
     1145                                $user->add_lang('mcp');
     1146
     1147                                // Set up general vars
     1148                                $start          = request_var('start', 0);
     1149                                $deletemark     = (isset($_POST['delmarked'])) ? true : false;
     1150                                $deleteall      = (isset($_POST['delall'])) ? true : false;
     1151                                $confirm        = (isset($_POST['confirm'])) ? true : false;
     1152                                $marked         = request_var('mark', array(0));
     1153                                $message        = utf8_normalize_nfc(request_var('message', '', true));
     1154
     1155                                // Sort keys
     1156                                $sort_days      = request_var('st', 0);
     1157                                $sort_key       = request_var('sk', 't');
     1158                                $sort_dir       = request_var('sd', 'd');
     1159
     1160                                // Delete entries if requested and able
     1161                                if ($deletemark || $deleteall || $confirm)
     1162                                {
     1163                                        if (confirm_box(true))
     1164                                        {
     1165                                                $where_sql = '';
     1166                                                $deletemark = request_var('delmarked', 0);
     1167                                                $deleteall = request_var('delall', 0);
     1168                                                if ($deletemark && $marked)
     1169                                                {
     1170                                                        $where_sql = ' AND ' . $db->sql_in_set('warning_id', array_values($marked));
     1171                                                }
     1172
     1173                                                if ($where_sql || $deleteall)
     1174                                                {
     1175                                                        $sql = 'DELETE FROM ' . WARNINGS_TABLE . "
     1176                                                                WHERE user_id = $user_id
     1177                                                                        $where_sql";
     1178                                                        $db->sql_query($sql);
     1179
     1180                                                        if ($deleteall)
     1181                                                        {
     1182                                                                $log_warnings = $deleted_warnings = 0;
     1183                                                        }
     1184                                                        else
     1185                                                        {
     1186                                                                $num_warnings = (int) $db->sql_affectedrows();
     1187                                                                $deleted_warnings = ' user_warnings - ' . $num_warnings;
     1188                                                                $log_warnings = ($num_warnings > 2) ? 2 : $num_warnings;
     1189                                                        }
     1190
     1191                                                        $sql = 'UPDATE ' . USERS_TABLE . "
     1192                                                                SET user_warnings = $deleted_warnings
     1193                                                                WHERE user_id = $user_id";
     1194                                                        $db->sql_query($sql);
     1195
     1196                                                        switch ($log_warnings)
     1197                                                        {
     1198                                                                case 2:
     1199                                                                        add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings);
     1200                                                                break;
     1201                                                                case 1:
     1202                                                                        add_log('admin', 'LOG_WARNING_DELETED', $user_row['username']);
     1203                                                                break;
     1204                                                                default:
     1205                                                                        add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']);
     1206                                                                break;
     1207                                                        }
     1208                                                }
     1209                                        }
     1210                                        else
     1211                                        {
     1212                                                $s_hidden_fields = array(
     1213                                                        'i'                             => $id,
     1214                                                        'mode'                  => $mode,
     1215                                                        'u'                             => $user_id,
     1216                                                        'mark'                  => $marked,
     1217                                                );
     1218                                                if (isset($_POST['delmarked']))
     1219                                                {
     1220                                                        $s_hidden_fields['delmarked'] = 1;
     1221                                                }
     1222                                                if (isset($_POST['delall']))
     1223                                                {
     1224                                                        $s_hidden_fields['delall'] = 1;
     1225                                                }
     1226                                                if (isset($_POST['delall']) || (isset($_POST['delmarked']) && sizeof($marked)))
     1227                                                {
     1228                                                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields));
     1229                                                }
     1230                                        }
     1231                                }
     1232
     1233                                $sql = 'SELECT w.warning_id, w.warning_time, w.post_id, l.log_operation, l.log_data, l.user_id AS mod_user_id, m.username AS mod_username, m.user_colour AS mod_user_colour
     1234                                        FROM ' . WARNINGS_TABLE . ' w
     1235                                        LEFT JOIN ' . LOG_TABLE . ' l
     1236                                                ON (w.log_id = l.log_id)
     1237                                        LEFT JOIN ' . USERS_TABLE . ' m
     1238                                                ON (l.user_id = m.user_id)
     1239                                        WHERE w.user_id = ' . $user_id . '
     1240                                        ORDER BY w.warning_time DESC';
     1241                                $result = $db->sql_query($sql);
     1242
     1243                                while ($row = $db->sql_fetchrow($result))
     1244                                {
     1245                                        if (!$row['log_operation'])
     1246                                        {
     1247                                                // We do not have a log-entry anymore, so there is no data available
     1248                                                $row['action'] = $user->lang['USER_WARNING_LOG_DELETED'];
     1249                                        }
     1250                                        else
     1251                                        {
     1252                                                $row['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}';
     1253                                                if (!empty($row['log_data']))
     1254                                                {
     1255                                                        $log_data_ary = @unserialize($row['log_data']);
     1256                                                        $log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary;
     1257
     1258                                                        if (isset($user->lang[$row['log_operation']]))
     1259                                                        {
     1260                                                                // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array
     1261                                                                // It doesn't matter if we add more arguments than placeholders
     1262                                                                if ((substr_count($row['action'], '%') - sizeof($log_data_ary)) > 0)
     1263                                                                {
     1264                                                                        $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - sizeof($log_data_ary), ''));
     1265                                                                }
     1266                                                                $row['action'] = vsprintf($row['action'], $log_data_ary);
     1267                                                                $row['action'] = bbcode_nl2br(censor_text($row['action']));
     1268                                                        }
     1269                                                        else if (!empty($log_data_ary))
     1270                                                        {
     1271                                                                $row['action'] .= '<br />' . implode('', $log_data_ary);
     1272                                                        }
     1273                                                }
     1274                                        }
     1275
     1276
     1277                                        $template->assign_block_vars('warn', array(
     1278                                                'ID'            => $row['warning_id'],
     1279                                                'USERNAME'      => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-',
     1280                                                'ACTION'        => make_clickable($row['action']),
     1281                                                'DATE'          => $user->format_date($row['warning_time']),
     1282                                        ));
     1283                                }
     1284                                $db->sql_freeresult($result);
     1285
     1286                                $template->assign_vars(array(
     1287                                        'S_WARNINGS'    => true,
     1288                                ));
    10341289
    10351290                        break;
     
    11361391
    11371392                                                // Update Custom Fields
    1138                                                 if (sizeof($cp_data))
    1139                                                 {
    1140                                                         switch ($db->sql_layer)
    1141                                                         {
    1142                                                                 case 'oracle':
    1143                                                                 case 'firebird':
    1144                                                                 case 'postgres':
    1145                                                                         $right_delim = $left_delim = '"';
    1146                                                                 break;
    1147 
    1148                                                                 case 'sqlite':
    1149                                                                 case 'mssql':
    1150                                                                 case 'mssql_odbc':
    1151                                                                         $right_delim = ']';
    1152                                                                         $left_delim = '[';
    1153                                                                 break;
    1154 
    1155                                                                 case 'mysql':
    1156                                                                 case 'mysql4':
    1157                                                                 case 'mysqli':
    1158                                                                         $right_delim = $left_delim = '`';
    1159                                                                 break;
    1160                                                         }
    1161 
    1162                                                         foreach ($cp_data as $key => $value)
    1163                                                         {
    1164                                                                 $cp_data[$left_delim . $key . $right_delim] = $value;
    1165                                                                 unset($cp_data[$key]);
    1166                                                         }
    1167 
    1168                                                         $sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . '
    1169                                                                 SET ' . $db->sql_build_array('UPDATE', $cp_data) . "
    1170                                                                 WHERE user_id = $user_id";
    1171                                                         $db->sql_query($sql);
    1172 
    1173                                                         if (!$db->sql_affectedrows())
    1174                                                         {
    1175                                                                 $cp_data['user_id'] = (int) $user_id;
    1176 
    1177                                                                 $db->sql_return_on_error(true);
    1178 
    1179                                                                 $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data);
    1180                                                                 $db->sql_query($sql);
    1181 
    1182                                                                 $db->sql_return_on_error(false);
    1183                                                         }
    1184                                                 }
     1393                                                $cp->update_profile_field_data($user_id, $cp_data);
    11851394
    11861395                                                trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
     
    12081417                                $now = getdate();
    12091418                                $s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>';
    1210                                 for ($i = $now['year'] - 100; $i < $now['year']; $i++)
     1419                                for ($i = $now['year'] - 100; $i <= $now['year']; $i++)
    12111420                                {
    12121421                                        $selected = ($i == $data['bday_year']) ? ' selected="selected"' : '';
     
    14751684                                }
    14761685
     1686                                if (!$config['allow_avatar'] && $user_row['user_avatar_type'])
     1687                                {
     1688                                        $error[] = $user->lang['USER_AVATAR_NOT_ALLOWED'];
     1689                                }
     1690                                else if ((($user_row['user_avatar_type'] == AVATAR_UPLOAD) && !$config['allow_avatar_upload']) ||
     1691                                 (($user_row['user_avatar_type'] == AVATAR_REMOTE) && !$config['allow_avatar_remote']) ||
     1692                                 (($user_row['user_avatar_type'] == AVATAR_GALLERY) && !$config['allow_avatar_local']))
     1693                                {
     1694                                        $error[] = $user->lang['USER_AVATAR_TYPE_NOT_ALLOWED'];
     1695                                }
     1696
    14771697                                // Generate users avatar
    1478                                 $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height']) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
     1698                                $avatar_img = ($user_row['user_avatar']) ? get_user_avatar($user_row['user_avatar'], $user_row['user_avatar_type'], $user_row['user_avatar_width'], $user_row['user_avatar_height'], 'USER_AVATAR', true) : '<img src="' . $phpbb_admin_path . 'images/no_avatar.gif" alt="" />';
    14791699
    14801700                                $display_gallery = (isset($_POST['display_gallery'])) ? true : false;
     
    14891709                                $template->assign_vars(array(
    14901710                                        'S_AVATAR'                      => true,
    1491                                         'S_CAN_UPLOAD'          => ($can_upload && $config['allow_avatar_upload']) ? true : false,
    1492                                         'S_ALLOW_REMOTE'        => ($config['allow_avatar_remote']) ? true : false,
    1493                                         'S_DISPLAY_GALLERY'     => ($config['allow_avatar_local'] && !$display_gallery) ? true : false,
    1494                                         'S_IN_GALLERY'          => ($config['allow_avatar_local'] && $display_gallery) ? true : false,
     1711                                        'S_CAN_UPLOAD'          => $can_upload,
     1712                                        'S_UPLOAD_FILE'         => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_upload']) ? true : false,
     1713                                        'S_REMOTE_UPLOAD'       => ($config['allow_avatar'] && $can_upload && $config['allow_avatar_remote_upload']) ? true : false,
     1714                                        'S_ALLOW_REMOTE'        => ($config['allow_avatar'] && $config['allow_avatar_remote']) ? true : false,
     1715                                        'S_DISPLAY_GALLERY'     => ($config['allow_avatar'] && $config['allow_avatar_local'] && !$display_gallery) ? true : false,
     1716                                        'S_IN_GALLERY'          => ($config['allow_avatar'] && $config['allow_avatar_local'] && $display_gallery) ? true : false,
    14951717
    14961718                                        'AVATAR_IMAGE'                  => $avatar_img,
     
    15501772                                include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    15511773
    1552                                 $enable_bbcode  = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', !$user->optionget('bbcode'))) ? false : true) : false;
    1553                                 $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', !$user->optionget('smilies'))) ? false : true) : false;
    1554                                 $enable_urls    = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
     1774                                $enable_bbcode  = ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false;
     1775                                $enable_smilies = ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false;
     1776                                $enable_urls    = ($config['allow_sig_links']) ? (bool) $this->optionget($user_row, 'sig_links') : false;
    15551777                                $signature              = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true));
    15561778
     
    15601782                                {
    15611783                                        include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
     1784
     1785                                        $enable_bbcode  = ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false;
     1786                                        $enable_smilies = ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false;
     1787                                        $enable_urls    = ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false;
    15621788
    15631789                                        $message_parser = new parse_message($signature);
     
    15781804                                        if (!sizeof($error) && $submit)
    15791805                                        {
     1806                                                $this->optionset($user_row, 'sig_bbcode', $enable_bbcode);
     1807                                                $this->optionset($user_row, 'sig_smilies', $enable_smilies);
     1808                                                $this->optionset($user_row, 'sig_links', $enable_urls);
     1809
    15801810                                                $sql_ary = array(
    15811811                                                        'user_sig'                                      => (string) $message_parser->message,
     1812                                                        'user_options'                          => $user_row['user_options'],
    15821813                                                        'user_sig_bbcode_uid'           => (string) $message_parser->bbcode_uid,
    15831814                                                        'user_sig_bbcode_bitfield'      => (string) $message_parser->bbcode_bitfield
     
    18472078
    18482079                                                        $error = array();
     2080
     2081                                                        // The delete action was successful - therefore update the user row...
     2082                                                        $sql = 'SELECT u.*, s.*
     2083                                                                FROM ' . USERS_TABLE . ' u
     2084                                                                        LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id)
     2085                                                                WHERE u.user_id = ' . $user_id . '
     2086                                                                ORDER BY s.session_time DESC';
     2087                                                        $result = $db->sql_query($sql);
     2088                                                        $user_row = $db->sql_fetchrow($result);
     2089                                                        $db->sql_freeresult($result);
    18492090                                                }
    18502091                                                else
     
    18602101
    18612102                                        break;
     2103
     2104                                        case 'approve':
     2105
     2106                                                if (confirm_box(true))
     2107                                                {
     2108                                                        if (!$group_id)
     2109                                                        {
     2110                                                                trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
     2111                                                        }
     2112                                                        group_user_attributes($action, $group_id, $user_id);
     2113                                                }
     2114                                                else
     2115                                                {
     2116                                                        confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
     2117                                                                'u'                             => $user_id,
     2118                                                                'i'                             => $id,
     2119                                                                'mode'                  => $mode,
     2120                                                                'action'                => $action,
     2121                                                                'g'                             => $group_id))
     2122                                                        );
     2123                                                }
     2124
     2125                                        break;
    18622126                                }
    18632127
     
    19522216                                                        'U_DEMOTE_PROMOTE'      => $this->u_action . '&amp;action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&amp;u=$user_id&amp;g=" . $data['group_id'],
    19532217                                                        'U_DELETE'                      => $this->u_action . "&amp;action=delete&amp;u=$user_id&amp;g=" . $data['group_id'],
     2218                                                        'U_APPROVE'                     => ($group_type == 'pending') ? $this->u_action . "&amp;action=approve&amp;u=$user_id&amp;g=" . $data['group_id'] : '',
    19542219
    19552220                                                        'GROUP_NAME'            => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'],
    19562221                                                        'L_DEMOTE_PROMOTE'      => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'],
    19572222
     2223                                                        'S_IS_MEMBER'           => ($group_type != 'pending') ? true : false,
    19582224                                                        'S_NO_DEFAULT'          => ($user_row['group_id'] != $data['group_id']) ? true : false,
    19592225                                                        'S_SPECIAL_GROUP'       => ($group_type == 'special') ? true : false,
  • trunk/forum/includes/acp/acp_words.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_words.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    2424{
    2525        var $u_action;
    26        
     26
    2727        function main($id, $mode)
    2828        {
     
    4848                {
    4949                        case 'edit':
     50
    5051                                $word_id = request_var('id', 0);
    51                                
     52
    5253                                if (!$word_id)
    5354                                {
     
    7475                                        'S_HIDDEN_FIELDS'       => $s_hidden_fields)
    7576                                );
    76                                
     77
    7778                                return;
    7879
     
    8586                                        trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
    8687                                }
     88
    8789                                $word_id                = request_var('id', 0);
    8890                                $word                   = utf8_normalize_nfc(request_var('word', '', true));
    8991                                $replacement    = utf8_normalize_nfc(request_var('replacement', '', true));
    90                                
    91                                 if (!$word || !$replacement)
     92
     93                                if ($word === '' || $replacement === '')
    9294                                {
    9395                                        trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING);
  • trunk/forum/includes/acp/auth.php

    r400 r702  
    33*
    44* @package phpBB3
    5 * @version $Id: auth.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    5959                }
    6060        }
    61        
     61
    6262        /**
    6363        * Get permission mask
     
    141141                                }
    142142
    143                                
     143
    144144                                $hold_ary[$userdata['user_id']] = array();
    145145                                foreach ($forum_ids as $f_id)
     
    346346                // Build js roles array (role data assignments)
    347347                $s_role_js_array = '';
    348                
     348
    349349                if (sizeof($roles))
    350350                {
     
    697697                $cur_options = array();
    698698
     699                // Determine current options
    699700                $sql = 'SELECT auth_option, is_global, is_local
    700701                        FROM ' . ACL_OPTIONS_TABLE . '
     
    704705                while ($row = $db->sql_fetchrow($result))
    705706                {
    706                         if ($row['is_global'])
    707                         {
    708                                 $cur_options['global'][] = $row['auth_option'];
    709                         }
    710 
    711                         if ($row['is_local'])
    712                         {
    713                                 $cur_options['local'][] = $row['auth_option'];
    714                         }
     707                        $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local');
    715708                }
    716709                $db->sql_freeresult($result);
     
    727720                        foreach ($option_ary as $option_value)
    728721                        {
    729                                 if (!in_array($option_value, $cur_options[$type]))
    730                                 {
    731                                         $new_options[$type][] = $option_value;
    732                                 }
     722                                $new_options[$type][] = $option_value;
    733723
    734724                                $flag = substr($option_value, 0, strpos($option_value, '_') + 1);
    735725
    736                                 if (!in_array($flag, $cur_options[$type]) && !in_array($flag, $new_options[$type]))
     726                                if (!in_array($flag, $new_options[$type]))
    737727                                {
    738728                                        $new_options[$type][] = $flag;
     
    745735                $options['local'] = array_diff($new_options['local'], $new_options['global']);
    746736                $options['global'] = array_diff($new_options['global'], $new_options['local']);
    747                 $options['local_global'] = array_intersect($new_options['local'], $new_options['global']);
    748 
    749                 $sql_ary = array();
    750 
     737                $options['both'] = array_intersect($new_options['local'], $new_options['global']);
     738
     739                // Now check which options to add/update
     740                $add_options = $update_options = array();
     741
     742                // First local ones...
    751743                foreach ($options as $type => $option_ary)
    752744                {
    753745                        foreach ($option_ary as $option)
    754746                        {
    755                                 $sql_ary[] = array(
    756                                         'auth_option'   => (string) $option,
    757                                         'is_global'             => ($type == 'global' || $type == 'local_global') ? 1 : 0,
    758                                         'is_local'              => ($type == 'local' || $type == 'local_global') ? 1 : 0
    759                                 );
    760                         }
    761                 }
    762 
    763                 $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
     747                                if (!isset($cur_options[$option]))
     748                                {
     749                                        $add_options[] = array(
     750                                                'auth_option'   => (string) $option,
     751                                                'is_global'             => ($type == 'global' || $type == 'both') ? 1 : 0,
     752                                                'is_local'              => ($type == 'local' || $type == 'both') ? 1 : 0
     753                                        );
     754
     755                                        continue;
     756                                }
     757
     758                                // Else, update existing entry if it is changed...
     759                                if ($type === $cur_options[$option])
     760                                {
     761                                        continue;
     762                                }
     763
     764                                // New type is always both:
     765                                // If is now both, we set both.
     766                                // If it was global the new one is local and we need to set it to both
     767                                // If it was local the new one is global and we need to set it to both
     768                                $update_options[] = $option;
     769                        }
     770                }
     771
     772                if (!empty($add_options))
     773                {
     774                        $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options);
     775                }
     776
     777                if (!empty($update_options))
     778                {
     779                        $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . '
     780                                SET is_global = 1, is_local = 1
     781                                WHERE ' . $db->sql_in_set('auth_option', $update_options);
     782                        $db->sql_query($sql);
     783                }
    764784
    765785                $cache->destroy('_acl_options');
     
    803823                $flag = key($auth);
    804824                $flag = substr($flag, 0, strpos($flag, '_') + 1);
    805                
     825
    806826                // This ID (the any-flag) is set if one or more permissions are true...
    807827                $any_option_id = (int) $this->acl_options['id'][$flag];
     
    917937                $flag = key($auth);
    918938                $flag = substr($flag, 0, strpos($flag, '_') + 1);
    919                
     939
    920940                // Remove any-flag from auth ary
    921941                if (isset($auth[$flag]))
     
    10681088                        $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary));
    10691089                }
    1070                
     1090
    10711091                $sql = "DELETE FROM $table
    10721092                        WHERE " . implode(' AND ', $where_sql);
     
    10911111                                'S_NEVER'       => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false,
    10921112                                'S_NO'          => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false,
    1093                                                        
     1113
    10941114                                'CAT_NAME'      => $user->lang['permission_cat'][$cat])
    10951115                        );
     
    11801200                                        );
    11811201                                }
    1182                        
     1202
    11831203                                $cat = $user->lang['acl_' . $permission]['cat'];
    1184                        
     1204
    11851205                                // Build our categories array
    11861206                                if (!isset($categories[$cat]))
  • trunk/forum/includes/acp/info/acp_board.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_board.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    2727                                'post'                  => array('title' => 'ACP_POST_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
    2828                                'signature'             => array('title' => 'ACP_SIGNATURE_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
     29                                'feed'                  => array('title' => 'ACP_FEED_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
    2930                                'registration'  => array('title' => 'ACP_REGISTER_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),
    3031
  • trunk/forum/includes/acp/info/acp_permissions.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_permissions.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    2525
    2626                                'setting_forum_local'   => array('title' => 'ACP_FORUM_PERMISSIONS', 'auth' => 'acl_a_fauth && (acl_a_authusers || acl_a_authgroups)', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')),
     27                                'setting_forum_copy'    => array('title' => 'ACP_FORUM_PERMISSIONS_COPY', 'auth' => 'acl_a_fauth && acl_a_authusers && acl_a_authgroups && acl_a_mauth', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')),
    2728                                'setting_mod_local'             => array('title' => 'ACP_FORUM_MODERATORS', 'auth' => 'acl_a_mauth && (acl_a_authusers || acl_a_authgroups)', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')),
    2829                                'setting_user_global'   => array('title' => 'ACP_USERS_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_aauth || acl_a_mauth || acl_a_uauth)', 'cat' => array('ACP_GLOBAL_PERMISSIONS', 'ACP_CAT_USERS')),
  • trunk/forum/includes/acp/info/acp_users.php

    r400 r702  
    33*
    44* @package acp
    5 * @version $Id: acp_users.php 8479 2008-03-29 00:22:48Z naderman $
     5* @version $Id$
    66* @copyright (c) 2005 phpBB Group
    77* @license http://opensource.org/licenses/gpl-license.php GNU Public License
     
    2323                                'overview'              => array('title' => 'ACP_MANAGE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')),
    2424                                'feedback'              => array('title' => 'ACP_USER_FEEDBACK', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
     25                                'warnings'              => array('title' => 'ACP_USER_WARNINGS', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
    2526                                'profile'               => array('title' => 'ACP_USER_PROFILE', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
    2627                                'prefs'                 => array('title' => 'ACP_USER_PREFS', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')),
Note: See TracChangeset for help on using the changeset viewer.