diff options
| -rw-r--r-- | phpBB/adm/admin_attachments.php | 1740 | ||||
| -rw-r--r-- | phpBB/adm/admin_bbcodes.php | 440 | ||||
| -rw-r--r-- | phpBB/adm/admin_board.php | 517 | ||||
| -rw-r--r-- | phpBB/adm/admin_bots.php | 394 | ||||
| -rw-r--r-- | phpBB/adm/admin_icons.php | 776 | ||||
| -rw-r--r-- | phpBB/adm/admin_jabber.php | 212 | ||||
| -rw-r--r-- | phpBB/adm/admin_language.php | 1039 | ||||
| -rw-r--r-- | phpBB/adm/admin_phpinfo.php | 85 | ||||
| -rw-r--r-- | phpBB/adm/admin_viewlogs.php | 253 | ||||
| -rw-r--r-- | phpBB/adm/admin_words.php | 200 |
10 files changed, 0 insertions, 5656 deletions
diff --git a/phpBB/adm/admin_attachments.php b/phpBB/adm/admin_attachments.php deleted file mode 100644 index 1b538593bc..0000000000 --- a/phpBB/adm/admin_attachments.php +++ /dev/null @@ -1,1740 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - $filename = basename(__FILE__); - $module['GENERAL']['ATTACHMENT_SETTINGS'] = ($auth->acl_get('a_attach')) ? "$filename$SID&mode=attach" : ''; - $module['POST']['ATTACHMENTS'] = ($auth->acl_get('a_attach')) ? "$filename$SID&mode=ext_groups" : ''; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); -include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); - -$user->add_lang(array('posting', 'viewtopic')); - -if (!$auth->acl_get('a_attach')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -$mode = request_var('mode', ''); -$submit = (isset($_POST['submit'])) ? true : false; - -$error = $notify = array(); - -switch ($mode) -{ - case 'attach': - $l_title = 'ATTACHMENT_SETTINGS'; - break; - - case 'extensions': - $l_title = 'MANAGE_EXTENSIONS'; - break; - - case 'ext_groups': - $l_title = 'EXTENSION_GROUPS_TITLE'; - break; - - case 'orphan': - $l_title = 'ORPHAN_ATTACHMENTS'; - break; - - default: - trigger_error('NO_MODE'); -} - -if ($mode == 'attach') -{ - $config_sizes = array('max_filesize' => 'size', 'attachment_quota' => 'quota_size', 'max_filesize_pm' => 'pm_size'); - foreach ($config_sizes as $cfg_key => $var) - { - $$var = request_var($var, ''); - } - - // Pull all config data - $sql = 'SELECT * - FROM ' . CONFIG_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $config_name = $row['config_name']; - $config_value = $row['config_value']; - - $default_config[$config_name] = $config_value; - $new[$config_name] = request_var($config_name, $default_config[$config_name]); - - foreach ($config_sizes as $cfg_key => $var) - { - if (empty($$var) && !$submit && $config_name == $cfg_key) - { - $$var = (intval($default_config[$config_name]) >= 1048576) ? 'mb' : ((intval($default_config[$config_name]) >= 1024) ? 'kb' : 'b'); - } - - if (!$submit && $config_name == $cfg_key) - { - $new[$config_name] = ($new[$config_name] >= 1048576) ? round($new[$config_name] / 1048576 * 100) / 100 : (($new[$config_name] >= 1024) ? round($new[$config_name] / 1024 * 100) / 100 : $new[$config_name]); - } - - if ($submit && $config_name == $cfg_key) - { - $old = $new[$config_name]; - $new[$config_name] = ($$var == 'kb') ? round($new[$config_name] * 1024) : (($$var == 'mb') ? round($new[$config_name] * 1048576) : $new[$config_name]); - } - } - - if ($submit) - { - set_config($config_name, $new[$config_name]); - - if (in_array($config_name, array('max_filesize', 'attachment_quota', 'max_filesize_pm'))) - { - $new[$config_name] = $old; - } - } - } - - perform_site_list(); - - if ($submit) - { - add_log('admin', 'LOG_' . strtoupper($mode) . '_CONFIG'); - - // Check Settings - test_upload($error, $new['upload_path'], false); - - if (!sizeof($error)) - { - trigger_error($user->lang['CONFIG_UPDATED']); - } - } -} - -adm_page_header($user->lang[$l_title]); - - -if ($submit && $mode == 'extensions') -{ - // Change Extensions ? - $extension_change_list = (isset($_POST['extension_change_list'])) ? array_map('intval', $_POST['extension_change_list']) : array(); - $group_select_list = (isset($_POST['group_select'])) ? array_map('intval', $_POST['group_select']) : array(); - - // Generate correct Change List - $extensions = array(); - - for ($i = 0; $i < count($extension_change_list); $i++) - { - $extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i]; - } - - $sql = 'SELECT * - FROM ' . EXTENSIONS_TABLE . ' - ORDER BY extension_id'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if ($row['group_id'] != $extensions[$row['extension_id']]['group_id']) - { - $sql = 'UPDATE ' . EXTENSIONS_TABLE . ' - SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . ' - WHERE extension_id = ' . $row['extension_id']; - $db->sql_query($sql); - add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']); - } - } - $db->sql_freeresult($result); - - // Delete Extension ? - $extension_id_list = (isset($_POST['extension_id_list'])) ? array_map('intval', $_POST['extension_id_list']) : array(); - - if (sizeof($extension_id_list)) - { - $sql = 'SELECT extension - FROM ' . EXTENSIONS_TABLE . ' - WHERE extension_id IN (' . implode(', ', $extension_id_list) . ')'; - $result = $db->sql_query($sql); - - $extension_list = ''; - while ($row = $db->sql_fetchrow($result)) - { - $extension_list .= ($extension_list == '') ? $row['extension'] : ', ' . $row['extension']; - } - $db->sql_freeresult($result); - - $sql = 'DELETE - FROM ' . EXTENSIONS_TABLE . ' - WHERE extension_id IN (' . implode(', ', $extension_id_list) . ')'; - $db->sql_query($sql); - - add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list); - } - - // Add Extension ? - $add_extension = strtolower(request_var('add_extension', '')); - $add_extension_group = request_var('add_group_select', 0); - $add = (isset($_POST['add_extension_check'])) ? true : false; - - if ($add_extension != '' && $add) - { - if (!sizeof($error)) - { - $sql = 'SELECT extension_id - FROM ' . EXTENSIONS_TABLE . " - WHERE extension = '" . $db->sql_escape($add_extension) . "'"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension); - } - $db->sql_freeresult($result); - - if (!sizeof($error)) - { - $sql_ary = array( - 'group_id' => $add_extension_group, - 'extension' => $add_extension - ); - - $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - add_log('admin', 'LOG_ATTACH_EXT_ADD', $add_extension); - } - } - } - - if (!sizeof($error)) - { - $notify[] = $user->lang['EXTENSIONS_UPDATED']; - } - - $cache->destroy('extensions'); -} - - -if ($submit && $mode == 'ext_groups') -{ - $action = request_var('action', ''); - $group_id = request_var('g', 0); - - if ($action != 'add' && $action != 'edit') - { - trigger_error('WRONG_MODE'); - } - - if (!$group_id && $action == 'edit') - { - trigger_error('NO_EXT_GROUP_SPECIFIED'); - } - - if ($group_id) - { - $sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $ext_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - } - else - { - $ext_row = array(); - } - - $group_name = request_var('group_name', ''); - $new_group_name = ($action == 'add') ? $group_name : (($ext_row['group_name'] != $group_name) ? $group_name : ''); - - if (!$group_name) - { - $error[] = $user->lang['NO_EXT_GROUP_NAME']; - } - - // Check New Group Name - if ($new_group_name) - { - $sql = 'SELECT group_id - FROM ' . EXTENSION_GROUPS_TABLE . " - WHERE LOWER(group_name) = '" . $db->sql_escape(strtolower($new_group_name)) . "'"; - $result = $db->sql_query($sql); - if ($db->sql_fetchrow($result)) - { - $error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name); - } - $db->sql_freeresult($result); - } - - if (!sizeof($error)) - { - // Ok, build the update/insert array - $upload_icon = request_var('upload_icon', 'no_image'); - $size_select = request_var('size_select', 'b'); - $forum_select = request_var('forum_select', false); - $allowed_forums = isset($_POST['allowed_forums']) ? array_map('intval', array_values($_POST['allowed_forums'])) : array(); - $allow_in_pm = isset($_POST['allow_in_pm']) ? true : false; - $max_filesize = request_var('max_filesize', 0); - $max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize); - - if ($max_filesize == $config['max_filesize']) - { - $max_filesize = 0; - } - - if (!sizeof($allowed_forums)) - { - $forum_select = false; - } - - $group_ary = array( - 'group_name' => $group_name, - 'cat_id' => request_var('special_category', ATTACHMENT_CATEGORY_NONE), - 'allow_group' => (isset($_POST['allow_group'])) ? 1 : 0, - 'download_mode' => request_var('download_mode', INLINE_LINK), - 'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon, - 'max_filesize' => $max_filesize, - 'allowed_forums'=> ($forum_select) ? serialize($allowed_forums) : '', - 'allow_in_pm' => ($allow_in_pm) ? 1 : 0 - ); - - $sql = ($action == 'add') ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET '; - $sql .= $db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary); - $sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : ''; - - $db->sql_query($sql); - - if ($action == 'add') - { - $group_id = $db->sql_nextid(); - } - - add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name); - } - - $extension_list = isset($_REQUEST['extensions']) ? array_map('intval', array_values($_REQUEST['extensions'])) : array(); - - if ($action == 'edit' && sizeof($extension_list)) - { - $sql = 'UPDATE ' . EXTENSIONS_TABLE . " - SET group_id = 0 - WHERE group_id = $group_id"; - $db->sql_query($sql); - } - - if (sizeof($extension_list)) - { - $sql = 'UPDATE ' . EXTENSIONS_TABLE . " - SET group_id = $group_id - WHERE extension_id IN (" . implode(', ', $extension_list) . ")"; - $db->sql_query($sql); - } - - rewrite_extensions(); - - if (!sizeof($error)) - { - $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; - } -} - -?> - -<h1><?php echo $user->lang[$l_title]; ?></h1> - -<p><?php echo $user->lang[$l_title . '_EXPLAIN']; ?></p> - -<?php - -if ($submit && $mode == 'orphan') -{ - $delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array(); - $add_files = (isset($_POST['add'])) ? array_keys(request_var('add', array('' => 0))) : array(); - $post_ids = request_var('post_id', 0); - - foreach ($delete_files as $delete) - { - phpbb_unlink($delete); - phpbb_unlink($delete, 'thumbnail'); - } - - if (sizeof($delete_files)) - { - add_log('admin', sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files))); - $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files)); - } - - $upload_list = array(); - foreach ($add_files as $file) - { - if (!in_array($file, $delete_files) && $post_ids[$file]) - { - $upload_list[$post_ids[$file]] = $file; - } - } - unset($add_files); - - if (sizeof($upload_list)) - { -?> - <h2><?php echo $user->lang['UPLOADING_FILES']; ?></h2> -<?php - include($phpbb_root_path . 'includes/message_parser.' . $phpEx); - $message_parser = new parse_message(); - - $sql = 'SELECT forum_id, forum_name - FROM ' . FORUMS_TABLE; - $result = $db->sql_query($sql); - - $forum_names = array(); - while ($row = $db->sql_fetchrow($result)) - { - $forum_names[$row['forum_id']] = $row['forum_name']; - } - $db->sql_freeresult($result); - - $sql = 'SELECT forum_id, topic_id, post_id - FROM ' . POSTS_TABLE . ' - WHERE post_id IN (' . implode(', ', array_keys($upload_list)) . ')'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - echo sprintf($user->lang['UPLOADING_FILE_TO'], $upload_list[$row['post_id']], $row['post_id']) . '<br />'; - if (!$auth->acl_gets('f_attach', 'u_attach', $row['forum_id'])) - { - echo '<span style="color:red">' . sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) . '</span><br /><br />'; - } - else - { - upload_file($row['post_id'], $row['topic_id'], $row['forum_id'], $config['upload_path'], $upload_list[$row['post_id']]); - } - } - unset($message_parser); - } -} - - -if (sizeof($error)) -{ -?> - -<h2 style="color:red"><?php echo $user->lang['WARNING']; ?></h2> - -<p><?php echo implode('<br />', $error); ?></p> - -<?php -} - -if (sizeof($notify)) -{ -?> - -<h2 style="color:green"><?php echo $user->lang['NOTIFY']; ?></h2> - -<p><?php echo implode('<br />', $notify); ?></p> - -<?php -} - -$modes = array('extensions', 'ext_groups', 'orphan'); - -$s_select_mode = '<select name="mode">'; -foreach ($modes as $_mode) -{ - $s_select_mode .= '<option value="' . $_mode . '"' . (($mode == $_mode) ? ' selected="selected"' : '') . '>' . $user->lang['ATTACH_' . strtoupper($_mode) . '_URL'] . '</option>'; -} -$s_select_mode .= '</select>'; -?> -<form name="attachments" method="post" action="admin_attachments.<?php echo "$phpEx$SID&mode=$mode"; ?>"> -<?php -if ($mode != 'attach') -{ -?> - <table cellspacing="1" cellpadding="0" border="0" align="center" width="99%"> - <tr> - <td align="right"><?php echo $s_select_mode; ?> <input type="submit" name="select_mode" class="btnlite" value="<?php echo $user->lang['SELECT']; ?>" /></td> - </tr> - </table> -<?php -} - -// Attachment Settings -if ($mode == 'attach') -{ - $action = request_var('action', ''); - - if ($action == 'imgmagick') - { - $new['img_imagick'] = search_imagemagick(); - } - - // We strip eventually manual added convert program, we only want the patch - $new['img_imagick'] = str_replace(array('convert', '.exe'), array('', ''), $new['img_imagick']); - - $select_size_mode = size_select('size', $size); - $select_quota_size_mode = size_select('quota_size', $quota_size); - $select_pm_size_mode = size_select('pm_size', $pm_size); - - $display_order_yes = ($new['display_order']) ? 'checked="checked"' : ''; - $display_order_no = (!$new['display_order']) ? 'checked="checked"' : ''; - - $sql = 'SELECT group_name, cat_id - FROM ' . EXTENSION_GROUPS_TABLE . ' - WHERE cat_id > 0 - ORDER BY cat_id'; - $result = $db->sql_query($sql); - - $s_assigned_groups = array(); - while ($row = $db->sql_fetchrow($result)) - { - $s_assigned_groups[$row['cat_id']][] = $row['group_name']; - } - $db->sql_freeresult($result); - - $display_inlined_yes = ($new['img_display_inlined']) ? 'checked="checked"' : ''; - $display_inlined_no = (!$new['img_display_inlined']) ? 'checked="checked"' : ''; - - $create_thumbnail_yes = ($new['img_create_thumbnail']) ? 'checked="checked"' : ''; - $create_thumbnail_no = (!$new['img_create_thumbnail']) ? 'checked="checked"' : ''; - - $secure_downloads_yes = ($new['secure_downloads']) ? 'checked="checked"' : ''; - $secure_downloads_no = (!$new['secure_downloads']) ? 'checked="checked"' : ''; - - $secure_allow_deny_yes = ($new['secure_allow_deny']) ? 'checked="checked"' : ''; - $secure_allow_deny_no = (!$new['secure_allow_deny']) ? 'checked="checked"' : ''; - - $secure_allow_empty_referer_yes = ($new['secure_allow_empty_referer']) ? 'checked="checked"' : ''; - $secure_allow_empty_referer_no = (!$new['secure_allow_empty_referer']) ? 'checked="checked"' : ''; - -?> - - <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <th colspan="2"><?php echo $user->lang[$l_title]; ?></th> - </tr> - <tr> - <td class="row1" width="40%"><b><?php echo $user->lang['UPLOAD_DIR']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['UPLOAD_DIR_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="25" maxlength="100" name="upload_path" class="post" value="<?php echo $new['upload_path'] ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['DISPLAY_ORDER']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DISPLAY_ORDER_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="display_order" value="0" <?php echo $display_order_no; ?> /> <?php echo $user->lang['DESCENDING']; ?> <input type="radio" name="display_order" value="1" <?php echo $display_order_yes; ?> /> <?php echo $user->lang['ASCENDING']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ATTACH_QUOTA']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ATTACH_QUOTA_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="8" maxlength="15" name="attachment_quota" class="post" value="<?php echo $new['attachment_quota']; ?>" /> <?php echo $select_quota_size_mode; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ATTACH_MAX_FILESIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ATTACH_MAX_FILESIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize" class="post" value="<?php echo $new['max_filesize']; ?>" /> <?php echo $select_size_mode; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['ATTACH_MAX_PM_FILESIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ATTACH_MAX_PM_FILESIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="8" maxlength="15" name="max_filesize_pm" class="post" value="<?php echo $new['max_filesize_pm']; ?>" /> <?php echo $select_pm_size_mode; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_ATTACHMENTS'] ?>: </b></td> - <td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments" class="post" value="<?php echo $new['max_attachments']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_ATTACHMENTS_PM'] ?>: </b></td> - <td class="row2"><input type="text" size="3" maxlength="3" name="max_attachments_pm" class="post" value="<?php echo $new['max_attachments_pm']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SECURE_DOWNLOADS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SECURE_DOWNLOADS_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="secure_downloads" value="1" <?php echo $secure_downloads_yes ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="secure_downloads" value="0" <?php echo $secure_downloads_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SECURE_ALLOW_DENY']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SECURE_ALLOW_DENY_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="secure_allow_deny" value="1" <?php echo $secure_allow_deny_yes ?> /> <?php echo $user->lang['ORDER_ALLOW_DENY']; ?> <input type="radio" name="secure_allow_deny" value="0" <?php echo $secure_allow_deny_no ?> /> <?php echo $user->lang['ORDER_DENY_ALLOW']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['SECURE_EMPTY_REFERER']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SECURE_EMPTY_REFERER_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="secure_allow_empty_referer" value="1" <?php echo $secure_allow_empty_referer_yes ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="secure_allow_empty_referer" value="0" <?php echo $secure_allow_empty_referer_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <th align="center" colspan="2"><?php echo $user->lang['SETTINGS_CAT_IMAGES']; ?></th> - </tr> - <tr> - <td class="row3" colspan="2" align="center"><?php echo $user->lang['ASSIGNED_GROUP']; ?>: <?php echo ((sizeof($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NONE']); ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['DISPLAY_INLINED']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DISPLAY_INLINED_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="img_display_inlined" value="1" <?php echo $display_inlined_yes ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="img_display_inlined" value="0" <?php echo $display_inlined_no ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> -<?php - - $supported_types = get_supported_image_types(); - - // Check Thumbnail Support - if (!$new['img_imagick'] && (!isset($supported_types['format']) || !sizeof($supported_types['format']))) - { - $new['img_create_thumbnail'] = '0'; - } - else - { - -?> - <tr> - <td class="row1"><b><?php echo $user->lang['CREATE_THUMBNAIL']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['CREATE_THUMBNAIL_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="img_create_thumbnail" value="1" <?php echo $create_thumbnail_yes; ?> /> <?php echo $user->lang['YES']; ?> <input type="radio" name="img_create_thumbnail" value="0" <?php echo $create_thumbnail_no; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MIN_THUMB_FILESIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MIN_THUMB_FILESIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="7" maxlength="15" name="img_min_thumb_filesize" value="<?php echo $new['img_min_thumb_filesize']; ?>" class="post" /> <?php echo $user->lang['BYTES']; ?></td> - </tr> -<?php - - } - -?> - <tr> - <td class="row1"><b><?php echo $user->lang['IMAGICK_PATH']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['IMAGICK_PATH_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="20" maxlength="200" name="img_imagick" value="<?php echo $new['img_imagick']; ?>" class="post" /> <span class="gensmall">[ <a href="<?php echo "admin_attachments.$phpEx$SID&mode=$mode&action=imgmagick"; ?>"><?php echo $user->lang['SEARCH_IMAGICK']; ?></a> ]</span></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['MAX_IMAGE_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['MAX_IMAGE_SIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="3" maxlength="4" name="img_max_width" value="<?php echo $new['img_max_width']; ?>" class="post" /> px X <input type="text" size="3" maxlength="4" name="img_max_height" value="<?php echo $new['img_max_height']; ?>" class="post" /> px</td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['IMAGE_LINK_SIZE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['IMAGE_LINK_SIZE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="text" size="3" maxlength="4" name="img_link_width" value="<?php echo $new['img_link_width']; ?>" class="post" /> px X <input type="text" size="3" maxlength="4" name="img_link_height" value="<?php echo $new['img_link_height']; ?>" class="post" /> px</td> - </tr> - <tr> - <td class="cat" colspan="2" 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> - </tr> - </table> -<?php - // Secure Download Options - Same procedure as with banning - $allow_deny = ($new['secure_allow_deny']) ? 'ALLOWED' : 'DISALLOWED'; - - $sql = 'SELECT * - FROM ' . SITELIST_TABLE; - $result = $db->sql_query($sql); - - $defined_ips = ''; - $ips = array(); - - while ($row = $db->sql_fetchrow($result)) - { - $value = ($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']; - if ($value) - { - $defined_ips .= '<option' . (($row['ip_exclude']) ? ' class="sep"' : '') . ' value="' . $row['site_id'] . '">' . $value . '</option>'; - $ips[$row['site_id']] = $value; - } - } - $db->sql_freeresult($result); - - if (!$new['secure_downloads']) - { -?> - <br /> - <table cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <td class="row3" align="center"><?php echo $user->lang['SECURE_DOWNLOAD_NOTICE']; ?></td> - </tr> - </table> - -<?php - } -?> - - <br /> - <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <th colspan="2"><?php echo $user->lang['DEFINE_' . $allow_deny . '_IPS']; ?></th> - </tr> - <tr> - <td colspan="2" class="row3"><?php echo $user->lang['DOWNLOAD_ADD_IPS_EXPLAIN']; ?></td> - <tr> - <td class="row1" width="45%"><b><?php echo $user->lang['IP_HOSTNAME']; ?>: </b></td> - <td class="row2"><textarea cols="40" rows="3" name="ips"></textarea></td> - </tr> - <tr> - <td class="row1" width="45%"><b><?php echo $user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['EXCLUDE_ENTERED_IP']; ?></span></td> - <td class="row2"><input type="radio" name="ipexclude" value="1" /> <?php echo $user->lang['YES']; ?> <input type="radio" name="ipexclude" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"> <input type="submit" name="securesubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /> </td> - </tr> - <tr> - <th colspan="2"><?php echo $user->lang['REMOVE_' . $allow_deny . '_IPS']; ?></th> - </tr> -<?php - - if ($defined_ips != '') - { - -?> - <tr> - <td colspan="2" class="row3"><?php echo $user->lang['DOWNLOAD_REMOVE_IPS_EXPLAIN']; ?></td> - <tr> - <tr> - <td class="row1" width="45%"><?php echo $user->lang['IP_HOSTNAME']; ?>: <br /></td> - <td class="row2"> <select name="unip[]" multiple="multiple" size="10"><?php echo $defined_ips; ?></select></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="unsecuresubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1" colspan="2" align="center"><?php echo $user->lang['NO_IPS_DEFINED']; ?></td> - </tr> -<?php - } -?> - </table> -<?php -} - -// Extension Groups -if ($mode == 'ext_groups') -{ - $cat_lang = array( - ATTACHMENT_CATEGORY_NONE => $user->lang['NONE'], - ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'] - ); - - - $action = request_var('action', 'show'); - $group_id = request_var('g', 0); - $action = (isset($_POST['add'])) ? 'add' : $action; - $action = (($action == 'add' || $action == 'edit') && $submit && !sizeof($error)) ? 'show' : $action; - - if (isset($_POST['select_mode'])) - { - $action = 'show'; - } - - if ($action == 'delete') - { - $confirm = (isset($_POST['confirm'])) ? true : false; - $cancel = (isset($_POST['cancel'])) ? true : false; - - if (!$cancel && !$confirm) - { - adm_page_confirm($user->lang['CONFIRM'], $user->lang['CONFIRM_OPERATION']); - } - else if ($confirm && !$cancel) - { - $sql = 'SELECT group_name - FROM ' . EXTENSION_GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_name = $db->sql_fetchfield('group_name', 0, $result); - $db->sql_freeresult($result); - - $sql = 'DELETE - FROM ' . EXTENSION_GROUPS_TABLE . " - WHERE group_id = $group_id"; - $db->sql_query($sql); - - // Set corresponding Extensions to a pending Group - $sql = 'UPDATE ' . EXTENSIONS_TABLE . " - SET group_id = 0 - WHERE group_id = $group_id"; - $db->sql_query($sql); - - add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name); - - rewrite_extensions(); - - trigger_error('EXTENSION_GROUP_DELETED'); - } - else - { - $action = 'show'; - } - } - - switch ($action) - { - case 'edit': - - if (!$group_id) - { - trigger_error('NO_EXTENSION_GROUP'); - } - - $sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . " - WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - extract($db->sql_fetchrow($result)); - $db->sql_freeresult($result); - - $forum_ids = (!$allowed_forums) ? array() : unserialize(trim($allowed_forums)); - - case 'add': - - if ($action == 'add') - { - $group_name = request_var('group_name', ''); - $cat_id = 0; - $allow_group = 1; - $allow_in_pm = 1; - $download_mode = 1; - $upload_icon = ''; - $max_filesize = 0; - $forum_ids = array(); - } - - $extensions = array(); - - $sql = 'SELECT * FROM ' . EXTENSIONS_TABLE . " - WHERE group_id = $group_id OR group_id = 0 - ORDER BY extension"; - $result = $db->sql_query($sql); - $extensions = $db->sql_fetchrowset($result); - $db->sql_freeresult($result); - - $img_path = $config['upload_icons_path']; - - $imglist = filelist($phpbb_root_path . $img_path); - $imglist = array_values($imglist); - $imglist = $imglist[0]; - - $filename_list = ''; - foreach ($imglist as $key => $img) - { - $filename_list .= '<option value="' . $img . '">' . htmlspecialchars($img) . '</option>'; - } - - if ($max_filesize == 0) - { - $max_filesize = (int) $config['max_filesize']; - } - - $size_format = ($max_filesize >= 1048576) ? 'mb' : (($max_filesize >= 1024) ? 'kb' : 'b'); - - $max_filesize = ($max_filesize >= 1048576) ? round($max_filesize / 1048576 * 100) / 100 : (($max_filesize >= 1024) ? round($max_filesize / 1024 * 100) / 100 : $max_filesize); - - $s_allowed = ($allow_group) ? ' checked="checked"' : ''; - $s_in_pm_allowed = ($allow_in_pm) ? ' checked="checked"' : ''; - - $filename_list = ''; - $no_image_select = false; - foreach ($imglist as $key => $img) - { - if (!$upload_icon) - { - $no_image_select = true; - $selected = ''; - } - else - { - $selected = ($upload_icon == $img) ? ' selected="selected"' : ''; - } - - $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . htmlspecialchars($img) . '</option>'; - } - - // Show Edit Screen -?> - <script language="javascript" type="text/javascript" defer="defer"> - <!-- - - function update_image(newimage) - { - if (newimage == 'no_image') - { - document.image.src = "<?php echo $phpbb_root_path; ?>images/spacer.gif"; - } - else - { - document.image.src = "<?php echo $phpbb_root_path . $img_path; ?>/" + newimage; - } - } - - function show_extensions(elem) - { - var str = ''; - - for (i = 0; i < elem.length; i++) - { - var element = elem.options[i]; - if (element.selected) - { - if (str) - { - str = str + ', '; - } - - str = str + element.innerHTML; - } - } - - if (document.all) - { - document.all.ext.innerText = str; - } - else if (document.getElementById('ext').textContent) - { - document.getElementById('ext').textContent = str; - } - else if (document.getElementById('ext').firstChild.nodeValue) - { - document.getElementById('ext').firstChild.nodeValue = str; - } - } - - //--> - </script> - - <input type="hidden" name="action" value="<?php echo $action; ?>" /> - <input type="hidden" name="g" value="<?php echo $group_id; ?>" /> - - <table class="bg" width="99%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang[strtoupper($action) . '_EXTENSION_GROUP']; ?></th> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['GROUP_NAME']; ?>: </b></td> - <td class="row2"><input type="text" size="20" maxlength="100" name="group_name" class="post" value="<?php echo $group_name; ?>" /></td> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['SPECIAL_CATEGORY']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['SPECIAL_CATEGORY_EXPLAIN']; ?></span></td> - <td class="row2"><?php echo category_select('special_category', $group_id); ?></td> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['ALLOWED']; ?>: </b></td> - <td class="row2"><input type="checkbox" name="allow_group" value="<?php echo $group_id; ?>"<?php echo $s_allowed; ?> /></td> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['ALLOW_IN_PM']; ?>: </b></td> - <td class="row2"><input type="checkbox" name="allow_in_pm" value="1"<?php echo $s_in_pm_allowed; ?> /></td> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['DOWNLOAD_MODE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['DOWNLOAD_MODE_EXPLAIN']; ?></span></td> - <td class="row2"><?php echo download_select('download_mode', $group_id); ?></td> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['UPLOAD_ICON']; ?>: </b></td> - <td class="row2" align="left"> - <table border="0" cellpadding="0" cellspacing="0"> - <tr> - <td align="center"><select name="upload_icon" onChange="update_image(this.options[selectedIndex].value);"><option value="no_image"<?php echo (($no_image_select) ? ' selected="selected"' : ''); ?>><?php echo $user->lang['NO_IMAGE']; ?></option><?php echo $filename_list ?></select></td> - <td width="50" align="center" valign="middle"> <img src="<?php echo (($no_image_select) ? $phpbb_root_path . 'images/spacer.gif' : $phpbb_root_path . $img_path . '/' . $upload_icon) ?>" name="image" border="0" alt="" title="" /> </td> - </tr> - </table> - </td> - </tr> - <tr> - <td class="row1" width="35%"><b><?php echo $user->lang['MAX_EXTGROUP_FILESIZE']; ?>: </b></td> - <td class="row2"><input type="text" size="3" maxlength="15" name="max_filesize" class="post" value="<?php echo $max_filesize; ?>" /> <?php echo size_select('size_select', $size_format); ?></td> - </tr> - <tr> - <td class="row1" width="35%" valign="top"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td colspan="2"><b><?php echo $user->lang['ASSIGNED_EXTENSIONS']; ?>: </b></td></tr> - <tr><td class="row1" width="20"> » </td> - <td class="row1"><div id="ext" style="margin:0px; width:200px"> <?php - $i = 0; - foreach ($extensions as $num => $row) - { - if ($row['group_id'] == $group_id && $group_id) - { - echo ($i) ? ', ' . $row['extension'] : $row['extension']; - $i++; - } - } - ?></div></td></tr> - <tr><td class="row1"> </td><td class="row1"><br />[ <a href="admin_attachments.<?php echo $phpEx.$SID . '&mode=extensions'; ?>"><?php echo $user->lang['GO_TO_EXTENSIONS']; ?></a> ]</td></tr></table> - </td> - <td class="row2"><select name="extensions[]" onChange="show_extensions(this);" multiple="true" size="8" style="width:100px"> -<?php - foreach ($extensions as $row) - { - echo '<option' . ((!$row['group_id']) ? ' class="blue"' : '') . ' value="' . $row['extension_id'] . '"' . (($row['group_id'] == $group_id && $group_id) ? ' selected="selected"' : '') . '>' . $row['extension'] . '</option>'; - } -?> - </select></td> - </tr> - <tr> - <td class="row1" valign="top"><b><?php echo $user->lang['ALLOWED_FORUMS']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['ALLOWED_FORUMS_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="forum_select" value="0"<?php echo (!sizeof($forum_ids)) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['ALLOW_ALL_FORUMS']; ?> <input type="radio" name="forum_select" value="1"<?php echo (sizeof($forum_ids)) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['ALLOW_SELECTED_FORUMS']; ?><br /><br /> - <select name="allowed_forums[]" multiple="true" size="8"> -<?php - - $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id - FROM ' . FORUMS_TABLE . ' - ORDER BY left_id ASC'; - $result = $db->sql_query($sql); - - $right = $cat_right = $padding_inc = 0; - $padding = $forum_list = $holding = ''; - $padding_store = array('0' => ''); - while ($row = $db->sql_fetchrow($result)) - { - if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) - { - // Non-postable forum with no subforums, don't display - continue; - } - - if (!$auth->acl_get('f_list', $row['forum_id'])) - { - // if the user does not have permissions to list this forum skip - continue; - } - - if ($row['left_id'] < $right) - { - $padding .= ' '; - $padding_store[$row['parent_id']] = $padding; - } - else if ($row['left_id'] > $right + 1) - { - $padding = $padding_store[$row['parent_id']]; - } - - $right = $row['right_id']; - - $selected = (in_array($row['forum_id'], $forum_ids)) ? ' selected="selected"' : ''; - - if ($row['left_id'] > $cat_right) - { - $holding = ''; - } - - if ($row['right_id'] - $row['left_id'] > 1) - { - $cat_right = max($cat_right, $row['right_id']); - - $holding .= '<option value="' . $row['forum_id'] . '"' . (($row['forum_type'] == FORUM_POST) ? ' class="blue"' : '') . $selected . '>' . $padding . $row['forum_name'] . '</option>'; - } - else - { - echo $holding . '<option value="' . $row['forum_id'] . '"' . (($row['forum_type'] == FORUM_POST) ? ' class="blue"' : '') . $selected . '>' . $padding . $row['forum_name'] . '</option>'; - $holding = ''; - } - } - $db->sql_freeresult($result); - unset($padding_store); -?> - </select></td> - </tr> - <tr> - <td class="cat" colspan="2" 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> -<?php - - break; - - case 'deactivate': - case 'activate': - - if (!$group_id) - { - trigger_error('NO_EXTENSION_GROUP'); - } - - $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' - SET allow_group = ' . (($action == 'activate') ? '1' : '0') . " - WHERE group_id = $group_id"; - - $db->sql_query($sql); - - rewrite_extensions(); - - case 'show': - - $sql = 'SELECT * - FROM ' . EXTENSION_GROUPS_TABLE . ' - ORDER BY allow_group DESC, group_name'; - $result = $db->sql_query($sql); - -?> - - <table class="bg" width="99%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th width="60%"><?php echo $user->lang['EXTENSION_GROUP']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['SPECIAL_CATEGORY']; ?></th> - <th colspan="3"><?php echo $user->lang['OPTIONS']; ?></th> - </tr> - -<?php - - $row_class = 'row2'; - - while ($row = $db->sql_fetchrow($result)) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - - if ($row['allow_group'] == 0 && $act_deact == 'deactivate') - { -?> - - <tr> - <td class="spacer" colspan="5" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> - -<?php - - } - - $act_deact = ($row['allow_group']) ? 'deactivate' : 'activate'; -?> - - <tr> - <td class="<?php echo $row_class; ?>"><a href="admin_attachments.<?php echo "$phpEx$SID&mode=$mode&action=edit&g={$row['group_id']}"; ?>"><?php echo $row['group_name']; ?></a></td> - <td class="<?php echo $row_class; ?>"><b><?php echo $cat_lang[$row['cat_id']]; ?></b></td> - <td class="<?php echo $row_class; ?>"><a href="admin_attachments.<?php echo "$phpEx$SID&mode=$mode&action=$act_deact&g={$row['group_id']}"; ?>"><?php echo $user->lang[strtoupper($act_deact)]; ?></a></td> - <td class="<?php echo $row_class; ?>"><a href="admin_attachments.<?php echo "$phpEx$SID&mode=$mode&action=edit&g={$row['group_id']}"; ?>"><?php echo $user->lang['EDIT']; ?></a></td> - <td class="<?php echo $row_class; ?>"><a href="admin_attachments.<?php echo "$phpEx$SID&mode=$mode&action=delete&g={$row['group_id']}"; ?>"><?php echo $user->lang['DELETE']; ?></a></td> - </tr> - -<?php - } - $db->sql_freeresult($result); - -?> - <td class="cat" colspan="5" align="right"><?php echo $user->lang['CREATE_GROUP']; ?>: <input class="post" type="text" name="group_name" maxlength="30" /> <input class="btnmain" type="submit" name="add" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </table> - -<?php - - break; - } - -} - -// Extensions -if ($mode == 'extensions') -{ -?> - <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <tr> - <th> <?php echo $user->lang['EXTENSION']; ?> </th> - <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> - <th> <?php echo $user->lang['ADD_EXTENSION']; ?> </th> - </tr> - <tr> - <td class="row1" align="center" valign="middle"><input type="text" size="20" maxlength="100" name="add_extension" class="post" value="<?php echo (isset($add_extension)) ? $add_extension : ''; ?>" /></td> - <td class="row2" align="center" valign="middle"><?php echo (($submit) ? group_select('add_group_select', $add_extension_group) : group_select('add_group_select')) ?></td> - <td class="row1" align="center" valign="middle"><input type="checkbox" name="add_extension_check" /></td> - </tr> - <tr align="right"> - <td class="cat" colspan="3"><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /></td> - </tr> - <tr> - <th> <?php echo $user->lang['EXTENSION']; ?> </th> - <th> <?php echo $user->lang['EXTENSION_GROUP']; ?> </th> - <th> <?php echo $user->lang['DELETE']; ?> </th> - </tr> - -<?php - $sql = 'SELECT * - FROM ' . EXTENSIONS_TABLE . ' - ORDER BY group_id, extension'; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $old_group_id = $row['group_id']; - do - { - $current_group_id = $row['group_id']; - if ($old_group_id != $current_group_id) - { -?> - <tr> - <td class="spacer" colspan="2" height="1"><img src="../images/spacer.gif" alt="" width="1" height="1" /></td> - </tr> -<?php - $old_group_id = $current_group_id; - } -?> - <tr> - <input type="hidden" name="extension_change_list[]" value="<?php echo $row['extension_id']; ?>" /> - <td class="row1" align="center" valign="middle"><b class="gen"><?php echo $row['extension']; ?></b></td> - <td class="row2" align="center" valign="middle"><?php echo group_select('group_select[]', $row['group_id']); ?></td> - <td class="row1" align="center" valign="middle"><input type="checkbox" name="extension_id_list[]" value="<?php echo $row['extension_id']; ?>" /></td> - </tr> -<? - } - while ($row = $db->sql_fetchrow($result)); - } -?> - <tr> - <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> -<? -} - -// Orphan Attachments -if ($mode == 'orphan') -{ - $attach_filelist = array(); - - $dir = @opendir($phpbb_root_path . $config['upload_path']); - while ($file = @readdir($dir)) - { - if (is_file($phpbb_root_path . $config['upload_path'] . '/' . $file) && filesize($phpbb_root_path . $config['upload_path'] . '/' . $file) && $file{0} != '.' && $file != 'index.htm' && !preg_match('#^thumb\_#', $file)) - { - $attach_filelist[$file] = $file; - } - } - @closedir($dir); - -?> - -<script language="Javascript" type="text/javascript"> -<!-- -function marklist(match, name, status) -{ - len = eval('document.' + match + '.length'); - object = eval('document.' + match); - for (i = 0; i < len; i++) - { - result = eval('object.elements[' + i + '].name.search(/' + name + '.+/)'); - if (result != -1) - object.elements[i].checked = status; - } -} -//--> -</script> - -<?php - $sql = 'SELECT physical_filename - FROM ' . ATTACHMENTS_TABLE; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - unset($attach_filelist[$row['physical_filename']]); - } - $db->sql_freeresult($result); - -?> - - <table class="bg" cellspacing="1" cellpadding="4" border="0" align="center" width="99%"> - <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> - </tr> - -<?php - $i = 0; - foreach ($attach_filelist as $file) - { - $row_class = (++$i % 2 == 0) ? 'row2' : 'row1'; - $filesize = @filesize($phpbb_root_path . $config['upload_path'] . '/' . $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 $phpbb_root_path . $config['upload_path'] . '/' . $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 - } - -?> - <tr> - <td class="cat" colspan="3"><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" align="left"><b><span class="gensmall"><a href="javascript:marklist('attachments', 'add', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('attachments', 'add', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b></td> - <td class="cat" align="left"><b><span class="gensmall"><a href="javascript:marklist('attachments', 'delete', true);" class="gensmall"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('attachments', 'delete', false);" class="gensmall"><?php echo $user->lang['UNMARK_ALL']; ?></a></span></b></td> - </tr> -</table> -<?php -} - -?> - -</form> - -<br clear="all" /> - -<?php - -adm_page_footer(); - -// Build Select for category items -function category_select($select_name, $group_id = false) -{ - global $db, $user; - - $types = array( - ATTACHMENT_CATEGORY_NONE => $user->lang['NONE'], - ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_WM => $user->lang['CAT_WM_FILES'], - ATTACHMENT_CATEGORY_RM => $user->lang['CAT_RM_FILES'] - ); - - if ($group_id) - { - $sql = 'SELECT cat_id - FROM ' . EXTENSION_GROUPS_TABLE . ' - WHERE group_id = ' . (int) $group_id; - $result = $db->sql_query($sql); - - $cat_type = (!($row = $db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id']; - - $db->sql_freeresult($result); - } - else - { - $cat_type = ATTACHMENT_CATEGORY_NONE; - } - - $group_select = '<select name="' . $select_name . '">'; - - foreach ($types as $type => $mode) - { - $selected = ($type == $cat_type) ? ' selected="selected"' : ''; - $group_select .= '<option value="' . $type . '"' . $selected . '>' . $mode . '</option>'; - } - - $group_select .= '</select>'; - - return $group_select; -} - -// Extension group select -function group_select($select_name, $default_group = false) -{ - global $db, $user; - - $group_select = '<select name="' . $select_name . '">'; - - $sql = 'SELECT group_id, group_name - FROM ' . EXTENSION_GROUPS_TABLE . ' - ORDER BY group_name'; - $result = $db->sql_query($sql); - - $group_name = array(); - while ($row = $db->sql_fetchrow($result)) - { - $group_name[] = $row; - } - $db->sql_freeresult($result); - - $row['group_id'] = 0; - $row['group_name'] = $user->lang['NOT_ASSIGNED']; - $group_name[] = $row; - - for ($i = 0; $i < sizeof($group_name); $i++) - { - if ($default_group === false) - { - $selected = ($i == 0) ? ' selected="selected"' : ''; - } - else - { - $selected = ($group_name[$i]['group_id'] == $default_group) ? ' selected="selected"' : ''; - } - - $group_select .= '<option value="' . $group_name[$i]['group_id'] . '"' . $selected . '>' . $group_name[$i]['group_name'] . '</option>'; - } - - $group_select .= '</select>'; - - return $group_select; -} - -// Build select for download modes -function download_select($select_name, $group_id = false) -{ - global $db, $user; - - $types = array( - INLINE_LINK => $user->lang['MODE_INLINE'], - PHYSICAL_LINK => $user->lang['MODE_PHYSICAL'] - ); - - if ($group_id) - { - $sql = "SELECT download_mode - FROM " . EXTENSION_GROUPS_TABLE . " - WHERE group_id = " . (int) $group_id; - $result = $db->sql_query($sql); - - $download_mode = (!($row = $db->sql_fetchrow($result))) ? INLINE_LINK : $row['download_mode']; - - $db->sql_freeresult($result); - } - else - { - $download_mode = INLINE_LINK; - } - - $group_select = '<select name="' . $select_name . '">'; - - foreach ($types as $type => $mode) - { - $selected = ($type == $download_mode) ? ' selected="selected"' : ''; - $group_select .= '<option value="' . $type . '"' . $selected . '>' . $mode . '</option>'; - } - - $group_select .= '</select>'; - - return $group_select; -} - -// Upload already uploaded file... huh? are you kidding? -function upload_file($post_id, $topic_id, $forum_id, $upload_dir, $filename) -{ - global $message_parser, $db, $user, $phpbb_root_path; - - $message_parser->attachment_data = array(); - - $message_parser->filename_data['filecomment'] = ''; - $message_parser->filename_data['filename'] = $phpbb_root_path . $upload_dir . '/' . basename($filename); - - $filedata = upload_attachment('local', $forum_id, true, $phpbb_root_path . $upload_dir . '/' . basename($filename)); - - if ($filedata['post_attach'] && !sizeof($filedata['error'])) - { - $message_parser->attachment_data = array( - 'post_msg_id' => $post_id, - 'poster_id' => $user->data['user_id'], - 'topic_id' => $topic_id, - 'in_message' => 0, - 'physical_filename' => $filedata['physical_filename'], - 'real_filename' => $filedata['real_filename'], - 'comment' => $message_parser->filename_data['filecomment'], - 'extension' => $filedata['extension'], - 'mimetype' => $filedata['mimetype'], - 'filesize' => $filedata['filesize'], - 'filetime' => $filedata['filetime'], - 'thumbnail' => $filedata['thumbnail'] - ); - - $message_parser->filename_data['filecomment'] = ''; - $filedata['post_attach'] = FALSE; - - // Submit Attachment - $attach_sql = $message_parser->attachment_data; - - $db->sql_transaction(); - - $sql = 'INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $attach_sql); - $db->sql_query($sql); - - $sql = 'UPDATE ' . POSTS_TABLE . " - SET post_attachment = 1 - WHERE post_id = $post_id"; - $db->sql_query($sql); - - $sql = 'UPDATE ' . TOPICS_TABLE . " - SET topic_attachment = 1 - WHERE topic_id = $topic_id"; - $db->sql_query($sql); - - $db->sql_transaction('commit'); - - add_log('admin', sprintf($user->lang['LOG_ATTACH_FILEUPLOAD'], $post_id, $filename)); - echo '<span style="color:green">' . $user->lang['SUCCESSFULLY_UPLOADED'] . '</span><br /><br />'; - } - else if (sizeof($filedata['error'])) - { - echo '<span style="color:red">' . sprintf($user->lang['ADMIN_UPLOAD_ERROR'], implode("<br />\t", $filedata['error'])) . '</span><br /><br />'; - } -} - -// Search Imagick -function search_imagemagick() -{ - $imagick = ''; - - $exe = ((defined('PHP_OS')) && (preg_match('#win#i', PHP_OS))) ? '.exe' : ''; - - if (empty($_ENV['MAGICK_HOME'])) - { - $locations = array('C:/WINDOWS/', 'C:/WINNT/', 'C:/WINDOWS/SYSTEM/', 'C:/WINNT/SYSTEM/', 'C:/WINDOWS/SYSTEM32/', 'C:/WINNT/SYSTEM32/', '/usr/bin/', '/usr/sbin/', '/usr/local/bin/', '/usr/local/sbin/', '/opt/', '/usr/imagemagick/', '/usr/bin/imagemagick/'); - - foreach ($locations as $location) - { - if (@is_readable($location . 'mogrify' . $exe) && @filesize($location . 'mogrify' . $exe) > 3000) - { - $imagick = str_replace('\\', '/', $location); - continue; - } - } - } - else - { - $imagick = str_replace('\\', '/', $_ENV['MAGICK_HOME']); - } - - return $imagick; -} - -// Test Settings -function test_upload(&$error, $upload_dir, $create_directory = false) -{ - global $user, $phpbb_root_path; - - // Does the target directory exist, is it a directory and writeable. - if ($create_directory) - { - if (!file_exists($phpbb_root_path . $upload_dir)) - { - @mkdir($phpbb_root_path . $upload_dir, 0777); - @chmod($phpbb_root_path . $upload_dir, 0777); - } - } - - if (!file_exists($phpbb_root_path . $upload_dir)) - { - $error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir); - return; - } - - if (!is_dir($phpbb_root_path . $upload_dir)) - { - $error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir); - return; - } - - if (!is_writable($phpbb_root_path . $upload_dir)) - { - $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); - return; - } -} - -function perform_site_list() -{ - global $db, $user; - - if (isset($_REQUEST['securesubmit'])) - { - // Grab the list of entries - $ips = request_var('ips', ''); - $ip_list = array_unique(explode("\n", $ips)); - $ip_list_log = implode(', ', $ip_list); - - $ip_exclude = (!empty($_POST['ipexclude'])) ? 1 : 0; - - $iplist = array(); - $hostlist = array(); - - foreach ($ip_list as $item) - { - if (preg_match('#^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$#', trim($item), $ip_range_explode)) - { - // Don't ask about all this, just don't ask ... ! - $ip_1_counter = $ip_range_explode[1]; - $ip_1_end = $ip_range_explode[5]; - - while ($ip_1_counter <= $ip_1_end) - { - $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; - $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; - - if ($ip_2_counter == 0 && $ip_2_end == 254) - { - $ip_2_counter = 256; - $ip_2_fragment = 256; - - $iplist[] = "'$ip_1_counter.*'"; - } - - while ($ip_2_counter <= $ip_2_end) - { - $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; - $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; - - if ($ip_3_counter == 0 && $ip_3_end == 254) - { - $ip_3_counter = 256; - $ip_3_fragment = 256; - - $iplist[] = "'$ip_1_counter.$ip_2_counter.*'"; - } - - while ($ip_3_counter <= $ip_3_end) - { - $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; - $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; - - if ($ip_4_counter == 0 && $ip_4_end == 254) - { - $ip_4_counter = 256; - $ip_4_fragment = 256; - - $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'"; - } - - while ($ip_4_counter <= $ip_4_end) - { - $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter'"; - $ip_4_counter++; - } - $ip_3_counter++; - } - $ip_2_counter++; - } - $ip_1_counter++; - } - } - else if (preg_match('#^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$#', trim($item)) || preg_match('#^[a-f0-9:]+\*?$#i', trim($item))) - { - $iplist[] = "'" . trim($item) . "'"; - } - else if (preg_match('#^([\w\-_]\.?){2,}$#is', trim($item))) - { - $hostlist[] = "'" . trim($item) . "'"; - } - else if (preg_match("#^([a-z0-9\-\*\._/]+?)$#is", trim($item))) - { - $hostlist[] = "'" . trim($item) . "'"; - } - } - - $sql = 'SELECT site_ip, site_hostname - FROM ' . SITELIST_TABLE . " - WHERE ip_exclude = $ip_exclude"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $iplist_tmp = array(); - $hostlist_tmp = array(); - do - { - if ($row['site_ip']) - { - $iplist_tmp[] = "'" . $row['site_ip'] . "'"; - } - else if ($row['site_hostname']) - { - $hostlist_tmp[] = "'" . $row['site_hostname'] . "'"; - } - break; - } - while ($row = $db->sql_fetchrow($result)); - - $iplist = array_unique(array_diff($iplist, $iplist_tmp)); - $hostlist = array_unique(array_diff($hostlist, $hostlist_tmp)); - unset($iplist_tmp); - unset($hostlist_tmp); - } - - if (sizeof($iplist)) - { - foreach ($iplist as $ip_entry) - { - $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_ip, ip_exclude) - VALUES ($ip_entry, $ip_exclude)"; - $db->sql_query($sql); - } - } - - if (sizeof($hostlist)) - { - foreach ($hostlist as $host_entry) - { - $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_hostname, ip_exclude) - VALUES ($host_entry, $ip_exclude)"; - $db->sql_query($sql); - } - } - - if (!empty($ip_list_log)) - { - // Update log - $log_entry = ($ip_exclude) ? 'LOG_DOWNLOAD_EXCLUDE_IP' : 'LOG_DOWNLOAD_IP'; - add_log('admin', $log_entry, $ip_list_log); - } - - trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS']); - } - else if (isset($_POST['unsecuresubmit'])) - { - $unip_sql = implode(', ', array_map('intval', $_POST['unip'])); - - if ($unip_sql != '') - { - $l_unip_list = ''; - - // Grab details of ips for logging information later - $sql = 'SELECT site_ip, site_hostname - FROM ' . SITELIST_TABLE . " - WHERE site_id IN ($unip_sql)"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $l_unip_list .= (($l_unip_list != '') ? ', ' : '') . (($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']); - } - - $sql = 'DELETE FROM ' . SITELIST_TABLE . " - WHERE site_id IN ($unip_sql)"; - $db->sql_query($sql); - - add_log('admin', 'LOG_DOWNLOAD_REMOVE_IP', $l_unip_list); - } - - trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS']); - } -} - -// Re-Write extensions cache file -function rewrite_extensions() -{ - global $db, $cache; - - $sql = 'SELECT e.extension, g.* - FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g - WHERE e.group_id = g.group_id - AND g.allow_group = 1'; - $result = $db->sql_query($sql); - - $extensions = array(); - while ($row = $db->sql_fetchrow($result)) - { - $extension = $row['extension']; - - $extensions[$extension]['display_cat'] = (int) $row['cat_id']; - $extensions[$extension]['download_mode']= (int) $row['download_mode']; - $extensions[$extension]['upload_icon'] = (string) $row['upload_icon']; - $extensions[$extension]['max_filesize'] = (int) $row['max_filesize']; - - $allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array(); - - if ($row['allow_in_pm']) - { - $allowed_forums = array_merge($allowed_forums, array(0)); - } - - // Store allowed extensions forum wise - $extensions['_allowed_'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums; - } - $db->sql_freeresult($result); - - $cache->destroy('extensions'); - $cache->put('extensions', $extensions); -} - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_bbcodes.php b/phpBB/adm/admin_bbcodes.php deleted file mode 100644 index 782191de87..0000000000 --- a/phpBB/adm/admin_bbcodes.php +++ /dev/null @@ -1,440 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_bbcode')) - { - return; - } - - $module['POST']['BBCODES'] = basename(__FILE__) . $SID; - return; -} - -define('IN_PHPBB', 1); - -// Include files -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Do we have general permissions? -if (!$auth->acl_get('a_bbcode')) -{ - trigger_error('NO_ADMIN'); -} - -// Set up general vars -$mode = request_var('mode', ''); -$bbcode_id = request_var('bbcode', 0); - -// Set up mode-specific vars -switch ($mode) -{ - case 'add': - $bbcode_match = $bbcode_tpl = ''; - break; - - case 'edit': - $sql = 'SELECT bbcode_match, bbcode_tpl - FROM ' . BBCODES_TABLE . ' - WHERE bbcode_id = ' . $bbcode_id; - $result = $db->sql_query($sql); - if (!$row = $db->sql_fetchrow($result)) - { - trigger_error('BBCODE_NOT_EXIST'); - } - $db->sql_freeresult($result); - - $bbcode_match = $row['bbcode_match']; - $bbcode_tpl = htmlspecialchars($row['bbcode_tpl']); - break; - - case 'modify': - $sql = 'SELECT bbcode_id - FROM ' . BBCODES_TABLE . ' - WHERE bbcode_id = ' . $bbcode_id; - $result = $db->sql_query($sql); - if (!$row = $db->sql_fetchrow($result)) - { - trigger_error('BBCODE_NOT_EXIST'); - } - $db->sql_freeresult($result); - - // No break here - - case 'create': - $bbcode_match = htmlspecialchars(stripslashes($_POST['bbcode_match'])); - $bbcode_tpl = stripslashes($_POST['bbcode_tpl']); - break; -} - -// Do major work -switch ($mode) -{ - case 'edit': - case 'add': - adm_page_header($user->lang['BBCODES']); - -?> - -<h1><?php echo $user->lang['BBCODES'] ?></h1> - -<p><?php echo $user->lang['BBCODES_EXPLAIN'] ?></p> - -<form method="post" action="admin_bbcodes.<?php echo $phpEx . $SID . '&mode=' . (($mode == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : '') ?>"> -<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%"> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['BBCODE_USAGE'] ?></th> - </tr> - <tr> - <td class="row3" colspan="2"><?php echo $user->lang['BBCODE_USAGE_EXPLAIN'] ?></td> - </tr> - <tr valign="top"> - <td class="row1" width="40%"><b><?php echo $user->lang['EXAMPLES'] ?></b><br /><br /><?php echo $user->lang['BBCODE_USAGE_EXAMPLE'] ?></td> - <td class="row2"><textarea name="bbcode_match" cols="60" rows="5"><?php echo $bbcode_match ?></textarea></td> - </tr> - </table></td> - </tr> -</table> - -<br clear="all" /> - -<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%"> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['HTML_REPLACEMENT'] ?></th> - </tr> - <tr> - <td class="row3" colspan="2"><?php echo $user->lang['HTML_REPLACEMENT_EXPLAIN'] ?></td> - </tr> - <tr valign="top"> - <td class="row1" width="40%"><b><?php echo $user->lang['EXAMPLES'] ?></b><br /><br /><?php echo $user->lang['HTML_REPLACEMENT_EXAMPLE'] ?></td> - <td class="row2"><textarea name="bbcode_tpl" cols="60" rows="8"><?php echo $bbcode_tpl ?></textarea></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" class="btnmain" /></td> - </tr> - </table></td> - </tr> -</table> - -<br clear="all" /> - -<table cellspacing="1" cellpadding="0" border="0" align="center" width="90%"> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['TOKENS'] ?></th> - </tr> - <tr> - <td class="row3" colspan="2"><?php echo $user->lang['TOKENS_EXPLAIN'] ?></td> - </tr> - <tr> - <th><?php echo $user->lang['TOKEN'] ?></th> - <th><?php echo $user->lang['TOKEN_DEFINITION'] ?></th> - </tr> -<?php - - foreach ($user->lang['tokens'] as $token => $token_explain) - { - ?><tr valign="top"> - <td class="row1">{<?php echo $token ?>}</td> - <td class="row2"><?php echo $token_explain ?></td> - </tr><?php - } - -?> - </table></td> - </tr> -</table> -</form> - -<?php - - adm_page_footer(); - break; - - case 'modify': - case 'create': - adm_page_header($user->lang['BBCODES']); - - $data = build_regexp($bbcode_match, $bbcode_tpl); - - $sql_ary = array( - 'bbcode_tag' => $data['bbcode_tag'], - 'bbcode_match' => $bbcode_match, - 'bbcode_tpl' => $bbcode_tpl, - 'first_pass_match' => $data['first_pass_match'], - 'first_pass_replace' => $data['first_pass_replace'], - 'second_pass_match' => $data['second_pass_match'], - 'second_pass_replace' => $data['second_pass_replace'] - ); - - if ($mode == 'create') - { - /* TODO: look for SQL incompatibilities - // NOTE: I'm sure there was another simpler (and obvious) way of finding a suitable bbcode_id - $sql = 'SELECT b1.bbcode_id - FROM ' . BBCODES_TABLE . ' b1, ' . BBCODES_TABLE . ' b2 - WHERE b2.bbcode_id > b1.bbcode_id - GROUP BY b1.bbcode_id - HAVING MIN(b2.bbcode_id) > b1.bbcode_id + 1 - ORDER BY b1.bbcode_id ASC'; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); -*/ - $sql = 'SELECT MAX(bbcode_id) as bbcode_id - FROM ' . BBCODES_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row) - { - $bbcode_id = $row['bbcode_id'] + 1; - } - else - { - $sql = 'SELECT MIN(bbcode_id) AS min_id, MAX(bbcode_id) AS max_id - FROM ' . BBCODES_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (empty($row['min_id']) || $row['min_id'] >= NUM_CORE_BBCODES) - { - $bbcode_id = NUM_CORE_BBCODES + 1; - } - else - { - $bbcode_id = $row['max_id'] + 1; - } - } - - if ($bbcode_id > 31) - { - trigger_error('TOO_MANY_BBCODES'); - } - - $sql_ary['bbcode_id'] = (int) $bbcode_id; - - $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); - $lang = 'BBCODE_ADDED'; - $log_action = 'LOG_BBCODE_ADD'; - } - else - { - $db->sql_query('UPDATE ' . BBCODES_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE bbcode_id = ' . $bbcode_id); - $lang = 'BBCODE_EDITED'; - $log_action = 'LOG_BBCODE_EDIT'; - } - - add_log('admin', $log_action, $data['bbcode_tag']); - - trigger_error($lang); - break; - - case 'delete': - $sql = 'SELECT bbcode_tag - FROM ' . BBCODES_TABLE . " - WHERE bbcode_id = $bbcode_id"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); - add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']); - } - $db->sql_freeresult($result); - - // No break here - - default: - - adm_page_header($user->lang['BBCODES']); - -?> - -<h1><?php echo $user->lang['BBCODES'] ?></h1> - -<p><?php echo $user->lang['BBCODES_EXPLAIN'] ?></p> - - -<form method="post" action="admin_bbcodes.<?php echo $phpEx . $SID ?>&mode=add"><table cellspacing="1" cellpadding="0" border="0" align="center"> - <tr> - <td><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['BBCODE_TAG'] ?></th> - <th><?php echo $user->lang['ACTION'] ?></th> - </tr><?php - - $sql = 'SELECT * - FROM ' . BBCODES_TABLE . ' - ORDER BY bbcode_id'; - $result = $db->sql_query($sql); - - $row_class = ''; - while ($row = $db->sql_fetchrow($result)) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; -?> - <tr> - <td class="<?php echo $row_class ?>" align="center"><?php echo $row['bbcode_tag'] ?></td> - <td class="<?php echo $row_class ?>" align="center"><a href="admin_bbcodes.<?php echo $phpEx . $SID ?>&mode=edit&bbcode=<?php echo $row['bbcode_id'] ?>"><?php echo $user->lang['EDIT'] ?></a> | <a href="admin_bbcodes.<?php echo $phpEx . $SID ?>&mode=delete&bbcode=<?php echo $row['bbcode_id'] ?>"><?php echo $user->lang['DELETE'] ?></a></td> - </tr> -<?php - } - $db->sql_freeresult($result); - -?> - - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" value="<?php echo $user->lang['ADD_BBCODE'] ?>" class="btnmain" /></td> - </tr> - </table></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); -} - -// ----------------------------- -// Functions -function build_regexp($msg_bbcode, $msg_html) -{ - $msg_bbcode = trim($msg_bbcode); - $msg_html = trim($msg_html); - - $fp_match = preg_quote($msg_bbcode, '!'); - $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $msg_bbcode); - $fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace); - - $sp_match = preg_quote($msg_bbcode, '!'); - $sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match); - $sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match); - $sp_replace = $msg_html; - - $tokens = array( - 'URL' => array( - '!([a-z0-9]+://)?([^?].*?[^ \t\n\r<"]*)!ie' => "(('\$1') ? '\$1\$2' : 'http://\$2')" - ), - 'LOCAL_URL' => array( - '!([^:]+/[^ \t\n\r<"]*)!' => '$1' - ), - 'EMAIL' => array( - '!([a-z0-9]+[a-z0-9\-\._]*@(?:(?:[0-9]{1,3}\.){3,5}[0-9]{1,3}|[a-z0-9]+[a-z0-9\-\._]*\.[a-z]+))!i' => '$1' - ), - 'TEXT' => array( - '!(.*?)!es' => "str_replace('\\\"', '"', str_replace('\\'', ''', '\$1'))" - ), - 'COLOR' => array( - '!([a-z]+|#[0-9abcdef]+!i' => '$1' - ), - 'NUMBER' => array( - '!([0-9]+)!' => '$1' - ) - ); - - if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $msg_bbcode, $m)) - { - $pad = 0; - $modifiers = 'i'; - - foreach ($m[0] as $n => $token) - { - $token_type = $m[1][$n]; - - reset($tokens[$token_type]); - list($match, $replace) = each($tokens[$token_type]); - - // Pad backreference numbers from tokens - if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad)) - { - $repad = $pad + count(array_unique($repad[0])); - $replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\$' . (\$1 + \$pad)", $replace); - $pad = $repad; - } - - // Obtain pattern modifiers to use and alter the regex accordingly - $regex = preg_replace('/!(.*)!([a-z]*)/', '$1', $match); - $regex_modifiers = preg_replace('/!(.*)!([a-z]*)/', '$2', $match); - - for ($i = 0; $i < strlen($regex_modifiers); ++$i) - { - if (strpos($modifiers, $regex_modifiers[$i]) === FALSE) - { - $modifiers .= $regex_modifiers[$i]; - - if ($regex_modifiers[$i] == 'e') - { - $fp_replace = "'" . str_replace("'", "\\'", $fp_replace) . "'"; - } - } - - if ($regex_modifiers[$i] == 'e') - { - $replace = "'.$replace.'"; - } - } - - $fp_match = str_replace(preg_quote($token, '!'), $regex, $fp_match); - $fp_replace = str_replace($token, $replace, $fp_replace); - - $sp_match = str_replace(preg_quote($token, '!'), '(.*?)', $sp_match); - $sp_replace = str_replace($token, '$' . ($n + 1), $sp_replace); - } - - $fp_match = '!' . $fp_match . '!' . $modifiers; - $sp_match = '!' . $sp_match . '!s'; - - if (strpos($fp_match, 'e') !== FALSE) - { - $fp_replace = str_replace("'.'", '', $fp_replace); - $fp_replace = str_replace(".''.", '.', $fp_replace); - } - } - else - { - // No replacement is present, no need for a second-pass pattern replacement - // A simple str_replace will suffice - $fp_match = '!' . $fp_match . '!' . $modifiers; - $sp_match = $fp_replace; - $sp_replace = ''; - } - - // Lowercase tags - $bbcode_tag = preg_replace('/.*?\[([a-z]+).*/i', '$1', $msg_bbcode); - $fp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_match); - $fp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $fp_replace); - $sp_match = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_match); - $sp_replace = preg_replace('#\[/?' . $bbcode_tag . '#ie', "strtolower('\$0')", $sp_replace); - - return array( - 'bbcode_tag' => $bbcode_tag, - 'first_pass_match' => $fp_match, - 'first_pass_replace' => $fp_replace, - 'second_pass_match' => $sp_match, - 'second_pass_replace' => $sp_replace - ); -} -// End Functions -// ----------------------------- - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_board.php b/phpBB/adm/admin_board.php deleted file mode 100644 index 9554e31f25..0000000000 --- a/phpBB/adm/admin_board.php +++ /dev/null @@ -1,517 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - $filename = basename(__FILE__); - $module['GENERAL']['AUTH_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=auth" : ''; - $module['GENERAL']['AVATAR_SETTINGS'] = ($auth->acl_get('a_board')) ? "$filename$SID&mode=avatar" : ''; - $module['GENERAL']['BOARD_DEFAULTS'] = ($auth->acl_get('a_defaults')) ? "$filename$SID&mode=default" : ''; - $module['GENERAL']['BOARD_SETTINGS'] = ($auth->acl_get('a_board')) ? "$filename$SID&mode=setting" : ''; - $module['GENERAL']['COOKIE_SETTINGS'] = ($auth->acl_get('a_cookies')) ? "$filename$SID&mode=cookie" : ''; - $module['GENERAL']['EMAIL_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=email" : ''; - $module['GENERAL']['LOAD_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=load" : ''; - $module['GENERAL']['SERVER_SETTINGS'] = ($auth->acl_get('a_server')) ? "$filename$SID&mode=server" : ''; - $module['GENERAL']['MESSAGE_SETTINGS'] = ($auth->acl_get('a_defaults')) ? "$filename$SID&mode=message" : ''; - return; -} - -define('IN_PHPBB', 1); -// Load default header -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Get mode -$mode = request_var('mode', ''); -$action = request_var('action', ''); -$submit = (isset($_POST['submit'])) ? true : false; - -// Set config vars -$display_vars = array( - 'cookie' => array( - 'auth' => 'a_cookies', - 'title' => 'COOKIE_SETTINGS', - 'vars' => array( - 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'type' => 'text::255', 'explain' => false), - 'cookie_name' => array('lang' => 'COOKIE_NAME', 'type' => 'text::16', 'explain' => false), - 'cookie_path' => array('lang' => 'COOKIE_PATH', 'type' => 'text::255', 'explain' => false), - 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'type' => 'radio:disabled_enabled', 'explain' => true) - ) - ), - 'avatar' => array( - 'auth' => 'a_board', - 'title' => 'AVATAR_SETTINGS', - 'vars' => array( - 'avatar_min_height' => false, 'avatar_min_width' => false, 'avatar_max_height' => false, 'avatar_max_width' => false, - - 'allow_avatar_local' => array('lang' => 'ALLOW_LOCAL', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_avatar_remote' => array('lang' => 'ALLOW_REMOTE', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_avatar_upload' => array('lang' => 'ALLOW_UPLOAD', 'type' => 'radio:yes_no', 'explain' => false), - 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'type' => 'text:4:10', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), - 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true), - 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'type' => 'dimension:3:4', 'explain' => true), - 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'type' => 'text:20:255', 'explain' => true), - 'avatar_gallery_path' => array('lang' => 'AVATAR_GALLERY_PATH', 'type' => 'text:20:255', 'explain' => true) - ) - ), - 'email' => array( - 'auth' => 'a_server', - 'title' => 'EMAIL_SETTINGS', - 'vars' => array( - 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'type' => 'radio:enabled_disabled', 'explain' => true), - 'email_function_name' => array('lang' => 'EMAIL_FUNCTION_NAME', 'type' => 'text:20:50', 'explain' => true), - 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'type' => 'text:5:5', 'explain' => true), - 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => true), - 'board_email' => array('lang' => 'ADMIN_EMAIL', 'type' => 'text:25:100', 'explain' => true), - 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'type' => 'textarea:5:30', 'explain' => true), - 'smtp_delivery' => array('lang' => 'USE_SMTP', 'type' => 'radio:yes_no', 'explain' => true), - 'smtp_host' => array('lang' => 'SMTP_SERVER', 'type' => 'text:25:50', 'explain' => false), - 'smtp_port' => array('lang' => 'SMTP_PORT', 'type' => 'text:4:5', 'explain' => true), - 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'type' => 'select', 'options' => 'mail_auth_select(\'{VALUE}\')', 'explain' => true), - 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'type' => 'text:25:255', 'explain' => true), - 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'type' => 'password:25:255', 'explain' => true) - ) - ), - 'load' => array( - 'auth' => 'a_server', - 'title' => 'SERVER_SETTINGS', - 'vars' => array( - 'limit_load' => array('lang' => 'LIMIT_LOAD', 'type' => 'text:4:4', 'explain' => true), - 'session_length' => array('lang' => 'SESSION_LENGTH', 'type' => 'text:5:5', 'explain' => true), - 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'type' => 'text:4:4', 'explain' => true), - 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'type' => 'radio:yes_no', 'explain' => true), - 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'type' => 'radio:yes_no', 'explain' => true), - 'load_online' => array('lang' => 'YES_ONLINE', 'type' => 'radio:yes_no', 'explain' => true), - 'load_online_guests'=> array('lang' => 'YES_ONLINE_GUESTS', 'type' => 'radio:yes_no', 'explain' => true), - 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'type' => 'radio:yes_no', 'explain' => true), - 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'type' => 'text:4:3', 'explain' => true), - 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'type' => 'radio:yes_no', 'explain' => false), - 'load_moderators' => array('lang' => 'YES_MODERATORS', 'type' => 'radio:yes_no', 'explain' => false), - 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'type' => 'radio:yes_no', 'explain' => false), - 'load_search' => array('lang' => 'YES_SEARCH', 'type' => 'radio:yes_no', 'explain' => true), - 'search_interval' => array('lang' => 'SEARCH_INTERVAL', 'type' => 'text:3:4', 'explain' => true), - 'min_search_chars' => array('lang' => 'MIN_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true), - 'max_search_chars' => array('lang' => 'MAX_SEARCH_CHARS', 'type' => 'text:3:3', 'explain' => true), - 'load_search_upd' => array('lang' => 'YES_SEARCH_UPDATE', 'type' => 'radio:yes_no', 'explain' => true), -// 'load_search_phr' => array('lang' => 'YES_SEARCH_PHRASE', 'type' => 'radio:yes_no', 'explain' => true), - 'load_tplcompile' => array('lang' => 'RECOMPILE_TEMPLATES', 'type' => 'radio:yes_no', 'explain' => true) - ) - ), - 'default' => array( - 'auth' => 'a_defaults', - 'title' => 'BOARD_DEFAULTS', - 'vars' => array( - 'default_style' => array('lang' => 'DEFAULT_STYLE', 'type' => 'select', 'options' => 'style_select(\'{VALUE}\', true)', 'explain' => false), - 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'type' => 'radio:yes_no', 'explain' => true), - 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'type' => 'select', 'options' => 'language_select(\'{VALUE}\')', 'explain' => false), - 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'type' => 'text::255', 'explain' => true), - 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'type' => 'select', 'options' => 'tz_select(\'{VALUE}\')', 'explain' => false), - 'board_dst' => array('lang' => 'SYSTEM_DST', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_privmsg' => array('lang' => 'BOARD_PM', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_html' => array('lang' => 'ALLOW_HTML', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_html_tags' => array('lang' => 'ALLOWED_TAGS', 'type' => 'text:30:255', 'explain' => true), - 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_sig' => array('lang' => 'ALLOW_SIG', 'type' => 'radio:yes_no', 'explain' => false), - 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'type' => 'text:5:4', 'explain' => true), - 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'type' => 'radio:yes_no', 'explain' => true) - ) - ), - 'message' => array( - 'auth' => 'a_defaults', - 'title' => 'MESSAGE_SETTINGS', - 'lang' => 'ucp', - 'vars' => array( - 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'type' => 'text:4:4', 'explain' => true), - 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'type' => 'text:4:4', 'explain' => true), - 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'type' => 'select', 'options' => 'full_folder_select(\'{VALUE}\')', 'explain' => true), - 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), - 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_html_pm' => array('lang' => 'ALLOW_HTML_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_download_pm' => array('lang' => 'ALLOW_DOWNLOAD_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_report_pm' => array('lang' => 'ALLOW_REPORT_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'email_pm' => array('lang' => 'ALLOW_EMAIL_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'type' => 'radio:yes_no', 'explain' => false), - 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'type' => 'radio:yes_no', 'explain' => false) - ) - ), - 'server' => array( - 'auth' => 'a_server', - 'title' => 'SERVER_SETTINGS', - 'vars' => array( - 'server_name' => array('lang' => 'SERVER_NAME', 'type' => 'text:40:255', 'explain' => true), - 'server_port' => array('lang' => 'SERVER_PORT', 'type' => 'text:5:5', 'explain' => true), - 'script_path' => array('lang' => 'SCRIPT_PATH', 'type' => 'text::255', 'explain' => true), - 'ip_check' => array('lang' => 'IP_VALID', 'type' => 'custom', 'options' => 'select_ip_check(\'{VALUE}\')', 'explain' => true), - 'browser_check' => array('lang' => 'BROWSER_VALID', 'type' => 'radio:yes_no', 'explain' => true), - 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'type' => 'radio:yes_no', 'explain' => false), - 'smilies_path' => array('lang' => 'SMILIES_PATH', 'type' => 'text:20:255', 'explain' => true), - 'icons_path' => array('lang' => 'ICONS_PATH', 'type' => 'text:20:255', 'explain' => true), - 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'type' => 'text:20:255', 'explain' => true), - 'ranks_path' => array('lang' => 'RANKS_PATH', 'type' => 'text:20:255', 'explain' => true) - ) - ), - 'setting' => array( - 'auth' => 'a_board', - 'title' => 'BOARD_SETTINGS', - 'vars' => array( - 'board_disable_msg' => false, 'max_name_chars' => false, 'max_pass_chars' => false, 'bump_type' => false, - - 'sitename' => array('lang' => 'SITE_NAME', 'type' => 'text:40:255', 'explain' => false), - 'site_desc' => array('lang' => 'SITE_DESC', 'type' => 'text:40:255', 'explain' => false), - 'board_disable' => array('lang' => 'DISABLE_BOARD', 'type' => 'custom', 'options' => 'board_disable(\'{VALUE}\')', 'explain' => true), - 'require_activation'=> array('lang' => 'ACC_ACTIVATION', 'type' => 'custom', 'options' => 'select_acc_activation(\'{VALUE}\')', 'explain' => true), - 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'type' => 'radio:yes_no', 'explain' => true), - 'max_autologin_time'=> array('lang' => 'AUTOLOGIN_LENGTH', 'type' => 'text:3:3', 'explain' => true), - 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'type' => 'radio:yes_no', 'explain' => true), - 'coppa_fax' => array('lang' => 'COPPA_FAX', 'type' => 'text:25:100', 'explain' => false), - 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'type' => 'textarea:5:40', 'explain' => true), - 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM', 'type' => 'radio:yes_no', 'explain' => true), - 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'type' => 'text:4:4', 'explain' => true), - 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'type' => 'custom', 'options' => 'username_length(\'{VALUE}\')', 'explain' => true), - 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'type' => 'select', 'options' => 'select_username_chars(\'{VALUE}\')', 'explain' => true), - 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'type' => 'custom', 'options' => 'password_length(\'{VALUE}\')', 'explain' => true), - 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'type' => 'select', 'options' => 'select_password_chars(\'{VALUE}\')', 'explain' => true), - 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'type' => 'text:3:3', 'explain' => true), - 'save_passwd' => array('lang' => 'SAVE_PASSWORDS', 'type' => 'text:2:2', 'explain' => true), - 'max_login_attempts'=> array('lang' => 'LOGIN_LIMIT', 'type' => 'text:4:4', 'explain' => true), - 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'type' => 'radio:yes_no', 'explain' => true), - 'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), - 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true), - 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'type' => 'text:3:4', 'explain' => true), - 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'type' => 'custom', 'options' => 'bump_interval(\'{VALUE}\')', 'explain' => true), - 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false), - 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'type' => 'text:3:4', 'explain' => false), - 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'type' => 'text:3:4', 'explain' => false), - 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'type' => 'text:4:4', 'explain' => false), - 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'type' => 'text:4:6', 'explain' => true), - 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'type' => 'text:4:4', 'explain' => true), - 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'type' => 'text:4:4', 'explain' => true) - ) - ), - 'auth' => array( - 'auth' => 'a_server', - 'title' => 'AUTH_SETTINGS', - 'vars' => array( - 'auth_method' => array('lang' => 'AUTH_METHOD', 'type' => 'select', 'options' => 'select_auth_method(\'{VALUE}\')', 'explain' => false) - ) - ) -); - -if (!in_array($mode, array_keys($display_vars))) -{ - return; -} - -// Perform the current mode -$display_vars = $display_vars[$mode]; - -// Check permissions -if (!$auth->acl_get($display_vars['auth'])) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -if (isset($display_vars['lang'])) -{ - $user->add_lang($display_vars['lang']); -} - -$new = $config; -$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $new; - -// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... -foreach ($display_vars['vars'] as $config_name => $null) -{ - if (!isset($cfg_array[$config_name])) - { - continue; - } - - $config_value = $cfg_array[$config_name]; - $new[$config_name] = $config_value; - - if ($config_name == 'email_function_name') - { - $new['email_function_name'] = (empty($new['email_function_name']) || !function_exists($new['email_function_name'])) ? 'mail' : str_replace(array('(', ')'), array('', ''), trim($new['email_function_name'])); - } - - if ($submit) - { - set_config($config_name, $config_value); - } -} - -if ($submit) -{ - add_log('admin', 'LOG_' . strtoupper($mode) . '_CONFIG'); - - trigger_error($user->lang['CONFIG_UPDATED']); -} - -adm_page_header($user->lang[$display_vars['title']]); - -?> - -<h1><?php echo $user->lang[$display_vars['title']]; ?></h1> - -<p><?php echo $user->lang[$display_vars['title'] . '_EXPLAIN']; ?></p> - -<form action="<?php echo "admin_board.$phpEx$SID&mode=$mode"; ?>" method="post"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang[$display_vars['title']]; ?></th> - </tr> -<?php - -// Output relevant page -foreach ($display_vars['vars'] as $config_key => $vars) -{ - if (!is_array($vars)) - { - continue; - } - - $type = explode(':', $vars['type']); - -?> - - <tr> - <td class="row1" width="50%"><b><?php echo $user->lang[$vars['lang']]; ?>: </b><?php echo ($vars['explain']) ? '<br /><span class="gensmall">' . $user->lang[$vars['lang'] . '_EXPLAIN'] . '</span>' : ''; ?></td> - <td class="row2"><?php echo build_cfg_template($type, $config_key, ((isset($vars['options'])) ? $vars['options'] : '')) . ((isset($vars['append'])) ? str_replace('{VALUE}', $new[$config_key], $vars['append']) : ''); ?></td> - </tr> - -<?php - - unset($display_vars['vars'][$config_key]); -} - -if ($mode == 'auth') -{ - $auth_plugins = array(); - - $dp = opendir($phpbb_root_path . 'includes/auth'); - while ($file = readdir($dp)) - { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) - { - $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); - } - } - - sort($auth_plugins); - - foreach ($auth_plugins as $method) - { - if ($method && file_exists($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx)) - { - include_once($phpbb_root_path . 'includes/auth/auth_' . $method . '.' . $phpEx); - - $method = 'admin_' . $method; - if (function_exists($method)) - { - if ($config_fields = $method($new)) - { - // Check if we need to create config fields for this plugin - foreach ($config_fields as $field) - { - if (!isset($config[$field])) - { - set_config($field, ''); - } - } - } - unset($config_fields); - } - } - } -} - -?> - <tr> - <td class="cat" colspan="2" 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> - </tr> -</table></form> - -<?php - -adm_page_footer(); - -function select_auth_method($selected_method) -{ - global $new, $phpbb_root_path, $phpEx; - - $auth_plugins = array(); - - $dp = opendir($phpbb_root_path . 'includes/auth'); - while ($file = readdir($dp)) - { - if (preg_match('#^auth_(.*?)\.' . $phpEx . '$#', $file)) - { - $auth_plugins[] = preg_replace('#^auth_(.*?)\.' . $phpEx . '$#', '\1', $file); - } - } - - sort($auth_plugins); - - $auth_select = ''; - foreach ($auth_plugins as $method) - { - $selected = ($selected_method == $method) ? ' selected="selected"' : ''; - $auth_select .= '<option value="' . $method . '"' . $selected . '>' . ucfirst($method) . '</option>'; - } - - return $auth_select; -} - -function mail_auth_select($selected_method) -{ - global $user; - - $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); - $s_smtp_auth_options = ''; - - foreach ($auth_methods as $method) - { - $s_smtp_auth_options .= '<option value="' . $method . '"' . (($selected_method == $method) ? ' selected="selected"' : '') . '>' . $user->lang['SMTP_' . str_replace('-', '_', $method)] . '</option>'; - } - - return $s_smtp_auth_options; -} - -function full_folder_select($value) -{ - global $user; - - return '<option value="1"' . (($value == 1) ? ' selected="selected"' : '') . '>' . $user->lang['DELETE_OLDEST_MESSAGES'] . '</option><option value="2"' . (($value == 2) ? ' selected="selected"' : '') . '>' . $user->lang['HOLD_NEW_MESSAGES'] . '</option>'; -} - -function select_ip_check($value) -{ - global $user; - - $ip_all = ($value == 4) ? ' checked="checked"' : ''; - $ip_classc = ($value == 3) ? ' checked="checked"' : ''; - $ip_classb = ($value == 2) ? ' checked="checked"' : ''; - $ip_none = ($value == 0) ? ' checked="checked"' : ''; - - $options = <<<EOT - <input type="radio" name="config[ip_check]" value="4"$ip_all /> {$user->lang['ALL']} <input type="radio" name="config[ip_check]" value="3"$ip_classc /> {$user->lang['CLASS_C']} <input type="radio" name="config[ip_check]" value="2"$ip_classb /> {$user->lang['CLASS_B']} <input type="radio" name="config[ip_check]" value="0"$ip_none /> {$user->lang['NONE']} -EOT; - - return $options; -} - -function select_acc_activation($value) -{ - global $user, $config; - - $activation_none = ($value == USER_ACTIVATION_NONE) ? ' checked="checked"' : ''; - $activation_user = ($value == USER_ACTIVATION_SELF) ? ' checked="checked"' : ''; - $activation_admin = ($value == USER_ACTIVATION_ADMIN) ? ' checked="checked"' : ''; - $activation_disable = ($value == USER_ACTIVATION_DISABLE) ? ' checked="checked"' : ''; - - $options = '<input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_NONE . '"' . $activation_none . ' /> ' . $user->lang['ACC_NONE']; - - if ($config['email_enable']) - { - $options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_SELF . '"' . $activation_user . ' /> ' . $user->lang['ACC_USER']; - $options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_ADMIN . '"' . $activation_admin . ' /> ' . $user->lang['ACC_ADMIN']; - } - $options .= ' <input type="radio" name="config[require_activation]" value="' . USER_ACTIVATION_DISABLE . '"' . $activation_disable . ' /> ' . $user->lang['ACC_DISABLE']; - - return $options; -} - -function username_length($value) -{ - global $new, $user; - - return '<input class="post" type="text" size="3" maxlength="3" name="config[min_name_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input class="post" type="text" size="3" maxlength="3" name="config[max_name_chars]" value="' . $new['max_name_chars'] . '" /> ' . $user->lang['MAX_CHARS']; -} - -function select_username_chars($selected_value) -{ - global $user; - - $user_char_ary = array('USERNAME_CHARS_ANY' => '.*', 'USERNAME_ALPHA_ONLY' => '[\w]+', 'USERNAME_ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+'); - $user_char_options = ''; - foreach ($user_char_ary as $lang => $value) - { - $selected = ($selected_value == $value) ? ' selected="selected"' : ''; - $user_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; - } - - return $user_char_options; -} - -function password_length($value) -{ - global $new, $user; - - return '<input class="post" type="text" size="3" maxlength="3" name="config[min_pass_chars]" value="' . $value . '" /> ' . $user->lang['MIN_CHARS'] . ' <input class="post" type="text" size="3" maxlength="3" name="config[max_pass_chars]" value="' . $new['max_pass_chars'] . '" /> ' . $user->lang['MAX_CHARS']; -} - -function select_password_chars($selected_value) -{ - global $user; - - $pass_type_ary = array('PASS_TYPE_ANY' => '.*', 'PASS_TYPE_CASE' => '[a-zA-Z]', 'PASS_TYPE_ALPHA' => '[a-zA-Z0-9]', 'PASS_TYPE_SYMBOL' => '[a-zA-Z\W]'); - $pass_char_options = ''; - foreach ($pass_type_ary as $lang => $value) - { - $selected = ($selected_value == $value) ? ' selected="selected"' : ''; - $pass_char_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; - } - - return $pass_char_options; -} - -function bump_interval($value) -{ - global $new, $user; - - $s_bump_type = ''; - $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); - foreach ($types as $type => $lang) - { - $selected = ($new['bump_type'] == $type) ? 'selected="selected" ' : ''; - $s_bump_type .= '<option value="' . $type . '" ' . $selected . '>' . $user->lang[$lang] . '</option>'; - } - - return '<input class="post" type="text" size="3" maxlength="4" name="config[bump_interval]" value="' . $value . '" /> <select name="config[bump_type]">' . $s_bump_type . '</select>'; -} - -function board_disable($value) -{ - global $new, $user; - - $board_disable_yes = ($value) ? ' checked="checked"' : ''; - $board_disable_no = (!$value) ? ' checked="checked"' : ''; - - return '<input type="radio" name="config[board_disable]" value="1"' . $board_disable_yes . ' /> ' . $user->lang['YES'] . ' <input type="radio" name="config[board_disable]" value="0"' . $board_disable_no . ' /> ' . $user->lang['NO'] . '<br /><input class="post" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $new['board_disable_msg'] . '" />'; -} - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_bots.php b/phpBB/adm/admin_bots.php deleted file mode 100644 index 92292ad0fc..0000000000 --- a/phpBB/adm/admin_bots.php +++ /dev/null @@ -1,394 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_server')) - { - return; - } - - $module['USER']['BOTS'] = basename(__FILE__) . $SID; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Do we have permission? -if (!$auth->acl_get('a_server')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Set various vars -$submit = (isset($_POST['submit'])) ? true : false; -$action = request_var('action', ''); -$mark = request_var('mark', 0); -$id = request_var('id', 0); - -if (isset($_POST['add'])) -{ - $action = 'add'; -} - -$error = array(); - -// User wants to do something, how inconsiderate of them! -switch ($action) -{ - case 'activate': - if ($id || $mark) - { - $id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')'; - $sql = 'UPDATE ' . BOTS_TABLE . " - SET bot_active = 1 - WHERE bot_id $id"; - $db->sql_query($sql); - } - - $cache->destroy('bots'); - break; - - case 'deactivate': - if ($id || $mark) - { - $id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')'; - $sql = 'UPDATE ' . BOTS_TABLE . " - SET bot_active = 0 - WHERE bot_id $id"; - $db->sql_query($sql); - } - - $cache->destroy('bots'); - break; - - case 'delete': - if ($id || $mark) - { - // We need to delete the relevant user, usergroup and bot entries ... - $id = ($id) ? " = $id" : ' IN (' . implode(', ', $mark) . ')'; - $sql = 'SELECT bot_name, user_id - FROM ' . BOTS_TABLE . " - WHERE bot_id $id"; - $result = $db->sql_query($sql); - - $user_id_ary = $bot_name_ary = array(); - while ($row = $db->sql_fetchrow($result)) - { - $user_id_ary[] = (int) $row['user_id']; - $bot_name_ary[] = $row['bot_name']; - } - $db->sql_freeresult($result); - - $db->sql_transaction(); - - $sql = 'DELETE FROM ' . BOTS_TABLE . " - WHERE bot_id $id"; - $db->sql_query($sql); - - foreach (array(USERS_TABLE, USER_GROUP_TABLE) as $table) - { - $sql = "DELETE FROM $table - WHERE user_id IN (" . implode(', ', $user_id_ary) . ')'; - $db->sql_query($sql); - } - - $db->sql_transaction('commit'); - - $cache->destroy('bots'); - - add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary)); - trigger_error($user->lang['BOT_DELETED']); - } - break; - - case 'edit': - case 'add': - $bot_name = request_var('bot_name', ''); - $bot_agent = request_var('bot_agent', ''); - $bot_ip = request_var('bot_ip', ''); - $bot_active = request_var('bot_active', true); - $bot_lang = request_var('bot_lang', $config['default_lang']); - $bot_style = request_var('bot_style' , $config['default_style']); - - if ($submit) - { - if (!$bot_agent && !$bot_ip) - { - $error[] = $user->lang['ERR_BOT_NO_MATCHES']; - } - - if ($bot_ip && !preg_match('#^[\d\.,:]+$#', $bot_ip)) - { - if (!$ip_list = gethostbynamel($bot_ip)) - { - $error[] = $user->lang['ERR_BOT_NO_IP']; - } - else - { - $bot_ip = implode(',', $ip_list); - } - } - $bot_ip = str_replace(' ', '', $bot_ip); - - if (!sizeof($error)) - { - $db->sql_transaction(); - - // New bot? Create a new user and group entry - if ($action == 'add') - { - $sql = 'SELECT group_id, group_colour - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS' - AND group_type = " . GROUP_SPECIAL; - $result = $db->sql_query($sql); - - if (!extract($db->sql_fetchrow($result))) - { - trigger_error($user->lang['NO_GROUP']); - } - $db->sql_freeresult($result); - - $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'group_id' => (int) $group_id, - 'username' => (string) $bot_name, - 'user_type' => (int) USER_IGNORE, - 'user_colour' => (string) $group_colour, - 'user_lang' => (string) $bot_lang, - 'user_style' => (int) $bot_style, - 'user_options' => 0) - ); - $db->sql_query($sql); - - $user_id = $db->sql_nextid(); - - // Add to Bots usergroup - $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => $user_id, - 'group_id' => $group_id) - ); - $db->sql_query($sql); - - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'user_id' => (int) $user_id, - 'bot_name' => (string) $bot_name, - 'bot_active' => (int) $bot_active, - 'bot_agent' => (string) $bot_agent, - 'bot_ip' => (string) $bot_ip,) - ); - - $log = 'ADDED'; - } - else - { - $sql = 'SELECT user_id - FROM ' . BOTS_TABLE . " - WHERE bot_id = $id"; - $result = $db->sql_query($sql); - - if (!extract($db->sql_fetchrow($result))) - { - trigger_error($user->lang['NO_BOT']); - } - - $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'user_style' => (int) $bot_style, - 'user_lang' => (string) $bot_lang,) - ) . " WHERE user_id = $user_id"; - $db->sql_query($sql); - - $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( - 'bot_name' => (string) $bot_name, - 'bot_active' => (int) $bot_active, - 'bot_agent' => (string) $bot_agent, - 'bot_ip' => (string) $bot_ip,) - ) . " WHERE bot_id = $id"; - - $log = 'UPDATED'; - } - $db->sql_query($sql); - - $db->sql_transaction('commit'); - - $cache->destroy('bots'); - - add_log('admin', 'LOG_BOT_' . $log, $bot_name); - trigger_error($user->lang['BOT_' . $log]); - } - } - else if ($id) - { - $sql = 'SELECT b.*, u.user_lang, u.user_style - FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u - WHERE b.bot_id = $id - AND u.user_id = b.user_id"; - $result = $db->sql_query($sql); - - if (!extract($db->sql_fetchrow($result))) - { - trigger_error($user->lang['NO_BOT']); - } - $db->sql_freeresult($result); - - $bot_lang = $user_lang; - $bot_style = $user_style; - } - - $s_active_options = ''; - foreach (array('0' => 'NO', '1' => 'YES') as $value => $lang) - { - $selected = ($bot_active == $value) ? ' selected="selected"' : ''; - $s_active_options .= '<option value="' . $value . '"' . $selected . '>' . $user->lang[$lang] . '</option>'; - } - - $style_select = style_select($bot_style, true); - $lang_select = language_select($bot_lang); - - $l_title = ($action == 'edit') ? 'EDIT' : 'ADD'; - - // Output relevant page - adm_page_header($user->lang['BOT_' . $l_title]); - -?> - -<h1><?php echo $user->lang['BOT_' . $l_title]; ?></h1> - -<p><?php echo $user->lang['BOT_EDIT_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_bots.$phpEx$SID&action=$action&id=$id"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['BOT_' . $l_title]; ?></th> - </tr> -<?php - - if (sizeof($error)) - { - -?> - <tr> - <td class="row3" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></span></td> - </tr> -<?php - - } - -?> - <tr> - <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_NAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_NAME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="bot_name" size="30" maxlength="255" value="<?php echo $bot_name; ?>" /></td> - </tr> - <tr> - <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_STYLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_STYLE_EXPLAIN']; ?></span></td> - <td class="row2"><select name="bot_style"><?php echo $style_select; ?></select></td> - </tr> - <tr> - <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_LANG']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_LANG_EXPLAIN']; ?></span></td> - <td class="row2"><select name="bot_lang"><?php echo $lang_select; ?></select></td> - </tr> - <tr> - <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_ACTIVE']; ?>: </b></td> - <td class="row2"><select name="bot_active"><?php echo $s_active_options; ?></select></td> - </tr> - <tr> - <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_AGENT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_AGENT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="bot_agent" size="30" maxlength="255" value="<?php echo $bot_agent; ?>" /></td> - </tr> - <tr> - <td class="row1" width="40%"><b class="genmed"><?php echo $user->lang['BOT_IP']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['BOT_IP_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="bot_ip" size="30" maxlength="255" value="<?php echo $bot_ip; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); - - break; -} - -// Output relevant page -adm_page_header($user->lang['BOTS']); - -?> - -<h1><?php echo $user->lang['BOTS']; ?></h1> - -<p><?php echo $user->lang['BOTS_EXPLAIN']; ?></p> - -<form method="post" action="<?php "admin_bots.$phpEx$SID"; ?>"><table class="bg" width="90%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th nowrap="nowrap"><?php echo $user->lang['BOT_NAME']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['BOT_LAST_VISIT']; ?></th> - <th colspan="3" nowrap="nowrap"><?php echo $user->lang['OPTIONS']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - -$s_options = ''; -foreach (array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE') as $value => $lang) -{ - $s_options .= '<option value="' . $value . '">' . $user->lang[$lang] . '</option>'; -} - -$sql = 'SELECT b.bot_id, b.bot_name, b.bot_active, u.user_lastvisit - FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u - WHERE u.user_id = b.user_id - ORDER BY u.user_lastvisit DESC'; -$result = $db->sql_query($sql); - -$row_class = ''; -while ($row = $db->sql_fetchrow($result)) -{ - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - - $active_lang = (!$row['bot_active']) ? 'BOT_ACTIVATE' : 'BOT_DEACTIVATE'; - $active_value = (!$row['bot_active']) ? 'activate' : 'deactivate'; - $id = $row['bot_id']; - -?> - <tr> - <td class="<?php echo $row_class; ?>" width="50%"><?php echo $row['bot_name']; ?></td> - <td class="<?php echo $row_class; ?>" width="15%" align="center" nowrap="nowrap"> <?php echo ($row['user_lastvisit']) ? $user->format_date($row['user_lastvisit']) : $user->lang['BOT_NEVER']; ?> </td> - <td class="<?php echo $row_class; ?>" width="1%"align="center"> <a href="<?php echo "admin_bots.$phpEx$SID&id=$id&action=$active_value"; ?>"><?php echo $user->lang[$active_lang]; ?></a> </td> - <td class="<?php echo $row_class; ?>" width="1%" align="center"> <a href="<?php echo "admin_bots.$phpEx$SID&id=$id&action=edit"; ?>"><?php echo $user->lang['EDIT']; ?></a> </td> - <td class="<?php echo $row_class; ?>" width="1%" align="center"> <a href="<?php echo "admin_bots.$phpEx$SID&id=$id&action=delete"; ?>"><?php echo $user->lang['DELETE']; ?></a> </td> - <td class="<?php echo $row_class; ?>" width="1%" align="center"><input type="checkbox" name="mark[]" value="<?php echo $id; ?>" /></td> - </tr> -<?php - -} -$db->sql_freeresult($result); - -?> - <tr> - <td class="cat" colspan="6"><table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td><input class="btnlite" type="submit" name="add" value="<?php echo $user->lang['BOT_ADD']; ?>" /></td> - <td align="right"><select name="action"><?php echo $s_options; ?></select> <input class="btnlite" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </tr> - </table></td> - </tr> -</table></form> -<?php - -adm_page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_icons.php b/phpBB/adm/admin_icons.php deleted file mode 100644 index bc400e8a18..0000000000 --- a/phpBB/adm/admin_icons.php +++ /dev/null @@ -1,776 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_icons')) - { - return; - } - - $filename = basename(__FILE__); - $module['POST']['SMILIES'] = "$filename$SID&mode=smilies"; - $module['POST']['ICONS'] = "$filename$SID&mode=icons"; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Do we have general permissions? -if (!$auth->acl_get('a_icons')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Grab some basic parameters -$mode = request_var('mode', ''); -$action = request_var('action', ''); -$action = (isset($_POST['add'])) ? 'add' : $action; -$action = (isset($_POST['edit'])) ? 'edit' : $action; -$id = request_var('id', 0); - -// What are we working on? -switch ($mode) -{ - case 'smilies': - $table = SMILIES_TABLE; - $lang = 'SMILIES'; - $fields = 'smiley'; - $img_path = $config['smilies_path']; - break; - - case 'icons': - $table = ICONS_TABLE; - $lang = 'ICONS'; - $fields = 'icons'; - $img_path = $config['icons_path']; - break; -} - -// Clear some arrays -$_images = $_paks = array(); -$notice = ''; - - -// Grab file list of paks and images -if ($action == 'edit' || $action == 'add' || $action == 'import') -{ - $imglist = filelist($phpbb_root_path . $img_path, ''); - - foreach ($imglist as $path => $img_ary) - { - foreach ($img_ary as $img) - { - $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $path . $img); - - $_images[$path.$img]['file'] = $path.$img; - $_images[$path.$img]['width'] = $img_size[0]; - $_images[$path.$img]['height'] = $img_size[1]; - } - } - unset($imglist); - - $dir = @opendir($phpbb_root_path . $img_path); - while ($file = @readdir($dir)) - { - if (is_file($phpbb_root_path . $img_path . '/' . $file) && preg_match('#\.pak$#i', $file)) - { - $_paks[] = $file; - } - } - @closedir($dir); -} - - -// What shall we do today? Oops, I believe that's trademarked ... -switch ($action) -{ - case 'edit': - unset($_images); - $_images = array(); - - case 'add': - - $order_list = ''; - - $sql = "SELECT * - FROM $table - ORDER BY {$fields}_order " . (($id || $action == 'add') ? 'DESC' : 'ASC'); - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - if ($action == 'add') - { - unset($_images[$row[$fields . '_url']]); - } - - if ($row[$fields . '_id'] == $id) - { - $after = TRUE; - $data[$row[$fields . '_url']] = $row; - } - else - { - if ($action == 'edit' && !$id) - { - $data[$row[$fields . '_url']] = $row; - } - - $selected = ''; - if (!empty($after)) - { - $selected = ' selected="selected"'; - $after = FALSE; - } - - $after_txt = ($mode == 'smilies') ? $row['code'] : $row['icons_url']; - $order_list = '<option value="' . ($row[$fields . '_order']) . '"' . $selected . '>' . sprintf($user->lang['AFTER_' . $lang], ' -> ' . htmlspecialchars($after_txt)) . '</option>' . $order_list; - } - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . $user->lang['FIRST'] . '</option>' . $order_list; - - if ($action == 'add') - { - $data = $_images; - } - - $colspan = (($mode == 'smilies') ? '7' : '5'); - $colspan += ($id) ? 1 : 0; - $colspan += ($action == 'add') ? 2 : 0; - - adm_page_header($user->lang[$lang]); - -?> - -<h1><?php echo $user->lang[$lang]; ?></h1> - -<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p> - -<form method="post" action="admin_icons.<?php echo $phpEx . $SID . "&mode=$mode&action=" . (($action == 'add') ? 'create' : 'modify'); ?>"> -<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> -<tr> - <th colspan="<?php echo $colspan; ?>"><?php echo $user->lang[$lang . '_CONFIG'] ?></th> -</tr> -<tr> - <td class="cat"><?php echo $user->lang[$lang . '_URL'] ?></td> - <td class="cat"><?php echo $user->lang[$lang . '_LOCATION'] ?></td> -<?php - if ($mode == 'smilies') - { -?> - <td class="cat"><?php echo $user->lang[$lang . '_CODE'] ?></td> - <td class="cat"><?php echo $user->lang[$lang . '_EMOTION'] ?></td> -<?php - } -?> - <td class="cat"><?php echo $user->lang[$lang . '_WIDTH'] ?></td> - <td class="cat"><?php echo $user->lang[$lang . '_HEIGHT'] ?></td> - <td class="cat"><?php echo $user->lang['DISPLAY_ON_POSTING'] ?></td> -<?php - if ($id || $action == 'add') - { -?> - <td class="cat"><?php echo $user->lang[$lang . '_ORDER'] ?></td> -<?php - } -?> -<?php - if ($action == 'add') - { -?> - <td class="cat"><?php echo $user->lang['ADD'] ?></td> -<?php - } -?> -</tr> -<?php - $row = 0; - foreach ($data as $img => $img_row) - { - $row_class = (($row % 2) == 0) ? 'row1' : 'row2'; -?> -<tr> - <td align="center" class="<?php echo $row_class; ?>"><img src="<?php echo $phpbb_root_path . $img_path . '/' . $img ?>" border="0" alt="" title="" /><input type="hidden" name="image[<?php echo $img; ?>]" value="1" /></td> - <td valign="top" class="<?php echo $row_class; ?>">[<?php echo $img; ?>]</td> -<?php - - if ($mode == 'smilies') - { - -?> - <td class="<?php echo $row_class; ?>"><input class="post" type="text" name="code[<?php echo $img; ?>]" value="<?php echo (!empty($img_row['code'])) ? $img_row['code'] : '' ?>" size="10" /></td> - <td class="<?php echo $row_class; ?>"><input class="post" type="text" name="emotion[<?php echo $img; ?>]" value="<?php echo (!empty($img_row['emotion'])) ? $img_row['emotion'] : '' ?>" size="10" /></td> -<?php - - } - -?> - <td class="<?php echo $row_class; ?>"><input class="post" type="text" size="3" name="width[<?php echo $img; ?>]" value="<?php echo (!empty($img_row[$fields .'_width'])) ? $img_row[$fields .'_width'] : $img_row['width'] ?>" /></td> - <td class="<?php echo $row_class; ?>"><input class="post" type="text" size="3" name="height[<?php echo $img; ?>]" value="<?php echo (!empty($img_row[$fields .'_height'])) ? $img_row[$fields .'_height'] : $img_row['height'] ?>" /></td> - <td class="<?php echo $row_class; ?>"><input type="checkbox" name="display_on_posting[<?php echo $img; ?>]"<?php echo (!empty($img_row['display_on_posting']) || $action == 'add') ? ' checked="checked"' : '' ?> /></td> -<?php - if ($id || $action == 'add') - { -?> - <td class="<?php echo $row_class; ?>"><select name="order[<?php echo $img; ?>]"><?php echo $order_list ?></select></td> -<?php - } - - if ($action == 'add') - { -?> - <td class="<?php echo $row_class; ?>"><input type="checkbox" name="add_img[<?php echo $img; ?>]" value="1" /><?php - - } -?> -</tr> -<?php - if (isset($img_row[$fields . '_id'])) - { - -?><input type="hidden" name="id[<?php echo $img; ?>]" value="<?php echo $img_row[$fields . '_id'] ?>" /><?php - - } - $row++; -} -?> -<tr> - <td class="cat" colspan="<?php echo $colspan; ?>" align="center"><?php - - -?><input class="btnmain" type="submit" value="<?php echo $user->lang['SUBMIT'] ?>" /></td> - </tr> -</table></form> -<?php - - adm_page_footer(); - break; - - case 'create': - case 'modify': - - // Get items to create/modify - $images = (isset($_POST['image'])) ? array_keys($_POST['image']) : array(); - - // Now really get the items - $image_id = (isset($_POST['id'])) ? array_map('intval', $_POST['id']) : array(); - $image_order = (isset($_POST['order'])) ? array_map('intval', $_POST['order']) : array(); - $image_width = (isset($_POST['width'])) ? array_map('intval', $_POST['width']) : array(); - $image_height = (isset($_POST['height'])) ? array_map('intval', $_POST['height']) : array(); - $image_add = (isset($_POST['add_img'])) ? array_map('intval', $_POST['add_img']) : array(); - $image_emotion = request_var('emotion', ''); - $image_code = request_var('code', ''); - $image_display_on_posting = (isset($_POST['display_on_posting'])) ? array_map('intval', $_POST['display_on_posting']) : array(); - - foreach ($images as $image) - { - if (($mode == 'smilies' && ($image_emotion[$image] == '' || $image_code[$image] == '')) || - ($action == 'create' && !isset($image_add[$image]))) - { - } - else - { - if ($image_width[$image] == 0 || $image_height[$image] == 0) - { - $img_size = @getimagesize($phpbb_root_path . $img_path . '/' . $image); - $image_width[$image] = $img_size[0]; - $image_height[$image] = $img_size[1]; - } - - $img_sql = array( - $fields . '_url' => $image, - $fields . '_width' => $image_width[$image], - $fields . '_height' => $image_height[$image], - 'display_on_posting'=> (isset($image_display_on_posting[$image])) ? 1 : 0, - ); - - if ($mode == 'smilies') - { - $img_sql = array_merge($img_sql, array( - 'emotion' => $image_emotion[$image], - 'code' => $image_code[$image]) - ); - } - - if (!empty($image_order[$image])) - { - $img_sql = array_merge($img_sql, array( - $fields . '_order' => $image_order[$image] . '.5') - ); - } - - if ($action == 'modify') - { - $sql = "UPDATE $table - SET " . $db->sql_build_array('UPDATE', $img_sql) . " - WHERE {$fields}_id = " . $image_id[$image]; - $db->sql_query($sql); - } - else - { - $sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql); - $db->sql_query($sql); - } - - $update = FALSE; - - if ($action == 'modify' && !empty($image_order[$image])) - { - $update = TRUE; - - $result = $db->sql_query("SELECT {$fields}_order - FROM $table - WHERE {$fields}_id = " . $image_id[$image]); - $order_old = $db->sql_fetchfield($fields . '_order', 0, $result); - - if ($order_old == $image_order[$image]) - { - $update = FALSE; - } - - if ($order_old > $image_order[$image]) - { - $sign = '+'; - $where = $fields . '_order >= ' . $image_order[$image] . " AND {$fields}_order < $order_old"; - } - else if ($order_old < $image_order[$image]) - { - $sign = '-'; - $where = "{$fields}_order > $order_old AND {$fields}_order < " . $image_order[$image]; - $sql[$fields . '_order'] = $image_order[$image] - 1; - } - } - - if ($update) - { - $sql = "UPDATE $table - SET {$fields}_order = {$fields}_order $sign 1 - WHERE $where"; - $db->sql_query($sql); - } - - } - } - - $cache->destroy('icons'); - - if ($action == 'modify') - { - trigger_error($user->lang[$lang . '_EDITED']); - } - else - { - trigger_error($user->lang[$lang . '_ADDED']); - } - - break; - - case 'import': - - $pak = request_var('pak', ''); - $current = request_var('current', ''); - - if ($pak != '') - { - $order = 0; - - // The user has already selected a smilies_pak file - if ($current == 'delete') - { - $db->sql_query("TRUNCATE $table"); - - switch ($mode) - { - case 'smilies': - break; - - case 'icons': - // Reset all icon_ids - $db->sql_query('UPDATE ' . TOPICS_TABLE . ' - SET icon_id = 0'); - $db->sql_query('UPDATE ' . POSTS_TABLE . ' - SET icon_id = 0'); - break; - } - } - else - { - $cur_img = array(); - - $field_sql = ($mode == 'smilies') ? 'code' : 'icons_url'; - $result = $db->sql_query("SELECT $field_sql FROM $table"); - - while ($row = $db->sql_fetchrow($result)) - { - ++$order; - $cur_img[$row[$field_sql]] = 1; - } - $db->sql_freeresult($result); - } - - if (!($pak_ary = @file($phpbb_root_path . $img_path . '/' . $pak))) - { - trigger_error('Could not read pak file', E_USER_ERROR); - } - - foreach ($pak_ary as $pak_entry) - { - $data = array(); - if (preg_match_all("#'(.*?)', #", $pak_entry, $data)) - { - if ((sizeof($data[1]) != 3 && $mode == 'icons') || - (sizeof($data[1]) != 5 && $mode == 'smilies')) - { - trigger_error($user->lang['WRONG_PAK_TYPE']); - } - - $img = stripslashes($data[1][0]); - $width = stripslashes($data[1][1]); - $height = stripslashes($data[1][2]); - if (isset($data[1][3]) && isset($data[1][4])) - { - $emotion = stripslashes($data[1][3]); - $code = htmlentities(stripslashes($data[1][4])); - } - - if ($current == 'replace' && - (($mode == 'smilies' && !empty($cur_img[$code])) || - ($mode == 'icons' && !empty($cur_img[$img])))) - { - $replace_sql = ($mode == 'smilies') ? $code : $img; - $sql = array( - $fields . '_url' => $img, - $fields . '_height' => (int) $height, - $fields . '_width' => (int) $width, - ); - if ($mode == 'smilies') - { - $sql = array_merge($sql, array( - 'emotion' => $emotion - )); - } - - $db->sql_query("UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . " - WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'"); - } - else - { - ++$order; - - $sql = array( - $fields . '_url' => $img, - $fields . '_height' => (int) $height, - $fields . '_width' => (int) $width, - $fields . '_order' => (int) $order, - ); - - if ($mode == 'smilies') - { - $sql = array_merge($sql, array( - 'code' => $code, - 'emotion' => $emotion - )); - } - $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql)); - } - - } - } - - $cache->destroy('icons'); - trigger_error($user->lang[$lang . '_IMPORT_SUCCESS']); - } - else - { - $pak_options = ''; - - foreach ($_paks as $pak) - { - $pak_options .= '<option value="' . $pak . '">' . htmlspecialchars($pak) . '</option>'; - } - - adm_page_header($user->lang[$lang]); - -?> -<h1><?php echo $user->lang[$lang] ?></h1> - -<p><?php echo $user->lang[$lang .'_EXPLAIN'] ?></p> - -<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=import'; ?>"> -<table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> -<tr> - <th colspan="2"><?php echo $user->lang[$lang . '_IMPORT'] ?></th> -</tr> -<?php - - if ($pak_options == '') - { - -?> -<tr> - <td class="row1" colspan="2"><?php echo $user->lang['NO_' . $lang . '_PAK']; ?></td> -</tr> -<?php - - } - else - { - -?> -<tr> - <td class="row2"><?php echo $user->lang['SELECT_PACKAGE'] ?></td> - <td class="row1"><select name="pak"><?php echo $pak_options ?></select></td> -</tr> -<tr> - <td class="row2"><?php echo $user->lang['CURRENT_' . $lang] ?><br /><span class="gensmall"><?php echo $user->lang['CURRENT_' . $lang . '_EXPLAIN'] ?></span></td> - <td class="row1"><input type="radio" name="current" value="keep" checked="checked" /> <?php echo $user->lang['KEEP_ALL'] ?> <input type="radio" name="current" value="replace" /> <?php echo $user->lang['REPLACE_MATCHES'] ?> <input type="radio" name="current" value="delete" /> <?php echo $user->lang['DELETE_ALL'] ?> </td> - </tr> -<tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" name="import" type="submit" value="<?php echo $user->lang['IMPORT_' . $lang] ?>" /></td> -</tr> -<?php - - } - -?> -</table></form> -<?php - adm_page_footer(); - - } - break; - - case 'export': - - adm_page_header($user->lang['EXPORT_' . $lang]); - trigger_error(sprintf($user->lang['EXPORT_' . $lang . '_EXPLAIN'], '<a href="admin_icons.' . $phpEx . $SID . '&mode=' . $mode . '&action=send">', '</a>')); - break; - - case 'send': - - $sql = "SELECT * - FROM $table - ORDER BY {$fields}_order"; - $result = $db->sql_query($sql); - - $pak = ''; - while ($row = $db->sql_fetchrow($result)) - { - $pak .= "'" . addslashes($row[$fields . '_url']) . "', "; - $pak .= "'" . addslashes($row[$fields . '_height']) . "', "; - $pak .= "'" . addslashes($row[$fields . '_width']) . "', "; - if ($mode == 'smilies') - { - $pak .= "'" . addslashes($row['emotion']) . "', "; - $pak .= "'" . addslashes($row['code']) . "', "; - } - $pak .= "\n"; - } - $db->sql_freeresult($result); - - if ($pak != '') - { - $db->sql_close(); - - header('Content-Type: text/x-delimtext; name="' . $fields . '.pak"'); - header('Content-disposition: attachment; filename=' . $fields . '.pak"'); - echo $pak; - exit; - } - else - { - trigger_error($user->lang['NO_' . $fields . '_EXPORT']); - } - break; - - case 'delete': - - $db->sql_query("DELETE FROM $table - WHERE {$fields}_id = $id"); - - switch ($mode) - { - case 'smilies': - break; - - case 'icons': - // Reset appropriate icon_ids - $db->sql_query('UPDATE ' . TOPICS_TABLE . " - SET icon_id = 0 - WHERE icon_id = $id"); - $db->sql_query('UPDATE ' . POSTS_TABLE . " - SET icon_id = 0 - WHERE icon_id = $id"); - break; - } - - $notice = $user->lang[$lang . '_DELETED']; - - case 'move_up': - case 'move_down': - - if ($action != 'delete') - { - $image_order = intval($_GET['order']); - $order_total = $image_order * 2 + (($action == 'move_up') ? -1 : 1); - - $sql = 'UPDATE ' . $table . ' - SET ' . $fields . "_order = $order_total - " . $fields . '_order - WHERE ' . $fields . "_order IN ($image_order, " . (($action == 'move_up') ? $image_order - 1 : $image_order + 1) . ')'; - $db->sql_query($sql); - - $cache->destroy('icons'); - - } - // No break; here, display the smilies admin back - - default: - - // By default, check that image_order is valid and fix it if necessary - $sql = "SELECT {$fields}_id AS order_id, {$fields}_order AS fields_order - FROM $table - ORDER BY {$fields}_order"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - $order = 0; - do - { - ++$order; - if ($row['fields_order'] != $order) - { - $db->sql_query("UPDATE $table - SET {$fields}_order = $order - WHERE {$fields}_id = " . $row['order_id']); - } - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - // Output the page - adm_page_header($user->lang[$lang]); - -?> - -<h1><?php echo $user->lang[$lang]; ?></h1> - -<p><?php echo $user->lang[$lang .'_EXPLAIN']; ?></p> - -<?php - - if ($notice != '') - { - -?> - <b style="color:green"><?php echo $notice; ?></b> -<?php - - } - -?> - -<form method="post" action="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode ?>"> -<table cellspacing="1" cellpadding="0" border="0" align="center"> -<tr> - <td align="right"> <a href="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=import'; ?>"><?php echo $user->lang['IMPORT_' . $lang]; ?></a> | <a href="admin_icons.<?php echo $phpEx . $SID . '&mode=' . $mode . '&action=export'; ?>"><?php echo $user->lang['EXPORT_' . $lang]; ?></a></td> -</tr> -<tr> - <td> - <table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang[$lang]; ?></th> -<?php - if ($mode == 'smilies') - { -?> - <th><?php echo $user->lang['CODE']; ?></th> - <th><?php echo $user->lang['EMOTION']; ?></th> -<?php - } -?> - <th><?php echo $user->lang['ACTION']; ?></th> - <th><?php echo $user->lang['REORDER']; ?></th> - </tr> -<?php - $spacer = FALSE; - - $sql = "SELECT * - FROM $table - ORDER BY display_on_posting DESC, {$fields}_order ASC"; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - if (!$spacer && !$row['display_on_posting']) - { - $spacer = TRUE; -?> - <tr> - <td class="row3" colspan="<?php echo ($mode == 'smilies') ? 5 : 3; ?>" align="center"><?php echo $user->lang[$lang . '_NOT_DISPLAYED'] ?></td> - </tr> -<?php - } - - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - $alt_text = ($mode == 'smilies') ? htmlspecialchars($row['code']) : ''; -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><img src="<?php echo $phpbb_root_path . $img_path . '/' . $row[$fields . '_url']; ?>" width="<?php echo $row[$fields . '_width']; ?>" height="<?php echo $row[$fields . '_height']; ?>" alt="<?php echo $alt_text; ?>" title="<?php echo $alt_text; ?>" /></td> -<?php - - if ($mode == 'smilies') - { -?> - <td class="<?php echo $row_class; ?>" align="center"><?php echo htmlspecialchars($row['code']); ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['emotion']; ?></td> -<?php - } -?> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=edit&id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=delete&id=" . $row[$fields . '_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td> - <td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=move_up&order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_UP']; ?></a> <br /> <a href="<?php echo "admin_icons.$phpEx$SID&mode=$mode&action=move_down&order=" . $row[$fields . '_order']; ?>"><?php echo $user->lang['MOVE_DOWN']; ?></a></td> - </tr> -<?php - - } - $db->sql_freeresult($result); - -?> - <tr> - <td class="cat" colspan="<?php echo ($mode == 'smilies') ? 5 : 3; ?>" align="center"><input type="submit" name="add" value="<?php echo $user->lang['ADD_' . $lang]; ?>" class="btnmain" /> <input type="submit" name="edit" value="<?php echo $user->lang['EDIT_' . $lang]; ?>" class="btnmain" /></td> - </tr> - </table> - </td> -</tr> -</table> -</form> - -<?php - adm_page_footer(); - - break; -} - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_jabber.php b/phpBB/adm/admin_jabber.php deleted file mode 100644 index 4ae0fc583c..0000000000 --- a/phpBB/adm/admin_jabber.php +++ /dev/null @@ -1,212 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -* @todo Check/enter/update transport info -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_server')) - { - return; - } - - $module['GENERAL']['IM'] = basename(__FILE__) . $SID; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); -include($phpbb_root_path . 'includes/functions_jabber.'.$phpEx); - -// Do we have general permissions? -if (!$auth->acl_get('a_server')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Grab some basic parameters -$submit = (isset($_POST['submit'])) ? true : false; - -$jab_enable = request_var('jab_enable', $config['jab_enable']); -$jab_host = request_var('jab_host', $config['jab_host']); -$jab_port = request_var('jab_port', $config['jab_port']); -$jab_username = request_var('jab_username', $config['jab_username']); -$jab_password = request_var('jab_password', $config['jab_password']); -$jab_resource = request_var('jab_resource', $config['jab_resource']); - -$jabber = new jabber(); -$error = array(); - -// Setup the basis vars for jabber connection -$jabber->server = $jab_host; -$jabber->port = ($jab_port) ? $jab_port : 5222; -$jabber->username = $jab_username; -$jabber->password = $jab_password; -$jabber->resource = $jab_resource; - -// Are changing (or initialising) a new host or username? If so run some checks and -// try to create account if it doesn't exist -if ($jab_enable) -{ - if ($jab_host != $config['jab_host'] || $jab_username != $config['jab_username']) - { - if (!$jabber->Connect()) - { - trigger_error('Could not connect to Jabber server', E_USER_ERROR); - } - - // First we'll try to authorise using this account, if that fails we'll - // try to create it. - if (!($result = $jabber->SendAuth())) - { - if (($result = $jabber->AccountRegistration($config['board_email'], $config['sitename'])) <> 2) - { - - $error[] = ($result == 1) ? $user->lang['ERR_JAB_USERNAME'] : sprintf($user->lang['ERR_JAB_REGISTER'], $result); - } - else - { - $message = $user->lang['JAB_REGISTERED']; - $log = 'JAB_REGISTER'; - } - } - else - { - $message = $user->lang['JAB_CHANGED']; - $log = 'JAB_CHANGED'; - } - - sleep(1); - $jabber->Disconnect(); - } - else if ($jab_password != $config['jab_password']) - { - if (!$jabber->Connect()) - { - trigger_error('Could not connect to Jabber server', E_USER_ERROR); - } - - if (!$jabber->SendAuth()) - { - trigger_error('Could not authorise on Jabber server', E_USER_ERROR); - } - $jabber->SendPresence(NULL, NULL, 'online'); - - if (($result = $jabber->ChangePassword($jab_password)) <> 2) - { - $error[] = ($result == 1) ? $user->lang['ERR_JAB_PASSCHG'] : sprintf($user->lang['ERR_JAB_PASSFAIL'], $result); - } - else - { - $message = $user->lang['JAB_PASS_CHANGED']; - $log = 'JAB_PASSCHG'; - } - - sleep(1); - $jabber->Disconnect(); - } -} - -// Pull relevant config data -$sql = 'SELECT * - FROM ' . CONFIG_TABLE . " - WHERE config_name LIKE 'jab_%'"; -$result = $db->sql_query($sql); - -while ($row = $db->sql_fetchrow($result)) -{ - $config_name = $row['config_name']; - $config_value = $row['config_value']; - - $default_config[$config_name] = $config_value; - $new[$config_name] = (isset($_POST[$config_name])) ? request_var($config_name, '') : $default_config[$config_name]; - - if ($submit && !sizeof($error)) - { - set_config($config_name, $new[$config_name]); - } -} - -if ($submit && !sizeof($error)) -{ - add_log('admin', 'LOG_' . $log); - trigger_error($message); -} - - - -// Output the page -adm_page_header($user->lang['IM']); - -$jab_enable_yes = ($new['jab_enable']) ? 'checked="checked"' : ''; -$jab_enable_no = (!$new['jab_enable']) ? 'checked="checked"' : ''; - -?> -<h1><?php echo $user->lang['IM']; ?></h1> - -<p><?php echo $user->lang['IM_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_jabber.$phpEx$SID"; ?>"><table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['IM']; ?></th> - </tr> -<?php - - if (sizeof($error)) - { - -?> - <tr> - <td class="row3" colspan="2" align="center"><span style="color:red"><?php echo implode('<br />', $error); ?></td> - </tr> -<?php - - } - -?> - <tr> - <td class="row1" width="40%"><b><?php echo $user->lang['JAB_ENABLE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_ENABLE_EXPLAIN']; ?></span></td> - <td class="row2"><input type="radio" name="jab_enable" value="1"<?php echo $jab_enable_yes; ?> /><?php echo $user->lang['ENABLED']; ?> <input type="radio" name="jab_enable" value="0"<?php echo $jab_enable_no; ?> /><?php echo $user->lang['DISABLED']; ?></td> - </tr> - <tr> - <td class="row1" width="40%"><b><?php echo $user->lang['JAB_SERVER']; ?>: </b><br /><span class="gensmall"><?php echo sprintf($user->lang['JAB_SERVER_EXPLAIN'], '<a href="http://www.jabber.org/user/publicservers.php" target="_blank">', '</a>'); ?></span></td> - <td class="row2"><input class="post" type="text" name="jab_host" value="<?php echo $new['jab_host']; ?>" /></td> - </tr> - <tr> - <td class="row1" width="40%"><b><?php echo $user->lang['JAB_PORT']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_PORT_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="jab_port" value="<?php echo $new['jab_port']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['JAB_USERNAME']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_USERNAME_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="jab_username" value="<?php echo $new['jab_username']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['JAB_PASSWORD']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="jab_password" value="<?php echo $new['jab_password']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['JAB_RESOURCE']; ?>: </b><br /><span class="gensmall"><?php echo $user->lang['JAB_RESOURCE_EXPLAIN']; ?></span></td> - <td class="row2"><input class="post" type="text" name="jab_resource" value="<?php echo $new['jab_resource']; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_language.php b/phpBB/adm/admin_language.php deleted file mode 100644 index 725472a440..0000000000 --- a/phpBB/adm/admin_language.php +++ /dev/null @@ -1,1039 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_server')) - { - return; - } - - $module['LANGUAGE']['LANGUAGE_PACKS'] = basename(__FILE__) . "$SID&mode=manage"; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); -include($phpbb_root_path . 'includes/functions_user.'.$phpEx); - -// Do we have general permissions? -if (!$auth->acl_get('a_server')) -{ - trigger_error('NO_ADMIN'); -} - -// Check and set some common vars -$mode = request_var('mode', ''); -$confirm = (isset($_POST['confirm'])) ? true : false; -$cancel = (isset($_POST['cancel'])) ? true : false; -$action = request_var('action', ''); - -$action = (isset($_POST['update_details'])) ? 'update_details' : $action; -$action = (isset($_POST['download_file'])) ? 'download_file' : $action; -$action = (isset($_POST['submit_file'])) ? 'submit_file' : $action; -$action = (isset($_POST['remove_store'])) ? 'details' : $action; - -$lang_id = request_var('id', 0); -$cur_file = request_var('cur_file', 'common'); - -if (is_array($cur_file)) -{ - list($cur_file, ) = array_keys($cur_file); -} - -$cur_file = (strpos($cur_file, 'email/') !== false) ? 'email/' . basename($cur_file) : basename($cur_file) . '.' . $phpEx; -$safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false; - -$language_files = array('common', 'groups', 'mcp', 'memberlist', 'posting', 'search', 'ucp', 'viewforum', 'viewtopic', 'admin', 'help_bbcode', 'help_faq'); - -$language_file_header = '<?php -/** -* -* {FILENAME} [{LANG_NAME}] -* -* @package phpBB3 -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @author {CHANGED} - {AUTHOR} -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -// DEVELOPERS PLEASE NOTE -// -// Placeholders can now contain order information, e.g. instead of -// \'Page %s of %s\' you can (and should) write \'Page %1$s of %2$s\', this allows -// translators to re-order the output of data while ensuring it remains correct -// -// You do not need this where single placeholders are used, e.g. \'Message %d\' is fine -// equally where a string contains only two placeholders which are used to wrap text -// in a url you again do not need to specify an order e.g., \'Click %sHERE%s\' is fine - -/** -*/ -'; - -if (!$mode) -{ - trigger_error('NO_MODE'); -} - -switch ($action) -{ - case 'update_details': - - if (!$lang_id) - { - trigger_error('NO_LANGUAGE_PACK_DEFINED'); - } - - $sql = 'SELECT * FROM ' . LANG_TABLE . " - WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $sql_ary['lang_english_name'] = request_var('lang_english_name', $row['lang_english_name']); - $sql_ary['lang_local_name'] = request_var('lang_local_name', $row['lang_local_name']); - $sql_ary['lang_author'] = request_var('lang_author', $row['lang_author']); - - $db->sql_query('UPDATE ' . LANG_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE lang_id = ' . $lang_id); - - add_log('admin', 'LOG_UPDATE_LANG_DETAILS', $sql_ary['lang_english_name']); - - trigger_error('LANGUAGE_DETAILS_UPDATED'); - break; - - case 'submit_file': - case 'download_file': - - if (!$lang_id) - { - trigger_error('NO_LANGUAGE_PACK_DEFINED'); - } - - if (!$cur_file) - { - trigger_error('NO_FILE_SELECTED'); - } - - $sql = 'SELECT * FROM ' . LANG_TABLE . " - WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (!$safe_mode) - { - $mkdir_ary = array('language', 'language/' . $row['lang_iso']); - if (strpos($cur_file, 'email/') !== false) - { - $mkdir_ary[] = 'language/' . $row['lang_iso'] . '/email'; - } - - foreach ($mkdir_ary as $dir) - { - $dir = $phpbb_root_path . 'store/' . $dir; - - if (!is_dir($dir)) - { - if (!@mkdir($dir, 0777)) - { - trigger_error("Could not create directory $dir"); - } - @chmod($dir, 0777); - } - } - } - - $filename = get_filename($row['lang_iso'], $cur_file, true); - $fp = fopen($filename, 'wb'); - - if (strpos($cur_file, 'email/') !== false) - { - fwrite($fp, (STRIP) ? stripslashes($_POST['entry']) : $_POST['entry']); - } - else if (strpos($cur_file, 'help_') === 0) - { - $header = str_replace(array('{FILENAME}', '{LANG_NAME}', '{CHANGED}', '{AUTHOR}'), array($cur_file, $row['lang_english_name'], date('Y-m-d', time()), $row['lang_author']), $language_file_header); - $header .= '$help = array(' . "\n"; - fwrite($fp, $header); - - foreach ($_POST['entry'] as $key => $value) - { - if (!is_array($value)) - { - } - else - { - $entry = "\tarray(\n"; - - foreach ($value as $_key => $_value) - { - $_value = (STRIP) ? stripslashes($_value) : $_value; - $entry .= "\t\t" . (int) $_key . "\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; - } - - $entry .= "\t),\n"; - } - - fwrite($fp, $entry); - } - - $footer = ");\n\n?>"; - fwrite($fp, $footer); - } - else - { - $header = str_replace(array('{FILENAME}', '{LANG_NAME}', '{CHANGED}', '{AUTHOR}'), array($cur_file, $row['lang_english_name'], date('Y-m-d', time()), $row['lang_author']), $language_file_header); - $header .= ' -/** -* DO NOT CHANGE -*/ -if (empty($lang) || !is_array($lang)) -{ - $lang = array(); -} - -$lang += array( -'; - fwrite($fp, $header); - - foreach ($_POST['entry'] as $key => $value) - { - if (!is_array($value)) - { - $value = (STRIP) ? stripslashes($value) : $value; - $entry = "\t'" . $key . "'\t=> '" . str_replace("'", "\\'", $value) . "',\n"; - } - else - { - $entry = "\n\t'" . $key . "'\t=> array(\n"; - - foreach ($value as $_key => $_value) - { - $_value = (STRIP) ? stripslashes($_value) : $_value; - $entry .= "\t\t'" . $_key . "'\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; - } - - $entry .= "\t),\n\n"; - } - - fwrite($fp, $entry); - } - - $footer = ");\n\n?>"; - fwrite($fp, $footer); - } - - fclose($fp); - - if ($action == 'download_file') - { - $name = basename($cur_file); - - header('Pragma: no-cache'); - header('Content-Type: application/octetstream; name="' . $name . '"'); - header('Content-disposition: attachment; filename=' . $name); - - $fp = fopen($filename, 'rb'); - while ($buffer = fread($fp, 1024)) - { - echo $buffer; - } - fclose($fp); - - exit; - } - - $action = 'details'; - - case 'details': - adm_page_header($user->lang['LANGUAGE_PACK_DETAILS']); - - if (!$lang_id) - { - trigger_error('NO_LANGUAGE_PACK_DEFINED'); - } - - $sql = 'SELECT * FROM ' . LANG_TABLE . ' - WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $lang_entries = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $lang_iso = $lang_entries['lang_iso']; - $missing_vars = $missing_files = array(); - - $email_templates = filelist($phpbb_root_path . 'language/' . $config['default_lang'], 'email', 'txt'); - $email_templates = $email_templates['email/']; - - if (!in_array(str_replace(".{$phpEx}", '', $cur_file), $language_files) && !in_array(basename($cur_file), $email_templates)) - { - trigger_error('WRONG_LANGUAGE_FILE'); - } - - if (isset($_POST['remove_store'])) - { - if (!$safe_mode) - { - @unlink(get_filename($lang_iso, $cur_file)); - } - else - { - @unlink(get_filename($lang_iso, $cur_file, true)); - } - } - -?> - <h1><?php echo $user->lang['LANGUAGE_PACK_DETAILS']; ?></h1> - - <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id"; ?>"> - <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $lang_entries['lang_local_name']; ?></th> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['LANG_ENGLISH_NAME']; ?>: </b></td> - <td class="row2"><input type="text" class="text" name="lang_english_name" value="<?php echo $lang_entries['lang_english_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['LANG_LOCAL_NAME']; ?>: </b></td> - <td class="row2"><input type="text" class="text" name="lang_local_name" value="<?php echo $lang_entries['lang_local_name']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['LANG_ISO_CODE']; ?>: </b></td> - <td class="row2"><?php echo $lang_entries['lang_iso']; ?></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['LANG_AUTHOR']; ?>: </b></td> - <td class="row2"><input type="text" class="text" name="lang_author" value="<?php echo $lang_entries['lang_author']; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="right"><input type="submit" name="update_details" class="btnmain" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </tr> - </table> - <br /><br /> - </form> -<?php - - // If current lang is different from the default lang, then first try to grab missing/additional vars - if ($lang_iso != $config['default_lang']) - { - $is_missing_var = false; - - foreach ($language_files as $file) - { - if (file_exists(get_filename($lang_iso, "$file.$phpEx"))) - { - $missing_vars["$file.$phpEx"] = compare_language_files($config['default_lang'], $lang_iso, $file); - - if (sizeof($missing_vars["$file.$phpEx"])) - { - $is_missing_var = true; - } - else - { - unset($missing_vars["$file.$phpEx"]); - } - } - else - { - $missing_files[] = get_filename($lang_iso, "$file.$phpEx"); - } - } - - // More missing files... for example email templates? - foreach ($email_templates as $file) - { - if (!file_exists(get_filename($lang_iso, "email/$file"))) - { - $missing_files[] = get_filename($lang_iso, "email/$file"); - } - } - - if (sizeof($missing_files)) - { -?> - <h1><?php echo sprintf($user->lang['THOSE_MISSING_LANG_FILES'], $lang_entries['lang_local_name']); ?></h1> - - <p><b style="color: red;"><?php echo implode('<br />', $missing_files); ?></b></p> - - <br /><br /> -<?php - } - - if ($is_missing_var) - { -?> - <h1><?php echo $user->lang['MISSING_LANG_VARIABLES']; ?></h1> - - <p><?php echo sprintf($user->lang['THOSE_MISSING_LANG_VARIABLES'], $lang_entries['lang_local_name']); ?></p> - - <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id"; ?>"> - <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_KEY']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_VARIABLE']; ?></th> - </tr> -<?php - foreach ($missing_vars as $file => $vars) - { -?> - <tr> - <td class="row3" colspan="2"><b><?php echo $file; ?></b></td> - </tr> -<?php - print_language_entries($vars, '', false); -?> - <tr> - <td class="cat" align="right" colspan="2"><input type="submit" name="cur_file[<?php echo str_replace(".{$phpEx}", '', $file); ?>]" value="<?php echo $user->lang['SELECT']; ?>" class="btnmain" /></td> - </tr> -<?php - } -?> - </table> - <br /><br /> - </form> -<?php - } - } - - $s_lang_options = '<option class="sep">' . $user->lang['LANGUAGE_FILES'] . '</option>'; - foreach ($language_files as $file) - { - if (strpos($file, 'help_') === 0) - { - continue; - } - - $prefix = (file_exists(get_filename($lang_iso, $file . '.' . $phpEx, true))) ? '* ' : ''; - - $selected = ($cur_file == $file . '.' . $phpEx) ? ' selected="selected"' : ''; - $s_lang_options .= '<option value="' . $file . '"' . $selected . '>' . $prefix . $file . '.' . $phpEx . '</option>'; - } - - $s_lang_options .= '<option class="sep">' . $user->lang['HELP_FILES'] . '</option>'; - foreach ($language_files as $file) - { - if (strpos($file, 'help_') !== 0) - { - continue; - } - - $prefix = (file_exists(get_filename($lang_iso, $file . '.' . $phpEx, true))) ? '* ' : ''; - - $selected = ($cur_file == $file . '.' . $phpEx) ? ' selected="selected"' : ''; - $s_lang_options .= '<option value="' . $file . '"' . $selected . '>' . $prefix . $file . '.' . $phpEx . '</option>'; - } - - $s_lang_options .= '<option class="sep">' . $user->lang['EMAIL_TEMPLATES'] . '</option>'; - foreach ($email_templates as $file) - { - $prefix = (file_exists(get_filename($lang_iso, "email/{$file}", true))) ? '* ' : ''; - - $selected = ($cur_file == 'email/' . $file) ? ' selected="selected"' : ''; - $s_lang_options .= '<option value="email/' . $file . '"' . $selected . '>' . $prefix . $file . '</option>'; - } - - // Get Language Entries - if saved within store folder, we take this one (with the option to remove it) - $lang = array(); - $is_email_file = (strpos($cur_file, 'email/') !== false) ? true : false; - $is_help_file = (strpos($cur_file, 'help_') === 0) ? true : false; - $file_from_store = (file_exists(get_filename($lang_iso, $cur_file, true))) ? true : false; - - if (!$file_from_store && !file_exists(get_filename($lang_iso, $cur_file))) - { - $print_message = sprintf($user->lang['MISSING_LANGUAGE_FILE'], $cur_file); - } - else - { - if ($is_email_file) - { - $lang = implode('', file(get_filename($lang_iso, $cur_file, $file_from_store))); - } - else - { - include(get_filename($lang_iso, $cur_file, $file_from_store)); - - if ($is_help_file) - { - $lang = $help; - unset($help); - } - } - $print_message = $cur_file; - } - - // Normal language pack entries -?> - <a name="entries"></a> - <h1><?php echo $user->lang['LANGUAGE_ENTRIES']; ?></h1> - - <p><?php echo $user->lang['LANGUAGE_ENTRIES_EXPLAIN']; ?></p> - - <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id#entries"; ?>"> - <table width="95%" cellspacing="0" cellpadding="0" border="0" align="center"> - <tr> - <td align="left"><?php - if ($file_from_store) { - ?> <input type="submit" name="remove_store" value="<?php echo $user->lang['REMOVE_FROM_STORAGE_FOLDER']; ?>" class="btnmain" /> <?php - } - ?> - <td align="right"><select name="cur_file"><?php echo $s_lang_options; ?></select> <input type="submit" class="btnmain" name="change" value="<?php echo $user->lang['SELECT']; ?>" /></td> - </tr> - </table> - <br /> - <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> -<?php - if ($is_email_file) - { -?> - <tr> - <th colspan="2"><?php echo $user->lang['FILE_CONTENTS']; ?></th> - </tr> -<?php - } - else - { -?> - <tr> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_KEY']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_VARIABLE']; ?></th> - </tr> -<?php - } -?> - <tr> - <td class="row3" align="left"><b><?php echo $print_message . (($file_from_store) ? '<br /><b style="color:red;">' . $user->lang['FILE_FROM_STORAGE'] . '</b>' : ''); ?></b></td> - <td class="row3" align="right"><input type="submit" name="download_file" class="btnlite" value="<?php echo $user->lang['SUBMIT_AND_DOWNLOAD']; ?>" /> <input type="submit" name="submit_file" class="btnmain" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </tr> -<?php - if (!$is_email_file) - { - $function = ($is_help_file) ? 'print_help_entries' : 'print_language_entries'; - if (isset($missing_vars[$cur_file]) && sizeof($missing_vars[$cur_file])) - { - $function($missing_vars[$cur_file], '* '); - } - $function($lang); - } - else - { -?> - <tr> - <td class="row1" colspan="2" align="center"><textarea name="entry" cols="80" rows="20" class="post" style="width:90%"><?php echo $lang; ?></textarea></td> - </tr> -<?php - } -?> - <tr> - <td class="cat" colspan="2" align="right"><input type="submit" name="download_file" class="btnlite" value="<?php echo $user->lang['SUBMIT_AND_DOWNLOAD']; ?>" /> <input type="submit" name="submit_file" class="btnmain" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </tr> - </table> - <br /><br /> - </form> -<?php - - break; - - case 'delete': - - if (!$lang_id) - { - trigger_error('NO_LANGUAGE_PACK_DEFINED'); - } - - $sql = 'SELECT * FROM ' . LANG_TABLE . ' - WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row['lang_iso'] == $config['default_lang']) - { - trigger_error('NO_REMOVE_DEFAULT_LANG'); - } - - $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); - $sql = 'UPDATE ' . USERS_TABLE . " - SET user_lang = '{$config['default_lang']}' - WHERE user_lang = '{$row['lang_iso']}'"; - $db->sql_query($sql); - - add_log('admin', 'LOG_DELETE_LANGUAGE_PACK', $row['lang_english_name']); - - trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name'])); - - break; - - case 'install': - $lang_iso = request_var('iso', ''); - $lang_iso = basename($lang_iso); - - if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt")) - { - trigger_error('LANGUAGE_PACK_NOT_EXIST'); - } - - $file = file("{$phpbb_root_path}language/$lang_iso/iso.txt"); - $lang_pack = array(); - - $lang_pack = array( - 'iso' => htmlspecialchars($lang_iso), - 'name' => trim(htmlspecialchars($file[0])), - 'local_name'=> trim(htmlspecialchars($file[1])), - 'author' => trim(htmlspecialchars($file[2])) - ); - unset($file); - - $sql = 'SELECT lang_iso FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'"; - $result = $db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) - { - trigger_error('LANGUAGE_PACK_ALREADY_INSTALLED'); - } - $db->sql_freeresult($result); - - if (!$lang_pack['name'] || !$lang_pack['local_name']) - { - trigger_error('INVALID_LANGUAGE_PACK'); - } - - // Add language pack - $sql_ary = array( - 'lang_iso' => $lang_pack['iso'], - 'lang_dir' => $lang_pack['iso'], - 'lang_english_name' => $lang_pack['name'], - 'lang_local_name' => $lang_pack['local_name'], - 'lang_author' => $lang_pack['author'] - ); - - $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - - add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); - - trigger_error(sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name'])); - - break; - - case 'download': - - if (!$lang_id) - { - trigger_error('NO_LANGUAGE_PACK_DEFINED'); - } - - $sql = 'SELECT * FROM ' . LANG_TABLE . ' - WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $use_method = request_var('use_method', ''); - $methods = array('tar'); - - foreach (array('tar.gz' => 'zlib', 'tar.bz2' => 'bz2', 'zip' => 'zlib') as $type => $module) - { - if (!@extension_loaded($module)) - { - break; - } - $methods[] = $type; - } - - if (!in_array($use_method, $methods)) - { - $use_method = ''; - } - - // Let the user decide in which format he wants to have the pack - if (!$use_method) - { - adm_page_header($user->lang['SELECT_DOWNLOAD_FORMAT']); - -?> - <h1><?php echo $user->lang['SELECT_DOWNLOAD_FORMAT']; ?></h1> - - <form method="post" action="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=$action&id=$lang_id"; ?>"> - <table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['DOWNLOAD_AS']; ?></td> - </tr> - <tr> - <td class="row1" align="center"> -<?php - foreach ($methods as $method) - { - echo '<input type="radio" value="' . $method . '" name="use_method" /> ' . $method . ' '; - } -?> - </td> - </tr> - <tr> - <td class="cat" align="right"><input type="submit" class="btnmain" value="<?php echo $user->lang['DOWNLOAD']; ?>" name="download" /></td> - </tr> - </table> - </form> - <br /><br /> -<?php - adm_page_footer(); - exit; - } - - include($phpbb_root_path . 'includes/functions_compress.'.$phpEx); - - if ($use_method == 'zip') - { - $compress = new compress_zip('w', $phpbb_root_path . 'store/lang_pack_' . $row['lang_iso'] . '.' . $use_method); - } - else - { - $compress = new compress_tar('w', $phpbb_root_path . 'store/lang_pack_' . $row['lang_iso'] . '.' . $use_method, $use_method); - } - - $email_templates = filelist($phpbb_root_path . 'language/' . $row['lang_iso'], 'email', 'txt'); - $email_templates = $email_templates['email/']; - - // Go through all language files, we want to write those within the storage folder first - $src_path = 'language/' . $row['lang_iso'] . '/'; - foreach ($language_files as $file) - { - if (file_exists(get_filename($row['lang_iso'], $file . '.' . $phpEx, 'store'))) - { - if ($safe_mode) - { - $compress->add_custom_file('store/langfile_' . $row['lang_iso'] . '_' . $file . '.' . $phpEx, $src_path . $file . '.' . $phpEx); - } - else - { - $compress->add_file('store/' . $src_path . $file . '.' . $phpEx, 'store/'); - } - } - else - { - $compress->add_file($src_path . $file . '.' . $phpEx); - } - } - - foreach ($email_templates as $file) - { - if (file_exists(get_filename($row['lang_iso'], 'email/' . $file, 'store'))) - { - if ($safe_mode) - { - $compress->add_custom_file('store/langfile_' . $row['lang_iso'] . '_email_' . $file, $src_path . 'email/' . $file); - } - else - { - $compress->add_file('store/' . $src_path . 'email/' . $file, 'store/'); - } - } - else - { - $compress->add_file($src_path . 'email/' . $file); - } - } - - // Write ISO File - $iso_src = strtr($row['lang_english_name'], array_flip(get_html_translation_table(HTML_ENTITIES))) . "\n"; - $iso_src .= strtr($row['lang_local_name'], array_flip(get_html_translation_table(HTML_ENTITIES))) . "\n"; - $iso_src .= strtr($row['lang_author'], array_flip(get_html_translation_table(HTML_ENTITIES))); - $compress->add_data($iso_src, 'language/' . $row['lang_iso'] . '/iso.txt'); - - // index.html files - $compress->add_data('', 'language/' . $row['lang_iso'] . '/index.html'); - $compress->add_data('', 'language/' . $row['lang_iso'] . '/email/index.html'); - $compress->close(); - - $compress->download('lang_pack_' . $row['lang_iso']); - @unlink($phpbb_root_path . 'store/lang_pack_' . $row['lang_iso'] . '.' . $use_method); - exit; - - break; - - default: - // Output list of language packs - adm_page_header($user->lang['LANGUAGE_PACKS']); -?> -<h1><?php echo $user->lang['LANGUAGE_PACKS']; ?></h1> - -<p><?php echo $user->lang['LANGUAGE_PACKS_EXPLAIN']; ?></p> - -<table class="bg" width="95%" cellspacing="1" cellpadding="4" border="0" align="center"> -<tr> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_NAME']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_LOCALNAME']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_ISO']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['LANGUAGE_PACK_USED_BY']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['OPTIONS']; ?></th> -</tr> -<tr> - <td class="row3" colspan="5"><b><?php echo $user->lang['INSTALLED_LANGUAGE_PACKS']; ?></b></td> -</tr> -<?php - - $sql = 'SELECT user_lang, COUNT(user_lang) AS lang_count - FROM ' . USERS_TABLE . ' - GROUP BY user_lang'; - $result = $db->sql_query($sql); - - $lang_count = array(); - while ($row = $db->sql_fetchrow($result)) - { - $lang_count[$row['user_lang']] = $row['lang_count']; - } - $db->sql_freeresult($result); - - $sql = 'SELECT * - FROM ' . LANG_TABLE; - $result = $db->sql_query($sql); - - $installed = array(); - $row_class = ''; - while ($row = $db->sql_fetchrow($result)) - { - $installed[] = $row['lang_iso']; - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - $tagstyle = ($row['lang_iso'] == $config['default_lang']) ? '*' : ''; - -?> - <tr> - <td class="<?php echo $row_class; ?>" width="100%" nowrap="nowrap"><a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=details&id=" . $row['lang_id']; ?>"><?php echo $row['lang_english_name']; ?></a> <?php echo $tagstyle; ?></td> - <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $row['lang_local_name']; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><b><?php echo $row['lang_iso']; ?></b></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo (isset($lang_count[$row['lang_iso']])) ? $lang_count[$row['lang_iso']] : '0'; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"> <a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=download&id=" . $row['lang_id']; ?>"><?php echo $user->lang['DOWNLOAD']; ?></a> | <a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=delete&id=" . $row['lang_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td> - </tr> -<?php - - } - $db->sql_freeresult($result); - -?> - <tr> - <td class="row3" colspan="5"><b><?php echo $user->lang['UNINSTALLED_LANGUAGE_PACKS']; ?></b></td> - </tr> -<?php - - $new_ary = $iso = array(); - $dp = opendir("{$phpbb_root_path}language"); - while ($file = readdir($dp)) - { - if ($file{0} != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt")) - { - if (!in_array($file, $installed)) - { - if ($iso = file("{$phpbb_root_path}language/$file/iso.txt")) - { - if (sizeof($iso) == 3) - { - $new_ary[$file] = array( - 'iso' => $file, - 'name' => trim($iso[0]), - 'local_name'=> trim($iso[1]), - 'author' => trim($iso[2]) - ); - } - } - } - } - } - unset($installed); - @closedir($dp); - - if (sizeof($new_ary)) - { - $row_class = ''; - foreach ($new_ary as $iso => $lang_ary) - { - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - -?> - <tr> - <td class="<?php echo $row_class; ?>"><?php echo $lang_ary['name']; ?></td> - <td class="<?php echo $row_class; ?>"><?php echo $lang_ary['local_name']; ?></td> - <td class="<?php echo $row_class; ?>"><b><?php echo $lang_ary['iso']; ?></b></td> - <td class="<?php echo $row_class; ?>" colspan="2" align="center"><a href="<?php echo "admin_language.$phpEx$SID&mode=$mode&action=install&iso=" . urlencode($lang_ary['iso']); ?>"><?php echo $user->lang['INSTALL']; ?></a></td> - </tr> -<?php - - } - } - else - { - -?> - <tr> - <td class="row1" colspan="5" align="center"><?php echo $user->lang['NO_UNINSTALLED_LANGUAGE_PACKS']; ?></td> - </tr> -<?php - - } - unset($new_ary); -?> -</table> -<br /><br /> -<?php - adm_page_footer(); - -} - -exit; - - -// -// FUNCTIONS - -/** -* Compare two language files -*/ -function compare_language_files($source_lang, $dest_lang, $file_var) -{ - global $phpbb_root_path, $phpEx; - - $return_ary = array(); - - $lang = array(); - include("{$phpbb_root_path}language/{$source_lang}/{$file_var}.{$phpEx}"); - $lang_entry_src = $lang; - - $lang = array(); - if (file_exists(get_filename($dest_lang, $file_var . '.' . $phpEx, true))) - { - include(get_filename($dest_lang, $file_var . '.' . $phpEx, true)); - } - else - { - include(get_filename($dest_lang, $file_var . '.' . $phpEx)); - } - $lang_entry_dst = $lang; - - unset($lang); - - $diff_array_keys = array_diff(array_keys($lang_entry_src), array_keys($lang_entry_dst)); - unset($lang_entry_dst); - - foreach ($diff_array_keys as $key) - { - $return_ary[$key] = $lang_entry_src[$key]; - } - - unset($lang_entry_src); - - return $return_ary; -} - -/** -* Print language entries -*/ -function print_language_entries(&$lang_ary, $key_prefix = '', $input_field = true) -{ - foreach ($lang_ary as $key => $value) - { -?> - <tr> - <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key; ?></b></td> - <td class="row2"> -<?php - if (is_array($value)) - { -?> - </td> - </tr> -<?php - foreach ($value as $_key => $_value) - { -?> - <tr> - <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key . ' :: ' . $_key; ?></b></td> - <td class="row2"><?php if ($input_field) { ?><input type="text" class="text" name="entry[<?php echo $key; ?>][<?php echo $_key; ?>]" value="<?php echo htmlspecialchars($_value); ?>" style="width:99%" /><?php } else { ?><b><?php echo htmlspecialchars($_value); ?></b><?php } ?></td> - </tr> -<?php - } - } - else - { -?> - <?php if ($input_field) { ?><input type="text" class="post" name="entry[<?php echo $key; ?>]" value="<?php echo htmlspecialchars($value); ?>" style="width:99%" /><?php } else { ?><b><?php echo htmlspecialchars($value); ?></b><?php } ?></td> - </tr> -<?php - } - } -} - -/** -* Print help entries -*/ -function print_help_entries(&$lang_ary, $key_prefix = '', $text_field = true) -{ - foreach ($lang_ary as $key => $value) - { -?> - <tr> - <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key; ?></b></td> - <td class="row2"> -<?php - if (is_array($value)) - { -?> - </td> - </tr> -<?php - foreach ($value as $_key => $_value) - { -?> - <tr> - <td class="row1" width="10%" nowrap="nowrap"><?php echo $key_prefix; ?><b><?php echo $key . ' :: ' . $_key; ?></b></td> - <td class="row2"><?php if ($text_field) { ?><textarea class="post" name="entry[<?php echo $key; ?>][<?php echo $_key; ?>]" cols="80" rows="5" class="post" style="width:90%"><?php echo htmlspecialchars($_value); ?></textarea><?php } else { ?><b><?php echo htmlspecialchars($_value); ?></b><?php } ?></td> - </tr> -<?php - } - } - else - { -?> - <?php if ($text_field) { ?><textarea type="text" class="post" name="entry[<?php echo $key; ?>]" cols="80" rows="5" style="width:90%"><?php echo htmlspecialchars($value); ?></textarea><?php } else { ?><b><?php echo htmlspecialchars($value); ?></b><?php } ?></td> - </tr> -<?php - } - } -} - -/** -* Get filename/location of language/help/email file -*/ -function get_filename($lang_iso, $file, $check_store = false) -{ - global $phpbb_root_path, $safe_mode; - - if ($check_store && $safe_mode) - { - return "{$phpbb_root_path}store/langfile_{$lang_iso}_" . ((strpos($file, 'email/') !== false) ? str_replace('email/', 'email_', $file) : $file); - } - else if ($check_store) - { - return $phpbb_root_path . 'store/language/' . $lang_iso . '/' . $file; - } - else - { - return $phpbb_root_path . 'language/' . $lang_iso . '/' . $file; - } -} - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_phpinfo.php b/phpBB/adm/admin_phpinfo.php deleted file mode 100644 index 5893d31562..0000000000 --- a/phpBB/adm/admin_phpinfo.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - $module['GENERAL']['PHP_INFO'] = ($auth->acl_get('a_server')) ? basename(__FILE__) . $SID : ''; - return; -} - -define('IN_PHPBB', 1); -// Load default header -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - - -// Check permissions -if (!$auth->acl_get('a_server')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -ob_start(); -phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES); -$phpinfo = ob_get_contents(); -ob_end_clean(); - -// Get used layout -$layout = (preg_match('#bgcolor#i', $phpinfo)) ? 'old' : 'new'; - -// Here we play around a little with the PHP Info HTML to try and stylise -// it along phpBB's lines ... hopefully without breaking anything. The idea -// for this was nabbed from the PHP annotated manual -preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output); - -switch ($layout) -{ - case 'old': - $output = preg_replace('#<table#', '<table class="bg"', $output[1][0]); - $output = preg_replace('# bgcolor="\#(\w){6}"#', '', $output); - $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); - $output = preg_replace('#border="0" cellpadding="3" cellspacing="1" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output); - $output = preg_replace('#<tr valign="top"><td align="left">(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td style="{background-color: #9999cc;}"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td style="{background-color: #9999cc;}">\2</td><td style="{background-color: #9999cc;}">\1</td></tr></table></td></tr>', $output); - $output = preg_replace('#<tr valign="baseline"><td[ ]{0,1}><b>(.*?)</b>#', '<tr><td class="row1" nowrap="nowrap">\1', $output); - $output = preg_replace('#<td align="(center|left)">#', '<td class="row2">', $output); - $output = preg_replace('#<td>#', '<td class="row2">', $output); - $output = preg_replace('#valign="middle"#', '', $output); - $output = preg_replace('#<tr >#', '<tr>', $output); - $output = preg_replace('#<hr(.*?)>#', '', $output); - $output = preg_replace('#<h1 align="center">#i', '<h1>', $output); - $output = preg_replace('#<h2 align="center">#i', '<h2>', $output); - break; - case 'new': - $output = preg_replace('#<table#', '<table class="bg" align="center"', $output[1][0]); - $output = preg_replace('#(\w),(\w)#', '\1, \2', $output); - $output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output); - $output = preg_replace('#<tr class="v"><td>(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td>\2</td><td>\1</td></tr></table></td></tr>', $output); - $output = preg_replace('#<td>#', '<td style="{background-color: #9999cc;}">', $output); - $output = preg_replace('#class="e"#', 'class="row1" nowrap="nowrap"', $output); - $output = preg_replace('#class="v"#', 'class="row2"', $output); - $output = preg_replace('# class="h"#', '', $output); - $output = preg_replace('#<hr />#', '', $output); - preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output); - $output = $output[1][0]; - break; -} - -adm_page_header($user->lang['PHP_INFO']); - -echo '<h1>' . $user->lang['PHP_INFO'] . '</h1>'; -echo '<p>' . $user->lang['PHP_INFO_EXPLAIN'] . '</p>'; -echo $output; - -adm_page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_viewlogs.php b/phpBB/adm/admin_viewlogs.php deleted file mode 100644 index f1043d2d99..0000000000 --- a/phpBB/adm/admin_viewlogs.php +++ /dev/null @@ -1,253 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_')) - { - return; - } - - $filename = basename(__FILE__); - $module['LOG']['ADMIN_LOGS'] = $filename . "$SID&mode=admin"; - $module['LOG']['MOD_LOGS'] = $filename . "$SID&mode=mod"; - $module['LOG']['CRITICAL_LOGS'] = $filename . "$SID&mode=critical"; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Do we have styles admin permissions? -if (!$auth->acl_get('a_')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Set some variables -$mode = request_var('mode', 'admin'); -$forum_id = request_var('f', 0); -$start = request_var('start', 0); -$deletemark = (isset($_POST['delmarked'])) ? true : false; -$deleteall = (isset($_POST['delall'])) ? true : false; -$marked = request_var('mark', array(0)); - -// Sort keys -$sort_days = request_var('st', 0); -$sort_key = request_var('sk', 't'); -$sort_dir = request_var('sd', 'd'); - -// Define some vars depending on which logs we're looking at -$log_type = ($mode == 'admin') ? LOG_ADMIN : (($mode == 'mod') ? LOG_MOD : LOG_CRITICAL); - -$user->add_lang('mcp'); - -// Delete entries if requested and able -if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) -{ - $where_sql = ''; - if ($deletemark && $marked) - { - $sql_in = array(); - foreach ($marked as $mark) - { - $sql_in[] = $mark; - } - $where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')'; - unset($sql_in); - } - - $sql = 'DELETE FROM ' . LOG_TABLE . " - WHERE log_type = $log_type - $where_sql"; - $db->sql_query($sql); - - add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR'); -} - -// Sorting -$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'], 364 => $user->lang['1_YEAR']); -$sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); -$sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); - -$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; -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); - -// Define where and sort sql for use in displaying logs -$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; -$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); - -$l_title = $user->lang[strtoupper($mode) . '_LOGS']; -$l_title_explain = $user->lang[strtoupper($mode) . '_LOGS_EXPLAIN']; - -// Output page -adm_page_header($l_title); - -?> - -<h1><?php echo $l_title; ?></h1> - -<p><?php echo $l_title_explain; ?></p> - -<form name="list" method="post" action="<?php echo "admin_viewlogs.$phpEx$SID&mode=$mode"; ?>"> -<?php - -// Define forum list if we're looking @ mod logs -if ($mode == 'mod') -{ - - $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id); - -?> -<table width="100%" cellpadding="1" cellspacing="1" border="0"> - <tr> - <td align="right"><?php echo $user->lang['SELECT_FORUM']; ?>: <select name="f" onchange="if(this.options[this.selectedIndex].value != -1){ this.form.submit() }"><?php echo $forum_box; ?></select> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" /></td> - </tr> -</table> -<?php - -} - -// -// Grab log data -// -$log_data = array(); -$log_count = 0; -view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort); - -?> - -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> -<tr> - <td align="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td> - <td align="right" valign="top" nowrap="nowrap"> - <span class="nav"><?php echo generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&$u_sort_param", $log_count, $config['topics_per_page'], $start, true); ?></span> - </td> -</tr> -</table> - -<table class="bg" width="100%" cellpadding="4" cellspacing="1" border="0"> - <tr> - <td class="cat" colspan="5" height="28" align="center"><?php echo $user->lang['DISPLAY_LOG']; ?>: <?php echo $s_limit_days; ?> <?php echo $user->lang['SORT_BY']; ?>: <?php echo $s_sort_key; ?> <?php echo $s_sort_dir; ?> <input class="btnlite" type="submit" value="<?php echo $user->lang['GO']; ?>" name="sort" /></td> - </tr> - <tr> - <th width="15%" height="25" nowrap="nowrap"><?php echo $user->lang['USERNAME']; ?></th> - <th width="15%" nowrap="nowrap"><?php echo $user->lang['IP']; ?></th> - <th width="20%" nowrap="nowrap"><?php echo $user->lang['TIME']; ?></th> - <th width="45%" nowrap="nowrap"><?php echo $user->lang['ACTION']; ?></th> - <th nowrap="nowrap"><?php echo $user->lang['MARK']; ?></th> - </tr> -<?php - -$row_class = ''; - -if ($log_count) -{ - for ($i = 0; $i < sizeof($log_data); $i++) - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>" nowrap="nowrap"><?php echo $log_data[$i]['username']; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $log_data[$i]['ip']; ?></td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><?php echo $user->format_date($log_data[$i]['time']); ?></td> - <td class="<?php echo $row_class; ?>"><?php - echo $log_data[$i]['action']; - - $data = array(); - - foreach (array('viewtopic', 'viewlogs', 'viewforum') as $check) - { - if (isset($log_data[$i][$check]) && $log_data[$i][$check]) - { - $data[] = '<a href="' . $log_data[$i][$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>'; - } - } - - if (sizeof($data)) - { - echo '<br />» <span class="gensmall">[ ' . implode(' | ', $data) . ' ]</span>'; - } -?> - </td> - <td class="<?php echo $row_class; ?>" align="center" nowrap="nowrap"><input type="checkbox" name="mark[]" value="<?php echo $log_data[$i]['id']; ?>" /></td> - </tr> -<?php - - } - - if ($auth->acl_get('a_clearlogs')) - { - -?> - <tr> - <td class="cat" colspan="5" height="28" align="right"><input class="btnlite" type="submit" name="delmarked" value="<?php echo $user->lang['DELETE_MARKED']; ?>" /> <input class="btnlite" type="submit" name="delall" value="<?php echo $user->lang['DELETE_ALL']; ?>" /> </td> - </tr> -<?php - - } -} -else -{ -?> - <tr> - <td class="row1" colspan="5" align="center" nowrap="nowrap"><?php echo $user->lang['NO_ENTRIES']; ?></td> - </tr> -<?php - -} - -?> -</table> - -<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> - <tr> - <td align="left" valign="top"> <span class="nav"><?php echo on_page($log_count, $config['topics_per_page'], $start); ?></span></td> - <td align="right" valign="top" nowrap="nowrap"><span class="nav"><?php - - if ($auth->acl_get('a_clearlogs')) - { - - -?><b><a href="javascript:marklist('list', true);"><?php echo $user->lang['MARK_ALL']; ?></a> :: <a href="javascript:marklist('list', false);"><?php echo $user->lang['UNMARK_ALL']; ?></a></b> <br /><br /><?php - - } - - echo generate_pagination("admin_viewlogs.$phpEx$SID&mode=$mode&$u_sort_param", $log_count, $config['topics_per_page'], $start, true); - -?></span></td> - </tr> -</table></form> - -<script language="Javascript" type="text/javascript"> -<!-- -function marklist(match, status) -{ - len = eval('document.' + match + '.length'); - for (i = 0; i < len; i++) - { - eval('document.' + match + '.elements[i].checked = ' + status); - } -} -//--> -</script> - -<?php - -adm_page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_words.php b/phpBB/adm/admin_words.php deleted file mode 100644 index 7f5324592f..0000000000 --- a/phpBB/adm/admin_words.php +++ /dev/null @@ -1,200 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_words')) - { - return; - } - - $module['POST']['WORD_CENSOR'] = basename(__FILE__) . $SID; - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = './../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Do we have forum admin permissions? -if (!$auth->acl_get('a_words')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -$mode = request_var('mode', ''); -$mode = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $mode); - -$s_hidden_fields = ''; -$word_info = array(); - -switch ($mode) -{ - case 'edit': - $word_id = request_var('id', 0); - - if (!$word_id) - { - trigger_error($user->lang['NO_WORD']); - } - - $sql = 'SELECT * - FROM ' . WORDS_TABLE . " - WHERE word_id = $word_id"; - $result = $db->sql_query_limit($sql, 1); - - $word_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - $s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />'; - - case 'add': - - adm_page_header($user->lang['WORDS_TITLE']); -?> - -<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1> - -<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_words.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['EDIT_WORD']; ?></th> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['WORD']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="word" value="<?php echo $word_info['word']; ?>" /></td> - </tr> - <tr> - <td class="row1"><b><?php echo $user->lang['REPLACEMENT']; ?>: </b></td> - <td class="row2"><input class="post" type="text" name="replacement" value="<?php echo $word_info['replacement']; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input class="btnmain" type="submit" name="save" value="<?php echo $user->lang['SUBMIT']; ?>" /></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); - break; - - case 'save': - $word_id = request_var('id', 0); - $word = request_var('word', ''); - $replacement = request_var('replacement', ''); - - if (!$word || !$replacement) - { - trigger_error($user->lang['ENTER_WORD']); - } - - $sql = ($word_id) ? "UPDATE " . WORDS_TABLE . " SET word = '" . $db->sql_escape($word) . "', replacement = '" . $db->sql_escape($replacement) . "' WHERE word_id = $word_id" : "INSERT INTO " . WORDS_TABLE . " (word, replacement) VALUES ('" . $db->sql_escape($word) . "', '" . $db->sql_escape($replacement) . "')"; - $db->sql_query($sql); - - $cache->destroy('word_censors'); - - $log_action = ($word_id) ? 'LOG_EDIT_WORD' : 'LOG_ADD_WORD'; - add_log('admin', $log_action, $word); - - $message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED']; - trigger_error($message); - break; - - case 'delete': - - $word_id = request_var('id', 0); - - if (!$word_id) - { - trigger_error($user->lang['NO_WORD']); - } - - $sql = 'SELECT word - FROM ' . WORDS_TABLE . " - WHERE word_id = $word_id"; - $result = $db->sql_query($sql); - $deleted_word = $db->sql_fetchfield('word', 0, $result); - $db->sql_freeresult($result); - - $sql = 'DELETE FROM ' . WORDS_TABLE . " - WHERE word_id = $word_id"; - $db->sql_query($sql); - - $cache->destroy('word_censors'); - - add_log('admin', 'LOG_DELETE_WORD', $deleted_word); - - $message = $user->lang['WORD_REMOVE']; - trigger_error($message); - - break; - - default: - - adm_page_header($user->lang['WORDS_TITLE']); -?> - -<h1><?php echo $user->lang['WORDS_TITLE']; ?></h1> - -<p><?php echo $user->lang['WORDS_EXPLAIN']; ?></p> - -<form method="post" action="admin_words.<?php echo $phpEx . $SID; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['WORD']; ?></th> - <th><?php echo $user->lang['REPLACEMENT']; ?></th> - <th colspan="2"><?php echo $user->lang['ACTION']; ?></th> - </tr> - -<?php - - $sql = 'SELECT * - FROM ' . WORDS_TABLE . ' - ORDER BY word'; - $result = $db->sql_query($sql); - - $row_class = ''; - if ($row = $db->sql_fetchrow($result)) - { - do - { - $row_class = ($row_class == 'row1') ? 'row2' : 'row1'; - -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['word']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['replacement']; ?></td> - <td class="<?php echo $row_class; ?>"> <a href="<?php echo "admin_words.$phpEx$SID&mode=edit&id=" . $row['word_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> </td> - <td class="<?php echo $row_class; ?>"> <a href="<?php echo "admin_words.$phpEx$SID&mode=delete&id=" . $row['word_id']; ?>"><?php echo $user->lang['DELETE']; ?></a> </td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - -?> - <tr> - <td class="cat" colspan="5" height="28" align="center"><?php echo $s_hidden_fields; ?><input class="btnmain" type="submit" name="add" value="<?php echo $user->lang['ADD_WORD']; ?>" /></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); - break; -} - -?>
\ No newline at end of file |
