mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
consistant obtain_* functions
git-svn-id: file:///svn/phpbb/trunk@6572 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b0217ddc11
commit
d89f60f182
14 changed files with 36 additions and 53 deletions
|
@ -63,8 +63,7 @@ if ($attachment['is_orphan'])
|
||||||
trigger_error('ERROR_NO_ATTACHMENT');
|
trigger_error('ERROR_NO_ATTACHMENT');
|
||||||
}
|
}
|
||||||
|
|
||||||
$extensions = array();
|
$extensions = $cache->obtain_attach_extensions();
|
||||||
$cache->obtain_attach_extensions($extensions);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,13 +70,13 @@ class cache extends acm
|
||||||
* Obtain list of naughty words and build preg style replacement arrays for use by the
|
* Obtain list of naughty words and build preg style replacement arrays for use by the
|
||||||
* calling script
|
* calling script
|
||||||
*/
|
*/
|
||||||
function obtain_word_list(&$censors)
|
function obtain_word_list()
|
||||||
{
|
{
|
||||||
global $config, $user, $db;
|
global $config, $user, $db;
|
||||||
|
|
||||||
if (!$user->optionget('viewcensors') && $config['allow_nocensors'])
|
if (!$user->optionget('viewcensors') && $config['allow_nocensors'])
|
||||||
{
|
{
|
||||||
return false;
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($censors = $this->get('word_censors')) === false)
|
if (($censors = $this->get('word_censors')) === false)
|
||||||
|
@ -96,13 +96,13 @@ class cache extends acm
|
||||||
$this->put('word_censors', $censors);
|
$this->put('word_censors', $censors);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return $censors;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain currently listed icons
|
* Obtain currently listed icons
|
||||||
*/
|
*/
|
||||||
function obtain_icons(&$icons)
|
function obtain_icons()
|
||||||
{
|
{
|
||||||
if (($icons = $this->get('icons')) === false)
|
if (($icons = $this->get('icons')) === false)
|
||||||
{
|
{
|
||||||
|
@ -127,13 +127,13 @@ class cache extends acm
|
||||||
$this->put('icons', $icons);
|
$this->put('icons', $icons);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return $icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain ranks
|
* Obtain ranks
|
||||||
*/
|
*/
|
||||||
function obtain_ranks(&$ranks)
|
function obtain_ranks()
|
||||||
{
|
{
|
||||||
if (($ranks = $this->get('ranks')) === false)
|
if (($ranks = $this->get('ranks')) === false)
|
||||||
{
|
{
|
||||||
|
@ -168,13 +168,13 @@ class cache extends acm
|
||||||
$this->put('ranks', $ranks);
|
$this->put('ranks', $ranks);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return $ranks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain allowed extensions
|
* Obtain allowed extensions
|
||||||
*/
|
*/
|
||||||
function obtain_attach_extensions(&$extensions, $forum_id = false)
|
function obtain_attach_extensions($forum_id = false)
|
||||||
{
|
{
|
||||||
if (($extensions = $this->get('_extensions')) === false)
|
if (($extensions = $this->get('_extensions')) === false)
|
||||||
{
|
{
|
||||||
|
@ -254,13 +254,13 @@ class cache extends acm
|
||||||
$extensions['_allowed_'] = array();
|
$extensions['_allowed_'] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return $extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain active bots
|
* Obtain active bots
|
||||||
*/
|
*/
|
||||||
function obtain_bots(&$bots)
|
function obtain_bots()
|
||||||
{
|
{
|
||||||
if (($bots = $this->get('bots')) === false)
|
if (($bots = $this->get('bots')) === false)
|
||||||
{
|
{
|
||||||
|
@ -303,7 +303,7 @@ class cache extends acm
|
||||||
$this->put('bots', $bots);
|
$this->put('bots', $bots);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return $bots;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -355,9 +355,12 @@ class cache extends acm
|
||||||
return $parsed_items;
|
return $parsed_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
function obtain_disallowed_usernames(&$usernames)
|
/**
|
||||||
|
* Obtain disallowed usernames
|
||||||
|
*/
|
||||||
|
function obtain_disallowed_usernames()
|
||||||
{
|
{
|
||||||
if (($usernames = $this->get('disallowed_usernames')) === false)
|
if (($usernames = $this->get('_disallowed_usernames')) === false)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
@ -372,10 +375,10 @@ class cache extends acm
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$this->put('disallowed_usernames', $usernames);
|
$this->put('_disallowed_usernames', $usernames);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return $usernames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2387,10 +2387,8 @@ function censor_text($text)
|
||||||
|
|
||||||
if (!isset($censors) || !is_array($censors))
|
if (!isset($censors) || !is_array($censors))
|
||||||
{
|
{
|
||||||
$censors = array();
|
|
||||||
|
|
||||||
// obtain_word_list is taking care of the users censor option and the board-wide option
|
// obtain_word_list is taking care of the users censor option and the board-wide option
|
||||||
$cache->obtain_word_list($censors);
|
$censors = $cache->obtain_word_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof($censors))
|
if (sizeof($censors))
|
||||||
|
@ -2466,9 +2464,7 @@ function extension_allowed($forum_id, $extension, &$extensions)
|
||||||
if (!sizeof($extensions))
|
if (!sizeof($extensions))
|
||||||
{
|
{
|
||||||
global $cache;
|
global $cache;
|
||||||
|
$extensions = $cache->obtain_attach_extensions();
|
||||||
$extensions = array();
|
|
||||||
$cache->obtain_attach_extensions($extensions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($extensions['_allowed_'][$extension]))
|
if (!isset($extensions['_allowed_'][$extension]))
|
||||||
|
|
|
@ -709,8 +709,7 @@ function display_attachments($forum_id, $blockname, &$attachment_data, &$update_
|
||||||
|
|
||||||
if (empty($extensions) || !is_array($extensions))
|
if (empty($extensions) || !is_array($extensions))
|
||||||
{
|
{
|
||||||
$extensions = array();
|
$extensions = $cache->obtain_attach_extensions();
|
||||||
$cache->obtain_attach_extensions($extensions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for missing attachment informations...
|
// Look for missing attachment informations...
|
||||||
|
|
|
@ -214,8 +214,7 @@ function posting_gen_topic_icons($mode, $icon_id)
|
||||||
global $phpbb_root_path, $config, $template, $cache;
|
global $phpbb_root_path, $config, $template, $cache;
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
if (!$icon_id)
|
if (!$icon_id)
|
||||||
{
|
{
|
||||||
|
@ -339,9 +338,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
|
||||||
return $filedata;
|
return $filedata;
|
||||||
}
|
}
|
||||||
|
|
||||||
$extensions = array();
|
$extensions = $cache->obtain_attach_extensions($forum_id);
|
||||||
$cache->obtain_attach_extensions($extensions, $forum_id);
|
|
||||||
|
|
||||||
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
|
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
|
||||||
|
|
||||||
$file = ($local) ? $upload->local_upload($local_storage) : $upload->form_upload($form_name);
|
$file = ($local) ? $upload->local_upload($local_storage) : $upload->form_upload($form_name);
|
||||||
|
|
|
@ -1159,8 +1159,7 @@ function validate_username($username)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$bad_usernames = array();
|
$bad_usernames = $cache->obtain_disallowed_usernames();
|
||||||
$cache->obtain_disallowed_usernames($bad_usernames);
|
|
||||||
|
|
||||||
foreach ($bad_usernames as $bad_username)
|
foreach ($bad_usernames as $bad_username)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,8 +87,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
$topic_rows = array();
|
$topic_rows = array();
|
||||||
|
|
||||||
|
|
|
@ -324,8 +324,7 @@ class session
|
||||||
* bot, act accordingly
|
* bot, act accordingly
|
||||||
*/
|
*/
|
||||||
$bot = false;
|
$bot = false;
|
||||||
$active_bots = array();
|
$active_bots = $cache->obtain_bots();
|
||||||
$cache->obtain_bots($active_bots);
|
|
||||||
|
|
||||||
foreach ($active_bots as $row)
|
foreach ($active_bots as $row)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,8 +26,7 @@ function view_folder($id, $mode, $folder_id, $folder)
|
||||||
$user->add_lang('viewforum');
|
$user->add_lang('viewforum');
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
$color_rows = array('marked', 'replied');
|
$color_rows = array('marked', 'replied');
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
$bbcode = false;
|
$bbcode = false;
|
||||||
|
|
||||||
|
@ -395,8 +394,7 @@ function get_user_informations($user_id, $user_row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab ranks
|
// Grab ranks
|
||||||
$ranks = array();
|
$ranks = $cache->obtain_ranks();
|
||||||
$cache->obtain_ranks($ranks);
|
|
||||||
|
|
||||||
// Generate online information for user
|
// Generate online information for user
|
||||||
if ($config['load_onlinetrack'])
|
if ($config['load_onlinetrack'])
|
||||||
|
|
|
@ -58,8 +58,7 @@ $sort_dir = request_var('sd', 'a');
|
||||||
|
|
||||||
|
|
||||||
// Grab rank information for later
|
// Grab rank information for later
|
||||||
$ranks = array();
|
$ranks = $cache->obtain_ranks();
|
||||||
$cache->obtain_ranks($ranks);
|
|
||||||
|
|
||||||
|
|
||||||
// What do you want to do today? ... oops, I think that line is taken ...
|
// What do you want to do today? ... oops, I think that line is taken ...
|
||||||
|
|
|
@ -421,8 +421,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
// Output header
|
// Output header
|
||||||
if ($search_id && ($total_match_count > 1000))
|
if ($search_id && ($total_match_count > 1000))
|
||||||
|
|
|
@ -279,8 +279,7 @@ $template->assign_vars(array(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
// Grab all topic data
|
// Grab all topic data
|
||||||
$rowset = $announcement_list = $topic_list = $global_announce_list = array();
|
$rowset = $announcement_list = $topic_list = $global_announce_list = array();
|
||||||
|
|
|
@ -471,18 +471,16 @@ if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('b
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab ranks
|
// Grab ranks
|
||||||
$ranks = array();
|
$ranks = $cache->obtain_ranks();
|
||||||
$cache->obtain_ranks($ranks);
|
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = array();
|
$icons = $cache->obtain_icons();
|
||||||
$cache->obtain_icons($icons);
|
|
||||||
|
|
||||||
// Grab extensions
|
// Grab extensions
|
||||||
$extensions = array();
|
$extensions = array();
|
||||||
if ($topic_data['topic_attachment'])
|
if ($topic_data['topic_attachment'])
|
||||||
{
|
{
|
||||||
$cache->obtain_attach_extensions($extensions);
|
$extensions = $cache->obtain_attach_extensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forum rules listing
|
// Forum rules listing
|
||||||
|
|
Loading…
Add table
Reference in a new issue