Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
update: uglify.php
Browse files Browse the repository at this point in the history
fix: proper perms set_perms.php
  • Loading branch information
darkalchemy committed Jun 9, 2019
1 parent d2d68ee commit f605d64
Show file tree
Hide file tree
Showing 723 changed files with 117 additions and 156 deletions.
Empty file modified .gitignore 100755 → 100644
Empty file.
Empty file modified .php_cs.dist 100755 → 100644
Empty file.
Empty file modified .stylelintrc 100755 → 100644
Empty file.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
### 09 Jun, 2019
update: uglify.php
fix: proper perms set_perms.php

### 07 Jun, 2019
update: button margin on small screens
fix: returnto login.php
Expand Down
Empty file modified LICENSE 100755 → 100644
Empty file.
Empty file modified backups/.gitignore 100755 → 100644
Empty file.
Empty file modified bin/.gitignore 100755 → 100644
Empty file.
Empty file modified bin/1/.gitignore 100755 → 100644
Empty file.
Empty file modified bin/2/.gitignore 100755 → 100644
Empty file.
74 changes: 19 additions & 55 deletions bin/functions.php
Expand Up @@ -7,9 +7,9 @@
use Pu239\Database;

/**
* @throws \Envms\FluentPDO\Exception
* @throws DependencyException
* @throws NotFoundException
* @throws \Envms\FluentPDO\Exception
*
* @return array
*/
Expand All @@ -35,9 +35,9 @@ function get_styles()
* @param array $styles
* @param bool $create
*
* @throws \Envms\FluentPDO\Exception
* @throws DependencyException
* @throws NotFoundException
* @throws \Envms\FluentPDO\Exception
*
* @return array
*/
Expand Down Expand Up @@ -78,57 +78,6 @@ function get_classes(array $styles, bool $create)
return $all_classes;
}

/**
* @param $group
*/
function cleanup($group)
{
global $site_config;

if (file_exists($site_config['files']['path'])) {
chmod_r($site_config['files']['path'], $group);
chgrp_r($site_config['files']['path'], $group);
}
}

/**
* @param $path
* @param $group
*/
function chgrp_r($path, $group)
{
if (!file_exists($path)) {
return;
}
$dir = new DirectoryIterator($path);
chgrp($path, $group);
foreach ($dir as $item) {
chgrp($item->getPathname(), $group);
if ($item->isDir() && !$item->isDot()) {
chgrp_r($item->getPathname(), $group);
}
}
}

/**
* @param $path
* @param $group
*/
function chmod_r($path, $group)
{
if (!file_exists($path)) {
return;
}
$dir = new DirectoryIterator($path);
foreach ($dir as $item) {
chmod($item->getPathname(), 0775);
chown($item->getPathname(), $group);
if ($item->isDir() && !$item->isDot()) {
chmod_r($item->getPathname(), $group);
}
}
}

/**
* @return string
*/
Expand All @@ -148,7 +97,7 @@ function get_webserver_user()
}

/**
* @return mixed|null
* @return mixed|string|null
*/
function get_username()
{
Expand All @@ -165,8 +114,23 @@ function get_username()
++$i;
}

return $user;
if (!empty($user)) {
return $user;
}
}

return get_webserver_user();
}

/**
* @param string $group
*/
function cleanup(string $group)
{
global $site_config;

if (file_exists($site_config['files']['path'])) {
chown($site_config['files']['path'], $group);
chgrp($site_config['files']['path'], $group);
}
}
Empty file modified bin/pu239.scss 100755 → 100644
Empty file.
85 changes: 28 additions & 57 deletions bin/set_perms.php
Expand Up @@ -11,9 +11,8 @@
}

$site_config['cache']['driver'] = 'memory';
$user = get_webserver_user();
$user = get_username();
$group = get_webserver_user();
cleanup($group);
$paths = [
ROOT_DIR,
];
Expand Down Expand Up @@ -52,78 +51,50 @@
ROOT_DIR . 'uploads/',
CHAT_DIR . 'js/',
IMAGES_DIR,
VENDOR_DIR,
NODE_DIR,
];

$folders = array_merge($dirs, $folders);

$excludes = [
ROOT_DIR . 'vendor',
ROOT_DIR . 'node_modules',
ROOT_DIR . 'vendor/',
ROOT_DIR . 'node_modules/',
ROOT_DIR . '.git/',
ROOT_DIR . '.idea/',
];

foreach ($folders as $folder) {
if (file_exists($folder)) {
chmod_r($folder, $group);
}
}
$chmod_folders = [
VENDOR_DIR,
];

cleanup($group);
chmod(ROOT_DIR, 0774);
$i = 1;

