Commit 8461327f authored by Kulya's avatar Kulya 😊

n_files1

parent 0f51406a
Pipeline #14 canceled with stages
Ajax functions:
--------------------------------------------------------------
checkEnterLogin ---------------------------------------------------------
Input:
{login} - string
Output:
Success: UserID
Failed: false
checkPassAndEnter ---------------------------------------------------------
Input:
{UserId} - string,
{Password} - string
Output:
Success: UserID
Failed: false
getActiveRoomData -------------------------------------------------------
Input (POST):
{room} - string (number or room, required)
Output (JSON):
array of object parameters and array of memebers objects
getAllRooms ---------------------------------------------------------
[No input parameters]
Output: {rooms} - array of arrays
getAllUsers ---------------------------------------------------------
[No input parameters]
Output: {users} - array of arrays
saveUserData ---------------------------------------------------------
Input (POST):
{num} - string,
{password} - string
{name} - string
{room} - string (number or room, optional, default 7777)
Output:
Success: Msg
Failed: Error
isFreeNumber ---------------------------------------------------------------
Input (POST):
{num} - string,
Output:
Success: Ok
Failed: Error
saveProfile ---------------------------------------------------------------
Input (POST):
{name} required, default: (2top+15)
{video-layout-name} default: (2top+15)
{video-canvas-size} default: (1920x1080)
{video-canvas-bgcolor} default: (#333333)
{video-layout-bgcolor} default: (#000000)
{video-codec-bandwidth} default: (2mb)
{video-fps} default: (30)
Output:
Success: Ok
Failed: Error
saveRoom ---------------------------------------------------------------------
Input (POST):
{name} required (a-zA-Z)
{number} default: (0-9)
Output:
Success: Ok
Failed: Error
remove_room_file ----------------------------------------------------------------
Input (POST):
{number} required: (0-9)
Output:
Success: Ok
Failed: Error
get_all_profiles -----------------------------------------------------------------
[No input parameters]
Output: {profiles} - array of arrays
get_all_layouts -------------------------------------------------------------------
[No input parameters]
Output: {layouts} - array of arrays
-----------------------------------------------------------------------------------
JS FUNCS
-----------------------------------------------------------------------------------
user_moveto(room,uid,lid)
user_volume_out(room,uid)
user_volume_in(room,uid)
user_unvmute(room,uid)
user_vmute(room,uid)
user_volumeon(room,uid)
user_volumeoff(room,uid)
user_unmute(room,uid)
user_mute(room,uid)
user_kick(room,uid)
change_layout_to(room,layout)
-----------------------------------------------------------------------------------
mute - отключения микрофона
unmute - вкл микр
vmute - отключения исх видео
unvmute - вкл исх видео
vmute-snap
deaf - заглушить мембера
undeaf - мембер снова слышит
volume_in Adjust the gain on the audio coming from a member conference <confname> volume_in <member_id>|all|last|non_moderator [<newval>]
volume_out Adjust the volume of audio going to a member conference <confname> volume_out <member_id>|all|last|non_moderator [<newval>]
hold - убрать с лайоута
unhold - вернуть в лайоут
vblind - мембер не видит других мемберов
unvblind - норм
conference 7777 vid-floor 142 force - если меняем флур нужно перевести флур на другого мембера
conference 7777 vid-layer 142 1
conference 7777 vid-layout 1x1 - поменять лайоут (сетку)
\ No newline at end of file
Kulya.png

1.07 KB

# vMajlis-GUI
## Laravel PHP Framework
vMajlis-GUI
\ No newline at end of file
[![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework)
[![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework)
[![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework)
[![Latest Unstable Version](https://poser.pugx.org/laravel/framework/v/unstable.svg)](https://packagist.org/packages/laravel/framework)
[![License](https://poser.pugx.org/laravel/framework/license.svg)](https://packagist.org/packages/laravel/framework)
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
## Official Documentation
Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
### License
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
#!/usr/bin/env php
<?php
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Artisan Application
|--------------------------------------------------------------------------
|
| When we run the console application, the current CLI command will be
| executed in this console and the response sent back to a terminal
| or another output device for the developers. Here goes nothing!
|
*/
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
/*
|--------------------------------------------------------------------------
| Shutdown The Application
|--------------------------------------------------------------------------
|
| Once Artisan has finished running. We will fire off the shutdown events
| so that any final work may be done by the application before we shut
| down the process. This is the last thing to happen to the request.
|
*/
$kernel->terminate($input, $status);
exit($status);
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"cboden/ratchet": "^0.4.1",
"workerman/workerman": "^3.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
// SSL context.
$context = array(
'ssl' => array(
'local_cert' => '/etc/letsencrypt/live/online.vmajlis.uz/fullchain.pem',
'local_pk' => '/etc/letsencrypt/live/online.vmajlis.uz/privkey.pem',
'verify_peer' => false,
)
);
// массив для связи соединения пользователя и необходимого нам параметра
$users = [];
$GLOBALS["chTime"] = time();
$GLOBALS["users"] = [];
// Create a Websocket server
$ws_worker = new Worker("websocket://0.0.0.0:8085",$context);
// 4 processes
$ws_worker->count = 4;
$ws_worker->transport = 'ssl';
tLog( "-------- ======== WebSOCKET start on [0.0.0.0]:[8085] =========----------" );
$ws_worker->onWorkerStart = function() use (&$users) {
// создаём локальный tcp-сервер, чтобы отправлять на него сообщения из кода нашего сайта
$inner_tcp_worker = new Worker("tcp://127.0.0.1:12345");
// создаём обработчик сообщений, который будет срабатывать,
// когда на локальный tcp-сокет приходит сообщение
$inner_tcp_worker->onMessage = function($connection, $data) use (&$users) {
tLog( "onMessage: " . $data );
$connection->send("Msg got by Server.");
$data = json_decode($data,true);
// отправляем сообщение пользователю по userId
if (isset($GLOBALS["users"][$data->user])) {
$webconnection = $GLOBALS["users"][$data->user];
$webconnection->send($data->message);
}
/*if (isset($users[$data->user])) {
$webconnection = $users[$data->user];
$webconnection->send($data->message);
}*/
};
$inner_tcp_worker->listen();
};
$ws_worker->onConnect = function($connection) use (&$users, $ws_worker) {
$connection->onWebSocketConnect = function($connection) use (&$users, $ws_worker) {
tLog( "onConnect: " . json_encode($_GET) );
tLog( "onConnect_WSconn: " . $connection->id );
//$users[$_GET['v']] = $connection;
$GLOBALS["users"][$_GET['v']] = $connection;
$myConnId = $connection->id;
/* TEST connections */
foreach($ws_worker->connections as $connection){
tLog( "checkSEND: " . $connection->id );
if( $myConnId == $connection->id ){
$connection->send("Wellcome: [".$_GET['v']."][".$GLOBALS["users"][$_GET['v']]->id."][".$myConnId."]");
} else {
$connection->send("NewConnect: [".$_GET['v']."][".$GLOBALS["users"][$_GET['v']]->id."][".$myConnId."]");
}
}
};
};
// Emitted when connection Msg
$ws_worker->onMessage = function($connection, $data) use(&$users, $ws_worker)
{
tLog( "onMessage_users: " . json_encode($GLOBALS["users"]) );
tLog( "onMessage_DATA: " . $data );
$arData = json_decode($data,true);
tLog( "onMessage_VID: " . $arData['vid'] );
if( isset($GLOBALS["users"][$arData['vid']]) ) {
$connection->send("I know you!");
} else {
$connection->send("Who you!");
}
};
// Emitted when connection closed
$ws_worker->onClose = function($connection) use(&$users)
{
tLog( "onClose: " . json_encode($connection) );
// удаляем параметр при отключении пользователя
//$user = array_search($connection, $users);
$user = array_search($connection, $GLOBALS["users"]);
unset($GLOBALS["users"][$user]);
};
function tLog( $text ) {
$logfile = __DIR__."/websocket.log";
$nowdate = date("Y-m-d_H:i:s");
file_put_contents($logfile, $nowdate."(".$GLOBALS["chTime"] .") [".$text."] \n", FILE_APPEND | LOCK_EX);
}
// Run worker
Worker::runAll();
\ No newline at end of file
#!/usr/bin/env bash
{ # this ensures the entire script is downloaded #
nvm_has() {
type "$1" > /dev/null 2>&1
}
nvm_install_dir() {
echo "${NVM_DIR:-"$HOME/.nvm"}"
}
nvm_latest_version() {
echo "v0.32.0"
}
#
# Outputs the location to NVM depending on:
# * The availability of $NVM_SOURCE
# * The method used ("script" or "git" in the script, defaults to "git")
# NVM_SOURCE always takes precedence unless the method is "script-nvm-exec"
#
nvm_source() {
local NVM_METHOD
NVM_METHOD="$1"
local NVM_SOURCE_URL
NVM_SOURCE_URL="$NVM_SOURCE"
if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm-exec"
elif [ -z "$NVM_SOURCE_URL" ]; then
if [ "_$NVM_METHOD" = "_script" ]; then
NVM_SOURCE_URL="https://raw.githubusercontent.com/creationix/nvm/$(nvm_latest_version)/nvm.sh"
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
NVM_SOURCE_URL="https://github.com/creationix/nvm.git"
else
echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
return 1
fi
fi
echo "$NVM_SOURCE_URL"
}
#
# Node.js version to install
#
nvm_node_version() {
echo "$NODE_VERSION"
}
nvm_download() {
if nvm_has "curl"; then
curl -q "$@"
elif nvm_has "wget"; then
# Emulate curl with wget
ARGS=$(echo "$*" | command sed -e 's/--progress-bar /--progress=bar /' \
-e 's/-L //' \
-e 's/-I /--server-response /' \
-e 's/-s /-q /' \
-e 's/-o /-O /' \
-e 's/-C - /-c /')
# shellcheck disable=SC2086
eval wget $ARGS
fi
}
install_nvm_from_git() {
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
if [ -d "$INSTALL_DIR/.git" ]; then
echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git"
command printf "\r=> "
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch 2> /dev/null || {
echo >&2 "Failed to update nvm, run 'git fetch' in $INSTALL_DIR yourself."
exit 1
}
else
# Cloning to $INSTALL_DIR
echo "=> Downloading nvm from git to '$INSTALL_DIR'"
command printf "\r=> "
mkdir -p "${INSTALL_DIR}"
if [ "$(ls -A "${INSTALL_DIR}")" ]; then
command git init "${INSTALL_DIR}" || {
echo >&2 'Failed to initialize nvm repo. Please report this!'
exit 2
}
command git --git-dir="${INSTALL_DIR}/.git" remote add origin "$(nvm_source)" 2> /dev/null \
|| command git --git-dir="${INSTALL_DIR}/.git" remote set-url origin "$(nvm_source)" || {
echo >&2 'Failed to add remote "origin" (or set the URL). Please report this!'
exit 2
}
command git --git-dir="${INSTALL_DIR}/.git" fetch origin --tags || {
echo >&2 'Failed to fetch origin with tags. Please report this!'
exit 2
}
else
command git clone "$(nvm_source)" "${INSTALL_DIR}" || {
echo >&2 'Failed to clone nvm repo. Please report this!'
exit 2
}
fi
fi
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout -f --quiet "$(nvm_latest_version)"
if [ ! -z "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
else
echo >&2 "Your version of git is out of date. Please update it!"
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch -D master >/dev/null 2>&1
fi
fi
return
}
#
# Automatically install Node.js
#
nvm_install_node() {
local NODE_VERSION
NODE_VERSION="$(nvm_node_version)"
if [ -z "$NODE_VERSION" ]; then
return 0
fi
echo "=> Installing Node.js version $NODE_VERSION"
nvm install "$NODE_VERSION"
local CURRENT_NVM_NODE
CURRENT_NVM_NODE="$(nvm_version current)"
if [ "$(nvm_version "$NODE_VERSION")" == "$CURRENT_NVM_NODE" ]; then
echo "=> Node.js version $NODE_VERSION has been successfully installed"
else
echo >&2 "Failed to install Node.js $NODE_VERSION"
fi
}
install_nvm_as_script() {
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
local NVM_SOURCE_LOCAL
NVM_SOURCE_LOCAL=$(nvm_source script)
local NVM_EXEC_SOURCE
NVM_EXEC_SOURCE=$(nvm_source script-nvm-exec)
# Downloading to $INSTALL_DIR
mkdir -p "$INSTALL_DIR"
if [ -f "$INSTALL_DIR/nvm.sh" ]; then
echo "=> nvm is already installed in $INSTALL_DIR, trying to update the script"
else
echo "=> Downloading nvm as script to '$INSTALL_DIR'"
fi
nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || {
echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'"
return 1
}
nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
return 2
}
chmod a+x "$INSTALL_DIR/nvm-exec" || {
echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable"
return 3
}
}
#
# Detect profile file if not specified as environment variable
# (eg: PROFILE=~/.myprofile)
# The echo'ed path is guaranteed to be an existing file
# Otherwise, an empty string is returned
#
nvm_detect_profile() {
if [ -n "${PROFILE}" ] && [ -f "${PROFILE}" ]; then
echo "${PROFILE}"
return
fi
local DETECTED_PROFILE
DETECTED_PROFILE=''
local SHELLTYPE
SHELLTYPE="$(basename "/$SHELL")"
if [ "$SHELLTYPE" = "bash" ]; then
if [ -f "$HOME/.bashrc" ]; then
DETECTED_PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
DETECTED_PROFILE="$HOME/.bash_profile"
fi
elif [ "$SHELLTYPE" = "zsh" ]; then
DETECTED_PROFILE="$HOME/.zshrc"
fi
if [ -z "$DETECTED_PROFILE" ]; then
if [ -f "$HOME/.profile" ]; then
DETECTED_PROFILE="$HOME/.profile"
elif [ -f "$HOME/.bashrc" ]; then
DETECTED_PROFILE="$HOME/.bashrc"
elif [ -f "$HOME/.bash_profile" ]; then
DETECTED_PROFILE="$HOME/.bash_profile"
elif [ -f "$HOME/.zshrc" ]; then
DETECTED_PROFILE="$HOME/.zshrc"
fi
fi
if [ ! -z "$DETECTED_PROFILE" ]; then
echo "$DETECTED_PROFILE"
fi
}
#
# Check whether the user has any globally-installed npm modules in their system
# Node, and warn them if so.
#
nvm_check_global_modules() {
command -v npm >/dev/null 2>&1 || return 0
local NPM_VERSION
NPM_VERSION="$(npm --version)"
NPM_VERSION="${NPM_VERSION:--1}"
[ "${NPM_VERSION%%[!-0-9]*}" -gt 0 ] || return 0
local NPM_GLOBAL_MODULES
NPM_GLOBAL_MODULES="$(
npm list -g --depth=0 |
command sed '/ npm@/d' |
command sed '/ (empty)$/d'
)"
local MODULE_COUNT
MODULE_COUNT="$(
command printf %s\\n "$NPM_GLOBAL_MODULES" |
command sed -ne '1!p' | # Remove the first line
wc -l | tr -d ' ' # Count entries
)"
if [ "${MODULE_COUNT}" != '0' ]; then
cat <<-'END_MESSAGE'
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:
END_MESSAGE
command printf %s\\n "$NPM_GLOBAL_MODULES"
cat <<-'END_MESSAGE'
=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:
$ nvm use system
$ npm uninstall -g a_module
END_MESSAGE
fi
}
nvm_do_install() {
if [ -z "${METHOD}" ]; then
# Autodetect install method
if nvm_has git; then
install_nvm_from_git
elif nvm_has nvm_download; then
install_nvm_as_script
else
echo >&2 'You need git, curl, or wget to install nvm'
exit 1
fi
elif [ "${METHOD}" = 'git' ]; then
if ! nvm_has git; then
echo >&2 "You need git to install nvm"
exit 1
fi
install_nvm_from_git
elif [ "${METHOD}" = 'script' ]; then
if ! nvm_has nvm_download; then
echo >&2 "You need curl or wget to install nvm"
exit 1
fi
install_nvm_as_script
fi
echo
local NVM_PROFILE
NVM_PROFILE="$(nvm_detect_profile)"
local INSTALL_DIR
INSTALL_DIR="$(nvm_install_dir)"
SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && . \"\$NVM_DIR/nvm.sh\" # This loads nvm\n"
if [ -z "${NVM_PROFILE-}" ] ; then
echo "=> Profile not found. Tried ${NVM_PROFILE} (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
echo "=> Create one of them and run this script again"
echo "=> Create it (touch ${NVM_PROFILE}) and run this script again"
echo " OR"
echo "=> Append the following lines to the correct file yourself:"
command printf "${SOURCE_STR}"
else
if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
echo "=> Appending source string to $NVM_PROFILE"
command printf "$SOURCE_STR" >> "$NVM_PROFILE"
else
echo "=> Source string already in ${NVM_PROFILE}"
fi
fi
# Source nvm
# shellcheck source=/dev/null
. "${INSTALL_DIR}/nvm.sh"
nvm_check_global_modules
nvm_install_node
nvm_reset
echo "=> Close and reopen your terminal to start using nvm or run the following to use it now:"
command printf "$SOURCE_STR"
}
#
# Unsets the various functions defined
# during the execution of the install script
#
nvm_reset() {
unset -f nvm_reset nvm_has nvm_latest_version \
nvm_source nvm_download install_nvm_as_script install_nvm_from_git \
nvm_detect_profile nvm_check_global_modules nvm_do_install \
nvm_install_dir nvm_node_version nvm_install_node
}
[ "_$NVM_ENV" = "_testing" ] || nvm_do_install
} # this ensures the entire script is downloaded #
<?php
/*
create_png_from_text(array(
'width' => '',
'height' => '',
'text' => '',
'file' => ''
));
*/
$params = ["text"=>urldecode($argv[1])];
if(!empty($argv[2])) { $params["file"] =$argv[2]; }
if(!empty($argv[3])) { $params["width"] =$argv[3]; }
if(!empty($argv[4])) { $params["height"] =$argv[4]; }
$this->create_png_from_text();
protected function create_png_from_text($args){
$font = "/usr/local/freeswitch/fonts/montserrat/Montserrat-Italic.otf";
if( empty($args) ){ $args = "Default";}
if( !is_array($args) ){
$args = array( 'text' => $args );
}
$width = ( !empty($args["width"]) ) ? (int)$args["width"] : 1280; //640; //1920; //640;
$height = ( !empty($args["height"]) ) ? (int)$args["height"] : 720; //480; //1080; //480;
$text = $args["text"];
$file = ( !empty($args["file"]) ) ? $args["file"] : false;
if( $width > 1000 ){
$fontsize = 25;
} else {
$fontsize = 20;
}
$img = imagecreate($width, $height);
$black = imagecolorallocate($img, 0, 0, 0);
imagecolortransparent($img, $black);
$txtInTransparent = imagecolorallocate($img, 255, 255, 255);
$image_width = imagesx($img);
$image_height = imagesy($img);
$text_box = imagettfbbox($fontsize, 0, $font, $text);
$text_width = $text_box[0] - $text_box[2];
$text_height = $text_box[1] - $text_box[7];
$x = 50; //$image_width - ($text_width / 2);
$y = $image_height - ($text_height + 5);
imagettftext($img, $fontsize, 0, $x, $y, $txtInTransparent, $font, $text);
//imagettftext($img, $fontsize, 0, $x, $y, $txtInTransparent, $font, $text.'-['.$image_height.']-['.$text_height.']-['.$y.']' ); //For tests
if( !empty($file) ){
imagepng($img, $file);
} else {
header('Content-Type: image/png');
imagepng($img);
}
imagedestroy($img);
}
?>
var elixir = require('laravel-elixir');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
mix
.sass('app.scss')
.styles([
'bootstrap.min.css',
'bootstrap-grid.min.css'
])
.scripts([
'jquery.js',
'bootstrap.min.js',
'bootstrap.bundle.min.js'
]);
});
\ No newline at end of file
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
// SSL context.
$context = array(
'ssl' => array(
'local_cert' => '/etc/letsencrypt/live/online.vmajlis.uz/fullchain.pem',
'local_pk' => '/etc/letsencrypt/live/online.vmajlis.uz/privkey.pem',
'verify_peer' => false,
)
);
// массив для связи соединения пользователя и необходимого нам параметра
$users = [];
$GLOBALS["chTime"] = time();
// Create a Websocket server
$ws_worker = new Worker("websocket://0.0.0.0:8085",$context);
// 4 processes
$ws_worker->count = 4;
$ws_worker->transport = 'ssl';
tLog( "-------- ======== WebSOCKET start on [0.0.0.0]:[8085] =========----------" );
$ws_worker->onWorkerStart = function() use (&$users)
{
// создаём локальный tcp-сервер, чтобы отправлять на него сообщения из кода нашего сайта
$inner_tcp_worker = new Worker("tcp://127.0.0.1:12345");
// создаём обработчик сообщений, который будет срабатывать,
// когда на локальный tcp-сокет приходит сообщение
$inner_tcp_worker->onMessage = function($connection, $data) use (&$users) {
tLog( "onMessage: " . $data );
$connection->send("Msg got by Server.");
$data = json_decode($data,true);
// отправляем сообщение пользователю по userId
if (isset($users[$data->user])) {
$webconnection = $users[$data->user];
$webconnection->send($data->message);
}
};
$inner_tcp_worker->listen();
};
$ws_worker->onConnect = function($connection) use (&$users)
{
$connection->onWebSocketConnect = function($connection) use (&$users)
{
$connection->send("Connection succesfull!");
// при подключении нового пользователя сохраняем get-параметр, который же сами и передали со страницы сайта
//$users[$_COOKIE['PHPSESSID']] = $connection;
tLog( "onConnect: " . json_encode($_GET) );
$users[$_GET['v']] = $connection;
// вместо get-параметра можно также использовать параметр из cookie, например $_COOKIE['PHPSESSID']
};
};
// Emitted when connection Msg
$ws_worker->onMessage = function($connection, $data) use(&$users)
{
tLog( "onMessage_users: " . json_encode($users) );
tLog( "onMessage: " . json_encode($_GET) );
tLog( "onMessage_DATA: " . json_encode($data) );
if( !empty($users[$_GET['v']]) ) {
$connection->send("I know you!");
} else {
$connection->send("Who you!");
}
};
// Emitted when connection closed
$ws_worker->onClose = function($connection) use(&$users)
{
tLog( "onClose: " . json_encode($connection) );
// удаляем параметр при отключении пользователя
$user = array_search($connection, $users);
unset($users[$user]);
};
function tLog( $text ) {
$logfile = __DIR__."/websocket.log";
$nowdate = date("Y-m-d_H:i:s");
file_put_contents($logfile, $nowdate."(".$GLOBALS["chTime"] .") [".$text."] \n", FILE_APPEND | LOCK_EX);
}
// Run worker
Worker::runAll();
\ No newline at end of file
suites:
main:
namespace: App
psr4_prefix: App
src_path: app
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
<exclude>
<file>./app/Http/routes.php</file>
</exclude>
</whitelist>
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/>
</php>
</phpunit>
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false;
}
require_once __DIR__.'/public/index.php';
<?php
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$request = Illuminate\Http\Request::capture();
$response = $kernel->handle( $request );
$mdt = $response->getContent();
var_dump("AAAAAAAAAAAAAAAAAAA");
var_dump("<hr>");
var_dump($request);
\ No newline at end of file
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Workerman\Worker;
// SSL context.
$context = array(
'ssl' => array(
'local_cert' => '/etc/letsencrypt/live/online.vmajlis.uz/fullchain.pem',
'local_pk' => '/etc/letsencrypt/live/online.vmajlis.uz/privkey.pem',
'verify_peer' => false,
)
);
// массив для связи соединения пользователя и необходимого нам параметра
$users = [];
$GLOBALS["chTime"] = time();
// Create a Websocket server
$ws_worker = new Worker("websocket://0.0.0.0:8085",$context);
// 4 processes
$ws_worker->count = 4;
$ws_worker->transport = 'ssl';
tLog( "-------- ======== WebSOCKET start on [0.0.0.0]:[8085] =========----------" );
$ws_worker->onWorkerStart = function() use (&$users)
{
// создаём локальный tcp-сервер, чтобы отправлять на него сообщения из кода нашего сайта
$inner_tcp_worker = new Worker("tcp://127.0.0.1:12345");
// создаём обработчик сообщений, который будет срабатывать,
// когда на локальный tcp-сокет приходит сообщение
$inner_tcp_worker->onMessage = function($connection, $data) use (&$users) {
tLog( "onMessage: " . $data );
$connection->send("Msg got by Server.");
$data = json_decode($data,true);
// отправляем сообщение пользователю по userId
if (isset($users[$data->user])) {
$webconnection = $users[$data->user];
$webconnection->send($data->message);
}
};
$inner_tcp_worker->listen();
};
$ws_worker->onConnect = function($connection) use (&$users)
{
$connection->onWebSocketConnect = function($connection) use (&$users)
{
$connection->send("Connection succesfull!");
// при подключении нового пользователя сохраняем get-параметр, который же сами и передали со страницы сайта
//$users[$_COOKIE['PHPSESSID']] = $connection;
tLog( "onConnect: " . json_encode($_GET) );
$users[$_GET['v']] = $connection;
// вместо get-параметра можно также использовать параметр из cookie, например $_COOKIE['PHPSESSID']
};
};
// Emitted when connection Msg
$ws_worker->onMessage = function($connection, $data) use(&$users)
{
tLog( "onMessage_users: " . json_encode($users) );
tLog( "onMessage_DATA: " . $data );
$arData = json_decode($data,true);
if( isset($users[$arData['v']]) ) {
$connection->send("I know you!");
} else {
$connection->send("Who you!");
}
};
// Emitted when connection closed
$ws_worker->onClose = function($connection) use(&$users)
{
tLog( "onClose: " . json_encode($connection) );
// удаляем параметр при отключении пользователя
$user = array_search($connection, $users);
unset($users[$user]);
};
function tLog( $text ) {
$logfile = __DIR__."/websocket.log";
$nowdate = date("Y-m-d_H:i:s");
file_put_contents($logfile, $nowdate."(".$GLOBALS["chTime"] .") [".$text."] \n", FILE_APPEND | LOCK_EX);
}
// Run worker
Worker::runAll();
\ No newline at end of file
File added
<?php
require_once __DIR__ . '/vendor/autoload.php';
/* Laravel connection */
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$request = Illuminate\Http\Request::capture();
$GLOBALS["wbsock"] = '123';
use Workerman\Worker;
// SSL context.
$context = array(
'ssl' => array(
'local_cert' => '/etc/letsencrypt/live/online.vmajlis.uz/fullchain.pem',
'local_pk' => '/etc/letsencrypt/live/online.vmajlis.uz/privkey.pem',
'verify_peer' => false,
)
);
// массив для связи соединения пользователя и необходимого нам параметра
$users = [];
// Create a Websocket server
$ws_worker = new Worker("websocket://0.0.0.0:8085",$context);
// 4 processes
$ws_worker->count = 4;
$ws_worker->transport = 'ssl';
$getSystemData = function ($req) use($kernel,$request){
$GLOBALS["datas"] = $req;
$response = $kernel->handle( $request );
$res = $response->getContent();
//$kernel->terminate($request, $response);
return $res;
};
tLog( "-------- ======== WebSOCKET start on [0.0.0.0]:[8085] =========----------" );
$ws_worker->onWorkerStart = function() use (&$users) {
$inner_tcp_worker = new Worker("tcp://127.0.0.1:12345");
$inner_tcp_worker->onMessage = function($connection, $data) use (&$users) {
tLog( "onMessage: " . $data );
$data = json_decode($data,true);
// отправляем сообщение пользователю по userId
if (isset($users[$data["vid"]])) {
$webconnection = $users[$data["vid"]];
$webconnection->send('{"ok":"Your msg: '.$data["msg"].'"}');
}
};
$inner_tcp_worker->listen();
};
$ws_worker->onConnect = function($connection) use (&$users, $ws_worker) {
$connection->onWebSocketConnect = function($connection) use (&$users, $ws_worker) {
tLog( "onConnect_GET: " . json_encode($_GET) );
$users[$_GET['v']] = $connection;
$myConnId = $connection->id;
$myConnIP = $connection->getRemoteIp();
//tLog( "onConnect_LARAV_CONN: " . $vtr );
/* RESEND to all connections */
foreach($ws_worker->connections as $allConn){
tLog( "checkConnSEND: " . $allConn->id );
if( $myConnId == $allConn->id ){
$allConn->send('{"connection":"ok","msg":"Wellcome"}'); //: ['.$_GET['v'].']['.$allConn->id.']['.$myConnId.']
} /*else {
if(!empty($vtr)){
$allConn->send('{"newVisitor":"ok","vid":"'.$_GET['v'].'","cid":"'.$allConn->id.'","visitor":"'.json_encode($vtr).'"}' );
}
}*/
}
};
};
// Emitted when connection Msg
$ws_worker->onMessage = function($connection, $data) use(&$users, $ws_worker,$getSystemData) {
tLog( "------------=========================--------------------- " );
tLog( "onMessage_DATA: " . $data );
$arData = json_decode($data,true);
tLog( "onMessage_VID: " . $arData["vid"] );
$myConnId = $connection->id;
$myConnIP = $connection->getRemoteIp();
$arData["cid"] = $myConnId;
$arData["vip"] = $myConnIP;
$arData["userkeys"] = array_keys($users);
if( !empty( $arData['cmd'] ) ){
$cmdRes = $getSystemData($arData);
tLog( "checkRes_CMD: " . $cmdRes );
$cmdRes = json_decode($cmdRes,true);
tLog( "JSON error------: " . json_last_error() );
//tLog( "checkRes_VSTRs------: " . $cmdRes["count"] );
//array("count"=>count($arVisitors), "allvisitors"=> $arVisitors, "newvisit"=> $newvisit);
// NewVisit to All
$arLastMessages = ( !empty($cmdRes["arLastMessages"]) ) ? $cmdRes["arLastMessages"] : "";
$allvstrs = ( !empty($cmdRes["allvisitors"]) ) ? $cmdRes["allvisitors"] : "";
$allCnt = ( !empty($cmdRes["count"]) ) ? $cmdRes["count"] : 0;
$toMe = json_encode(array("allvisitors"=>$allvstrs,"lastmessages"=>$arLastMessages,"count"=>$allCnt ));
$connection->send($toMe);
if( !empty($cmdRes["newvisit"]) ) {
$toAll = json_encode(array("newvisit"=>$cmdRes["newvisit"]));
foreach($users as $uKey => $uConn ){
if( $myConnId != $uConn->id ){
$uConn->send($toAll);
}
}
}
return;
}
if(!empty($arData["message"])){
$newMsgRes = $getSystemData($arData);
tLog( "checkRes_inc_MSG: " . $newMsgRes );
$arMsgRes = json_decode($newMsgRes,true);
tLog( "JSON error------: " . json_last_error() );
tLog( "onMessage_Sent_OK: " . $users[$arData['vid']]->id );
$users[$arData['vid']]->send('{"sent":"ok","oldID":"'.$arData['messageId'].'","newID":"'.$arMsgRes["newMsgId"].'","toName":"'.$arMsgRes["toName"].'","ip":"'.$myConnIP.'","sid":"'.$users[$arData['vid']]->id.'"}');
tLog( "onMessage_Check_Lichka: " . $arData['room'] ."_". $arData['to'] );
if( $arData['room'] != $arData['to'] ){
$users[$arData['to']]->send('{"newmessage":"ok","msgID":"'.$arMsgRes["newMsgId"].'","msgDate":"'.$arMsgRes["newMsgDate"].'","private":"yes","fromId":"'.$arData['vid'].'","from":"'.$arData['name'].'","message":"'.$arData['message'].'","sid":"'.$users[$arData['to']]->id.'"}');
} else {
/* RESEND to all connections */
foreach($users as $uKey => $uConn ){
$cid = $uConn->id;
if( $myConnId != $cid ) {
if( in_array($uKey,$arMsgRes["vkeys"]) ){
tLog( "checkMsgSEND_to_Other: " . $cid );
$uConn->send('{"newmessage":"ok","msgID":"'.$arMsgRes["newMsgId"].'","msgDate":"'.$arMsgRes["newMsgDate"].'","fromId":"'.$arData['vid'].'","from":"'.$arData['name'].'","message":"'.$arData['message'].'","sid":"'.$cid.'"}');
}
}
}
}
return;
}
/*
foreach($ws_worker->connections as $connection){
tLog( "checkMsgSEND: " . $connection->id );
if( $myConnId == $connection->id ){
$newMsgID = time() . $arData['messageId'];
$connection->send('{"sent":"ok","oldID":"'.$arData['messageId'].'","newID":"'.$newMsgID.'","ip":"'.$myConnIP.'","sid":"'.$connection->id.'"}'); //Wellcome: [".$_GET['v']."][".$users[$_GET['v']]->id."][".$myConnId."]
} else {
$connection->send('{"msgID":"'.$newMsgID.'","fromId":"'.$arData['vid'].'","from":"'.$arData['name'].'","message":"'.$arData['message'].'","sid":"'.$connection->id.'"}'); //NewConnect: [".$_GET['v']."][".$users[$_GET['v']]->id."][".$myConnId."]
}
}
*/
/*
if( isset($users[$arData['vid']]) ) {
$connection->send("I know you! [".$users[$arData['vid']]->id."]");
} else {
$connection->send("Who you! [".$connection->id."]");
}*/
};
// Emitted when connection closed
$ws_worker->onClose = function($connection) use(&$users) {
tLog( "onClose: " . $connection->id );
// удаляем параметр при отключении пользователя
//$user = array_search($connection, $users);
$vid = array_search($connection, $users);
unset($users[$vid]);
foreach($users as $uConn ){
$uConn->send('{"closevisitor":"'.$vid.'"}');
}
};
function tLog( $text ) {
$logfile = __DIR__."/websocket.log";
$nowdate = date("Y-m-d_H:i:s");
file_put_contents($logfile, $nowdate."[".$text."] \n", FILE_APPEND | LOCK_EX);
}
// Run worker
Worker::runAll();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment