Skip to content

Commit

Permalink
Смайлы перемещены в /assets/emoticons/
Browse files Browse the repository at this point in the history
  • Loading branch information
batumibiz committed Oct 26, 2019
1 parent f6acb2d commit 69a356c
Show file tree
Hide file tree
Showing 104 changed files with 27 additions and 25 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
14 changes: 7 additions & 7 deletions modules/admin/includes/smilies.php
Expand Up @@ -27,30 +27,30 @@
$smileys = [];

// Обрабатываем простые смайлы
foreach (glob(ROOT_PATH . 'images' . DIRECTORY_SEPARATOR . 'smileys' . DIRECTORY_SEPARATOR . 'simply' . DIRECTORY_SEPARATOR . '*') as $var) {
foreach (glob(ASSETS_PATH . 'emoticons' . DS . 'simply' . DS . '*') as $var) {
$file = basename($var);
$name = explode('.', $file);
if (in_array($name[1], $ext)) {
$smileys['usr'][':' . $name[0]] = '<img src="' . $config['homeurl'] . '/images/smileys/simply/' . $file . '" alt="" />';
$smileys['usr'][':' . $name[0]] = '<img src="' . $config['homeurl'] . '/assets/emoticons/simply/' . $file . '" alt="" />';
}
}

// Обрабатываем Админские смайлы
foreach (glob(ROOT_PATH . 'images' . DIRECTORY_SEPARATOR . 'smileys' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . '*') as $var) {
foreach (glob(ASSETS_PATH . 'emoticons' . DS . 'admin' . DS . '*') as $var) {
$file = basename($var);
$name = explode('.', $file);
if (in_array($name[1], $ext)) {
$smileys['adm'][':' . $tools->trans($name[0]) . ':'] = '<img src="' . $config['homeurl'] . '/images/smileys/admin/' . $file . '" alt="" />';
$smileys['adm'][':' . $name[0] . ':'] = '<img src="' . $config['homeurl'] . '/images/smileys/admin/' . $file . '" alt="" />';
$smileys['adm'][':' . $tools->trans($name[0]) . ':'] = '<img src="' . $config['homeurl'] . '/assets/emoticons/admin/' . $file . '" alt="" />';
$smileys['adm'][':' . $name[0] . ':'] = '<img src="' . $config['homeurl'] . '/assets/emoticons/admin/' . $file . '" alt="" />';
}
}

// Обрабатываем смайлы каталога
foreach (glob(ROOT_PATH . 'images' . DIRECTORY_SEPARATOR . 'smileys' . DIRECTORY_SEPARATOR . 'user' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*') as $var) {
foreach (glob(ASSETS_PATH . 'emoticons' . DS . 'user' . DS . '*' . DS . '*') as $var) {
$file = basename($var);
$name = explode('.', $file);
if (in_array($name[1], $ext)) {
$path = $config['homeurl'] . '/images/smileys/user/' . basename(dirname($var));
$path = $config['homeurl'] . '/assets/emoticons/user/' . basename(dirname($var));
$smileys['usr'][':' . $tools->trans($name[0]) . ':'] = '<img src="' . $path . '/' . $file . '" alt="" />';
$smileys['usr'][':' . $name[0] . ':'] = '<img src="' . $path . '/' . $file . '" alt="" />';
}
Expand Down
6 changes: 3 additions & 3 deletions modules/help/includes/admsmilies.php
Expand Up @@ -38,7 +38,7 @@
echo '<div class="topmenu"><a href="?act=my_smilies">' . _t('My smilies') . '</a> (' . count($user_sm) . ' / ' . $user_smileys . ')</div>' .
'<form action="?act=set_my_sm&amp;start=' . $start . '&amp;adm" method="post">';
$array = [];
$dir = opendir('../images/smileys/admin');
$dir = opendir(ASSETS_PATH . 'emoticons/admin');

while (($file = readdir($dir)) !== false) {
if (($file != '.') && ($file != '..') && ($file != 'name.dat') && ($file != '.svn') && ($file != 'index.php')) {
Expand All @@ -58,10 +58,10 @@

for ($i = $start; $i < $end; $i++) {
$smile = preg_replace('#^(.*?).(gif|jpg|png)$#isU', '$1', $array[$i], 1);
echo $i % 2 ? '<div class="list2">' : '<div class="list1">';
echo ($i % 2) ? '<div class="list2">' : '<div class="list1">';
$smileys = (in_array($smile, $user_sm) ? ''
: '<input type="checkbox" name="add_sm[]" value="' . $smile . '" />&#160;');
echo $smileys . '<img src="../images/smileys/admin/' . $array[$i] . '" alt="" /> - :' . $smile . ': ' . _t('or') . ' :' . $tools->trans($smile) . ':</div>';
echo $smileys . '<img src="../assets/emoticons/admin/' . $array[$i] . '" alt="" /> - :' . $smile . ': ' . _t('or') . ' :' . $tools->trans($smile) . ':</div>';
}
} else {
echo '<div class="menu"><p>' . _t('The list is empty') . '</p></div>';
Expand Down
6 changes: 3 additions & 3 deletions modules/help/includes/set_my_sm.php
Expand Up @@ -28,7 +28,7 @@
$tools = $container->get(Johncms\Api\ToolsInterface::class);

if (($adm && ! $systemUser->rights) || ($add && ! $adm && ! $cat) || ($delete && ! $_POST['delete_sm']) || ($add && ! $_POST['add_sm'])) {
echo $tools->displayError(_t('Wrong data'), '<a href="faq.php?act=smileys">' . _t('Smilies') . '</a>');
echo $tools->displayError(_t('Wrong data'), '<a href="?act=smileys">' . _t('Smilies') . '</a>');
require 'system/end.php';
exit;
}
Expand Down Expand Up @@ -56,7 +56,7 @@
$db->query('UPDATE `users` SET `smileys` = ' . $db->quote(serialize($smileys)) . ' WHERE `id` = ' . $systemUser->id);

if ($delete || isset($_GET['clean'])) {
header('location: index.php?act=my_smilies&start=' . $start . '');
header('location: ?act=my_smilies&start=' . $start . '');
} else {
header('location: index.php?act=' . ($adm ? 'admsmilies' : 'usersmilies&cat=' . urlencode($cat) . '') . '&start=' . $start . '');
header('location: ?act=' . ($adm ? 'admsmilies' : 'usersmilies&cat=' . urlencode($cat) . '') . '&start=' . $start . '');
}
6 changes: 3 additions & 3 deletions modules/help/includes/smilies.php
Expand Up @@ -24,10 +24,10 @@
}

if ($systemUser->rights >= 1) {
echo '<div class="gmenu"><a href="?act=admsmilies">' . _t('For administration') . '</a> (' . (int)count(glob(ROOT_PATH . 'images/smileys/admin/*.gif')) . ')</div>';
echo '<div class="gmenu"><a href="?act=admsmilies">' . _t('For administration') . '</a> (' . (int)count(glob(ASSETS_PATH . 'emoticons/admin/*.gif')) . ')</div>';
}

$dir = glob(ROOT_PATH . 'images/smileys/user/*', GLOB_ONLYDIR);
$dir = glob(ASSETS_PATH . 'emoticons/user/*', GLOB_ONLYDIR);

foreach ($dir as $val) {
$cat = strtolower(basename($val));
Expand All @@ -45,7 +45,7 @@
foreach ($smileys_cat as $key => $val) {
echo $i % 2 ? '<div class="list2">' : '<div class="list1">';
echo '<a href="?act=usersmilies&amp;cat=' . urlencode($key) . '">' . htmlspecialchars($val) . '</a>' .
' (' . count(glob(ROOT_PATH . 'images/smileys/user/' . $key . '/*.{gif,jpg,png}', GLOB_BRACE)) . ')';
' (' . count(glob(ASSETS_PATH . 'emoticons/user/' . $key . '/*.{gif,jpg,png}', GLOB_BRACE)) . ')';
echo '</div>';
++$i;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/help/includes/usersmilies.php
Expand Up @@ -22,15 +22,15 @@
$tools = $container->get(Johncms\Api\ToolsInterface::class);

// Каталог пользовательских Смайлов
$dir = glob(ROOT_PATH . 'images/smileys/user/*', GLOB_ONLYDIR);
$dir = glob(ASSETS_PATH . 'emoticons/user/*', GLOB_ONLYDIR);

foreach ($dir as $val) {
$val = explode('/', $val);
$cat_list[] = array_pop($val);
}

$cat = isset($_GET['cat']) && in_array(trim($_GET['cat']), $cat_list) ? trim($_GET['cat']) : $cat_list[0];
$smileys = glob(ROOT_PATH . 'images/smileys/user/' . $cat . '/*.{gif,jpg,png}', GLOB_BRACE);
$smileys = glob(ASSETS_PATH . 'emoticons/user/' . $cat . '/*.{gif,jpg,png}', GLOB_BRACE);
$total = count($smileys);
$end = $start + $kmess;

Expand Down Expand Up @@ -67,7 +67,7 @@
echo in_array($smile, $user_sm) ? '' : '<input type="checkbox" name="add_sm[]" value="' . $smile . '" />&#160;';
}

echo '<img src="../images/smileys/user/' . $cat . '/' . basename($smileys[$i]) . '" alt="" />&#160;:' . $smile . ': ' . _t('or') . ' :' . $tools->trans($smile) . ':';
echo '<img src="../assets/emoticons/user/' . $cat . '/' . basename($smileys[$i]) . '" alt="" />&#160;:' . $smile . ': ' . _t('or') . ' :' . $tools->trans($smile) . ':';
echo '</div>';
}

Expand Down
14 changes: 8 additions & 6 deletions system/bootstrap.php
Expand Up @@ -33,12 +33,14 @@

define('START_MEMORY', memory_get_usage());
define('START_TIME', microtime(true));

define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
const CONFIG_PATH = ROOT_PATH . 'config' . DIRECTORY_SEPARATOR;
const DATA_PATH = ROOT_PATH . 'data' . DIRECTORY_SEPARATOR;
const UPLOAD_PATH = ROOT_PATH . 'upload' . DIRECTORY_SEPARATOR;
const CACHE_PATH = DATA_PATH. 'cache' . DIRECTORY_SEPARATOR;
const DS = DIRECTORY_SEPARATOR;

define('ROOT_PATH', dirname(__DIR__) . DS);
const ASSETS_PATH = ROOT_PATH . 'assets' . DS;
const CONFIG_PATH = ROOT_PATH . 'config' . DS;
const DATA_PATH = ROOT_PATH . 'data' . DS;
const UPLOAD_PATH = ROOT_PATH . 'upload' . DS;
const CACHE_PATH = DATA_PATH. 'cache' . DS;

require __DIR__ . '/vendor/autoload.php';

Expand Down

0 comments on commit 69a356c

Please sign in to comment.