Skip to content

Instantly share code, notes, and snippets.

define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
if (strpos('/usr/bin/php', '@php_bin') === 0) {
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
} else {
require '/usr/lib/php' . DIRECTORY_SEPARATOR . 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';
}
@arturo-c
arturo-c / get_next_sequential
Last active August 29, 2015 13:58
Get next sequential id
<?php
function get_next_sequential($nid) {
$node = node_load($nid);
foreach ($node->webform['components'] as $component) {
if ($component['type'] == 'sequential_id') {
$mid_component = $component;
}
}
return webform_sequential_id_acquire_id($mid_component);
@arturo-c
arturo-c / update_usar_submissions
Last active August 29, 2015 13:58
Update usar submissions
<?php
function get_usar_submissions() {
// Get the blank webform ucids.
$mid_ucid = db_select('webform_component_unique', 'wcu')
->fields('wcu', array('ucid'))
->condition('nid', 4194858)
->condition('form_key', 'org__sequential_id__org_webform')
->execute()
->fetchField();
Server error response
[status code] 500
[reason phrase] Internal Server Error
[url] https://api.a.dbehrman.allplayers.com/api/v2/webforms/4194858/submissions
[request] POST /api/v2/webforms/4194858/submissions HTTP/1.1
Host: api.a.dbehrman.allplayers.com
Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0
Accept: application/json
User-Agent: Guzzle/2.8.8 curl/7.22.0 PHP/5.3.10-1ubuntu3.9
Expect: 100-Continue
rm -rf app/cache/*
rm -rf app/logs/*
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data' | grep -v root | head -1 | cut -d\ -f1`
sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
diff --git a/www/includes/common.inc b/www/includes/common.inc
index 72dc525..23b34a7 100644
--- a/www/includes/common.inc
+++ b/www/includes/common.inc
@@ -946,7 +946,7 @@ function t($string, $args = array(), $langcode = NULL) {
$string = $custom_strings[$langcode][$string];
}
// Translate with locale module if enabled.
- elseif (function_exists('locale') && $langcode != 'en') {
+ elseif (function_exists('locale') && $langcode != 'en' && !empty($string) && !empty($langcode)) {
diff --git a/www/sites/all/modules/apci_features/apci_public_api_services/AllPlayers/Resources/UserResource.php b/www/sites/all/modules/apci_features/apci_public_api_services/AllPlayers/Resources/UserResource.php
index 394832a..73976ec 100644
--- a/www/sites/all/modules/apci_features/apci_public_api_services/AllPlayers/Resources/UserResource.php
+++ b/www/sites/all/modules/apci_features/apci_public_api_services/AllPlayers/Resources/UserResource.php
@@ -86,7 +86,18 @@ class UserResource {
if (!empty($address)) {
$webform = webform_profile_load_profile_webform();
$profile = webform_profile_load_profile($created_user->uid);
- UserResource::setAddress($profile, $address);
+ $keys_not_found = '';
@arturo-c
arturo-c / gist:8566544
Created January 22, 2014 20:15
oauth config hook
/**
* Implements hook_update_N().
*
* Sets a default oauth configuration.
*/
function apci_defaults_update_6022() {
$authorization_options = array(
'access_token_lifetime' => 0,
'page_title' => 'Authorize All',
'message' => 'Authorize <span id="oauth-auth-appname">@appname</span> to use your account?',
@arturo-c
arturo-c / gist:8544271
Last active January 4, 2016 00:49
Webform data pushed as webhooks.
{
"event_data"=>
{
"webform_submission"=>
{
"user_uuid"=>User uuid of the webform submission (string),
"submission_id"=>Submission id (integer),
"data"=>
{
"profile__field_phone__profile"=>
def show(args)
@user = args[:user]
if @user.present?
@notifications = Notification.where({ 'game_admin_id' => @user.twitter_id }).order_by([:notifier_date_time, :desc])
@unread_notifications = Notification.where({ 'flag_read' => 0 })
end
respond_to do |format|
format.html
format.json { render :json => @notifications.to_json }
format.js