Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .holo/sources/laddr.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[holosource]
url = "https://github.com/CodeForPhilly/laddr"
ref = "refs/tags/v3.0.7"
ref = "refs/tags/v3.0.9"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

// add new user to a MailChimp list (see http://forum.laddr.us/t/mailchimp-integration/26)
\RemoteSystems\MailChimp::call('lists/subscribe', [
'id' => '411e7bdbef',
'email' => [
'email' => $_EVENT['User']->Email
],
'merge_vars' => [
'FNAME' => $_EVENT['User']->FirstName,
'LNAME' => $_EVENT['User']->LastName
],
'double_optin' => false,
'replace_interests' => false,
'send_welcome' => false
]);
32 changes: 32 additions & 0 deletions html-templates/discourse/topic.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{extends designs/site.tpl}

{block title}{$fancy_title|escape} &mdash; {$dwoo.parent}{/block}

{block content}
<h2>{$fancy_title|escape}</h2>
{$post_stream.posts[0].cooked}

<hr>
{$url = "http://forum.codeforphilly.org/t/$slug/$id"}
Edit or discuss this page at <a href="{$url|escape}">{$url|escape}</a>


<hr>

<div id="discourse-comments"></div>

<script type="text/javascript">
var DiscourseEmbed = {
discourseUrl: '//forum.codeforphilly.org/',
topicId: {$id|json_encode}
};

(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
})();
</script>

{/block}
1 change: 1 addition & 0 deletions html-templates/includes/site.nav-sitelinks.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<a class="dropdown-item" href="/mission">{_ "Mission"}</a>
<a class="dropdown-item" href="/pages/code_of_conduct/">{_ "Code of Conduct"}</a>
<a class="dropdown-item" href="/pages/leadership/">{_ "Organizing Team"}</a>
<a class="dropdown-item" href="/pages/leadership-support_team_open_positions/">{_ "Join the Organizing Team"}</a>
<a class="dropdown-item" href="/contact">{_ "Contact Us"}</a>
</div>
</li>
4 changes: 4 additions & 0 deletions php-config/ActiveRecord.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

// use ActiveRecord caching in production
ActiveRecord::$useCache = Site::$production;
3 changes: 3 additions & 0 deletions php-config/ContactRequestHandler.config.d/email-alerts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

ContactRequestHandler::$emailTo = 'hello@codeforphilly.org';
3 changes: 3 additions & 0 deletions php-config/DiscourseKids.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

DiscourseKids::$ssoSecret = getenv('DISCOURSE_KIDS_SSO_SECRET');
3 changes: 3 additions & 0 deletions php-config/DiscourseSteering.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

DiscourseSteering::$ssoSecret = getenv('DISCOURSE_STEERING_SSO_SECRET');
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

// Uncomment to restrict commenting to staff
Emergence\Comments\CommentsRequestHandler::$accountLevelWrite = 'Staff';
4 changes: 4 additions & 0 deletions php-config/Emergence/Connectors/Discourse.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

Emergence\Connectors\Discourse::$host = getenv('DISCOURSE_HOST');
Emergence\Connectors\Discourse::$ssoSecret = getenv('DISCOURSE_SSO_SECRET');
9 changes: 9 additions & 0 deletions php-config/Emergence/Meetup/Connector.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

/**
* The name of your Meetup group as formatted in the URL
*
* The example value is for https://meetup.com/Code-for-Philly
*/

Emergence\Meetup\Connector::$groupSlug = 'Code-for-Philly';
4 changes: 4 additions & 0 deletions php-config/RemoteSystems/Twitter.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

RemoteSystems\Twitter::$siteHandle = 'CodeForPhilly';
RemoteSystems\Twitter::$defaultTweetIntentParams['related'] .= ',codeforphilly';
4 changes: 4 additions & 0 deletions php-config/Site.config.d/cors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

// uncomment or set to an array of specific hostnames to enable CORS
Site::$permittedOrigins = '*';
9 changes: 5 additions & 4 deletions script/studio
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ if [ "$(docker ps -aq -f name="${STUDIO_NAME}")" ]; then
echo
docker attach "${STUDIO_NAME}"
launch_studio=false
break;;
;;
s|S)
echo "==> studio: stopping existing container…"
docker stop "${STUDIO_NAME}" > /dev/null
break;;
;;
n|N)
echo "==> studio: doing nothing with existing container… an error is likely to occur"
break ;;
;;
*)
echo "==> studio: $choice is invalid";;
echo "==> studio: $choice is invalid"
;;
esac
done
fi
Expand Down
15 changes: 15 additions & 0 deletions site-root/discourse/topic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

if (!($topicId = array_shift(Site::$pathStack))) {
RequestHandler::throwInvalidRequestError('topicId required');
}

$topicJson = @file_get_contents("http://forum.codeforphilly.org/t/$topicId.json");
if (!$topicJson) {
RequestHandler::throwNotFoundError('Could not find or load requested topic');
}


$topic = json_decode($topicJson, true);

RequestHandler::respond('topic', $topic);
24 changes: 0 additions & 24 deletions site-root/projects.csv.php

This file was deleted.

71 changes: 71 additions & 0 deletions site-root/send-newsletter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

/**
* PRE-FLIGHT CHECKLIST
*
* - [ ] Subject updated
* - [ ] Body updated to new template
* - [ ] Test send to admins
* - [ ] Verify all links
* - [ ] Verify all images being server from codeforphilly.org with 2x resolution
*/

$GLOBALS['Session']->requireAccountLevel('Developer');

#if ($_SERVER['REQUEST_METHOD'] != 'POST') {
# die('must be post');
#}

header('X-Accel-Buffering: no');
header('Content-Type: text/plain; charset=utf-8');
ob_end_flush();
set_time_limit(0);


// select newsletter
$newsletterDate = '2018-05-21';


// get body markup
if (!$mjmlNode = Site::resolvePath("newsletters/$newsletterDate/index.mjml")) {
RequestHandler::throwNotFoundError('Newsletter markup not found');
}

$html = shell_exec('hab pkg exec jarvus/mjml mjml -r '.escapeshellarg($mjmlNode->RealPath));

$url = Emergence\Util\Url::buildAbsolute(['newsletters', $newsletterDate, '']);
$html = str_replace('[[SHORT_PERMALINK]]', $url, $html);


// get recipients
$Users = Emergence\People\User::getAllByWhere([
'Newsletter' => true,
'Email IS NOT NULL'

// toggle to test:
,'Username' => [
'values' => ['chris', 'a_priori_rainbows', 'rmcmillen50', 'Tonimacattack']
]
]);
printf("Found %u subscribed users\n\n", count($Users));


// send to each recipient
foreach ($Users as $i => $User) {
printf("Sending #%u to %s\n", $i+1, $User->EmailRecipient);

# Emergence\Mailer\Mailer::send(
# $User->EmailRecipient,
## '🔔 Open Data, Open Source, Open this email! 🔔',
## '🚀 This weekend: Help a project lift off at our Civic Engagement Launchpad 🚀',
# '🎉 Celebrate a successful launch: it’s time for demo night! 🎉',
# $html,
# 'Code for Philly <hello@codeforphilly.org>'
# );

ob_flush();
flush();
}


printf("\n\nDone\n");