Skip to content

Instantly share code, notes, and snippets.

View vsguts's full-sized avatar

Volodymyr Huts vsguts

View GitHub Profile
@vsguts
vsguts / docker-compose.yml
Created December 9, 2022 15:03
Simple VPN server (ipsec)
version: '3'
services:
vpn:
image: hwdsl2/ipsec-vpn-server
restart: always
environment:
- VPN_IPSEC_PSK=my-shared-secret
- VPN_USER=my-username
- VPN_PASSWORD=my-password
<?php
class User
{
private $name;
public function setName($name)
{
$this->name = $name;
}
@vsguts
vsguts / 1.create-database.sql
Last active March 17, 2019 20:03
PHP school: MySQL: Home task 3
CREATE DATABASE mydb CHARACTER SET utf8;
@vsguts
vsguts / sql.sql
Created January 23, 2019 23:34
Catalog example with foreign key
CREATE TABLE `categories` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`description` TEXT,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
CREATE TABLE `products` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`category_id` INT(11) NOT NULL,
@vsguts
vsguts / demo-catalog.sql
Created January 21, 2019 21:31
Demo catalog
CREATE TABLE `categories` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
`description` TEXT,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
CREATE TABLE `products` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`category_id` INT(11) NOT NULL,
@vsguts
vsguts / docker-compose.yml
Created January 16, 2019 21:50
MySQL and PMA via docker compose
version: '3.3'
services:
mysql:
image: mysql:5.7.21
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
@vsguts
vsguts / docker-compose.yml
Created January 16, 2019 21:35
MySQL via Docker compose
version: '3.3'
services:
mysql:
image: mysql:5.7.21
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
[user]
name = vsguts
email = vsguts@gmail.com
[github]
user = vsguts
token = 055666e14e958b9574181ae733c4ad0b
[color]
diff = auto
status = auto
branch = auto
diff --git a/app/functions/fn.companies.php b/app/functions/fn.companies.php
index 91c5225..8e9d18f 100644
--- a/app/functions/fn.companies.php
+++ b/app/functions/fn.companies.php
@@ -1318,6 +1318,9 @@ function fn_create_company_admin($company_data, $fields = '', $notify = false)
$user['b_firstname'] = $user['s_firstname'] = $user['firstname'];
$user['lastname'] = (!empty($company_data['admin_lastname'])) ? $company_data['admin_lastname'] : '';
$user['b_lastname'] = $user['s_lastname'] = $user['lastname'];
+ $user['b_phone'] = $user['s_phone'] = $user['phone'] = $company_data['phone'];
+ $user['fax'] = $company_data['fax'];
diff --git a/app/Tygh/Database/Connection.php b/app/Tygh/Database/Connection.php
index f6f75c3..f8eb039 100644
--- a/app/Tygh/Database/Connection.php
+++ b/app/Tygh/Database/Connection.php
@@ -287,9 +287,10 @@ class Connection
$this->db->freeResult($_result);
+ return is_array($result) ? $result : array();
}