mirror of https://github.com/itflow-org/itflow
Convert custom function names to camelCase
This commit is contained in:
parent
bdc71d3163
commit
10362f86ef
|
|
@ -17,7 +17,7 @@ header('Content-Type: application/json');
|
|||
$_POST = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
// Get user IP
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, getIp()));
|
||||
// Get user agent
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
|
|
@ -114,4 +114,4 @@ if (isset($api_key)) {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ if (!isset($_SESSION['logged']) || !$_SESSION['logged']) {
|
|||
}
|
||||
|
||||
// SESSION FINGERPRINT
|
||||
$session_ip = strip_tags(mysqli_real_escape_string($mysqli,get_ip()));
|
||||
$session_ip = strip_tags(mysqli_real_escape_string($mysqli,getIp()));
|
||||
|
||||
// User agent
|
||||
$session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
$log_ip = htmlentities($row['log_ip']);
|
||||
$log_user_agent = htmlentities($row['log_user_agent']);
|
||||
$log_user_os = get_os($log_user_agent);
|
||||
$log_user_browser = get_web_browser($log_user_agent);
|
||||
$log_user_browser = getWebBrowser($log_user_agent);
|
||||
$log_created_at = $row['log_created_at'];
|
||||
$user_id = $row['user_id'];
|
||||
$user_name = htmlentities($row['user_name']);
|
||||
|
|
@ -110,4 +110,4 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
<?php include("footer.php"); ?>
|
||||
|
|
|
|||
|
|
@ -63,12 +63,11 @@ function removeDirectory($path) {
|
|||
rmdir($path);
|
||||
}
|
||||
|
||||
function get_user_agent() {
|
||||
function getUserAgent() {
|
||||
return $_SERVER['HTTP_USER_AGENT'];
|
||||
}
|
||||
|
||||
function get_ip() {
|
||||
|
||||
function getIp() {
|
||||
if (defined("CONST_GET_IP_METHOD")) {
|
||||
if (CONST_GET_IP_METHOD == "HTTP_X_FORWARDED_FOR") {
|
||||
$ip = getenv('HTTP_X_FORWARDED_FOR');
|
||||
|
|
@ -86,7 +85,7 @@ function get_ip() {
|
|||
return $ip;
|
||||
}
|
||||
|
||||
function get_web_browser($user_browser) {
|
||||
function getWebBrowser($user_browser) {
|
||||
$browser = "Unknown Browser";
|
||||
$browser_array = array(
|
||||
'/msie/i' => "<i class='fab fa-fw fa-internet-explorer text-secondary'></i> Internet Explorer",
|
||||
|
|
@ -131,7 +130,7 @@ function get_os($user_os) {
|
|||
return $os_platform;
|
||||
}
|
||||
|
||||
function get_device() {
|
||||
function GetDevice() {
|
||||
$tablet_browser = 0;
|
||||
$mobile_browser = 0;
|
||||
if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
|
||||
|
|
@ -143,7 +142,7 @@ function get_device() {
|
|||
if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) || ((isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])))) {
|
||||
$mobile_browser++;
|
||||
}
|
||||
$mobile_ua = strtolower(substr(get_user_agent(), 0, 4));
|
||||
$mobile_ua = strtolower(substr(getUserAgent(), 0, 4));
|
||||
$mobile_agents = array(
|
||||
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
|
||||
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
|
||||
|
|
@ -157,7 +156,7 @@ function get_device() {
|
|||
if (in_array($mobile_ua,$mobile_agents)) {
|
||||
$mobile_browser++;
|
||||
}
|
||||
if (strpos(strtolower(get_user_agent()),'opera mini') > 0) {
|
||||
if (strpos(strtolower(getUserAgent()),'opera mini') > 0) {
|
||||
$mobile_browser++;
|
||||
//Check for tablets on Opera Mini alternative headers
|
||||
$stock_ua = strtolower(isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])?$_SERVER['HTTP_X_OPERAMINI_PHONE_UA']:(isset($_SERVER['HTTP_DEVICE_STOCK_UA'])?$_SERVER['HTTP_DEVICE_STOCK_UA']:''));
|
||||
|
|
@ -217,7 +216,7 @@ function formatPhoneNumber($phoneNumber) {
|
|||
return $phoneNumber;
|
||||
}
|
||||
|
||||
function mkdir_missing($dir) {
|
||||
function mkdirMissing($dir) {
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir);
|
||||
}
|
||||
|
|
@ -435,7 +434,7 @@ function getSSL($name) {
|
|||
return $certificate;
|
||||
}
|
||||
|
||||
function strto_AZaz09($string) {
|
||||
function strtoAZaz09($string) {
|
||||
$string = ucwords(strtolower($string));
|
||||
|
||||
// Replace spaces with _
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ include_once("config.php");
|
|||
include_once("functions.php");
|
||||
|
||||
// IP & User Agent for logging
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,getIp()));
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
// Define wording for the user
|
||||
|
|
@ -147,4 +147,4 @@ if (isset($_GET['host'])) {
|
|||
}
|
||||
|
||||
//TODO: Future work:-
|
||||
// - Showing multiple logins for a single URL
|
||||
// - Showing multiple logins for a single URL
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Not including the guest header as we don't want any HTML output
|
||||
include("config.php");
|
||||
include("functions.php");
|
||||
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,get_ip())));
|
||||
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,getIp())));
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
if (isset($_GET['id']) && isset($_GET['key'])) {
|
||||
|
|
@ -65,4 +65,4 @@ if (isset($_GET['id']) && isset($_GET['key'])) {
|
|||
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Downloaded shared file $file_name via link', log_client_id = '$client_id', log_created_at = NOW(), log_ip = '$ip', log_user_agent = '$user_agent', company_id = '1'");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ include("functions.php");
|
|||
|
||||
session_start();
|
||||
|
||||
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,get_ip())));
|
||||
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,getIp())));
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
?>
|
||||
|
|
@ -61,4 +61,4 @@ $user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_A
|
|||
unset($_SESSION['alert_message']);
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ if (isset($_GET['invoice_id'], $_GET['url_key'])) {
|
|||
//Set Currency Format
|
||||
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
|
||||
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,getIp()));
|
||||
|
||||
$session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
$os = strip_tags(mysqli_real_escape_string($mysqli,get_os($session_user_agent)));
|
||||
$browser = strip_tags(mysqli_real_escape_string($mysqli,get_web_browser($session_user_agent)));
|
||||
$browser = strip_tags(mysqli_real_escape_string($mysqli,getWebBrowser($session_user_agent)));
|
||||
|
||||
//Set Badge color based off of invoice status
|
||||
if ($invoice_status == "Sent") {
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ if (isset($_GET['quote_id'], $_GET['url_key'])) {
|
|||
//Set Currency Format
|
||||
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
|
||||
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,getIp()));
|
||||
|
||||
$session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
|
||||
$os = strip_tags(mysqli_real_escape_string($mysqli,get_os($session_user_agent)));
|
||||
$browser = strip_tags(mysqli_real_escape_string($mysqli,get_web_browser($session_user_agent)));
|
||||
$browser = strip_tags(mysqli_real_escape_string($mysqli,getWebBrowser($session_user_agent)));
|
||||
|
||||
//Update status to Viewed only if invoice_status = "Sent"
|
||||
if ($quote_status == 'Sent') {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ require_once("functions.php");
|
|||
require_once("rfc6238.php");
|
||||
|
||||
// IP & User Agent for logging
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, getIp()));
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
// Block brute force password attacks - check recent failed login attempts for this IP
|
||||
|
|
|
|||
2
logs.php
2
logs.php
|
|
@ -142,7 +142,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$log_ip = htmlentities($row['log_ip']);
|
||||
$log_user_agent = htmlentities($row['log_user_agent']);
|
||||
$log_user_os = get_os($log_user_agent);
|
||||
$log_user_browser = get_web_browser($log_user_agent);
|
||||
$log_user_browser = getWebBrowser($log_user_agent);
|
||||
$log_created_at = $row['log_created_at'];
|
||||
$user_id = $row['user_id'];
|
||||
$user_name = htmlentities($row['user_name']);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ if (!$_SESSION['client_logged_in']) {
|
|||
}
|
||||
|
||||
// SESSION FINGERPRINT
|
||||
$session_ip = strip_tags(mysqli_real_escape_string($mysqli, get_ip()));
|
||||
$session_ip = strip_tags(mysqli_real_escape_string($mysqli, getIp()));
|
||||
|
||||
// Get user agent
|
||||
$session_user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT']));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ if (!isset($_SESSION)) {
|
|||
session_start();
|
||||
}
|
||||
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli, getIp()));
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
$sql_settings = mysqli_query($mysqli, "SELECT config_azure_client_id FROM settings WHERE company_id = '1'");
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ if (!isset($_SESSION)) {
|
|||
session_start();
|
||||
}
|
||||
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,get_ip()));
|
||||
$ip = strip_tags(mysqli_real_escape_string($mysqli,getIp()));
|
||||
$user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT']));
|
||||
|
||||
$company_sql = mysqli_query($mysqli, "SELECT company_name FROM companies WHERE company_id = '1'");
|
||||
|
|
|
|||
20
post.php
20
post.php
|
|
@ -4371,7 +4371,7 @@ if(isset($_GET['export_client_contacts_csv'])){
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN locations ON location_id = contact_location_id WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
|
||||
if($sql->num_rows > 0){
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Contacts-" . date('Y-m-d') . ".csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Contacts-" . date('Y-m-d') . ".csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -4509,7 +4509,7 @@ if(isset($_GET['download_client_contacts_csv_template'])){
|
|||
$client_name = $row['client_name'];
|
||||
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Contacts-Template.csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Contacts-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -4789,7 +4789,7 @@ if(isset($_GET['export_client_locations_csv'])){
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL AND company_id = $session_company_id ORDER BY location_name ASC");
|
||||
if($sql->num_rows > 0){
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Locations-" . date('Y-m-d') . ".csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Locations-" . date('Y-m-d') . ".csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -4915,7 +4915,7 @@ if(isset($_GET['download_client_locations_csv_template'])){
|
|||
$client_name = $row['client_name'];
|
||||
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Locations-Template.csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Locations-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -5189,7 +5189,7 @@ if(isset($_GET['download_client_assets_csv_template'])){
|
|||
$client_name = $row['client_name'];
|
||||
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Assets-Template.csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Assets-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -5226,7 +5226,7 @@ if(isset($_GET['export_client_assets_csv'])){
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id LEFT JOIN locations ON asset_location_id = location_id WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
|
||||
if($sql->num_rows > 0){
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Assets-" . date('Y-m-d') . ".csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Assets-" . date('Y-m-d') . ".csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -5632,7 +5632,7 @@ if(isset($_GET['export_client_logins_csv'])){
|
|||
$sql = mysqli_query($mysqli,"SELECT * FROM logins WHERE login_client_id = $client_id ORDER BY login_name ASC");
|
||||
if($sql->num_rows > 0){
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Logins-" . date('Y-m-d') . ".csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Logins-" . date('Y-m-d') . ".csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -5751,7 +5751,7 @@ if(isset($_GET['download_client_logins_csv_template'])){
|
|||
$client_name = $row['client_name'];
|
||||
|
||||
$delimiter = ",";
|
||||
$filename = strto_AZaz09($client_name) . "-Logins-Template.csv";
|
||||
$filename = strtoAZaz09($client_name) . "-Logins-Template.csv";
|
||||
|
||||
//create a file pointer
|
||||
$f = fopen('php://memory', 'w');
|
||||
|
|
@ -7864,7 +7864,7 @@ if(isset($_GET['export_client_pdf'])){
|
|||
|
||||
var docDefinition = {
|
||||
info: {
|
||||
title: '<?php echo strto_AZaz09($client_name); ?>- IT Documentation',
|
||||
title: '<?php echo strtoAZaz09($client_name); ?>- IT Documentation',
|
||||
author: <?php echo json_encode($session_company_name); ?>
|
||||
},
|
||||
|
||||
|
|
@ -9046,7 +9046,7 @@ if(isset($_GET['export_client_pdf'])){
|
|||
};
|
||||
|
||||
|
||||
pdfMake.createPdf(docDefinition).download('<?php echo strto_AZaz09($client_name); ?>-IT_Documentation-<?php echo date('Y-m-d'); ?>.pdf');
|
||||
pdfMake.createPdf(docDefinition).download('<?php echo strtoAZaz09($client_name); ?>-IT_Documentation-<?php echo date('Y-m-d'); ?>.pdf');
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
10
setup.php
10
setup.php
|
|
@ -857,7 +857,7 @@ if (isset($_POST['add_user'])) {
|
|||
|
||||
$user_id = mysqli_insert_id($mysqli);
|
||||
|
||||
mkdir_missing("uploads/users/$user_id");
|
||||
mkdirMissing("uploads/users/$user_id");
|
||||
|
||||
//Check to see if a file is attached
|
||||
if ($_FILES['file']['tmp_name'] != '') {
|
||||
|
|
@ -934,13 +934,13 @@ if (isset($_POST['add_company_settings'])) {
|
|||
|
||||
$company_id = mysqli_insert_id($mysqli);
|
||||
|
||||
mkdir_missing("uploads/clients/$company_id");
|
||||
mkdirMissing("uploads/clients/$company_id");
|
||||
file_put_contents("uploads/clients/$company_id/index.php", "");
|
||||
mkdir_missing("uploads/expenses/$company_id");
|
||||
mkdirMissing("uploads/expenses/$company_id");
|
||||
file_put_contents("uploads/expenses/$company_id/index.php", "");
|
||||
mkdir_missing("uploads/settings/$company_id");
|
||||
mkdirMissing("uploads/settings/$company_id");
|
||||
file_put_contents("uploads/settings/$company_id/index.php", "");
|
||||
mkdir_missing("uploads/tmp/$company_id");
|
||||
mkdirMissing("uploads/tmp/$company_id");
|
||||
file_put_contents("uploads/tmp/$company_id/index.php", "");
|
||||
|
||||
//Check to see if a file is attached
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ $sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs
|
|||
$log_ip = htmlentities($row['log_ip']);
|
||||
$log_user_agent = htmlentities($row['log_user_agent']);
|
||||
$log_user_os = get_os($log_user_agent);
|
||||
$log_user_browser = get_web_browser($log_user_agent);
|
||||
$log_user_browser = getWebBrowser($log_user_agent);
|
||||
$log_created_at = $row['log_created_at'];
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
$log_ip = htmlentities($row['log_ip']);
|
||||
$log_user_agent = htmlentities($row['log_user_agent']);
|
||||
$log_user_os = get_os($log_user_agent);
|
||||
$log_user_browser = get_web_browser($log_user_agent);
|
||||
$log_user_browser = getWebBrowser($log_user_agent);
|
||||
$last_login = "$log_user_os<br>$log_user_browser<br><i class='fa fa-fw fa-globe'></i> $log_ip";
|
||||
if (empty($last_login)) {
|
||||
$last_login = "Never logged in";
|
||||
|
|
|
|||
Loading…
Reference in New Issue