mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
PHP 7+ deprecations of old cache systems
Signed-off-by: Yuriy Pikhtarev <iglix@me.com>
This commit is contained in:
parent
1296f58f8c
commit
a4845b4514
14 changed files with 39 additions and 476 deletions
|
@ -1475,98 +1475,6 @@ function topic_attachment_image($switch_attachment)
|
|||
return '<img src="styles/images/icon_clip.gif" alt="" border="0" /> ';
|
||||
}
|
||||
|
||||
/**
|
||||
* array_combine()
|
||||
*
|
||||
* @package PHP_Compat
|
||||
* @link http://php.net/function.array_combine
|
||||
* @author Aidan Lister <aidan@php.net>
|
||||
* @version $Revision: 1.21 $
|
||||
* @since PHP 5
|
||||
*/
|
||||
if (!function_exists('array_combine')) {
|
||||
function array_combine($keys, $values)
|
||||
{
|
||||
if (!is_array($keys)) {
|
||||
user_error('array_combine() expects parameter 1 to be array, ' .
|
||||
gettype($keys) . ' given', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_array($values)) {
|
||||
user_error('array_combine() expects parameter 2 to be array, ' .
|
||||
gettype($values) . ' given', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
$key_count = count($keys);
|
||||
$value_count = count($values);
|
||||
if ($key_count !== $value_count) {
|
||||
user_error('array_combine() both parameters should have equal number of elements', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($key_count === 0 || $value_count === 0) {
|
||||
user_error('array_combine() both parameters should have number of elements at least 0', E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$keys = array_values($keys);
|
||||
$values = array_values($values);
|
||||
|
||||
$combined = array();
|
||||
for ($i = 0; $i < $key_count; $i++) {
|
||||
$combined[$keys[$i]] = $values[$i];
|
||||
}
|
||||
|
||||
return $combined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array_intersect_key()
|
||||
*
|
||||
* @package PHP_Compat
|
||||
* @link http://php.net/function.array_intersect_key
|
||||
* @author Tom Buskens <ortega@php.net>
|
||||
* @version $Revision: 1.4 $
|
||||
* @since PHP 5.0.2
|
||||
*/
|
||||
if (!function_exists('array_intersect_key')) {
|
||||
function array_intersect_key()
|
||||
{
|
||||
$args = func_get_args();
|
||||
if (count($args) < 2) {
|
||||
user_error('Wrong parameter count for array_intersect_key()', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check arrays
|
||||
$array_count = count($args);
|
||||
foreach ($args as $i => $iValue) {
|
||||
if (!is_array($args[$i])) {
|
||||
user_error('array_intersect_key() Argument #' .
|
||||
($i + 1) . ' is not an array', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Compare entries
|
||||
$result = array();
|
||||
foreach ($args[0] as $key1 => $value1) {
|
||||
for ($i = 1; $i !== $array_count; $i++) {
|
||||
foreach ($args[$i] as $key2 => $value2) {
|
||||
if ((string)$key1 === (string)$key2) {
|
||||
$result[$key1] = $value1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
function clear_dl_list($topics_csv)
|
||||
{
|
||||
DB()->query("DELETE FROM " . BB_BT_DLSTATUS . " WHERE topic_id IN($topics_csv)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue