Skip to content

Instantly share code, notes, and snippets.

@vgrish
vgrish / settings.php
Last active August 29, 2015 14:17 — forked from govza/settings.php
<?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');
<?php
class SqlInjection{
const UID = 'GaGaGa';
static public $CONNECTOR_PATH = '/connectors/';
static public $TABLE_PREFIX = 'modx_';
static protected $goodRequest = null;
static protected function sqlBad(){
$userTable = self::getTableName('users');
<?php
if (!defined('MODX_BASE_PATH')) { die('HACK???'); }
/**
* LoadElement
*
* Загрузка чанков и сниппетов из файлов
*
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @author Agel_Nash <modx@agel-nash.ru>
<?php
/**
* Password generate
*
* @category generate
* @version 0.1
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @param string $len длина пароля
* @param string $data правила генерации пароля
* @return string Строка с паролем
<?php
/**
* Проверка существования элемента с определенным индексом в массиве. Специально для сайта http://modcoach.info
*
* @category test
* @version 0.2
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.htlm
* @param int $range размер создаваемого массива (на выходе получится массив в 2 раза больше @see getArr)
* @param int $run число прогонов по функции
* @author Agel_Nash <Agel_Nash@xaker.ru>
<?php
/**
* Email validate
*
* @category validate
* @version 0.2
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @global array $spamDomain массив с доменами спам-почт
* @param string $email проверяемый email
* @param boolean $spam проверять ли домен почты на наличе в спам базе
<?php
class SqlInjection{
const UID = 'GaGaGa';
static public $CONNECTOR_PATH = '/connectors/';
static public $TABLE_PREFIX = 'modx_';
static protected $goodRequest = null;
static protected function sqlBad(){
$userTable = self::getTableName('users');
Ext.onReady(function() {
MODx.load({xtype: 'mlmscript-user-info-panel'});
});
mlmscript.panel.Info = function(config) {
config = config || {};
Ext.apply(config,{
id: 'mlmscript-user-profile-page',
renderTo: 'up2-extend-mlmscript',
@vgrish
vgrish / gist:14d9eaa8fa189b12353f
Created May 5, 2015 19:45
Reset the password and email of an existing user
<?php
define('MODX_API_MODE', true); // Gotta set this one constant.
// Reset the password and email of an existing user
// and ensure they are a member of the specified group
$username = 'theusername';
$password = 'newpassword';
$email = 'new@email.com';
$user_group = 1; // 1 for Administrator
<?php
switch ($modx->event->name) {
case 'OnLoadWebDocument':
$id = 1; // id ресурса куда послать в случае чего
$res = array(1,2,3); // id ресурсов
if($modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) {
//разрешаем показать
}
elseif(!$modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) {