foreach ($paths as $path) {
if (file_exists($path)) {
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
foreach ($objects as $name => $object) {
if (is_file($name)) {
$ext = pathinfo($name, PATHINFO_EXTENSION);
$parent = dirname($name);
$continue = true;
foreach ($excludes as $exclude) {
if (preg_match('#' . $exclude . '#', $parent)) {
$continue = false;
}
if (is_dir($name) && !preg_match('#' . implode('|', $excludes) . '#', realpath($name) . '/')) {
if (preg_match('#' . IMAGES_DIR . '|' . CACHE_DIR . '|' . IMDB_CACHE_DIR . '#', realpath($name) . '/')) {
chown($name, $group);
} else {
chown($name, $user);
}
if ($continue && in_array($ext, $exts)) {
if (chmod($name, 0664)) {
chown($name, $user);
chgrp($name, $group);
++$i;
}
chgrp($name, $group);
chmod($name, 0774);
$i++;
} elseif (!is_dir($name) && !preg_match('#' . implode('|', $excludes) . '#', realpath($name) . '/')) {
if (preg_match('#' . IMAGES_DIR . '|' . CACHE_DIR . '|' . IMDB_CACHE_DIR . '#', realpath($name) . '/')) {
chown($name, $group);
chmod($name, 0774);
} else {
chmod($name, 0664);
}
$i++;
}
}
}
}

foreach ($folders as $folder) {
if (file_exists($folder)) {
chown_r($folder, $group);
}
}

/**
* @param $path
* @param $group
*/
function chown_r($path, $group)
{
if (!file_exists($path)) {
return;
}
$user_group = false;
if ($path === IMAGES_DIR || $path === CACHE_DIR) {
$user_group = true;
}
$dir = new DirectoryIterator($path);
chown($path, $group);
foreach ($dir as $item) {
chown($item->getPathname(), $group);
if ($user_group) {
chgrp($item->getPathname(), $group);
}
if ($item->isDir() && !$item->isDot()) {
chown_r($item->getPathname(), $group);
}
}
}

cleanup($group);
echo "$i files processed\n";
5 changes: 4 additions & 1 deletion bin/uglify.php
Expand Up @@ -400,6 +400,9 @@ function run_uglify($argv = [])
if (PRODUCTION) {
passthru('sudo rm ' . DI_CACHE_DIR . 'CompiledContainer.php');
}

cleanup(get_webserver_user());
return true;
}

/**
Expand Down Expand Up @@ -582,12 +585,12 @@ function get_default_border($folder)
* @param string $file
* @param bool $delete
*
* @throws DependencyException
* @throws NotFoundException
* @throws AuthError
* @throws NotLoggedInException
* @throws \Envms\FluentPDO\Exception
* @throws InvalidManipulation
* @throws DependencyException
*
* @return bool
*/
Expand Down
Empty file modified bucket/.gitignore 100755 → 100644
Empty file.
Empty file modified cache/bans_cache.php 100644 → 100755
Empty file.
Empty file modified cache/block_settings_cache.php 100644 → 100755
Empty file.
Empty file modified cache/categorie_icons.php 100644 → 100755
Empty file.
Empty file modified cache/countries.php 100644 → 100755
Empty file.
Empty file modified cache/country.php 100644 → 100755
Empty file.
Empty file modified cache/free_cache.php 100644 → 100755
Empty file.
Empty file modified cache/happyhour.cache 100644 → 100755
Empty file.
Empty file modified cache/lottery.txt 100644 → 100755
Empty file.
Empty file modified cache/nameblacklist.txt 100644 → 100755
Empty file.
Empty file modified cache/rep_cache.php 100644 → 100755
Empty file.
Empty file modified cache/rep_settings_cache.php 100644 → 100755
Empty file.
Empty file modified cache/timezones.php 100644 → 100755
Empty file.
Empty file modified chat/css/1/.gitignore 100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions chat/css/1/custom.css
@@ -1,6 +1,6 @@
.mentioned {
color: #5eff00;
text-shadow: 1px 1px #2c6609;
color: var(--main-bdr-color);
text-shadow: 1px 1px #000;
}

a {
Expand Down
4 changes: 2 additions & 2 deletions chat/css/1/default.css
Expand Up @@ -37,7 +37,7 @@ input, select, textarea, #content #chatList, #content #onlineListContainer, #con

.ajax-chat {
height: 100%;
color: #fff;
color: var(--default-text-color);
}

.ajax-chat h1, .ajax-chat h3 {
Expand All @@ -54,7 +54,7 @@ input, select, textarea, #content #chatList, #content #onlineListContainer, #con
}

#content textarea {
color: #b0b8a8;
color: var(--default-text-color);
}

#content #chatList, #content #onlineListContainer, #content #helpContainer, #content #settingsContainer {
Expand Down
Empty file modified chat/js/.gitignore 100755 → 100644
Empty file.
Empty file modified chat/lib/template/loggedIn.html 100755 → 100644
Empty file.
Empty file modified chat/lib/template/loggedOut.html 100755 → 100644
Empty file.
Empty file modified chat/lib/template/logs.html 100755 → 100644
Empty file.
28 changes: 17 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/define.php
Expand Up @@ -23,6 +23,7 @@
define('IMAGES_DIR', PUBLIC_DIR . 'images' . DIRECTORY_SEPARATOR);
define('PROXY_IMAGES_DIR', IMAGES_DIR . 'proxy' . DIRECTORY_SEPARATOR);
define('VENDOR_DIR', ROOT_DIR . 'vendor' . DIRECTORY_SEPARATOR);
define('NODE_DIR', ROOT_DIR . 'node_modules' . DIRECTORY_SEPARATOR);
define('DATABASE_DIR', ROOT_DIR . 'database' . DIRECTORY_SEPARATOR);
define('BITBUCKET_DIR', ROOT_DIR . 'bucket' . DIRECTORY_SEPARATOR);
define('LOGS_DIR', ROOT_DIR . 'logs' . DIRECTORY_SEPARATOR);
Expand Down
Empty file modified config/goaccess.conf 100755 → 100644
Empty file.
Empty file modified dir_list/.gitignore 100755 → 100644
Empty file.
Empty file modified include/geoip.inc 100755 → 100644
Empty file.
Empty file modified include/geoipcity.inc 100755 → 100644
Empty file.
Empty file modified logs/sqlerr/.gitignore 100755 → 100644
Empty file.

0 comments on commit f605d64

Please sign in to comment.