Skip to content

Instantly share code, notes, and snippets.

@vgrish
vgrish / gist:11b1a57026374f02daae
Created February 27, 2015 06:37
tpl.msGallery.row.th
<div class="pager-slide">
<a class="center" href="#"><img src="[[+59x95]]" title="[[+name]]" alt="[[+description]]" width="59" height="95">
</a>
</div>
@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
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
/**
* Проверка существования элемента с определенным индексом в массиве. Специально для сайта 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
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',
[[!weather?
&cityId=`26850`
&tpl=`weather.tpl`
&cacheTime=`7200`
]]
var msop2 = {
par: {},
setup: function() {
msop2.par.msform = '.ms2_form';
msop2.par.product = '.msop2.product-';
msop2.par.product_weight = '.msop2.product_weight-';
},
initialize: function() {
msop2.setup();
@vgrish
vgrish / gist:b5fbfa19af75e48d0541
Created June 23, 2015 18:03
snippet.list_orders.php
<?php
/** @var array $scriptProperties */
/** @var mslistorders $mslistorders */
if (!$mslistorders = $modx->getService('mslistorders', 'mslistorders', $modx->getOption('mslistorders_core_path', null, $modx->getOption('core_path') . 'components/mslistorders/') . 'model/mslistorders/', $scriptProperties)) {
return 'Could not load mslistorders class!';
}
$mslistorders->initialize($modx->context->key, $scriptProperties);
// default
$class = 'msOrder';
$row = array();
<?php
function download($src, $timeout = 3) {
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $src);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);