1
0
Fork 0

Minor changes

This commit is contained in:
Airikr 2024-04-25 22:00:49 +02:00
parent 6e56ef7e10
commit ff9653ba47
6 changed files with 16 additions and 86 deletions

13
functions/age.php Normal file
View file

@ -0,0 +1,13 @@
<?php
function age($year, $month, $day, $time = null) {
if(!is_numeric($year) OR !is_numeric($month) OR !is_numeric($day)) {
return 'XX';
} else {
$diff = date_diff(date_create($year.'-'.$month.'-'.$day . (empty($time) ? null : ' '.$time)), date_create(date('Y-m-d'.(empty($time) ? null : ' Hi'))));
return $diff->y;
}
}
?>

View file

@ -1,20 +0,0 @@
<?php
function endecrypt_file($file, $encrypt = true) {
global $enc, $dir_encfiles, $encryption_method;
$encryption_key = base64_decode($enc['keys'][0]);
if($encrypt == true) {
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($encryption_method));
$encrypted = openssl_encrypt(file_get_contents($dir_encfiles.'/'.$file), $encryption_method, $encryption_key, 0, $iv);
file_put_contents($dir_encfiles.'/'.$file.'.enc', base64_encode($encrypted.'::'.$iv));
} else {
list($encrypted_data, $iv) = explode('::', base64_decode(file_get_contents($dir_encfiles.'/'.$file.'.enc')), 2);
$decrypt = openssl_decrypt($encrypted_data, $encryption_method, $encryption_key, 0, $iv);
file_put_contents($dir_encfiles.'/'.$file, $decrypt);
}
}
?>

View file

@ -1,57 +0,0 @@
<?php
function log_action($code, $userid = null, $sessionid = null, $iditem = null, $isexpense = null, $isdebt = null, $isloan = null, $isnotes = null, $istfa_enabled = null, $istfa_disabled = null, $isexporting = null, $isimporting = null, $isdeletedata = null) {
global $user, $session;
sql("INSERT INTO sess_actions(
id_user,
id_session,
id_item,
data_code,
is_expense,
is_debt,
is_loan,
is_notes,
is_tfa_enabled,
is_tfa_disabled,
is_exporting,
is_importing,
is_delete_data,
timestamp_occurred
)
VALUES(
:_iduser,
:_idsession,
:_iditem,
:_code,
:_isexpense,
:_isdebt,
:_isloan,
:_isnotes,
:_istfa_enabled,
:_istfa_disabled,
:_isexporting,
:_isimporting,
:_isdeletedata,
:_occurred
)
", Array(
'_iduser' => (empty($userid) ? (int)$user['id'] : (int)$userid),
'_idsession' => (empty($sessionid) ? (int)$session['id'] : (int)$sessionid),
'_iditem' => (empty($iditem) ? null : (int)$iditem),
'_code' => $code,
'_isexpense' => (empty($isexpense) ? null : (int)$isexpense),
'_isdebt' => (empty($isdebt) ? null : (int)$isdebt),
'_isloan' => (empty($isloan) ? null : (int)$isloan),
'_isnotes' => (empty($isnotes) ? null : (int)$isnotes),
'_istfa_enabled' => (empty($istfa_enabled) ? null : (int)$istfa_enabled),
'_istfa_disabled' => (empty($istfa_disabled) ? null : (int)$istfa_disabled),
'_isexporting' => (empty($isexporting) ? null : (int)$isexporting),
'_isimporting' => (empty($isimporting) ? null : (int)$isimporting),
'_isdeletedata' => (empty($isdeletedata) ? null : (int)$isdeletedata),
'_occurred' => time()
), 'insert');
}
?>

View file

@ -1,7 +0,0 @@
<?php
function lowercaseplus($string) {
return str_replace(' ', '+', mb_strtolower($string));
}
?>

View file

@ -1,8 +1,8 @@
<?php
$site_title = 'airikr.me';
$site_title = null;
$site_protocol = 'https';
$site_domain = 'airikr.me';
$site_domain = null;
$site_subdomain = null;
$site_url = $site_protocol.'://'.(empty($site_subdomain) ? null : $site_subdomain.'.') . $site_domain;
$site_url_current = sprintf(

View file

@ -9,6 +9,7 @@
require_once $dir_functions.'/endecrypt.php';
require_once $dir_functions.'/external-link.php';
require_once $dir_functions.'/format-number.php';
require_once $dir_functions.'/get-ip.php';
require_once $dir_functions.'/pw-random.php';
require_once $dir_functions.'/safe-tag.php';
require_once $dir_functions.'/send-email.php';