Небольшая уборка после статического анализа

Дегенерация PHPdoc, исправления нескольких явных ошибок.
This commit is contained in:
Exile 2016-01-19 05:44:25 +03:00
commit 313356a9a4
21 changed files with 335 additions and 80 deletions

View file

@ -1206,6 +1206,10 @@ function check_name_dup ($mode, $name, $die_on_error = true)
/**
* Change subforums cat_id if parent's cat_id was changed
*
* @param $parent_id
* @param $new_cat_id
* @param $order_shear
*/
function change_sf_cat ($parent_id, $new_cat_id, $order_shear)
{

View file

@ -24,7 +24,7 @@ echo '
foreach ($sql as $i => $query)
{
$row = mysql_fetch_row(DB()->query($query));
$row = mysql_fetch_row(DB()->query($query)); // TODO: deprecated
echo "<tr><td>{$lang['TR_STATS'][$i]}</td><td><b>{$row[0]}</b></td>";
}

View file

@ -197,6 +197,9 @@ class ajax_common
/**
* Exit on error
*
* @param $error_msg
* @param int $error_code
*/
function ajax_die($error_msg, $error_code = E_AJAX_GENERAL_ERROR)
{
@ -233,6 +236,10 @@ class ajax_common
/**
* OB Handler
*
* @param $contents
*
* @return string
*/
function ob_handler($contents)
{
@ -296,6 +303,8 @@ class ajax_common
/**
* Prompt for confirmation
*
* @param $confirm_msg
*/
function prompt_for_confirm($confirm_msg)
{
@ -308,6 +317,8 @@ class ajax_common
/**
* Verify mod rights
*
* @param $forum_id
*/
function verify_mod_rights($forum_id)
{

View file

@ -72,7 +72,7 @@ $domain_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $do
// Version info
$bb_cfg['tp_version'] = '2.2.0';
$bb_cfg['tp_release_date'] = '1/06/2015';
$bb_cfg['tp_release_date'] = '**/02/2016';
$bb_cfg['tp_release_state'] = 'ALPHA';
// Database
@ -82,7 +82,7 @@ $pconnect = false;
// Настройка баз данных ['db']['srv_name'] => (array) srv_cfg;
// порядок параметров srv_cfg (хост, название базы, пользователь, пароль, charset, pconnect);
$bb_cfg['db'] = array(
'db1' => array('localhost', 'tp_216', 'user', 'pass', $charset, $pconnect),
'db1' => array('localhost', 'tp_220', 'user', 'pass', $charset, $pconnect),
//'db2' => array('localhost2', 'dbase2', 'user2', 'pass2', $charset, $pconnect),
//'db3' => array('localhost3', 'dbase3', 'user2', 'pass3', $charset, $pconnect),
);

View file

@ -285,10 +285,14 @@ function strip_quotes ($text)
* Strips away bbcode from a given string, leaving plain text
*
* @param string Text to be stripped of bbcode tags
* @param boolean If true, strip away quote tags AND their contents
* @param boolean If true, use the fast-and-dirty method rather than the shiny and nice method
* @param bool $stripquotes
* @param bool $fast_and_dirty
* @param bool $showlinks
*
* @return string
* @internal param \If $boolean true, strip away quote tags AND their contents
* @internal param \If $boolean true, use the fast-and-dirty method rather than the shiny and nice method
*
*/
function strip_bbcode ($message, $stripquotes = true, $fast_and_dirty = false, $showlinks = true)
{
@ -546,6 +550,10 @@ class bbcode
/**
* bbcode2html
* $text должен быть уже обработан htmlCHR($text, false, ENT_NOQUOTES);
*
* @param $text
*
* @return string
*/
function bbcode2html ($text)
{
@ -596,6 +604,10 @@ class bbcode
/**
* Clean up
*
* @param $text
*
* @return mixed|string
*/
static function clean_up ($text)
{
@ -608,6 +620,10 @@ class bbcode
/**
* Spam filter
*
* @param $text
*
* @return mixed|string
*/
private function spam_filter ($text)
{
@ -673,6 +689,10 @@ class bbcode
/**
* [code] callback
*
* @param $m
*
* @return string
*/
function code_callback ($m)
{
@ -686,6 +706,10 @@ class bbcode
/**
* [url] callback
*
* @param $m
*
* @return string
*/
function url_callback ($m)
{
@ -710,6 +734,10 @@ class bbcode
/**
* Escape tags inside tiltes in [quote="tilte"]
*
* @param $m
*
* @return string
*/
function escape_tiltes_callback ($m)
{
@ -722,6 +750,10 @@ class bbcode
/**
* make_clickable
*
* @param $text
*
* @return string
*/
function make_clickable ($text)
{
@ -752,6 +784,10 @@ class bbcode
/**
* make_url_clickable_callback
*
* @param $m
*
* @return string
*/
function make_url_clickable_callback ($m)
{
@ -775,6 +811,10 @@ class bbcode
/**
* smilies_pass
*
* @param $text
*
* @return mixed
*/
function smilies_pass ($text)
{
@ -795,6 +835,10 @@ class bbcode
/**
* new_line2html
*
* @param $text
*
* @return mixed
*/
function new_line2html ($text)
{
@ -805,6 +849,10 @@ class bbcode
/**
* tidy
*
* @param $text
*
* @return string
*/
function tidy ($text)
{
@ -853,6 +901,10 @@ class words_rate
/**
* возвращает "показатель полезности" сообщения используемый для автоудаления коротких сообщений типа "спасибо", "круто" и т.д.
*
* @param $text
*
* @return int
*/
function get_words_rate ($text)
{

View file

@ -5,23 +5,42 @@ if (!defined('BB_ROOT')) die(basename(__FILE__));
class cache_common
{
var $used = false;
/**
* Returns value of variable
*
* @param $name
* @param string $get_miss_key_callback
* @param int $ttl
*
* @return array|bool
*/
function get ($name, $get_miss_key_callback = '', $ttl = 604800)
{
if ($get_miss_key_callback) return $get_miss_key_callback($name);
return is_array($name) ? array() : false;
}
/**
* Store value of variable
*
* @param $name
* @param $value
* @param int $ttl
*
* @return bool
*/
function set ($name, $value, $ttl = 604800)
{
return false;
}
/**
* Remove variable
*
* @param string $name
*
* @return bool
*/
function rm ($name = '')
{

View file

@ -56,7 +56,7 @@ class cache_xcache extends cache_common
{
xcache_clear_cache(XC_TYPE_PHP, 0);
xcache_clear_cache(XC_TYPE_VAR, 0);
return;
return true;
}
}

View file

@ -733,6 +733,10 @@ function replace_quote ($str, $double = true, $single = true)
/**
* Build simple hidden fields from array
*
* @param $fields_ary
*
* @return string
*/
function build_hidden_fields ($fields_ary)
{
@ -759,6 +763,12 @@ function build_hidden_fields ($fields_ary)
/**
* Choost russian word declension based on numeric [from dklab.ru]
* Example for $expressions: array("ответ", "ответа", "ответов")
*
* @param $int
* @param $expressions
* @param string $format
*
* @return string
*/
function declension ($int, $expressions, $format = '%1$s %2$s')
{
@ -827,6 +837,10 @@ function url_arg ($url, $arg, $value, $amp = '&amp;')
/**
* Adds commas between every group of thousands
*
* @param $number
*
* @return string
*/
function commify ($number)
{
@ -835,6 +849,13 @@ function commify ($number)
/**
* Returns a size formatted in a more human-friendly format, rounded to the nearest GB, MB, KB..
*
* @param $size
* @param null $rounder
* @param null $min
* @param string $space
*
* @return string
*/
function humn_size ($size, $rounder = null, $min = null, $space = '&nbsp;')
{
@ -953,6 +974,12 @@ function select_get_val ($key, &$val, $options_ary, $default, $num = true)
* Set variable, used by {@link request_var the request_var function}
*
* @access private
*
* @param $result
* @param $var
* @param $type
* @param bool $multibyte
* @param bool $strip
*/
function set_var (&$result, $var, $type, $multibyte = false, $strip = true)
{
@ -983,6 +1010,13 @@ function set_var (&$result, $var, $type, $multibyte = false, $strip = true)
* request_var
*
* Used to get passed variable
*
* @param $var_name
* @param $default
* @param bool $multibyte
* @param bool $cookie
*
* @return array
*/
function request_var ($var_name, $default, $multibyte = false, $cookie = false)
{
@ -2110,6 +2144,10 @@ function print_confirmation ($tpl_vars)
*
* $mode = 'no_header'
* 'no_footer'
*
* @param $args
* @param string $type
* @param string $mode
*/
function print_page ($args, $type = '', $mode = '')
{

View file

@ -90,6 +90,10 @@ if (!$attach_config = CACHE('bb_cache')->get('attach_config'))
/**
* Writing Data into plain Template Vars
*
* @param $template_var
* @param $replacement
* @param string $filename
*/
function init_display_template($template_var, $replacement, $filename = 'viewtopic_attach.tpl')
{
@ -141,6 +145,9 @@ function init_display_template($template_var, $replacement, $filename = 'viewtop
/**
* Display Attachments in Posts
*
* @param $post_id
* @param $switch_attachment
*/
function display_post_attachments($post_id, $switch_attachment)
{
@ -159,6 +166,8 @@ function display_post_attachments($post_id, $switch_attachment)
/**
* Initializes some templating variables for displaying Attachments in Posts
*
* @param $switch_attachment
*/
function init_display_post_attachments($switch_attachment)
{

View file

@ -72,6 +72,10 @@ class user_common
/**
* Start session (restore existent session or create new)
*
* @param array $cfg
*
* @return array|bool
*/
function session_start ($cfg = array())
{
@ -208,6 +212,11 @@ class user_common
/**
* Create new session for the given user
*
* @param $userdata
* @param bool $auto_created
*
* @return array
*/
function session_create ($userdata, $auto_created = false)
{
@ -327,6 +336,9 @@ class user_common
/**
* Initialize sessiondata stored in cookies
*
* @param bool $update_lastvisit
* @param bool $set_cookie
*/
function session_end ($update_lastvisit = false, $set_cookie = true)
{
@ -369,6 +381,11 @@ class user_common
/**
* Login
*
* @param $args
* @param bool $mod_admin_login
*
* @return array
*/
function login ($args, $mod_admin_login = false)
{
@ -458,6 +475,8 @@ class user_common
/**
* Store sessiondata in cookies
*
* @param $user_id
*/
function set_session_cookies ($user_id)
{
@ -500,6 +519,12 @@ class user_common
/**
* Verify autologin_id
*
* @param $userdata
* @param bool $expire_check
* @param bool $create_new
*
* @return bool|string
*/
function verify_autologin_id ($userdata, $expire_check = false, $create_new = true)
{
@ -527,6 +552,11 @@ class user_common
/**
* Create autologin_id
*
* @param $userdata
* @param bool $create_new
*
* @return string
*/
function create_autologin_id ($userdata, $create_new = true)
{
@ -606,6 +636,8 @@ class user_common
/**
* Mark read
*
* @param $type
*/
function mark_read ($type)
{
@ -658,6 +690,10 @@ class user_common
/**
* Get not auth forums
*
* @param $auth_type
*
* @return string
*/
function get_not_auth_forums ($auth_type)
{
@ -718,6 +754,11 @@ class user_common
/**
* Get excluded forums
*
* @param $auth_type
* @param string $return_as
*
* @return array|string
*/
function get_excluded_forums ($auth_type, $return_as = 'csv')
{
@ -820,6 +861,8 @@ function db_update_userdata ($userdata, $sql_ary, $data_already_escaped = true)
{
cache_rm_userdata($userdata);
}
return true;
}
// $user_id - array(id1,id2,..) or (string) id

View file

@ -88,6 +88,8 @@ class Template
/**
* Constructor. Installs XS mod on first run or updates it and sets the root dir.
*
* @param string $root
*/
function Template($root = '.')
{
@ -117,6 +119,11 @@ class Template
/**
* Generates a full path+filename for the given filename, which can either
* be an absolute name, or a name relative to the rootdir for this Template object
*
* @param $filename
* @param bool $xs_include
*
* @return string
*/
function make_filename($filename, $xs_include = false)
{
@ -136,6 +143,10 @@ class Template
* Converts template filename to cache filename
* Returns empty string if non-cachable (for tpl files outside of root dir)
* $filename should be absolute filename
*
* @param $filename
*
* @return string
*/
function make_filename_cache($filename)
{
@ -146,6 +157,8 @@ class Template
/**
* Sets the template filenames for handles. $filename_array
* Should be a hash of handle => filename pairs
*
* @param $filenames
*/
function set_filenames($filenames)
{
@ -156,6 +169,13 @@ class Template
/**
* Assigns template filename for handle
*
* @param $handle
* @param $filename
* @param bool $xs_include
* @param bool $quiet
*
* @return bool
*/
function set_filename($handle, $filename, $xs_include = false, $quiet = false)
{
@ -198,6 +218,10 @@ class Template
/**
* Includes file or executes code
*
* @param $filename
* @param $code
* @param $handle
*/
function execute($filename, $code, $handle)
{
@ -218,6 +242,10 @@ class Template
/**
* Load the file for the handle, compile the file, and run the compiled code
* This will print out the results of executing the template
*
* @param $handle
*
* @return bool
*/
function pparse($handle)
{
@ -271,6 +299,11 @@ class Template
/**
* Precompile file
*
* @param $template
* @param $filename
*
* @return bool
*/
function precompile($template, $filename)
{
@ -323,6 +356,11 @@ class Template
* Inserts the uncompiled code for $handle as the value of $varname in the root-level
* This can be used to effectively include a template in the middle of another template
* Note that all desired assignments to the variables in $handle should be done BEFORE calling this function
*
* @param $varname
* @param $handle
*
* @return bool
*/
function assign_var_from_handle($varname, $handle)
{
@ -336,6 +374,11 @@ class Template
/**
* Block-level variable assignment. Adds a new block iteration with the given variable assignments
* Note that this should only be called once per block iteration
*
* @param $blockname
* @param $vararray
*
* @return bool
*/
function assign_block_vars($blockname, $vararray)
{
@ -361,6 +404,8 @@ class Template
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name
*
* @param $vararray
*/
function assign_vars($vararray)
{
@ -372,6 +417,9 @@ class Template
/**
* Root-level variable assignment. Adds to current assignments, overriding
* any existing variable assignment with the same name
*
* @param $varname
* @param bool $varval
*/
function assign_var($varname, $varval = true)
{
@ -381,6 +429,8 @@ class Template
/**
* Root-level. Adds to current assignments, appends
* to any existing variable assignment with the same name
*
* @param $vararray
*/
function append_vars($vararray)
{
@ -392,6 +442,10 @@ class Template
/**
* If not already done, load the file for the given handle and populate
* the uncompiled_code[] hash with its code. Do not compile
*
* @param $handle
*
* @return bool
*/
function loadfile($handle)
{
@ -425,6 +479,11 @@ class Template
* Generates a reference to the given variable inside the given (possibly nested) block namespace
* This is a string of the form: $this->_tpldata['parent.'][$_parent_i]['$child1.'][$_child1_i]['$child2.'][$_child2_i]...['varname']
* It's ready to be inserted into an "echo" line in one of the templates. NOTE: expects a trailing "." on the namespace
*
* @param $namespace
* @param $varname
*
* @return string
*/
function generate_block_varref($namespace, $varname)
{
@ -446,6 +505,11 @@ class Template
* Generates a reference to the array of data values for the given (possibly nested) block namespace
* This is a string of the form: $this->_tpldata['parent.'][$_parent_i]['$child1.'][$_child1_i]['$child2.'][$_child2_i]...['$childN.']
* If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. NOTE: does not expect a trailing "." on the blockname
*
* @param $blockname
* @param $include_last_iterator
*
* @return string
*/
function generate_block_data_ref($blockname, $include_last_iterator)
{
@ -945,10 +1009,16 @@ class Template
/**
* Compiles code and writes to cache if needed
*
* @param $code
* @param $handle
* @param $cache_file
*
* @return string
*/
function compile2($code, $handle, $cache_file)
{
$code = $this->compile_code('', $code, XS_USE_ISSET);
$code = $this->compile_code('', $code);
if ($cache_file && !empty($this->use_cache) && !empty($this->auto_compile)) {
$res = $this->write_cache($cache_file, $code);
if ($handle && $res) {
@ -964,10 +1034,16 @@ class Template
* If "do_not_echo" is true, the returned code will not be directly executable,
* but can be used as part of a variable assignment for use in assign_code_from_handle().
* This function isn't used and kept only for compatibility with original template.php
*
* @param $code
* @param bool $do_not_echo
* @param string $retvar
*
* @return string
*/
function compile($code, $do_not_echo = false, $retvar = '')
{
$code = ' ?' . '>' . $this->compile_code('', $code, true) . '<' . "?php \n";
$code = ' ?' . '>' . $this->compile_code('', $code) . '<' . "?php \n";
if ($do_not_echo) {
$code = "ob_start();\n" . $code . "\n\${$retvar} = ob_get_contents();\nob_end_clean();\n";
}
@ -976,6 +1052,9 @@ class Template
/**
* Write cache to disk
*
* @param $filename
* @param $code
*/
function write_cache($filename, $code)
{

View file

@ -199,6 +199,8 @@ class bb_poll
global $lang;
return $this->err_msg = sprintf($lang['NEW_POLL_VOTES'], $this->max_votes);
}
return false;
}
function insert_votes_into_db ($topic_id)

View file

@ -702,7 +702,7 @@ else
{
$template->assign_var('BB_DIE_APPEND_MSG', '
<form id="mod-action" method="POST" action="search.php">
<input type="submit" name="add_my_post" value="'. $lang['RESTORE_ALL_POSTS'] .'" class="bold" onclick="if (!window.confirm( this.value +\'?\' )){ return false };" />
<input type="submit" name="add_my_post" value="'. $lang['RESTORE_ALL_POSTS'] .'" class="bold" onclick="if (!window.confirm( this.value +\'?\' )){ return false }" />
</form>
<br /><br />
<a href="index.php">'. $lang['INDEX_RETURN'] .'</a>

View file

@ -117,7 +117,7 @@ function setCookie(name, value, days, path, domain, secure) {
}
document.cookie =
name + '=' + escape(value)
name + '=' + encodeURI(value)
+ ((expires) ? '; expires=' + expires : '')
+ ((path) ? '; path=' + path : ((cookiePath) ? '; path=' + cookiePath : ''))
+ ((domain) ? '; domain=' + domain : ((cookieDomain) ? '; domain=' + cookieDomain : ''))

View file

@ -14,7 +14,6 @@
background-image: -o-linear-gradient(top, #62c462, #51a351);
background-image: linear-gradient(top, #62c462, #51a351);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', endColorstr='#51a351', GradientType=0);
border-color: #51a351 #51a351 #387038;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
@ -52,7 +51,6 @@
background-image: -o-linear-gradient(top, #fbb450, #f89406);
background-image: linear-gradient(top, #fbb450, #f89406);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', endColorstr='#f89406', GradientType=0);
border-color: #f89406 #f89406 #ad6704;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);

View file

@ -171,7 +171,7 @@ function checkForm(form) {
type : 'add',
message : $('textarea#message').val(),
topic_id : {TOPIC_ID},
notify : notify,
notify : notify
});
}, 100);
return false;

View file

@ -38,7 +38,7 @@
toggle_disabled('author', !this.checked);
toggle_disabled('{MY_TOPICS_ID}', this.checked);
if (this.checked) { $p('author').value = '{THIS_USER_NAME}'; }
else { $p('author').value = ''; $p('{MY_TOPICS_ID}').checked = 0; };
else { $p('author').value = ''; $p('{MY_TOPICS_ID}').checked = 0; }
"
name="{POSTER_ID_KEY}" value="{THIS_USER_ID}" />
{L_IN_MY_POSTS}
@ -133,7 +133,7 @@ function refresh_username(selected_username)
opener.document.forms['post'].{INPUT_NAME}.value = selected_username;
opener.focus();
window.close();
}
};
</script>
<form method="post" name="search" action="{SEARCH_ACTION}">

View file

@ -43,7 +43,7 @@
ajax.exec({
action : 'change_torrent',
attach_id : {postrow.attach.tor_not_reged.ATTACH_ID},
type : $('#tor-select-{postrow.attach.tor_not_reged.ATTACH_ID}').val(),
type : $('#tor-select-{postrow.attach.tor_not_reged.ATTACH_ID}').val()
});
}
</script>
@ -124,7 +124,7 @@
attach_id : {postrow.attach.tor_reged.ATTACH_ID},
mode : mode,
status : $('#sel_status').val(),
comment : $('#comment').val(),
comment : $('#comment').val()
});
};
ajax.callback.change_tor_status = function(data) {
@ -180,7 +180,7 @@
ajax.exec({
action : 'change_torrent',
attach_id : {postrow.attach.tor_reged.ATTACH_ID},
type : $('#tor-select-{postrow.attach.tor_reged.ATTACH_ID}').val(),
type : $('#tor-select-{postrow.attach.tor_reged.ATTACH_ID}').val()
});
}
</script>

View file

@ -116,7 +116,7 @@
size = size/1024;
i++;
}
size = new String(size);
size = String(size);
if (size.indexOf('.') != -1) {
size = size.substring(0, size.indexOf('.') + 3);
}

View file

@ -3188,7 +3188,7 @@ TPL.selects = {
'1024x768',
'1024x768, 2048х1536',
'480x320, 960x640 (SD) + 1024x768 (HD)',
'480x320, 960x640 (SD) + 1024x768, 2048х1536 (HD)',
'480x320, 960x640 (SD) + 1024x768, 2048х1536 (HD)'
],
apple_ios_def_abr: [