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 | |
| $installPackages = array( | |
| 'sdStore' | |
| , 'translit' | |
| , 'SanitizeUpload' | |
| , 'TinyMCE' | |
| , 'FormIt' | |
| , 'Analytics' | |
| , 'Big Brother' |
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 | |
| require_once dirname(__FILE__).'/config.core.php'; | |
| include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; | |
| $modx= new modX(); | |
| $modx->initialize('mgr'); | |
| $modx->setLogLevel(modX::LOG_LEVEL_INFO); | |
| $modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML'); | |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 | |
| $time = microtime(true); | |
| for ($i = 1; $i <= 1000000; $i++) { | |
| $x = rand(); | |
| } | |
| echo microtime(true) - $time; |
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 | |
| // Получаем текущие курсы валют в rss-формате с сайта www.cbr.ru | |
| // Формируем сегодняшнюю дату | |
| $date = date("d/m/Y"); | |
| // Формируем ссылку | |
| $link = "http://www.cbr.ru/scripts/XML_daily.asp?date_req=".$date; | |
| // Загружаем HTML-страницу | |
| $content = file_get_contents($link); | |
| // Разбираем содержимое, при помощи регулярных выражений |
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 | |
| $siteName = $modx->getOption('siteName', $scriptProperties, $modx->getOption('site_name')); // Имя сайта | |
| $companyName = $modx->getOption('companyName', $scriptProperties, $modx->getOption('site_name')); // Компания | |
| $bid = $modx->getOption('bid', $scriptProperties, 10); // Цена за клик | |
| $categoriesTpl = $modx->getOption('minishop.categories_tpl'); // Шаблоны категорий | |
| $goodsTpl = $modx->getOption('minishop.goods_tpl'); // Шаблоны товаров | |
| $siteUrl = $modx->makeUrl($modx->getOption('site_start'), '', '', 'full'); // Ссылка на главную страницу сайта | |
| $descTpl = strip_tags($modx->getOption('descTpl', $scriptProperties, '[[+description]]')); // Шаблон для описания товара, без html | |
| // Параметры товаров |
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
| #!/bin/bash | |
| ############## | |
| echo "Welcome to MODx autoinstaller. | |
| ------------------------------------ | |
| Enter MySQL root password" | |
| read ROOTPASS | |
| echo "Enter username for site and database" |
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
| #!/bin/bash | |
| echo "Enter username" | |
| read USERNAME | |
| ############## | |
| echo "Updating MODx" | |
| cd /var/www/$USERNAME/www/ |
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
| #!/bin/bash | |
| # MySQL root password | |
| ROOTPASS='password' | |
| TIMEZONE='Europe/Moscow' | |
| MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
| SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
| PASSWORD=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12` | |
| ############## |
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
| #!/bin/bash | |
| ROOTPASS='password' | |
| echo "Enter username to delete:" | |
| read USERNAME | |
| mysql -uroot --password=$ROOTPASS -e "DROP USER $USERNAME@localhost" | |
| mysql -uroot --password=$ROOTPASS -e "DROP DATABASE $USERNAME" | |
| rm -f /etc/nginx/sites-enabled/$USERNAME.conf |