diff options
Diffstat (limited to 'phpBB/adm')
-rw-r--r-- | phpBB/adm/admin_attachments.php | 94 | ||||
-rw-r--r-- | phpBB/adm/admin_board.php | 2 | ||||
-rw-r--r-- | phpBB/adm/index.php | 65 |
3 files changed, 82 insertions, 79 deletions
diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php index a4e6ecfed1..b47f4a0e17 100644 --- a/phpBB/adm/admin_attachments.php +++ b/phpBB/adm/admin_attachments.php @@ -36,9 +36,6 @@ $submit = (isset($_POST['submit'])) ? true : false; $error = $notify = array(); -// Adjust the Upload Directory. Relative or absolute, this is the question here. -$upload_dir = ($config['upload_dir'][0] == '/' || ($config['upload_dir'][0] != '/' && $config['upload_dir'][1] == ':')) ? $config['upload_dir'] : $phpbb_root_path . $config['upload_dir']; - switch ($mode) { case 'extensions': @@ -310,7 +307,8 @@ if ($submit && $mode == 'orphan') foreach ($delete_files as $delete) { - phpbb_unlink($upload_dir . '/' . $delete); + phpbb_unlink($config['upload_dir'] . '/' . $delete); + phpbb_unlink($config['upload_dir'] . '/thumb_' . $delete); } if (sizeof($delete_files)) @@ -362,7 +360,7 @@ if ($submit && $mode == 'orphan') } else { - upload_file($row['post_id'], $row['topic_id'], $row['forum_id'], $upload_dir, $upload_list[$row['post_id']]); + upload_file($row['post_id'], $row['topic_id'], $row['forum_id'], $config['upload_dir'], $upload_list[$row['post_id']]); } } } @@ -467,20 +465,14 @@ if ($mode == 'ext_groups') </script> <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <th align="center" colspan="7"><?php echo $user->lang['EXTENSION_GROUPS_TITLE']; ?></th> - </tr> - <tr> - <td class="spacer" colspan="2" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> <tr> - <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> - <th> <?php echo $user->lang['SPECIAL_CATEGORY']; ?> </th> - <th> <?php echo $user->lang['ALLOWED']; ?> </th> - <th> <?php echo $user->lang['DOWNLOAD_MODE']; ?> </th> - <th> <?php echo $user->lang['UPLOAD_ICON']; ?> </th> - <th> <?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?> </th> - <th> <?php echo $user->lang['ADD']; ?> </th> + <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> + <th> <?php echo $user->lang['SPECIAL_CATEGORY']; ?> </th> + <th> <?php echo $user->lang['ALLOWED']; ?> </th> + <th> <?php echo $user->lang['DOWNLOAD_MODE']; ?> </th> + <th> <?php echo $user->lang['UPLOAD_ICON']; ?> </th> + <th> <?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?> </th> + <th> <?php echo $user->lang['ADD']; ?> </th> </tr> <tr> <td class="row1" align="center" valign="middle"> @@ -509,13 +501,13 @@ if ($mode == 'ext_groups') <td class="cat" colspan="7"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /></td> </tr> <tr> - <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> - <th> <?php echo $user->lang['SPECIAL_CATEGORY']; ?> </th> - <th> <?php echo $user->lang['ALLOWED']; ?> </th> - <th> <?php echo $user->lang['DOWNLOAD_MODE']; ?> </th> - <th> <?php echo $user->lang['UPLOAD_ICON']; ?> </th> - <th> <?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?> </th> - <th> <?php echo $user->lang['DELETE']; ?> </th> + <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> + <th> <?php echo $user->lang['SPECIAL_CATEGORY']; ?> </th> + <th> <?php echo $user->lang['ALLOWED']; ?> </th> + <th> <?php echo $user->lang['DOWNLOAD_MODE']; ?> </th> + <th> <?php echo $user->lang['UPLOAD_ICON']; ?> </th> + <th> <?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?> </th> + <th> <?php echo $user->lang['DELETE']; ?> </th> </tr> <? @@ -528,7 +520,7 @@ if ($mode == 'ext_groups') // Format the filesize if ($row['max_filesize'] == 0) { - $row['max_filesize'] = intval($config['max_filesize']); + $row['max_filesize'] = (int) $config['max_filesize']; } $size_format = ($row['max_filesize'] >= 1048576) ? 'mb' : (($row['max_filesize'] >= 1024) ? 'kb' : 'b'); @@ -552,7 +544,7 @@ if ($mode == 'ext_groups') $selected = ($edit_img == $img) ? ' selected="selected"' : ''; } - $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>'; + $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . htmlspecialchars($img) . '</option>'; } ?> <tr> @@ -583,7 +575,7 @@ if ($mode == 'ext_groups') if ($viewgroup && $viewgroup == $row['group_id']) { - $sql = 'SELECT comment, extension + $sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . " WHERE group_id = $viewgroup"; $e_result = $db->sql_query($sql); @@ -604,7 +596,7 @@ if ($mode == 'ext_groups') } ?> <tr> - <td class="cat" colspan="7" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> + <td class="cat" colspan="7" align="right"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> </tr> </table> <? @@ -616,12 +608,6 @@ if ($mode == 'extensions') { ?> <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <th align="center" colspan="3"><?php echo $user->lang['MANAGE_EXTENSIONS']; ?></th> - </tr> - <tr> - <td class="spacer" colspan="2" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> <tr> <th> <?php echo $user->lang['EXTENSION']; ?> </th> <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> @@ -675,7 +661,7 @@ if ($mode == 'extensions') } ?> <tr> - <td class="cat" colspan="3" align="center"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> + <td class="cat" colspan="3" align="right"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> </tr> </table> <? @@ -686,10 +672,10 @@ if ($mode == 'orphan') { $attach_filelist = array(); - $dir = @opendir($upload_dir); + $dir = @opendir($config['upload_dir']); while ($file = @readdir($dir)) { - if (is_file($upload_dir . '/' . $file) && filesize($upload_dir . '/' . $file) && $file != '.htaccess') + if (is_file($config['upload_dir'] . '/' . $file) && filesize($config['upload_dir'] . '/' . $file) && $file{0} != '.' && $file != 'index.htm' && !preg_match('#^thumb\_#', $file)) { $attach_filelist[$file] = $file; } @@ -728,18 +714,12 @@ function marklist(match, name, status) ?> <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <th align="center" colspan="5">Orphan Attachments</th> - </tr> - <tr> - <td class="spacer" colspan="5" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> <tr> - <th> <?php echo $user->lang['FILENAME']; ?> </th> - <th> <?php echo $user->lang['FILESIZE']; ?> </th> - <th> <?php echo $user->lang['ATTACH_POST_ID']; ?> </th> - <th> <?php echo $user->lang['ATTACH_TO_POST']; ?> </th> - <th> <?php echo $user->lang['DELETE']; ?> </th> + <th> <?php echo $user->lang['FILENAME']; ?> </th> + <th> <?php echo $user->lang['FILESIZE']; ?> </th> + <th> <?php echo $user->lang['ATTACH_POST_ID']; ?> </th> + <th> <?php echo $user->lang['ATTACH_TO_POST']; ?> </th> + <th> <?php echo $user->lang['DELETE']; ?> </th> </tr> <?php @@ -747,17 +727,17 @@ function marklist(match, name, status) foreach ($attach_filelist as $file) { $row_class = (++$i % 2 == 0) ? 'row2' : 'row1'; - $filesize = @filesize($upload_dir . '/' . $file); + $filesize = @filesize($config['upload_dir'] . '/' . $file); $size_lang = ($filesize >= 1048576) ? $user->lang['MB'] : ( ($filesize >= 1024) ? $user->lang['KB'] : $user->lang['BYTES'] ); $filesize = ($filesize >= 1048576) ? round((round($filesize / 1048576 * 100) / 100), 2) : (($filesize >= 1024) ? round((round($filesize / 1024 * 100) / 100), 2) : $filesize); ?> -<tr> - <td class="<?php echo $row_class; ?>"><a href="<?php echo $upload_dir . '/' . $file; ?>" class="gen" target="file"><?php echo $file; ?></a></td> - <td class="<?php echo $row_class; ?>"><?php echo $filesize . ' ' . $size_lang; ?></td> - <td class="<?php echo $row_class; ?>"><b class="gen">ID: </b><input type="text" name="post_id[<?php echo $file; ?>]" class="post" size="7" maxlength="10" value="<?php echo (!empty($post_ids[$file])) ? $post_ids[$file] : ''; ?>" /></td> - <td class="<?php echo $row_class; ?>"><input type="checkbox" name="add[<?php echo $file; ?>]" /></td> - <td class="<?php echo $row_class; ?>"><input type="checkbox" name="delete[<?php echo $file; ?>]" /></td> -</tr> + <tr> + <td class="<?php echo $row_class; ?>"><a href="<?php echo $config['upload_dir'] . '/' . $file; ?>" class="gen" target="file"><?php echo $file; ?></a></td> + <td class="<?php echo $row_class; ?>"><?php echo $filesize . ' ' . $size_lang; ?></td> + <td class="<?php echo $row_class; ?>"><b class="gen">ID: </b><input type="text" name="post_id[<?php echo $file; ?>]" class="post" size="7" maxlength="10" value="<?php echo (!empty($post_ids[$file])) ? $post_ids[$file] : ''; ?>" /></td> + <td class="<?php echo $row_class; ?>"><input type="checkbox" name="add[<?php echo $file; ?>]" /></td> + <td class="<?php echo $row_class; ?>"><input type="checkbox" name="delete[<?php echo $file; ?>]" /></td> + </tr> <?php } diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php index a3e553134a..27cb9b04cd 100644 --- a/phpBB/adm/admin_board.php +++ b/phpBB/adm/admin_board.php @@ -180,7 +180,7 @@ if ($submit) { // Check Settings test_upload($error, $new['upload_dir'], false); - test_upload($error, $new['upload_dir'] . '/thumbs', true); +// test_upload($error, $new['upload_dir'] . '/thumbs', true); } if (!sizeof($error)) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index d7b2defc47..6915a68ae6 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -148,7 +148,7 @@ elseif ($pane == 'right') if (!$delete) { - set_config('num_users', $config['num_users'] + $db->affected_rows()); + set_config('num_users', $config['num_users'] + $db->affected_rows(), true); } $log_action = ($activate) ? 'log_index_activate' : 'log_index_delete'; @@ -224,8 +224,8 @@ elseif ($pane == 'right') trigger_error($user->lang['NO_ADMIN']); } - set_config('record_online_users', 1); - set_config('record_online_date', time()); + set_config('record_online_users', 1, true); + set_config('record_online_date', time(), true); add_log('admin', 'LOG_RESET_ONLINE'); break; @@ -242,7 +242,7 @@ elseif ($pane == 'right') $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_posts', $row['stat']); + set_config('num_posts', (int) $row['stat'], true); $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' @@ -251,7 +251,7 @@ elseif ($pane == 'right') $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_topics', $row['stat']); + set_config('num_topics', (int) $row['stat'], true); $sql = 'SELECT COUNT(user_id) AS stat FROM ' . USERS_TABLE . ' @@ -260,7 +260,21 @@ elseif ($pane == 'right') $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - set_config('num_users', $row['stat']); + set_config('num_users', (int) $row['stat'], true); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + + set_config('num_files', (int) $db->sql_fetchfield('stat', 0, $result), true); + $db->sql_freeresult($result); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + + set_config('upload_dir_size', (int) $db->sql_fetchfield('stat', 0, $result), true); + $db->sql_freeresult($result); add_log('admin', 'LOG_RESYNC_STATS'); break; @@ -271,7 +285,7 @@ elseif ($pane == 'right') trigger_error($user->lang['NO_ADMIN']); } - set_config('board_startdate', time() - 1); + set_config('board_startdate', time() - 1, true); add_log('admin', 'LOG_RESET_DATE'); break; } @@ -280,6 +294,7 @@ elseif ($pane == 'right') $total_posts = $config['num_posts']; $total_topics = $config['num_topics']; $total_users = $config['num_users']; + $total_files = $config['num_files']; $start_date = $user->format_date($config['board_startdate']); @@ -288,6 +303,9 @@ elseif ($pane == 'right') $posts_per_day = sprintf('%.2f', $total_posts / $boarddays); $topics_per_day = sprintf('%.2f', $total_topics / $boarddays); $users_per_day = sprintf('%.2f', $total_users / $boarddays); + $files_per_day = sprintf('%.2f', $total_files / $boarddays); + + $upload_dir_size = ($config['upload_dir_size'] >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($config['upload_dir_size'] / 1048576)) : (($config['upload_dir_size'] >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($config['upload_dir_size'] / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $config['upload_dir_size'])); $avatar_dir_size = 0; @@ -305,19 +323,7 @@ elseif ($pane == 'right') // This bit of code translates the avatar directory size into human readable format // Borrowed the code from the PHP.net annoted manual, origanally written by: // Jesse (jesse@jess.on.ca) - if ($avatar_dir_size >= 1048576) - { - $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . ' MB'; - } - else if ($avatar_dir_size >= 1024) - { - $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . ' KB'; - } - else - { - $avatar_dir_size = $avatar_dir_size . ' Bytes'; - } - + $avatar_dir_size = ($avatar_dir_size >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($avatar_dir_size / 1048576)) : (($avatar_dir_size >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($avatar_dir_size / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $avatar_dir_size)); } else { @@ -340,6 +346,11 @@ elseif ($pane == 'right') $users_per_day = $total_users; } + if ($files_per_day > $total_files) + { + $files_per_day = $total_files; + } + // DB size ... MySQL only // This code is heavily influenced by a similar routine // in phpMyAdmin 2.2.0 @@ -403,7 +414,7 @@ elseif ($pane == 'right') if (is_int($dbsize)) { - $dbsize = ($dbsize >= 1048576) ? sprintf('%.2f MB', ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f KB', ($dbsize / 1024)) : sprintf('%.2f Bytes', $dbsize)); + $dbsize = ($dbsize >= 1048576) ? sprintf('%.2f ' . $user->lang['MB'], ($dbsize / 1048576)) : (($dbsize >= 1024) ? sprintf('%.2f ' . $user->lang['KB'], ($dbsize / 1024)) : sprintf('%.2f ' . $user->lang['BYTES'], $dbsize)); } adm_page_header($user->lang['ADMIN_INDEX']); @@ -454,6 +465,12 @@ elseif ($pane == 'right') <td class="row2"><b><?php echo $users_per_day; ?></b></td> </tr> <tr> + <td class="row1" nowrap="nowrap"><?php echo $user->lang['NUMBER_FILES']; ?>:</td> + <td class="row2"><b><?php echo $total_files; ?></b></td> + <td class="row1" nowrap="nowrap"><?php echo $user->lang['FILES_PER_DAY']; ?>:</td> + <td class="row2"><b><?php echo $files_per_day; ?></b></td> + </tr> + <tr> <td class="row1" nowrap="nowrap"><?php echo $user->lang['BOARD_STARTED']; ?>:</td> <td class="row2"><b><?php echo $start_date; ?></b></td> <td class="row1" nowrap="nowrap"><?php echo $user->lang['AVATAR_DIR_SIZE']; ?>:</td> @@ -462,8 +479,14 @@ elseif ($pane == 'right') <tr> <td class="row1" nowrap="nowrap"><?php echo $user->lang['DATABASE_SIZE']; ?>:</td> <td class="row2"><b><?php echo $dbsize; ?></b></td> + <td class="row1" nowrap="nowrap"><?php echo $user->lang['UPLOAD_DIR_SIZE']; ?>:</td> + <td class="row2"><b><?php echo $upload_dir_size; ?></b></td> + </tr> + <tr> <td class="row1" nowrap="nowrap"><?php echo $user->lang['GZIP_COMPRESSION']; ?>:</td> <td class="row2"><b><?php echo ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF']; ?></b></td> + <td class="row1" nowrap="nowrap"> </td> + <td class="row2"> </td> </tr> <tr> <td class="cat" colspan="4" align="right"><select name="action"><option value="online"><?php echo $user->lang['RESET_ONLINE']; ?></option><option value="date"><?php echo $user->lang['RESET_DATE']; ?></option><option value="stats"><?php echo $user->lang['RESYNC_STATS']; ?></option></select> <input class="btnlite" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> </td> |