Changeset 702 for trunk/forum/includes/acp
- Timestamp:
- Mar 31, 2010, 6:32:40 PM (15 years ago)
- Location:
- trunk/forum/includes/acp
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/forum/includes/acp/acp_attachments.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_attachments.php 9041 2008-11-02 11:19:12Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 125 125 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 126 126 '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']), 128 128 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int', 'type' => 'text:7:15', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 129 129 'img_imagick' => array('lang' => 'IMAGICK_PATH', 'validate' => 'string', 'type' => 'text:20:200', 'explain' => true, 'append' => ' <span>[ <a href="' . $this->u_action . '&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']), 132 132 ) 133 133 ); … … 685 685 } 686 686 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']; 689 690 690 691 $img_path = $config['upload_icons_path']; … … 695 696 $imglist = filelist($phpbb_root_path . $img_path); 696 697 697 if ( sizeof($imglist))698 if (!empty($imglist[''])) 698 699 { 699 700 $imglist = array_values($imglist); … … 1004 1005 if ($files_added) 1005 1006 { 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); 1008 1009 } 1009 1010 } … … 1027 1028 'FILESIZE' => get_formatted_filesize($row['filesize']), 1028 1029 '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']), 1031 1032 'ATTACH_ID' => $row['attach_id'], 1032 1033 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '', … … 1430 1431 { 1431 1432 // 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']; 1434 1436 1435 1437 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 3 3 * 4 4 * @package acp 5 * @version $Id : acp_ban.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 157 157 WHERE (ban_end >= ' . time() . " 158 158 OR ban_end = 0) 159 AND ban_ip <> ''"; 159 AND ban_ip <> '' 160 ORDER BY ban_ip"; 160 161 break; 161 162 … … 169 170 WHERE (ban_end >= ' . time() . " 170 171 OR ban_end = 0) 171 AND ban_email <> ''"; 172 AND ban_email <> '' 173 ORDER BY ban_email"; 172 174 break; 173 175 } … … 182 184 183 185 $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 } 185 202 186 203 $ban_reasons[$row['ban_id']] = $row['ban_reason']; -
trunk/forum/includes/acp/acp_bbcodes.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_bbcodes.php 8743 2008-08-12 16:03:18Z Kellanved$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 125 125 case 'create': 126 126 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 204 212 { 205 213 $bbcode_id = NUM_CORE_BBCODES + 1; 206 214 } 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'; 207 228 } 208 229 else 209 230 { 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)); 225 244 } 226 245 else 227 246 { 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 } 241 257 242 258 break; … … 300 316 $bbcode_match = trim($bbcode_match); 301 317 $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 } 302 330 303 331 $fp_match = preg_quote($bbcode_match, '!'); … … 326 354 'SIMPLETEXT' => array( 327 355 '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" 356 ), 357 'INTTEXT' => array( 358 ($utf8_pcre_properties) ? '!([\p{L}\p{N}\-+,_. ]+)!u' : '!([a-zA-Z0-9\-+,_. ]+)!u' => "$1" 328 359 ), 329 360 'IDENTIFIER' => array( … … 344 375 'TEXT' => '(.*?)', 345 376 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', 377 'INTTEXT' => ($utf8_pcre_properties) ? '([\p{L}\p{N}\-+,_. ]+)' : '([a-zA-Z0-9\-+,_. ]+)', 346 378 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 347 379 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', … … 351 383 $pad = 0; 352 384 $modifiers = 'i'; 385 $modifiers .= ($utf8 && $utf8_pcre_properties) ? 'u' : ''; 353 386 354 387 if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m)) … … 399 432 400 433 $fp_match = '!' . $fp_match . '!' . $modifiers; 401 $sp_match = '!' . $sp_match . '!s' ;434 $sp_match = '!' . $sp_match . '!s' . (($utf8) ? 'u' : ''); 402 435 403 436 if (strpos($fp_match, 'e') !== false) -
trunk/forum/includes/acp/acp_board.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_board.php 8911 2008-09-23 13:03:33Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 30 30 global $db, $user, $auth, $template; 31 31 global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; 32 global $cache; 32 33 33 34 $user->add_lang('acp/board'); 34 35 35 36 $action = request_var('action', ''); 36 $submit = (isset($_POST['submit']) ) ? true : false;37 $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; 37 38 38 39 $form_key = 'acp_board'; … … 65 66 'legend2' => 'WARNINGS', 66 67 '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', 67 70 ) 68 71 ); … … 80 83 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 81 84 '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), 82 86 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 83 87 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), … … 86 90 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 87 91 '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), 88 93 89 94 'legend2' => 'ACP_LOAD_SETTINGS', … … 94 99 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 95 100 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 101 102 'legend3' => 'ACP_SUBMIT_CHANGES', 96 103 ) 97 104 ); … … 109 116 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), 110 117 118 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 111 119 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 112 120 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 113 121 '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), 114 123 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), 115 124 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:3:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), … … 144 153 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 145 154 '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', 147 158 ) 148 159 ); … … 163 174 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 164 175 '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), 165 177 166 178 '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),169 179 'bump_type' => false, 170 180 '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']), 171 182 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 172 183 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0', 'type' => 'text:3:10', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), … … 174 185 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1', 'type' => 'text:3:4', 'explain' => false), 175 186 '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), 176 188 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true), 177 189 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false), 178 190 '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), 179 192 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true), 180 193 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true), … … 183 196 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 184 197 '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', 185 200 ) 186 201 ); … … 206 221 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), 207 222 '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', 208 225 ) 209 226 ); … … 219 236 220 237 '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), 221 240 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), 222 241 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), … … 236 255 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), 237 256 '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), 238 287 ) 239 288 ); … … 280 329 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 281 330 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 331 332 'legend4' => 'ACP_SUBMIT_CHANGES', 282 333 ) 283 334 ); … … 313 364 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0', 'type' => 'text:5:5', 'explain' => true), 314 365 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), 366 367 'legend4' => 'ACP_SUBMIT_CHANGES', 315 368 ) 316 369 ); … … 361 414 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 362 415 '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', 364 419 ) 365 420 ); … … 401 456 } 402 457 403 if ($config_name == 'auth_method' )458 if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') 404 459 { 405 460 continue; … … 418 473 { 419 474 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'); 421 491 } 422 492 … … 795 865 796 866 /** 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 /** 797 881 * Select default dateformat 798 882 */ … … 831 915 <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />"; 832 916 } 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 833 986 } 834 987 -
trunk/forum/includes/acp/acp_captcha.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_captcha.php 8722 2008-07-29 15:13:13Z Kellanved$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 30 30 $user->add_lang('acp/board'); 31 31 32 include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx); 33 $captchas = phpbb_captcha_factory::get_captcha_types(); 32 34 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); 39 38 40 if (isset($_GET['demo'])) 39 40 // Oh, they are just here for the view 41 if (isset($_GET['captcha_demo'])) 41 42 { 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)) 44 70 { 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)); 46 96 } 47 if ($config['captcha_gd'])97 else if ($submit) 48 98 { 49 include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);99 trigger_error($user->lang['FORM_INVALID'] . adm_back_link()); 50 100 } 51 101 else 52 102 { 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 )); 54 128 } 55 $captcha = new captcha();56 $captcha->execute(gen_rand_string(mt_rand(5, 8)), time());57 exit;58 129 } 130 } 59 131 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; 65 138 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(); 70 142 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&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 .= "&$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(); 119 145 } 120 146 } -
trunk/forum/includes/acp/acp_database.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_database.php 8814 2008-09-04 12:01:47Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 28 28 global $cache, $db, $user, $auth, $template, $table_prefix; 29 29 global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; 30 30 31 31 $user->add_lang('acp/database'); 32 32 … … 83 83 84 84 @set_time_limit(1200); 85 @set_time_limit(0); 85 86 86 87 $time = time(); … … 142 143 143 144 case 'oracle': 144 $extractor->flush('TRUNCATE TABLE ' . $table_name . " \\\n");145 $extractor->flush('TRUNCATE TABLE ' . $table_name . "/\n"); 145 146 break; 146 147 … … 188 189 'U_ACTION' => $this->u_action . '&action=download' 189 190 )); 190 191 191 192 $available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2'); 192 193 … … 425 426 $dh = @opendir($dir); 426 427 428 $backup_files = array(); 429 427 430 if ($dh) 428 431 { … … 431 434 if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches)) 432 435 { 433 $supported = in_array($matches[2], $methods); 434 435 if ($supported == 'true') 436 if (in_array($matches[2], $methods)) 436 437 { 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; 442 439 } 443 440 } 444 441 } 445 442 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 } 446 457 } 447 458 … … 509 520 header("Content-Type: $mimetype; name=\"$name\""); 510 521 header("Content-disposition: attachment; filename=$name"); 511 522 512 523 switch ($format) 513 524 { … … 528 539 } 529 540 } 530 541 531 542 if ($store == true) 532 543 { 533 544 global $phpbb_root_path; 534 545 $file = $phpbb_root_path . 'store/' . $filename . $ext; 535 546 536 547 $this->fp = $open($file, 'w'); 537 548 538 549 if (!$this->fp) 539 550 { 540 trigger_error(' Unable to write temporary file to storage folder', E_USER_ERROR);551 trigger_error('FILE_WRITE_FAIL', E_USER_ERROR); 541 552 } 542 553 } … … 546 557 { 547 558 static $close; 559 548 560 if ($this->store) 549 561 { … … 663 675 { 664 676 $fields_cnt = mysqli_num_fields($result); 665 677 666 678 // Get field information 667 679 $field = mysqli_fetch_fields($result); 668 680 $field_set = array(); 669 681 670 682 for ($j = 0; $j < $fields_cnt; $j++) 671 683 { … … 680 692 $query_len = 0; 681 693 $max_len = get_usable_memory(); 682 694 683 695 while ($row = mysqli_fetch_row($result)) 684 696 { … … 751 763 } 752 764 $field_set = array(); 753 765 754 766 for ($j = 0; $j < $fields_cnt; $j++) 755 767 { … … 967 979 } 968 980 $db->sql_freeresult($result); 969 981 970 982 foreach ($ar as $value) 971 983 { … … 1125 1137 } 1126 1138 $db->sql_freeresult($result); 1127 1139 1128 1140 $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 1129 1141 FROM pg_class c, pg_attribute a, pg_type t … … 1146 1158 AND d.adnum = " . $row['attnum']; 1147 1159 $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)) 1150 1164 { 1151 1165 unset($row['rowdefault']); … … 1153 1167 else 1154 1168 { 1155 $row['rowdefault'] = $db->sql_fetchfield('rowdefault', false, $def_res); 1156 } 1157 $db->sql_freeresult($def_res); 1169 $row['rowdefault'] = $def_row['rowdefault']; 1170 } 1158 1171 1159 1172 if ($row['type'] == 'bpchar') … … 1189 1202 $line .= ' NOT NULL'; 1190 1203 } 1191 1204 1192 1205 $lines[] = $line; 1193 1206 } … … 1389 1402 $sql_data .= "\nCREATE TABLE [$table_name] (\n"; 1390 1403 $rows = array(); 1391 1404 1392 1405 $text_flag = false; 1393 1406 1394 1407 $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY 1395 1408 FROM INFORMATION_SCHEMA.COLUMNS 1396 1409 WHERE TABLE_NAME = '$table_name'"; 1397 1410 $result = $db->sql_query($sql); 1398 1411 1399 1412 while ($row = $db->sql_fetchrow($result)) 1400 1413 { 1401 1414 $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]"; 1402 1415 1403 1416 if ($row['DATA_TYPE'] == 'text') 1404 1417 { 1405 1418 $text_flag = true; 1406 1419 } 1407 1420 1408 1421 if ($row['IS_IDENTITY']) 1409 1422 { 1410 1423 $line .= ' IDENTITY (1 , 1)'; 1411 1424 } 1412 1425 1413 1426 if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text') 1414 1427 { 1415 1428 $line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')'; 1416 1429 } 1417 1430 1418 1431 if ($row['IS_NULLABLE'] == 'YES') 1419 1432 { … … 1424 1437 $line .= ' NOT NULL'; 1425 1438 } 1426 1439 1427 1440 if ($row['COLUMN_DEFAULT']) 1428 1441 { 1429 1442 $line .= ' DEFAULT ' . $row['COLUMN_DEFAULT']; 1430 1443 } 1431 1444 1432 1445 $rows[] = $line; 1433 1446 } 1434 1447 $db->sql_freeresult($result); 1435 1448 1436 1449 $sql_data .= implode(",\n", $rows); 1437 1450 $sql_data .= "\n) ON [PRIMARY]"; 1438 1451 1439 1452 if ($text_flag) 1440 1453 { 1441 1454 $sql_data .= " TEXTIMAGE_ON [PRIMARY]"; 1442 1455 } 1443 1456 1444 1457 $sql_data .= "\nGO\n\n"; 1445 1458 $rows = array(); 1446 1459 1447 1460 $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME 1448 1461 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE … … 1464 1477 } 1465 1478 $db->sql_freeresult($result); 1466 1479 1467 1480 $index = array(); 1468 1481 $sql = "EXEC sp_statistics '$table_name'"; … … 1476 1489 } 1477 1490 $db->sql_freeresult($result); 1478 1491 1479 1492 foreach ($index as $index_name => $column_name) 1480 1493 { 1481 1494 $index[$index_name] = implode(', ', $column_name); 1482 1495 } 1483 1496 1484 1497 foreach ($index as $index_name => $columns) 1485 1498 { … … 1509 1522 $ident_set = false; 1510 1523 $sql_data = ''; 1511 1524 1512 1525 // Grab all of the data from current table. 1513 1526 $sql = "SELECT * … … 1603 1616 $ident_set = false; 1604 1617 $sql_data = ''; 1605 1618 1606 1619 // Grab all of the data from current table. 1607 1620 $sql = "SELECT * … … 1704 1717 global $db; 1705 1718 $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"; 1708 1720 $sql_data .= "\nCREATE TABLE $table_name (\n"; 1709 1721 … … 1720 1732 if ($row['data_type'] !== 'CLOB') 1721 1733 { 1722 if ($row['data_type'] !== 'VARCHAR2' )1734 if ($row['data_type'] !== 'VARCHAR2' && $row['data_type'] !== 'CHAR') 1723 1735 { 1724 1736 $line .= '(' . $row['data_precision'] . ')'; … … 1750 1762 $result = $db->sql_query($sql); 1751 1763 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 } 1757 1777 1758 1778 $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME … … 1763 1783 $result = $db->sql_query($sql); 1764 1784 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 } 1770 1798 1771 1799 $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 1776 1804 WHERE A.REFERENCED_TYPE = 'SEQUENCE' 1777 1805 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"; 1779 1808 $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"; 1783 1823 } 1784 1824 $db->sql_freeresult($result); … … 1790 1830 while ($row = $db->sql_fetchrow($result)) 1791 1831 { 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"; 1793 1833 } 1794 1834 $db->sql_freeresult($result); … … 1810 1850 foreach ($index as $index_name => $column_names) 1811 1851 { 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"; 1813 1853 } 1814 1854 $db->sql_freeresult($result); … … 1820 1860 global $db; 1821 1861 $ary_type = $ary_name = array(); 1822 1862 1823 1863 // Grab all of the data from current table. 1824 1864 $sql = "SELECT * … … 1843 1883 for ($i = 0; $i < $i_num_fields; $i++) 1844 1884 { 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])) 1848 1889 { 1849 1890 $str_quote = ''; … … 1874 1915 1875 1916 $schema_vals[$i] = $str_quote . $str_val . $str_quote; 1876 $schema_fields[$i] = '"' . $ary_name[$i] . "'";1917 $schema_fields[$i] = '"' . $ary_name[$i] . '"'; 1877 1918 } 1878 1919 1879 1920 // Take the ordered fields and their associated data and build it 1880 1921 // 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"; 1882 1923 1883 1924 $this->flush($sql_data); … … 1916 1957 global $db; 1917 1958 $ary_type = $ary_name = array(); 1918 1959 1919 1960 // Grab all of the data from current table. 1920 1961 $sql = "SELECT * … … 2198 2239 function sanitize_data_oracle($text) 2199 2240 { 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); 2202 2245 2203 2246 $val = array(); … … 2245 2288 $record = ''; 2246 2289 $delim_len = strlen($delim); 2247 2290 2248 2291 while (!$eof($fp)) 2249 2292 { -
trunk/forum/includes/acp/acp_email.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_email.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 109 109 trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); 110 110 } 111 111 112 112 $i = $j = 0; 113 113 … … 122 122 if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) || 123 123 ($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']))) 125 125 { 126 126 if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) … … 174 174 $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); 175 175 $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); 176 176 177 177 $messenger->subject(htmlspecialchars_decode($subject)); 178 178 $messenger->set_mail_priority($priority); … … 182 182 'MESSAGE' => htmlspecialchars_decode($message)) 183 183 ); 184 184 185 185 if (!($messenger->send($used_method))) 186 186 { … … 240 240 $select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . $user->lang['ALL_USERS'] . '</option>'; 241 241 $select_list .= group_select_options($group_id, $exclude); 242 242 243 243 $s_priority_options = '<option value="' . MAIL_LOW_PRIORITY . '">' . $user->lang['MAIL_LOW_PRIORITY'] . '</option>'; 244 244 $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 3 3 * 4 4 * @package acp 5 * @version $Id : acp_forums.php 8898 2008-09-19 17:07:13Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 140 140 'enable_prune' => request_var('enable_prune', false), 141 141 'enable_post_review' => request_var('enable_post_review', true), 142 'enable_quick_reply' => request_var('enable_quick_reply', false), 142 143 'prune_days' => request_var('prune_days', 7), 143 144 'prune_viewed' => request_var('prune_viewed', 7), … … 151 152 ); 152 153 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 153 160 // Use link_display_on_index setting if forum type is link 154 161 if ($forum_data['forum_type'] == FORUM_LINK) … … 163 170 } 164 171 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); 166 173 167 174 // Get data for forum rules if specified... … … 182 189 { 183 190 $forum_perm_from = request_var('forum_perm_from', 0); 191 $cache->destroy('sql', FORUMS_TABLE); 184 192 185 193 // 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')))) 188 196 { 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); 246 198 cache_moderators(); 247 199 } 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 */ 249 207 $auth->acl_clear_prefetch(); 250 $cache->destroy('sql', FORUMS_TABLE);251 208 252 209 $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; … … 424 381 $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; 425 382 $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; 426 384 } 427 385 … … 485 443 'prune_viewed' => 7, 486 444 '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, 488 447 'forum_password' => '', 489 448 'forum_password_confirm'=> '', … … 561 520 WHERE forum_type = ' . FORUM_POST . " 562 521 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; 565 525 if ($db->sql_fetchrow($result)) 566 526 { 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; 570 528 } 571 529 $db->sql_freeresult($result); … … 584 542 $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); 585 543 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) 593 545 { 594 546 $template->assign_vars(array( … … 596 548 ); 597 549 } 598 $db->sql_freeresult($result);599 550 600 551 $template->assign_vars(array( 601 552 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, 602 553 '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)) 603 560 ); 604 561 } … … 685 642 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) ? true : false, 686 643 '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, 687 645 '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, 688 646 )); … … 715 673 WHERE forum_type = ' . FORUM_POST . " 716 674 AND forum_id <> $forum_id"; 717 $result = $db->sql_query ($sql);675 $result = $db->sql_query_limit($sql, 1); 718 676 719 677 if ($db->sql_fetchrow($result)) … … 743 701 return; 744 702 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 = '&mode=setting_forum_local&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 . '&parent_id=' . $this->parent_id)); 726 } 727 728 break; 745 729 } 746 730 … … 807 791 808 792 $url = $this->u_action . "&parent_id=$this->parent_id&f={$row['forum_id']}"; 809 810 $forum_title = ($forum_type != FORUM_LINK) ? '<a href="' . $this->u_action . '&parent_id=' . $row['forum_id'] . '">' : '';811 $forum_title .= $row['forum_name'];812 $forum_title .= ($forum_type != FORUM_LINK) ? '</a>' : '';813 793 814 794 $template->assign_block_vars('forums', array( … … 889 869 function update_forum_data(&$forum_data) 890 870 { 891 global $db, $user, $cache ;871 global $db, $user, $cache, $phpbb_root_path; 892 872 893 873 $errors = array(); … … 926 906 array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), 927 907 ); 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 } 928 913 929 914 validate_range($range_test_ary, $errors); … … 943 928 $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; 944 929 $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; 945 931 946 932 // Unset data that are not database fields … … 953 939 unset($forum_data_sql['show_active']); 954 940 unset($forum_data_sql['enable_post_review']); 941 unset($forum_data_sql['enable_quick_reply']); 955 942 unset($forum_data_sql['forum_password_confirm']); 956 943 … … 1929 1916 adm_page_footer(); 1930 1917 } 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 = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; 1928 $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&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 . '&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 1931 1943 } 1932 1944 -
trunk/forum/includes/acp/acp_groups.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_groups.php 9053 2008-11-09 15:10:40Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 310 310 'max_recipients' => request_var('group_max_recipients', 0), 311 311 'founder_manage' => 0, 312 'skip_auth' => request_var('group_skip_auth', 0), 312 313 ); 313 314 … … 401 402 402 403 $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) 405 420 { 406 421 if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) 407 422 { 423 settype($submit_ary[$test], $type); 408 424 $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test]; 409 425 } … … 563 579 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, 564 580 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', 565 581 'GROUP_SKIP_AUTH' => (!empty($group_row['group_skip_auth'])) ? ' checked="checked"' : '', 566 582 567 583 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], … … 592 608 'U_ACTION' => "{$this->u_action}&action=$action&g=$group_id", 593 609 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)), 594 ) 595 ); 610 )); 596 611 597 612 return; … … 608 623 609 624 // 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_pending625 $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 611 626 FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug 612 627 WHERE ug.group_id = $group_id … … 622 637 623 638 'USERNAME' => $row['username'], 639 'USERNAME_COLOUR' => $row['user_colour'], 624 640 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, 625 641 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', 626 642 'USER_POSTS' => $row['user_posts'], 627 'USER_ID' => $row['user_id'] )628 ) ;643 'USER_ID' => $row['user_id'], 644 )); 629 645 } 630 646 $db->sql_freeresult($result); … … 663 679 664 680 // 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_pending681 $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 666 682 FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug 667 683 WHERE ug.group_id = $group_id … … 688 704 689 705 'USERNAME' => $row['username'], 706 'USERNAME_COLOUR' => $row['user_colour'], 690 707 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, 691 708 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', … … 764 781 'GROUP_NAME' => $group_name, 765 782 'TOTAL_MEMBERS' => $row['total_members'], 766 ) 767 ); 783 )); 768 784 } 769 785 } -
trunk/forum/includes/acp/acp_icons.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_icons.php 8974 2008-10-06 13:23:41Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 90 90 } 91 91 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 92 107 $_images[$path . $img]['file'] = $path . $img; 93 108 $_images[$path . $img]['width'] = $img_size[0]; … … 169 184 } 170 185 } 171 186 172 187 $sql = "SELECT * 173 188 FROM $table 174 189 ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC'); 175 190 $result = $db->sql_query($sql); 176 191 177 192 $data = array(); 178 193 $after = false; … … 181 196 $add_order_lists = array('', ''); 182 197 $display_count = 0; 183 198 184 199 while ($row = $db->sql_fetchrow($result)) 185 200 { … … 232 247 } 233 248 234 $colspan = (($mode == 'smilies') ? '7' : '5');249 $colspan = (($mode == 'smilies') ? 7 : 5); 235 250 $colspan += ($icon_id) ? 1 : 0; 236 251 $colspan += ($action == 'add') ? 2 : 0; 237 252 238 253 $template->assign_vars(array( 239 254 'S_EDIT' => true, 240 255 'S_SMILIES' => ($mode == 'smilies') ? true : false, 241 256 'S_ADD' => ($action == 'add') ? true : false, 242 257 243 258 'S_ORDER_LIST_DISPLAY' => $order_list . $order_lists[1], 244 259 'S_ORDER_LIST_UNDISPLAY' => $order_list . $order_lists[0], … … 287 302 288 303 'S_IMG_OPTIONS' => $smiley_options, 289 304 290 305 'S_ADD_ORDER_LIST_DISPLAY' => $add_order_list . $add_order_lists[1], 291 306 'S_ADD_ORDER_LIST_UNDISPLAY' => $add_order_list . $add_order_lists[0], 292 307 293 308 'IMG_SRC' => $phpbb_root_path . $img_path . '/' . $default_row['smiley_url'], 294 309 'IMG_PATH' => $img_path, … … 304 319 305 320 return; 306 321 307 322 break; 308 323 … … 312 327 // Get items to create/modify 313 328 $images = (isset($_POST['image'])) ? array_keys(request_var('image', array('' => 0))) : array(); 314 329 315 330 // Now really get the items 316 331 $image_id = (isset($_POST['id'])) ? request_var('id', array('' => 0)) : array(); … … 349 364 } 350 365 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 351 385 $icons_updated = 0; 352 386 $errors = array(); … … 368 402 $image_width[$image] = $img_size[0]; 369 403 $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 } 370 419 } 371 420 … … 427 476 $icons_updated++; 428 477 } 429 478 430 479 } 431 480 } 432 481 433 482 $cache->destroy('_icons'); 434 483 $cache->destroy('sql', $table); 435 484 436 485 $level = E_USER_NOTICE; 437 486 switch ($icons_updated) … … 441 490 $level = E_USER_WARNING; 442 491 break; 443 492 444 493 case 1: 445 494 $suc_lang = "{$lang}_ONE"; 446 495 break; 447 496 448 497 default: 449 498 $suc_lang = $lang; … … 496 545 } 497 546 498 499 547 // The user has already selected a smilies_pak file 500 548 if ($current == 'delete') … … 540 588 } 541 589 $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 } 542 599 } 543 600 … … 836 893 837 894 $spacer = false; 895 $pagination_start = request_var('start', 0); 896 897 $item_count = $this->item_count($table); 838 898 839 899 $sql = "SELECT * 840 900 FROM $table 841 901 ORDER BY {$fields}_order ASC"; 842 $result = $db->sql_query ($sql);902 $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $pagination_start); 843 903 844 904 while ($row = $db->sql_fetchrow($result)) … … 856 916 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row[$fields . '_id'], 857 917 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row[$fields . '_id'], 858 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row[$fields . '_id'] ,859 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row[$fields . '_id'] )860 ) ;918 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row[$fields . '_id'] . '&start=' . $pagination_start, 919 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row[$fields . '_id'] . '&start=' . $pagination_start, 920 )); 861 921 862 922 if (!$spacer && !$row['display_on_posting']) … … 866 926 } 867 927 $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; 868 951 } 869 952 } -
trunk/forum/includes/acp/acp_inactive.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_inactive.php 8598 2008-06-04 15:37:06Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2006 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 52 52 add_form_key($form_key); 53 53 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 54 67 if ($submit && sizeof($mark)) 55 68 { … … 68 81 WHERE ' . $db->sql_in_set('user_id', $mark); 69 82 $result = $db->sql_query($sql); 70 83 71 84 $user_affected = array(); 72 85 while ($row = $db->sql_fetchrow($result)) … … 78 91 if ($action == 'activate') 79 92 { 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); 96 106 97 107 user_active_flip('activate', $mark); … … 101 111 include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); 102 112 103 $messenger = new messenger( );113 $messenger = new messenger(false); 104 114 105 115 foreach ($inactive_users as $row) … … 112 122 $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); 113 123 $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); 124 $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); 114 125 115 126 $messenger->assign_vars(array( … … 122 133 $messenger->save_queue(); 123 134 } 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 . "&$u_sort_param&start=$start"; 147 $u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : ''; 148 149 redirect($u_action); 124 150 } 125 151 else if ($action == 'delete') … … 162 188 $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey 163 189 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 165 195 $result = $db->sql_query($sql); 166 196 … … 171 201 172 202 $messenger = new messenger(); 173 $usernames = array();203 $usernames = $user_ids = array(); 174 204 175 205 do … … 180 210 $messenger->im($row['user_jabber'], $row['username']); 181 211 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 182 217 $messenger->assign_vars(array( 183 218 '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), 185 220 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']) 186 221 ); … … 189 224 190 225 $usernames[] = $row['username']; 226 $user_ids[] = (int) $row['user_id']; 191 227 } 192 228 while ($row = $db->sql_fetchrow($result)); 193 229 194 230 $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); 195 238 196 239 add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); … … 198 241 } 199 242 $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 . "&$u_sort_param&start=$start"; 246 $u_action .= ($per_page != $config['topics_per_page']) ? "&users_per_page=$per_page" : ''; 247 248 redirect($u_action); 249 201 250 break; 202 251 } 203 252 } 204 253 205 // Sorting206 $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 213 254 // Define where and sort sql for use in displaying logs 214 255 $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; … … 218 259 $inactive_count = 0; 219 260 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); 221 262 222 263 foreach ($inactive as $row) … … 224 265 $template->assign_block_vars('inactive', array( 225 266 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), 267 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), 226 268 'JOINED' => $user->format_date($row['user_regdate']), 227 269 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), 270 228 271 'REASON' => $row['inactive_reason'], 229 272 'USER_ID' => $row['user_id'], 230 'USERNAME' => $row['username'], 231 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&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&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&mode=overview&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']}&sr=posts") : '', 284 )); 233 285 } 234 286 … … 246 298 'S_SORT_KEY' => $s_sort_key, 247 299 '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 . "&$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 . "&$u_sort_param&users_per_page=$per_page", $inactive_count, $per_page, $start, true), 302 'USERS_PER_PAGE' => $per_page, 303 251 304 'U_ACTION' => $this->u_action . '&start=' . $start, 252 305 )); -
trunk/forum/includes/acp/acp_jabber.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_jabber.php 8990 2008-10-09 15:41:19Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 45 45 $this->page_title = 'ACP_JABBER_SETTINGS'; 46 46 47 $jab_enable = request_var('jab_enable', 48 $jab_host = request_var('jab_host', 49 $jab_port = request_var('jab_port', 50 $jab_username = request_var('jab_username', 51 $jab_password = request_var('jab_password', 52 $jab_package_size = request_var('jab_package_size', 53 $jab_use_ssl = request_var('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']); 54 54 55 55 $form_name = 'acp_jabber'; … … 89 89 { 90 90 // 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. 92 93 $sql_ary = array( 93 94 'user_notify_type' => NOTIFY_BOTH, … … 117 118 'L_JAB_SERVER_EXPLAIN' => sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/">', '</a>'), 118 119 'JAB_HOST' => $jab_host, 119 'JAB_PORT' => $jab_port,120 'JAB_PORT' => ($jab_port) ? $jab_port : '', 120 121 'JAB_USERNAME' => $jab_username, 121 122 'JAB_PASSWORD' => $jab_password, -
trunk/forum/includes/acp/acp_language.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_language.php 8780 2008-08-22 12:52:48Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 767 767 } 768 768 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 } 791 804 break; 792 805 … … 1108 1121 while (($file = readdir($dp)) !== false) 1109 1122 { 1123 if (!is_dir($phpbb_root_path . 'language/' . $file)) 1124 { 1125 continue; 1126 } 1127 1110 1128 if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt")) 1111 1129 { … … 1255 1273 1256 1274 $non_static = array_shift($keys); 1257 $value = array_shift($keys);1275 $value = utf8_normalize_nfc(array_shift($keys)); 1258 1276 1259 1277 if (!$non_static) -
trunk/forum/includes/acp/acp_logs.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_logs.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 34 34 $action = request_var('action', ''); 35 35 $forum_id = request_var('f', 0); 36 $topic_id = request_var('t', 0); 36 37 $start = request_var('start', 0); 37 38 $deletemark = (!empty($_POST['delmarked'])) ? true : false; … … 105 106 $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); 106 107 108 $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); 109 $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; 110 107 111 $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS']; 108 112 $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN']; … … 124 128 $log_data = array(); 125 129 $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); 127 131 128 132 $template->assign_vars(array( … … 132 136 133 137 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start), 134 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param ", $log_count, $config['topics_per_page'], $start, true),138 'PAGINATION' => generate_pagination($this->u_action . "&$u_sort_param$keywords_param", $log_count, $config['topics_per_page'], $start, true), 135 139 136 140 'S_LIMIT_DAYS' => $s_limit_days, … … 138 142 'S_SORT_DIR' => $s_sort_dir, 139 143 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'), 144 'S_KEYWORDS' => $keywords, 140 145 ) 141 146 ); -
trunk/forum/includes/acp/acp_main.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_main.php 9171 2008-12-04 14:53:04Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 97 97 $confirm = true; 98 98 $confirm_lang = 'PURGE_CACHE_CONFIRM'; 99 break; 100 case 'purge_sessions': 101 $confirm = true; 102 $confirm_lang = 'PURGE_SESSIONS_CONFIRM'; 99 103 break; 100 104 … … 342 346 add_log('admin', 'LOG_PURGE_CACHE'); 343 347 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; 344 394 } 345 395 } 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&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 )); 346 424 } 347 425 … … 436 514 'TOTAL_ORPHAN' => $total_orphan, 437 515 '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'], 439 517 'DATABASE_INFO' => $db->sql_server_info(), 440 518 'BOARD_VERSION' => $config['version'], … … 443 521 'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'), 444 522 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), 523 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), 524 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=1&versioncheck_force=1'), 445 525 446 526 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, … … 469 549 if ($auth->acl_get('a_user')) 470 550 { 551 $user->add_lang('memberlist'); 552 471 553 $inactive = array(); 472 554 $inactive_count = 0; … … 478 560 $template->assign_block_vars('inactive', array( 479 561 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), 562 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), 480 563 'JOINED' => $user->format_date($row['user_regdate']), 481 564 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), 565 482 566 'REASON' => $row['inactive_reason'], 483 567 'USER_ID' => $row['user_id'], 484 'USERNAME' => $row['username'], 485 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&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&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&mode=overview&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']}&sr=posts") : '', 579 )); 487 580 } 488 581 … … 500 593 501 594 // 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')) 503 596 { 504 597 $template->assign_var('S_REMOVE_INSTALL', true); 505 598 } 506 599 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)) 508 601 { 509 602 // World-Writable? (000x) 510 603 $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)); 511 610 } 512 611 -
trunk/forum/includes/acp/acp_permissions.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_permissions.php 8710 2008-07-29 13:35:49Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 24 24 var $u_action; 25 25 var $permission_dropdown; 26 26 27 27 function main($id, $mode) 28 28 { … … 55 55 return; 56 56 } 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 57 72 trigger_error('NO_MODE', E_USER_ERROR); 58 73 } … … 95 110 $db->sql_freeresult($result); 96 111 } 97 112 98 113 // Map usernames to ids and vice versa 99 114 if ($usernames) … … 113 128 } 114 129 unset($username); 115 130 116 131 // Build forum ids (of all forums are checked or subforum listing used) 117 132 if ($all_forums) … … 218 233 } 219 234 220 221 235 // Handle actions 222 236 if (strpos($mode, 'setting_') === 0 && $action) … … 225 239 { 226 240 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) 241 248 { 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 } 243 259 } 244 else if ($all_groups && sizeof($items['group_ids'])) 260 261 if (sizeof($user_id) || sizeof($group_id)) 245 262 { 246 $ group_id = $items['group_ids'];263 $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); 247 264 } 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 } 253 269 } 254 270 else 255 271 { 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 . '&type=' . $permission_type; 275 foreach ($forum_id as $fid) 276 { 277 $u_redirect .= '&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)); 257 300 } 258 301 break; … … 529 572 continue; 530 573 } 531 574 532 575 if ($branch_there) 533 576 { … … 540 583 return $s_options; 541 584 } 542 585 543 586 /** 544 587 * Build dropdown field for changing permission types … … 547 590 { 548 591 global $user, $auth; 549 592 550 593 $s_dropdown_options = ''; 551 594 foreach ($options as $setting) … … 627 670 trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); 628 671 } 629 672 630 673 $ug_id = $forum_id = 0; 631 674 … … 763 806 $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids); 764 807 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 . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); 811 } 812 else 813 { 814 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 815 } 766 816 } 767 817 … … 810 860 { 811 861 global $user, $db, $auth; 812 862 813 863 // User or group to be set? 814 864 $ug_type = (sizeof($user_id)) ? 'user' : 'group'; … … 830 880 $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (sizeof($forum_id) ? $forum_id : array(0 => 0))); 831 881 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 . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); 885 } 886 else 887 { 888 trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); 889 } 833 890 } 834 891 … … 950 1007 WHERE ug.user_id = ' . $user_id . ' 951 1008 AND ug.user_pending = 0 1009 AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) 952 1010 ORDER BY g.group_type DESC, g.group_id DESC'; 953 1011 $result = $db->sql_query($sql); … … 1111 1169 1112 1170 /** 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 /** 1113 1222 * Get already assigned users/groups 1114 1223 */ … … 1151 1260 $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; 1152 1261 } 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)) 1154 1267 { 1155 1268 $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); -
trunk/forum/includes/acp/acp_profile.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_profile.php 9127 2008-11-26 19:58:35Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 370 370 'field_no_view' => 0, 371 371 'field_show_on_reg' => 0, 372 'field_show_on_vt' => 0, 372 373 'lang_name' => utf8_normalize_nfc(request_var('field_ident', '', true)), 373 374 'lang_explain' => '', … … 380 381 // $exclude contains the data we gather in each step 381 382 $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'), 383 384 2 => array('field_length', 'field_maxlen', 'field_minlen', 'field_validation', 'field_novalue', 'field_default_value'), 384 385 3 => array('l_lang_name', 'l_lang_explain', 'l_lang_default_value', 'l_lang_options') … … 406 407 'field_required', 407 408 'field_show_on_reg', 409 'field_show_on_vt', 408 410 'field_show_profile', 409 411 'field_hide', … … 508 510 $var = request_var('field_default_value', 0); 509 511 }*/ 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 } 510 520 511 521 $cp->vars[$key] = $var; … … 722 732 'S_FIELD_REQUIRED' => ($cp->vars['field_required']) ? true : false, 723 733 '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, 724 735 'S_FIELD_HIDE' => ($cp->vars['field_hide']) ? true : false, 725 736 'S_SHOW_PROFILE' => ($cp->vars['field_show_profile']) ? true : false, … … 923 934 case FIELD_TEXT: 924 935 case FIELD_STRING: 925 if ( $cp->vars['lang_default_value'])936 if (strlen($cp->vars['lang_default_value'])) 926 937 { 927 938 $options['lang_default_value'] = ($field_type == FIELD_STRING) ? 'string' : 'text'; … … 1037 1048 'field_required' => $cp->vars['field_required'], 1038 1049 'field_show_on_reg' => $cp->vars['field_show_on_reg'], 1050 'field_show_on_vt' => $cp->vars['field_show_on_vt'], 1039 1051 'field_hide' => $cp->vars['field_hide'], 1040 1052 'field_show_profile' => $cp->vars['field_show_profile'], … … 1540 1552 1541 1553 // 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) . '" '; 1543 1555 1544 1556 switch ($field_type) -
trunk/forum/includes/acp/acp_prune.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_prune.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 407 407 $where_sql .= ($count !== '') ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; 408 408 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') 410 415 { 411 416 $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 3 3 * 4 4 * @package acp 5 * @version $Id : acp_ranks.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 40 40 $this->page_title = 'ACP_MANAGE_RANKS'; 41 41 42 $form_name = 'acp_ prune';42 $form_name = 'acp_ranks'; 43 43 add_form_key($form_name); 44 44 … … 169 169 $img = $path . $img; 170 170 171 if ( !in_array($img, $existing_imgs) || $action == 'edit')171 if ($ranks && $img == $ranks['rank_image']) 172 172 { 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; 189 175 } 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>'; 190 187 } 191 188 } -
trunk/forum/includes/acp/acp_search.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_search.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 64 64 'limit_search_load' => 'float', 65 65 'min_search_author_chars' => 'integer', 66 'max_num_search_keywords' => 'integer', 66 67 'search_store_results' => 'integer', 67 68 ); … … 217 218 'SEARCH_GUEST_INTERVAL' => (float) $config['search_anonymous_interval'], 218 219 'SEARCH_STORE_RESULTS' => (int) $config['search_store_results'], 220 'MAX_NUM_SEARCH_KEYWORDS' => (int) $config['max_num_search_keywords'], 219 221 220 222 'S_SEARCH_TYPES' => $search_options, … … 592 594 ksort($this->state); 593 595 594 set_config('search_indexing_state', implode(',', $this->state) );596 set_config('search_indexing_state', implode(',', $this->state), true); 595 597 } 596 598 -
trunk/forum/includes/acp/acp_styles.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_styles.php 9152 2008-12-02 16:49:59Z acydburn$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 38 38 $bitfield = new bitfield(); 39 39 $bitfield->set(0); 40 $bitfield->set(1); 41 $bitfield->set(2); 40 42 $bitfield->set(3); 43 $bitfield->set(4); 41 44 $bitfield->set(8); 42 45 $bitfield->set(9); … … 208 211 } 209 212 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') 217 214 { 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; 221 218 $db->sql_query($sql); 222 219 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)); 227 243 } 228 244 break; … … 628 644 while (($file = readdir($dp)) !== false) 629 645 { 646 if (!is_dir($phpbb_root_path . 'styles/' . $file)) 647 { 648 continue; 649 } 650 630 651 $subpath = ($mode != 'style') ? "$mode/" : ''; 631 652 if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg")) … … 732 753 if (!($fp = @fopen($file, 'wb'))) 733 754 { 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); 735 757 } 736 758 fwrite($fp, $template_data); … … 744 766 if (!$template_info['template_storedb']) 745 767 { 746 if ($ this->get_super('template', $template_id))768 if ($super = $this->get_super('template', $template_id)) 747 769 { 748 770 $this->store_in_db('template', $super['template_id']); … … 825 847 } 826 848 849 if (empty($filelist[''])) 850 { 851 trigger_error($user->lang['NO_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); 852 } 853 827 854 // Now create the categories 828 855 $filelist_cats[''] = array(); … … 1022 1049 foreach ($file_ary as $file) 1023 1050 { 1024 $file 1051 $file = str_replace('/', '.', $file); 1025 1052 1026 1053 // perform some dirty guessing to get the path right. 1027 1054 // We assume that three dots in a row were '../' 1028 $tpl_file 1029 $tpl_file 1055 $tpl_file = str_replace('.', '/', $file); 1056 $tpl_file = str_replace('///', '../', $tpl_file); 1030 1057 1031 1058 $filename = "{$cache_prefix}_$file.html.$phpEx"; … … 1059 1086 } 1060 1087 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 } 1061 1093 1062 1094 $template->assign_block_vars('file', array( … … 1066 1098 'FILENAME' => $file, 1067 1099 '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")), 1069 1101 'MODIFIED' => $user->format_date((!$template_row['template_storedb']) ? filemtime($file_tpl) : $filemtime[$file . '.html'])) 1070 1102 ); … … 1264 1296 } 1265 1297 1266 1267 1298 /** 1268 1299 * Edit imagesets … … 1276 1307 $this->page_title = 'EDIT_IMAGESET'; 1277 1308 1309 if (!$imageset_id) 1310 { 1311 trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING); 1312 } 1313 1278 1314 $update = (isset($_POST['update'])) ? true : false; 1279 1315 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'); 1286 1317 $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; 1411 1446 } 1412 1447 … … 1530 1565 'NAME' => $imageset_name, 1531 1566 'A_NAME' => addslashes($imageset_name), 1567 'PATH' => $imageset_path, 1568 'A_PATH' => addslashes($imageset_path), 1532 1569 'ERROR' => !$valid_name, 1533 1570 'IMG_SRC' => ($image_found) ? '../styles/' . $imageset_path . '/imageset/' . $img_val : 'images/no_image.png', … … 2396 2433 } 2397 2434 2398 2399 2435 if ($mode == 'template') 2400 2436 { … … 2527 2563 trigger_error("Could not open {$phpbb_root_path}styles/$template_path$pathfile$file", E_USER_ERROR); 2528 2564 } 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 2530 2573 fclose($fp); 2574 2575 if (!$filesize) 2576 { 2577 // File is empty 2578 continue; 2579 } 2531 2580 2532 2581 if (preg_match_all('#<!-- INCLUDE (.*?\.html) -->#is', $template_data, $matches)) … … 3196 3245 $db->sql_freeresult($result); 3197 3246 3198 3199 3247 if ($row) 3200 3248 { … … 3211 3259 if (isset($cfg_data['inherit_from']) && $cfg_data['inherit_from']) 3212 3260 { 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 3214 3271 FROM $sql_from 3215 3272 WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "' … … 3226 3283 $inherit_id = $row["{$mode}_id"]; 3227 3284 $inherit_path = $row["{$mode}_path"]; 3285 $inherit_bf = ($mode === 'template') ? $row["bbcode_bitfield"] : false; 3228 3286 $cfg_data['store_db'] = $row["{$mode}_storedb"]; 3229 3287 $store_db = $row["{$mode}_storedb"]; … … 3234 3292 $inherit_id = 0; 3235 3293 $inherit_path = ''; 3236 }3237 3294 $inherit_bf = false; 3295 } 3238 3296 3239 3297 if (sizeof($error)) … … 3255 3313 { 3256 3314 $sql_ary['bbcode_bitfield'] = $cfg_data['template_bitfield']; 3315 } 3316 else if ($inherit_bf) 3317 { 3318 $sql_ary['bbcode_bitfield'] = $inherit_bf; 3257 3319 } 3258 3320 else … … 3502 3564 } 3503 3565 3504 3505 3566 $sql = "SELECT {$mode}_inherits_id 3506 3567 FROM $sql_from -
trunk/forum/includes/acp/acp_update.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_update.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 38 38 $errno = 0; 39 39 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); 41 41 42 42 if ($info === false) 43 43 { 44 trigger_error( $errstr, E_USER_WARNING);44 trigger_error('VERSIONCHECK_FAIL', E_USER_WARNING); 45 45 } 46 46 … … 49 49 50 50 $announcement_url = trim($info[1]); 51 $announcement_url = (strpos($announcement_url, '&') === false) ? str_replace('&', '&', $announcement_url) : $announcement_url; 51 52 $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); 52 53 … … 69 70 'S_VERSION_CHECK' => true, 70 71 'U_ACTION' => $this->u_action, 72 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), 71 73 72 74 'LATEST_VERSION' => $latest_version, -
trunk/forum/includes/acp/acp_users.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_users.php 8831 2008-09-05 19:02:36Z toonarmy$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 386 386 user_active_flip('flip', $user_id); 387 387 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 388 413 $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED'; 389 414 $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; … … 494 519 } 495 520 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 . '&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 } 496 571 break; 497 572 … … 651 726 652 727 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 . '&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; 653 750 } 654 751 … … 776 873 $sql_ary += array( 777 874 'user_email' => $update_email, 778 'user_email_hash' => crc32($update_email) . strlen($update_email)875 'user_email_hash' => phpbb_email_hash($update_email), 779 876 ); 780 877 … … 821 918 if ($user_id == $user->data['user_id']) 822 919 { 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 } 824 925 } 825 926 else … … 837 938 } 838 939 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'); 840 941 841 942 if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE)) 842 943 { 843 944 $quick_tool_ary['reactivate'] = 'FORCE'; 945 } 946 947 if ($user_row['user_new']) 948 { 949 $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; 844 950 } 845 951 } … … 918 1024 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', 919 1025 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&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&u={$user_row['user_id']}&hash=" . generate_link_hash('switchperm')) : '', 921 1027 922 1028 'POSTS_IN_QUEUE' => $user_row['posts_in_queue'], … … 973 1079 $sql = 'DELETE FROM ' . LOG_TABLE . ' 974 1080 WHERE log_type = ' . LOG_USERS . " 1081 AND reportee_id = $user_id 975 1082 $where_sql"; 976 1083 $db->sql_query($sql); … … 1032 1139 ); 1033 1140 } 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 )); 1034 1289 1035 1290 break; … … 1136 1391 1137 1392 // 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); 1185 1394 1186 1395 trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); … … 1208 1417 $now = getdate(); 1209 1418 $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++) 1211 1420 { 1212 1421 $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; … … 1475 1684 } 1476 1685 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 1477 1697 // 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="" />'; 1479 1699 1480 1700 $display_gallery = (isset($_POST['display_gallery'])) ? true : false; … … 1489 1709 $template->assign_vars(array( 1490 1710 '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, 1495 1717 1496 1718 'AVATAR_IMAGE' => $avatar_img, … … 1550 1772 include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); 1551 1773 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; 1555 1777 $signature = utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true)); 1556 1778 … … 1560 1782 { 1561 1783 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; 1562 1788 1563 1789 $message_parser = new parse_message($signature); … … 1578 1804 if (!sizeof($error) && $submit) 1579 1805 { 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 1580 1810 $sql_ary = array( 1581 1811 'user_sig' => (string) $message_parser->message, 1812 'user_options' => $user_row['user_options'], 1582 1813 'user_sig_bbcode_uid' => (string) $message_parser->bbcode_uid, 1583 1814 'user_sig_bbcode_bitfield' => (string) $message_parser->bbcode_bitfield … … 1847 2078 1848 2079 $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); 1849 2090 } 1850 2091 else … … 1860 2101 1861 2102 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 . '&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; 1862 2126 } 1863 2127 … … 1952 2216 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'], 1953 2217 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], 2218 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', 1954 2219 1955 2220 'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'], 1956 2221 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], 1957 2222 2223 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, 1958 2224 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, 1959 2225 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, -
trunk/forum/includes/acp/acp_words.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_words.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 24 24 { 25 25 var $u_action; 26 26 27 27 function main($id, $mode) 28 28 { … … 48 48 { 49 49 case 'edit': 50 50 51 $word_id = request_var('id', 0); 51 52 52 53 if (!$word_id) 53 54 { … … 74 75 'S_HIDDEN_FIELDS' => $s_hidden_fields) 75 76 ); 76 77 77 78 return; 78 79 … … 85 86 trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); 86 87 } 88 87 89 $word_id = request_var('id', 0); 88 90 $word = utf8_normalize_nfc(request_var('word', '', true)); 89 91 $replacement = utf8_normalize_nfc(request_var('replacement', '', true)); 90 91 if ( !$word || !$replacement)92 93 if ($word === '' || $replacement === '') 92 94 { 93 95 trigger_error($user->lang['ENTER_WORD'] . adm_back_link($this->u_action), E_USER_WARNING); -
trunk/forum/includes/acp/auth.php
r400 r702 3 3 * 4 4 * @package phpBB3 5 * @version $Id : auth.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 59 59 } 60 60 } 61 61 62 62 /** 63 63 * Get permission mask … … 141 141 } 142 142 143 143 144 144 $hold_ary[$userdata['user_id']] = array(); 145 145 foreach ($forum_ids as $f_id) … … 346 346 // Build js roles array (role data assignments) 347 347 $s_role_js_array = ''; 348 348 349 349 if (sizeof($roles)) 350 350 { … … 697 697 $cur_options = array(); 698 698 699 // Determine current options 699 700 $sql = 'SELECT auth_option, is_global, is_local 700 701 FROM ' . ACL_OPTIONS_TABLE . ' … … 704 705 while ($row = $db->sql_fetchrow($result)) 705 706 { 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'); 715 708 } 716 709 $db->sql_freeresult($result); … … 727 720 foreach ($option_ary as $option_value) 728 721 { 729 if (!in_array($option_value, $cur_options[$type])) 730 { 731 $new_options[$type][] = $option_value; 732 } 722 $new_options[$type][] = $option_value; 733 723 734 724 $flag = substr($option_value, 0, strpos($option_value, '_') + 1); 735 725 736 if (!in_array($flag, $ cur_options[$type]) && !in_array($flag, $new_options[$type]))726 if (!in_array($flag, $new_options[$type])) 737 727 { 738 728 $new_options[$type][] = $flag; … … 745 735 $options['local'] = array_diff($new_options['local'], $new_options['global']); 746 736 $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... 751 743 foreach ($options as $type => $option_ary) 752 744 { 753 745 foreach ($option_ary as $option) 754 746 { 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 } 764 784 765 785 $cache->destroy('_acl_options'); … … 803 823 $flag = key($auth); 804 824 $flag = substr($flag, 0, strpos($flag, '_') + 1); 805 825 806 826 // This ID (the any-flag) is set if one or more permissions are true... 807 827 $any_option_id = (int) $this->acl_options['id'][$flag]; … … 917 937 $flag = key($auth); 918 938 $flag = substr($flag, 0, strpos($flag, '_') + 1); 919 939 920 940 // Remove any-flag from auth ary 921 941 if (isset($auth[$flag])) … … 1068 1088 $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); 1069 1089 } 1070 1090 1071 1091 $sql = "DELETE FROM $table 1072 1092 WHERE " . implode(' AND ', $where_sql); … … 1091 1111 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 1092 1112 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, 1093 1113 1094 1114 'CAT_NAME' => $user->lang['permission_cat'][$cat]) 1095 1115 ); … … 1180 1200 ); 1181 1201 } 1182 1202 1183 1203 $cat = $user->lang['acl_' . $permission]['cat']; 1184 1204 1185 1205 // Build our categories array 1186 1206 if (!isset($categories[$cat])) -
trunk/forum/includes/acp/info/acp_board.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_board.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 27 27 'post' => array('title' => 'ACP_POST_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 28 28 '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')), 29 30 'registration' => array('title' => 'ACP_REGISTER_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 30 31 -
trunk/forum/includes/acp/info/acp_permissions.php
r400 r702 3 3 * 4 4 * @package acp 5 * @version $Id : acp_permissions.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 25 25 26 26 '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')), 27 28 'setting_mod_local' => array('title' => 'ACP_FORUM_MODERATORS', 'auth' => 'acl_a_mauth && (acl_a_authusers || acl_a_authgroups)', 'cat' => array('ACP_FORUM_BASED_PERMISSIONS')), 28 29 '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 3 3 * 4 4 * @package acp 5 * @version $Id : acp_users.php 8479 2008-03-29 00:22:48Z naderman$5 * @version $Id$ 6 6 * @copyright (c) 2005 phpBB Group 7 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License … … 23 23 'overview' => array('title' => 'ACP_MANAGE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')), 24 24 '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')), 25 26 'profile' => array('title' => 'ACP_USER_PROFILE', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), 26 27 '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.