This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Смена прав только у директорий (рекурсивно) | |
$ find /path/to/base/dir -type d -exec chmod 755 {} + | |
или | |
$ chmod 755 $(find /path/to/base/dir -type d) | |
или | |
$ chmod 755 `find /path/to/base/dir -type d` | |
или | |
$ find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 | |
Смена прав только у файлов (рекурсивно) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo find /path/ -type f -exec chmod 644 {} \; && sudo find /path/ -type d -exec chmod 755 {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Использоватние | |
{$variable | snippet} | |
Сниппет "snippet" | |
<?php | |
/** @var modX $modx */ | |
switch ($modx->event->name) { | |
case 'pdoToolsOnFenomInit': | |
/** @var Fenom $fenom | |
Мы получаем переменную $fenom при его первой инициализации и можем вызывать его методы. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Это возникает из за аналитики в шапке | |
<!— Global site tag (gtag.js) - Google Analytics —> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-111032207-1"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'UA-XXXXXXXXX-X'); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt install sudo | |
sudo apt update | |
sudo apt install curl | |
sudo apt install software-properties-common | |
sudo apt install python-software-properties | |
sudo apt install language-pack-ru-base | |
sudo echo "ru_RU.CP1251 CP1251" >>/var/lib/locales/supported.d/ru | |
sudo locale-gen | |
sudo locale-gen en_US.UTF-8 | |
export LANG=en_US.UTF-8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MODX_API_MODE', true); // Gotta set this one constant. | |
// Сбрасывает пароль и email существующего пользователя | |
// и задаёт его группу | |
$username = 'theusername'; | |
$password = 'newpassword'; | |
$email = '[email protected]'; | |
$user_group = 1; // 1 для Administrator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.value = sum(this.value); | |
function sum(str) { | |
str=str.trim().replace(/[^\d\.]+/gi,""); | |
var s=str.indexOf(".",str.indexOf(".")); | |
if(s>=0){ | |
str=str.substr(0,s+3); | |
var whole = str.substr(0,s); | |
var fractional = str.substr(s+1, s+3).replace(/[^\d]+/gi,""); | |
str = whole +'.'+ fractional; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (empty($parent)) {$parent = $modx->resource->id;} | |
$pids = array_merge(array($parent), $modx->getChildIds($parent)); | |
$ids = array(); | |
$q = $modx->newQuery('msProduct'); | |
$q->where(array('class_key' => 'msProduct','parent:IN' => $pids,'published' => 1,'deleted' => 0)); | |
$q->select('`msProduct`.`id`'); | |
if ($q->prepare() && $q->stmt->execute()) { | |
$ids = $q->stmt->fetchAll(PDO::FETCH_COLUMN); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Плагин для переадресации с url с UpperCase на LoverCase | |
*/ | |
$eventName = $modx->event->name; | |
switch($eventName) { | |
case 'OnHandleRequest': | |
if($modx->context->get('key') != "mgr"){ | |
if(isset($_GET['rewrite-strtolower-url'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tplProduct = 3; //номер шаблона для карточки товара | |
$tplParent = 2; //номер шаблона для категорий | |
$tplChildParent = 2; //номер шаблона для подкатегорий | |
$idParent = 6; //id каталога товаров | |
$fileProduct = 'product.xml'; //имя файла с товарами | |
$xpath_expression['pagetitle'] = '//Товары/Номенклатура'; //DOM структура в XML файле до имени | |
$xpath_expression['article'] = '//Товары/Артикул'; //DOM структура в XML файле до артикула | |
$xpath_expression['parents'] = '//Товары/Родитель'; //DOM структура в XML файле до родителей |